pgxpool

package
v1.2.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 2, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

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

type Config = ppool.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

func ParseConfig(dsn string) (*Config, error)

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

type Conn = ppool.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

type Pool = ppool.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.

func New

func New(ctx context.Context, dsn string) (*Pool, error)

New creates a Pool for a libpq-style URL or keyword DSN, which may carry the pool_* parameters. Connections are established lazily; use Ping to verify the configuration eagerly.

func NewWithConfig

func NewWithConfig(ctx context.Context, cfg *Config) (*Pool, error)

NewWithConfig creates a Pool from a configuration built by ParseConfig. The config must originate from ParseConfig, which is pgxpool's own rule.

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

type Stat = ppool.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.

type Tx

type Tx = ppool.Tx

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL