pgxpool pools always connect lazily
Rename constructor functions now that they don't actually connect.
This commit is contained in:
+7
-4
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user