mirror of
https://github.com/jackc/pgx.git
synced 2025-07-10 20:48:09 +00:00
Fix: pgxpool.New() instead of pgxpool.Connect()
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.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user