mirror of
https://github.com/jackc/pgx.git
synced 2025-07-30 22:28:43 +00:00
add doc for OpenDBFromPool
This commit is contained in:
parent
f42824cab3
commit
b301530a5f
@ -223,6 +223,9 @@ func OpenDB(config pgx.ConnConfig, opts ...OptionOpenDB) *sql.DB {
|
|||||||
return sql.OpenDB(c)
|
return sql.OpenDB(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// OpenDBFromPool creates a new *sql.DB from the given *pgxpool.Pool. Note that this method automatically sets the
|
||||||
|
// maximum number of idle connections in *sql.DB to zero, since they must be managed from the *pgxpool.Pool. This is
|
||||||
|
// required to avoid acquiring all the connections from the pgxpool and starving any direct users of the pgxpool.
|
||||||
func OpenDBFromPool(pool *pgxpool.Pool, opts ...OptionOpenDB) *sql.DB {
|
func OpenDBFromPool(pool *pgxpool.Pool, opts ...OptionOpenDB) *sql.DB {
|
||||||
c := GetPoolConnector(pool, opts...)
|
c := GetPoolConnector(pool, opts...)
|
||||||
db := sql.OpenDB(c)
|
db := sql.OpenDB(c)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user