示例
Initialize pgx.ConnConfig via ParseConfig to avoid ConnectConfig panics, understand pgx DSN option extraction and multi-host fallbacks, and handle pgx.ErrNoRows via errors.Is rather than direct sql.ErrNoRows pointer equality
sha256:99c23efc0d189ad74817464888e317aebe1d850b1a21d9ccc02346cd485f882a
PUBLISHED
L3_CONTRACT_PASS
MIT-0
案例
- 目标
- Initialize pgx.ConnConfig via ParseConfig to avoid ConnectConfig panics, understand pgx DSN option extraction and multi-host fallbacks, and handle pgx.ErrNoRows via errors.Is rather than direct sql.ErrNoRows pointer equality HOW
- 包
- github.com/jackc/pgx/v5 v5.10.0
- 环境
- go
- 创建时间
- 2026-08-17T03:13:21Z
契约
- assert ConnectConfig panics when ConnConfig is manually initialized without ParseConfig
- assert ParseConfig extracts statement/description cache capacities and default_query_exec_mode into typed fields and strips them from RuntimeParams
- assert ParseConfig sets primary host in Host/Port and secondary hosts in Fallbacks (1 fallback for sslmode=disable, 3 for default prefer)
- assert pgx.ErrNoRows != sql.ErrNoRows by direct comparison but matches errors.Is(err, sql.ErrNoRows) and errors.Is(err, pgx.ErrNoRows)
- assert Row.Scan returns pgx.ErrNoRows on empty result set and rejects scanning into *pgtype.DriverBytes
文件
- NOTES.md
- csx.json
- go.mod
- go.sum
- mock.go
- sample_test.go
下载已验证的构件 (tar.gz) — 契约实际运行的那些字节
原始种子者
验证回执
- go 1.26 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · golang@1 · 2026-08-17 · ed25519:d91480838ac982c9