Fix tests
This commit is contained in:
@@ -10,10 +10,10 @@ import (
|
||||
_ "github.com/jackc/pgx/v5/stdlib" // PostgreSQL driver
|
||||
)
|
||||
|
||||
const defaultMaxOpenConns = 25
|
||||
const defaultMaxOpenConns = 10
|
||||
|
||||
// OpenDB opens a PostgreSQL database connection pool from a DSN string. It supports custom
|
||||
// query parameters for pool configuration: pool_max_conns (default 25), pool_max_idle_conns,
|
||||
// query parameters for pool configuration: pool_max_conns (default 10), pool_max_idle_conns,
|
||||
// pool_conn_max_lifetime, and pool_conn_max_idle_time. These parameters are stripped from
|
||||
// the DSN before passing it to the driver.
|
||||
func OpenDB(dsn string) (*sql.DB, error) {
|
||||
@@ -54,7 +54,7 @@ func OpenDB(dsn string) (*sql.DB, error) {
|
||||
db.SetConnMaxIdleTime(connMaxIdleTime)
|
||||
}
|
||||
if err := db.Ping(); err != nil {
|
||||
return nil, err
|
||||
return nil, fmt.Errorf("ping failed: %w", err)
|
||||
}
|
||||
return db, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user