Wire postgress config: MaxConns, MaxIdleConns, MaxConnLifetime
The Mysql plugin has these exact lines.
Fixes
@@ -98,6 +98,15 @@ func (d *plugin) createDBConnection(cfg *config.SQL) (*sqlx.DB, error) {
if err != nil {
return nil, err
}
+ if cfg.MaxConns > 0 {
+ db.SetMaxOpenConns(cfg.MaxConns)
+ }
+ if cfg.MaxIdleConns > 0 {
+ db.SetMaxIdleConns(cfg.MaxIdleConns)
+ }
+ if cfg.MaxConnLifetime > 0 {
+ db.SetConnMaxLifetime(cfg.MaxConnLifetime)
+ }
// Maps struct names in CamelCase to snake without need for db struct tags.
db.MapperFunc(strcase.ToSnake)
