Versions in this module Expand all Collapse all v2 v2.1.1 Dec 1, 2025 v2.1.0 Dec 1, 2025 v2.0.0 Nov 26, 2025 Changes in this version + const DEFAULT_CONN_MAX_LIFETIME + const DEFAULT_MAX_IDLE_CONNS + const DEFAULT_MAX_OPEN_CONNS + const DEFAULT_TIMEOUT_SECONDS + func GetSqlError(err error) error + func ManageUpdateError(callerName string, result sql.Result, err error) error + type Connection interface + Exec func(query string, args ...interface{}) (sql.Result, error) + Query func(query string, args ...interface{}) (*sql.Rows, error) + QueryRow func(query string, args ...interface{}) *sql.Row + type DbConfig struct + ConnMaxLifetime time.Duration + DBName string + Driver DbDriver + Host string + MaxIdleConns int + MaxOpenConns int + Pass string + Port int + TimeoutSeconds int + User string + type DbDriver string + const DB_DRIVER_MYSQL + const DB_DRIVER_POSTGRES + type DbPool struct + func CreateDbPool(cfg DbConfig) (*DbPool, error) + func (d *DbPool) BeginEnhacedTx(ctx context.Context) (*EnhacedTx, error) + func (d *DbPool) BeginTx(ctx context.Context) (*sql.Tx, error) + func (d *DbPool) Close() + func (d *DbPool) GetConnection() *sql.DB + type EnhacedTx struct + func (v *EnhacedTx) Commit() error + func (v *EnhacedTx) Exec(query string, args ...any) (sql.Result, error) + func (v *EnhacedTx) ForceClose() error + func (v *EnhacedTx) IsActive() bool + func (v *EnhacedTx) Query(query string, args ...any) (*sql.Rows, error) + func (v *EnhacedTx) QueryRow(query string, args ...any) *sql.Row + func (v *EnhacedTx) Rollback() error + type Executor interface + Exec func(query string, args any) (sql.Result, error) + Query func(query string, args any) (*sql.Rows, error) + QueryRow func(query string, args any) *sql.Row Other modules containing this package github.com/bitsbuster/utils