Security-first Go library with fluent queries, constructor-injected adaptors, and production-grade observability for PostgreSQL-compatible databases.
import "github.com/goozt/gopgbase"
opts := gopgbase.Options{
Addr: "localhost:5432",
User: "app",
Password: "securepassword",
Database: "myapp",
Logger: slog.Default(),
}
client := gopgbase.NewClient(opts)
err := client.
Query("SELECT id, name FROM users WHERE tenant_id = ?").
WithArgs("tenant-1").
ScanAll(context.Background(), &users)
Works with PostgreSQL, RDS, CockroachDB, YugabyteDB using one API.
Constructor-injected logger, tracer, metrics for testability.
Chainable SELECT, INSERT, UPDATE with auto parameterization.
OpenTelemetry, slog, metrics out of the box.
All inputs parameterized, no string concatenation.
No CGO, minimal attack surface, easy to audit.
Timeouts, circuit breakers, resource limits.
Open source contributions welcome! Add adaptors, query helpers, or observability integrations.
Open an Issue →