# DB Checker `type: db` 用于数据库连接和查询结果检查,支持 PostgreSQL、MySQL 和 SQLite。 ## 配置项 | 字段 | 说明 | 必填 | 默认值 | | ---------- | ------------------------------------------------------------- | ---- | ------ | | `db.url` | 数据库连接字符串,支持 `postgres://`、`mysql://`、`sqlite://` | 是 | 无 | | `db.query` | SQL 查询语句,不配置时仅测试连接 | 否 | 无 | ## expect 校验项 | 字段 | 说明 | 必填 | 默认值 | | ------------ | ----------------------------------------------------------------------- | ---- | ------ | | `rowCount` | 查询返回行数校验,使用 `ValueMatcher` | 否 | 无 | | `rows` | 查询结果逐行校验,数组内每行为列名到 `KeyedExpectations` 的映射 | 否 | 无 | | `result` | 完整查询结果 `{ rows, rowCount }` 校验,使用 `ContentExpectations` 数组 | 否 | 无 | | `durationMs` | 完整执行耗时校验,使用 `ValueMatcher` | 否 | 无 | ## 示例 ```yaml - id: "sqlite-query" name: "SQLite 数据库检查" type: db db: url: "sqlite:///path/to/db.sqlite" query: "SELECT COUNT(*) as cnt FROM users WHERE status = 'active'" expect: durationMs: lte: 5000 rowCount: gte: 1 rows: - cnt: gte: 0 ```