Repository navigation
pgGo v0.1.0
pgGo is now a Go library as well as a CLI. The pggo command is rebuilt on the same core, with an unchanged JSON contract. PgBot now runs on this library instead of pgx.
go get github.com/pgrundev/pggo@v0.1.0 # library
go install github.com/pgrundev/pggo/cmd/pggo@v0.1.0 # CLILibrary (github.com/pgrundev/pggo)
Connect/ParseConfigread URLs, key=value strings,PG*environment variables, service files and.pgpass. They takeReadOnly(),StatementTimeout()andLockTimeout()options, and aConfig.DialFuncfor custom dialers such as SSH tunnels.Querystreams rows (Next/Scan/Values/RawValues/Err/Close); there are alsoQueryRow+ErrNoRows,Exec→CommandTag.RowsAffected(),SimpleQuery,Prepare/DeallocateandMaxRows(n).BeginTx(ctx, TxOptions{ReadOnly: true}):BEGINtravels with the first statement in the same sync, so the statement can never run outside the transaction, and it costs no extra round trip.CollectStructs[T]/CollectOneStruct[T]map rows onto structs usingdb:"…"tags;CollectStructsByPos[T]maps by position.- Unknown PostgreSQL types never fail: scan them into
*stringor*pggo.RawValue. *pggo.PgErrorcarries the SQLSTATE, detail, hint and position.- Every call takes a
context.Context. When it's cancelled, pgGo sends a cancel request and closes the connection, so the connection can never be reused in an unknown state. - A deliberately minimal
Pool: max connections, max lifetime, andAfterConnect/BeforeClosehooks. - Still zero dependencies (standard library only).
CLI
- The JSON contract, limits, timeouts and hints are unchanged, and the full regression suite passes on PostgreSQL 16–19.
- Fix: a connection closed during the handshake is now reported as
connection_error.
Verification
- The library and CLI suites pass on PostgreSQL 16, 17, 18 and 19beta1, with the race detector clean and 7 fuzz targets.
- PgBot's suites pass on pgGo across PostgreSQL 13–19, over TLS, and through PgBouncer (transaction mode) and PgDog.
- Agent tests: 6/6.
- Performance matches v0.0.1 within noise. The binary is 4.10 MB (+1.7%) and peak RSS 6.4 MiB.
The PgBot compatibility audit is in docs/pgbot-compatibility.md.