File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change
1
+ // Package pgxpool is a connection pool for pgx.
2
+ /*
3
+ pgxpool implements a nearly identical interface to pgx connections.
4
+
5
+ Establishing a Connection
6
+
7
+ The primary way of establishing a connection is with `pgxpool.Connect`.
8
+
9
+ pool, err := pgxpool.Connect(context.Background(), os.Getenv("DATABASE_URL"))
10
+
11
+ The database connection string can be in URL or DSN format. PostgreSQL settings, pgx settings, and pool settings can be
12
+ specified here. In addition, a config struct can be created by `ParseConfig` and modified before establishing the
13
+ connection with `ConnectConfig`.
14
+
15
+ config, err := pgxpool.ParseConfig(os.Getenv("DATABASE_URL"))
16
+ if err != nil {
17
+ // ...
18
+ }
19
+ config.AfterConnect = func(ctx context.Context, conn *pgx.Conn) error {
20
+ // do something with every new connection
21
+ }
22
+
23
+ pool, err := pgxpool.ConnectConfig(context.Background(), config)
24
+ */
25
+ package pgxpool
You can’t perform that action at this time.
0 commit comments