Versions in this module Expand all Collapse all v1 v1.0.0 Mar 6, 2026 Changes in this version + var ErrNoRows = errors.New("no rows in result set") + func Connect(databaseURL string) (*pgxpool.Pool, error) + func ConvertPlaceholders(query string, driver DriverType) string + func IsMySQLDuplicateError(err error) bool + func IsNoRows(err error) bool + func IsNoRowsError(err error) bool + func NormalizeError(err error) error + func PlaceholderStyle(driver DriverType) string + type DB struct + func New(ctx context.Context, databaseURL string) (*DB, error) + func (db *DB) Close() + func (db *DB) Pool() *pgxpool.Pool + type DriverType string + const DriverMySQL + const DriverPostgres + func DetectDriver(url string) DriverType + type MySQLPool struct + func TryGetMySQLPool(p Pool) (*MySQLPool, bool) + func (p *MySQLPool) Begin(ctx context.Context) (Tx, error) + func (p *MySQLPool) Close() error + func (p *MySQLPool) Driver() DriverType + func (p *MySQLPool) Exec(ctx context.Context, sql string, args ...any) (Result, error) + func (p *MySQLPool) Ping(ctx context.Context) error + func (p *MySQLPool) Query(ctx context.Context, sql string, args ...any) (Rows, error) + func (p *MySQLPool) QueryRow(ctx context.Context, sql string, args ...any) Row + func (p *MySQLPool) Stats() PoolStats + func (p *MySQLPool) Underlying() *sql.DB + type Pool interface + Begin func(ctx context.Context) (Tx, error) + Close func() error + Driver func() DriverType + Exec func(ctx context.Context, sql string, args ...any) (Result, error) + Ping func(ctx context.Context) error + Query func(ctx context.Context, sql string, args ...any) (Rows, error) + QueryRow func(ctx context.Context, sql string, args ...any) Row + Stats func() PoolStats + func ConnectWithDriver(ctx context.Context, databaseURL, driver string) (Pool, error) + func Open(ctx context.Context, url string, cfg PoolConfig) (Pool, error) + type PoolConfig struct + ConnMaxLifetime time.Duration + MaxIdleConns int + MaxOpenConns int + func DefaultPoolConfig() PoolConfig + type PoolStats struct + Idle int + InUse int + MaxOpenConnections int + OpenConnections int + type PostgresPool struct + func MustGetPostgresPool(p Pool) *PostgresPool + func TryGetPostgresPool(p Pool) (*PostgresPool, bool) + func (p *PostgresPool) Begin(ctx context.Context) (Tx, error) + func (p *PostgresPool) Close() error + func (p *PostgresPool) Driver() DriverType + func (p *PostgresPool) Exec(ctx context.Context, sql string, args ...any) (Result, error) + func (p *PostgresPool) Ping(ctx context.Context) error + func (p *PostgresPool) Query(ctx context.Context, sql string, args ...any) (Rows, error) + func (p *PostgresPool) QueryRow(ctx context.Context, sql string, args ...any) Row + func (p *PostgresPool) Stats() PoolStats + func (p *PostgresPool) Underlying() *pgxpool.Pool + type Result interface + LastInsertId func() (int64, error) + RowsAffected func() (int64, error) + type Row interface + Scan func(dest ...any) error + type Rows interface + Close func() + Err func() error + Next func() bool + Scan func(dest ...any) error + type SQLBuilder struct + func NewSQLBuilder(driver DriverType) *SQLBuilder + func (b *SQLBuilder) ArrayContains(column string, pos int) string + func (b *SQLBuilder) ArrayLength(column string) string + func (b *SQLBuilder) Concat(parts ...string) string + func (b *SQLBuilder) CountFilter(condition string) string + func (b *SQLBuilder) ForUpdateSkipLocked() string + func (b *SQLBuilder) ILike(column string) string + func (b *SQLBuilder) ILikeWithPos(column string, pos int) string + func (b *SQLBuilder) LikePattern(value string) string + func (b *SQLBuilder) Now() string + func (b *SQLBuilder) Placeholder(pos int) string + func (b *SQLBuilder) Returning(columns ...string) string + func (b *SQLBuilder) ReturningID() string + func (b *SQLBuilder) TimestampLiteral(ts string) string + func (b *SQLBuilder) UpsertQuery(table string, columns []string, conflictKey string, updateColumns []string) string + type StringArray []string + func (a *StringArray) Scan(src any) error + func (a StringArray) Value() (driver.Value, error) + type Tx interface + Commit func(ctx context.Context) error + Exec func(ctx context.Context, sql string, args ...any) (Result, error) + Query func(ctx context.Context, sql string, args ...any) (Rows, error) + QueryRow func(ctx context.Context, sql string, args ...any) Row + Rollback func(ctx context.Context) error + type UnsupportedDriverError struct + Driver string + func (e *UnsupportedDriverError) Error() string