Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyPoolSettings ¶
ApplyPoolSettings maps Config pool fields onto a parsed pgxpool.Config.
func ConnectWithBackoff ¶
ConnectWithBackoff establishes a connection pool to PostgreSQL with exponential backoff retry.
Types ¶
type Config ¶
type Config struct {
DSN string `json:"dsn" yaml:"dsn"`
ReadDSN string `json:"read_dsn" yaml:"read_dsn"`
MaxOpenConns int32 `json:"max_open_conns" yaml:"max_open_conns"`
MaxIdleConns int32 `json:"max_idle_conns" yaml:"max_idle_conns"`
MaxConnLifetime time.Duration `json:"max_conn_lifetime" yaml:"max_conn_lifetime"`
MaxConnIdleTime time.Duration `json:"max_conn_idle_time" yaml:"max_conn_idle_time"`
MaxRetries int `json:"max_retries" yaml:"max_retries"`
RetryDelay time.Duration `json:"retry_delay" yaml:"retry_delay"`
}
Config holds the database configuration options.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns the default database configuration.
type DBPool ¶
DBPool holds primary write pool and optional read-replica pool.
func (*DBPool) GetReadPool ¶
GetReadPool returns ReadPool if configured, otherwise falls back to WritePool.
Click to show internal directories.
Click to hide internal directories.