Documentation
¶
Overview ¶
Package pgxpool provides the pgx-native connection pool under both TinyGo and standard Go.
It is the pool companion to database/pgx: on standard Go every name is an alias for the upstream github.com/jackc/pgx/v5/pgxpool type, so a *Pool from this package is upstream's *Pool and passes to third-party code unchanged; on TinyGo the same names bind to the vendored copy. A Pool is safe for concurrent use by many goroutines, which a bare pgx.Conn is not.
pool, err := pgxpool.New(ctx, "postgres://user:pass@localhost:5432/db?sslmode=disable")
if err != nil { ... }
defer pool.Close()
var n int
err = pool.QueryRow(ctx, "SELECT 1").Scan(&n)
ParseConfig accepts the pool_* DSN parameters upstream documents (pool_max_conns, pool_min_conns, pool_max_conn_lifetime, ...), and installs the same per-connection defaults as database/pgx.ParseConfig: the CancelRequest cancellation watcher on both builds, and on TinyGo the fd-carrying dialer that makes sslmode work. Both sit on Config.ConnConfig as plain fields and may be overwritten before NewWithConfig.
The TinyGo notes in database/pgx apply here unchanged: build with -scheduler=threads, import netdev for its side effect, TCP over IPv4 only.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AcquireTracer ¶
type AcquireTracer = ppool.AcquireTracer
The public surface, as aliases so every value is the upstream pgxpool value itself. The vendored backend defines the same names against its own copy.
type Config ¶
The public surface, as aliases so every value is the upstream pgxpool value itself. The vendored backend defines the same names against its own copy.
func ParseConfig ¶
ParseConfig parses a DSN including the pool_* parameters and applies this package's per-connection defaults; see the package documentation. The result may be adjusted before NewWithConfig.
type Conn ¶
The public surface, as aliases so every value is the upstream pgxpool value itself. The vendored backend defines the same names against its own copy.
type Pool ¶
The public surface, as aliases so every value is the upstream pgxpool value itself. The vendored backend defines the same names against its own copy.
type ReleaseTracer ¶
type ReleaseTracer = ppool.ReleaseTracer
The public surface, as aliases so every value is the upstream pgxpool value itself. The vendored backend defines the same names against its own copy.
type ShouldPingParams ¶
type ShouldPingParams = ppool.ShouldPingParams
The public surface, as aliases so every value is the upstream pgxpool value itself. The vendored backend defines the same names against its own copy.
type Stat ¶
The public surface, as aliases so every value is the upstream pgxpool value itself. The vendored backend defines the same names against its own copy.
type TraceAcquireEndData ¶
type TraceAcquireEndData = ppool.TraceAcquireEndData
The public surface, as aliases so every value is the upstream pgxpool value itself. The vendored backend defines the same names against its own copy.
type TraceAcquireStartData ¶
type TraceAcquireStartData = ppool.TraceAcquireStartData
The public surface, as aliases so every value is the upstream pgxpool value itself. The vendored backend defines the same names against its own copy.
type TraceReleaseData ¶
type TraceReleaseData = ppool.TraceReleaseData
The public surface, as aliases so every value is the upstream pgxpool value itself. The vendored backend defines the same names against its own copy.