Versions in this module Expand all Collapse all v0 v0.2.0 Oct 8, 2024 v0.1.0 Oct 8, 2024 Changes in this version + const DefaultConnMaxLifetime + const DefaultMaxIdleConns + const DefaultMaxOpenConns + const MSSQLDefaultTxLevel + const MetricsLabelQuery + const MySQLDefaultTxLevel + const PgReadWriteParam + const PgTargetSessionAttrs + const PostgresDefaultSSLMode + const PostgresDefaultTxLevel + var DefaultQueryDurationBuckets = []float64 + func DoInTx(ctx context.Context, dbConn *sql.DB, fn func(tx *sql.Tx) error) (err error) + func DoInTxWithOpts(ctx context.Context, dbConn *sql.DB, txOpts *sql.TxOptions, ...) (err error) + func GetIsRetryable(d driver.Driver) retry.IsRetryable + func InitOpenedDB(db *sql.DB, cfg *Config, ping bool) error + func MakeMSSQLDSN(cfg *MSSQLConfig) string + func MakeMySQLDSN(cfg *MySQLConfig) string + func MakePostgresDSN(cfg *PostgresConfig) string + func MakeSQLiteDSN(cfg *SQLiteConfig) string + func RegisterIsRetryableFunc(d driver.Driver, retryable retry.IsRetryable) + type Config struct + ConnMaxLifetime time.Duration + Dialect Dialect + MSSQL MSSQLConfig + MaxIdleConns int + MaxOpenConns int + MySQL MySQLConfig + Postgres PostgresConfig + SQLite SQLiteConfig + func NewConfig(supportedDialects []Dialect) *Config + func NewConfigWithKeyPrefix(keyPrefix string, supportedDialects []Dialect) *Config + func (c *Config) DriverNameAndDSN() (driverName, dsn string) + func (c *Config) KeyPrefix() string + func (c *Config) Set(dp config.DataProvider) error + func (c *Config) SetProviderDefaults(dp config.DataProvider) + func (c *Config) SupportedDialects() []Dialect + func (c *Config) TxIsolationLevel() sql.IsolationLevel + type Dialect string + const DialectMSSQL + const DialectMySQL + const DialectPgx + const DialectPostgres + const DialectSQLite + type MSSQLConfig struct + Database string + Host string + Password string + Port int + TxIsolationLevel sql.IsolationLevel + User string + type MetricsCollector struct + QueryDurations *prometheus.HistogramVec + func NewMetricsCollector() *MetricsCollector + func NewMetricsCollectorWithOpts(opts MetricsCollectorOpts) *MetricsCollector + func (c *MetricsCollector) AllMetrics() []prometheus.Collector + func (c *MetricsCollector) MustCurryWith(labels prometheus.Labels) *MetricsCollector + func (c *MetricsCollector) MustRegister() + func (c *MetricsCollector) Unregister() + type MetricsCollectorOpts struct + ConstLabels prometheus.Labels + CurriedLabelNames []string + Namespace string + QueryDurationBuckets []float64 + type MySQLConfig struct + Database string + Host string + Password string + Port int + TxIsolationLevel sql.IsolationLevel + User string + type Parameter struct + Name string + Value string + type PostgresConfig struct + AdditionalParameters []Parameter + Database string + Host string + Password string + Port int + SSLMode PostgresSSLMode + SearchPath string + TxIsolationLevel sql.IsolationLevel + User string + type PostgresErrCode string + const PgxErrCodeDeadlockDetected + const PgxErrCodeSerializationFailure + const PgxErrCodeUniqueViolation + const PgxErrFeatureNotSupported + const PostgresErrCodeDeadlockDetected + const PostgresErrCodeSerializationFailure + const PostgresErrCodeUniqueViolation + type PostgresSSLMode string + const PostgresSSLModeDisable + const PostgresSSLModeRequire + const PostgresSSLModeVerifyCA + const PostgresSSLModeVerifyFull + type SQLiteConfig struct + Path string