z-go-database
Installation
SKILL.md
Go database access
No ORMs. SQL is explicit, visible, and testable. House default is pgx/pgxpool
with queries generated by sqlc — see [[z-go-sqlc]] for the codegen side.
Library choice
database/sql |
sqlx |
pgx |
|
|---|---|---|---|
| Multi-database | yes | yes | no |
| Struct scanning | manual Scan |
StructScan / Select |
pgx.RowToStructByName, or generated by sqlc |
| PG-specific (COPY, LISTEN, arrays) | no | no | yes |
| Performance | benchmark representative queries | thin wrapper over database/sql | benchmark native and generated-query paths |
Pick pgx for PostgreSQL-only services — the house default, paired with
sqlc-generated queries. Pick sqlx only when multi-database portability is
a real requirement.
Prefer explicit SQL for new work under this convention. Preserve an existing ORM unless a measured query/control problem justifies migration.