1 // Package pgxpool is a concurrency-safe connection pool for pgx. 2 /* 3 pgxpool implements a nearly identical interface to pgx connections. 4 5 Creating a Pool 6 7 The primary way of creating a pool is with [pgxpool.New]: 8 9 pool, err := pgxpool.New(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]. 13 14 config, err := pgxpool.ParseConfig(os.Getenv("DATABASE_URL")) 15 if err != nil { 16 // ... 17 } 18 config.AfterConnect = func(ctx context.Context, conn *pgx.Conn) error { 19 // do something with every new connection 20 } 21 22 pool, err := pgxpool.NewWithConfig(context.Background(), config) 23 24 A pool returns without waiting for any connections to be established. Acquire a connection immediately after creating 25 the pool to check if a connection can successfully be established. 26 */ 27 package pgxpool 28