2
0

pgxpool pools always connect lazily

Rename constructor functions now that they don't actually connect.
This commit is contained in:
Jack Christensen
2022-07-10 14:58:30 -05:00
parent ca41a6a222
commit a059d1099f
10 changed files with 79 additions and 268 deletions
+7 -4
View File
@@ -2,11 +2,11 @@
/*
pgxpool implements a nearly identical interface to pgx connections.
Establishing a Connection
Creating a Pool
The primary way of establishing a connection is with `pgxpool.Connect`.
The primary way of creating a pool is with `pgxpool.New`.
pool, err := pgxpool.Connect(context.Background(), os.Getenv("DATABASE_URL"))
pool, err := pgxpool.New(context.Background(), os.Getenv("DATABASE_URL"))
The database connection string can be in URL or DSN format. PostgreSQL settings, pgx settings, and pool settings can be
specified here. In addition, a config struct can be created by `ParseConfig` and modified before establishing the
@@ -20,6 +20,9 @@ connection with `ConnectConfig`.
// do something with every new connection
}
pool, err := pgxpool.ConnectConfig(context.Background(), config)
pool, err := pgxpool.NewConfig(context.Background(), config)
A pool returns without waiting for any connections to be established. Acquire a connection immediately after creating
the pool to check if a connection can successfully be established.
*/
package pgxpool