Documentation
¶
Overview ¶
Package db is the GOWDK database plumbing addon. It enables the db feature and ships a thin, driver-agnostic helper for opening a *sql.DB on top of the standard library's database/sql. It is designed to pair with sqlc: you own the schema, the queries, the generated models, and all domain logic. GOWDK owns none of that and adds no driver, ORM, or query opinions.
The helper imports no SQL driver. Your application registers a driver with a blank import (for example _ "github.com/jackc/pgx/v5/stdlib") and passes its name to Open, so GOWDK carries no database dependency of its own.
Index ¶
Constants ¶
const DefaultPingTimeout = 5 * time.Second
DefaultPingTimeout bounds the connectivity check performed by Open.
const ImportPath = "github.com/cssbruno/gowdk/addons/db"
ImportPath is the canonical Go import path for the db addon.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Options ¶
type Options struct {
// MaxOpenConns caps total open connections. Zero means unlimited.
MaxOpenConns int
// MaxIdleConns caps idle connections. Zero uses the database/sql default.
MaxIdleConns int
// ConnMaxLifetime caps connection reuse time. Zero means unlimited.
ConnMaxLifetime time.Duration
// PingTimeout bounds the initial connectivity check. Defaults to 5s.
PingTimeout time.Duration
}
Options tunes the connection pool. The zero value applies sensible defaults.