Fix: pgxpool.New() instead of pgxpool.Connect()

Jack Christensen 2022-12-20 20:17:44 -06:00
parent 72c0dca70c
commit a7e0765054

@ -98,7 +98,7 @@ Hello, world!
## Using a Connection Pool
The `*pgx.Conn` returned by `pgx.Connect()` represents a single connection and is not concurrency safe. This is entirely appropriate for a simple command line example such as above. However, for many uses, such as a web application server, concurrency is required. To use a connection pool replace the import `github.com/jackc/pgx/v5` with `github.com/jackc/pgx/v5/pgxpool` and connect with `pgxpool.Connect()` instead of `pgx.Connect()`.
The `*pgx.Conn` returned by `pgx.Connect()` represents a single connection and is not concurrency safe. This is entirely appropriate for a simple command line example such as above. However, for many uses, such as a web application server, concurrency is required. To use a connection pool replace the import `github.com/jackc/pgx/v5` with `github.com/jackc/pgx/v5/pgxpool` and connect with `pgxpool.New()` instead of `pgx.Connect()`.
You may need to run `go get` for the `pgxpool` package.