From d93f31b8faf9ceb74721c66e8c70d20f7b2603a4 Mon Sep 17 00:00:00 2001 From: Vincent Le Goff Date: Sat, 23 Sep 2023 12:43:31 -0400 Subject: [PATCH] docs: GetPoolConnector --- stdlib/sql.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/stdlib/sql.go b/stdlib/sql.go index 6a081e21..95603c1f 100644 --- a/stdlib/sql.go +++ b/stdlib/sql.go @@ -204,6 +204,10 @@ func GetConnector(config pgx.ConnConfig, opts ...OptionOpenDB) driver.Connector return c } +// GetPoolConnector creates a new driver.Connector from the given *pgxpool.Pool. By using this be sure to set the +// maximum idle connections of the *sql.DB created with this connector 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 GetPoolConnector(pool *pgxpool.Pool, opts ...OptionOpenDB) driver.Connector { c := connector{ pool: pool,