Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
Host string `env:"HOST" envDefault:"localhost"`
Port string `env:"PORT" envDefault:"5432"`
User string `env:"USER" envDefault:"supermq"`
Pass string `env:"PASS" envDefault:"supermq"`
Name string `env:"NAME" envDefault:""`
SSLMode string `env:"SSL_MODE" envDefault:"disable"`
SSLCert string `env:"SSL_CERT" envDefault:""`
SSLKey string `env:"SSL_KEY" envDefault:""`
SSLRootCert string `env:"SSL_ROOT_CERT" envDefault:""`
Pool PoolConfig `envPrefix:"POOL_"`
}
Config defines the options that are used when connecting to a TimescaleSQL instance.
type PoolConfig ¶ added in v0.17.0
type PoolConfig struct {
// MaxConnLifetime is the duration since creation after which a connection will be automatically closed.
MaxConnLifetime time.Duration `env:"MAX_CONN_LIFETIME" envDefault:"1h"`
// pool_max_conn_lifetime_jitter
MaxConnLifetimeJitter time.Duration `env:"MAX_CONN_LIFETIME_JITTER" envDefault:"0"`
// MaxConnIdleTime is the duration after which an idle connection will be automatically closed by the health check.
MaxConnIdleTime time.Duration `env:"MAX_CONN_IDLE_TIME" envDefault:"15m"`
// MaxConnLifetime is the duration since creation after which a connection will be automatically closed.
MaxConns uint16 `env:"MAX_CONNS" envDefault:"5"`
// MinConns is the minimum size of the pool. After connection closes, the pool might dip below MinConns. A low
// number of MinConns might mean the pool is empty after MaxConnLifetime until the health check has a chance
// to create new connections.
MinConns uint16 `env:"MIN_CONNS" envDefault:"1"`
// MinIdleConns is the minimum number of idle connections in the pool. You can increase this to ensure that
// there are always idle connections available. This can help reduce tail latencies during request processing,
// as you can avoid the latency of establishing a new connection while handling requests. It is superior
// to MinConns for this purpose.
// Similar to MinConns, the pool might temporarily dip below MinIdleConns after connection closes.
MinIdleConns uint16 `env:"MIN_IDLE_CONNS" envDefault:"1"`
// HealthCheckPeriod is the duration between checks of the health of idle connections.
HealthCheckPeriod time.Duration `env:"HEALTH_CHECK_PERIOD" envDefault:"1m"`
}
Click to show internal directories.
Click to hide internal directories.