Packages
Search packages... ⌘K
Go Package
database
PostgreSQL adapter — connection pooling, schema isolation, health checks
Go Ready MD
Connection Pool Lifecycle
$ pool, err := database.NewPool(ctx, cfg)
[database] connecting to postgres://sbx@localhost:5432/sbx
[database] schema: sbx_dev
[database] pool: min=2 max=10 idle_timeout=5m
[database] pool ready — 2 connections established
$ err = pool.HealthCheck(ctx)
[health] acquired=1 idle=2 total=3 max=10
[health] ok — 0.4ms
About
Provides a managed PostgreSQL connection pool built on pgx/pgxpool. Handles schema-qualified connections for multi-tenant isolation, automatic health monitoring, and graceful shutdown with drain support.
Public API
| Name | Kind | Signature |
|---|---|---|
| NewPool | func | func NewPool(ctx context.Context, cfg Config) (*Pool, error) |
| Pool | type | type Pool struct |
| Config | type | type Config struct |
| HealthCheck | func | func (p *Pool) HealthCheck(ctx context.Context) error |
Dependencies
Imports (2)
Imported By (3)
persistence Go Ready
Generic persistence layer — CRUD operations with type-safe repositories
crudgenericsrepository-patterntype-safe
4 exports 2 deps
repository Go Ready
Domain-specific repositories — typed wrappers for entity persistence
domain-driventyped-repositoriesentity-storage
4 exports 2 deps
migrate Go Ready
Database migration runner — up/down/status with versioned SQL files
migrationssqlversionedup-down
5 exports 2 deps
Related Packages
persistence Go Ready
Generic persistence layer — CRUD operations with type-safe repositories
crudgenericsrepository-patterntype-safe
4 exports 2 deps
repository Go Ready
Domain-specific repositories — typed wrappers for entity persistence
domain-driventyped-repositoriesentity-storage
4 exports 2 deps
migrate Go Ready
Database migration runner — up/down/status with versioned SQL files
migrationssqlversionedup-down
5 exports 2 deps
Source
github.com/shredbx/sbx-core/pkg/database
postgresqlpgxpoolingschema-isolation