Versions in this module Expand all Collapse all v0 v0.1.0 Feb 15, 2026 Changes in this version + const DefaultQueryTimeout + func IsCheckViolation(err error) bool + func IsForeignKeyViolation(err error) bool + func IsUniqueViolation(err error) bool + type Config struct + ConnMaxIdleTime time.Duration + ConnMaxLifetime time.Duration + ConnectTimeout time.Duration + Database string + Host string + MaxIdleConns int + MaxOpenConns int + Password string + Port int + QueryTimeout time.Duration + SSLMode string + User string + func ConfigFromEnv(host string, port int, user, password, database, sslMode string) Config + func DefaultConfig() Config + type DB struct + func Connect(cfg Config) (*DB, error) + func MustConnect(cfg Config) *DB + func NewFromURL(url string) (*DB, error) + func (db *DB) Close() error + func (db *DB) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error) + func (db *DB) ExecWithTimeout(ctx context.Context, query string, args ...interface{}) (sql.Result, error) + func (db *DB) HealthCheck(ctx context.Context) error + func (db *DB) QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error) + func (db *DB) QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row + func (db *DB) QueryRowWithTimeout(ctx context.Context, query string, args ...interface{}) (*sql.Row, context.CancelFunc) + func (db *DB) QueryTimeout() time.Duration + func (db *DB) QueryWithTimeout(ctx context.Context, query string, args ...interface{}) (*sql.Rows, context.CancelFunc, error) + func (db *DB) SetQueryTimeout(timeout time.Duration) + func (db *DB) Stats() sql.DBStats + func (db *DB) Transaction(ctx context.Context, fn func(*sql.Tx) error) error + func (db *DB) TransactionWithOptions(ctx context.Context, opts *sql.TxOptions, fn func(*sql.Tx) error) error + func (db *DB) WithTimeout(ctx context.Context) (context.Context, context.CancelFunc) + type Migrator struct + func NewMigrator(db *sql.DB, migrationsDir string) *Migrator + func (m *Migrator) Down() error + func (m *Migrator) Up() error