Versions in this module Expand all Collapse all v1 v1.1.0 Nov 6, 2026 Changes in this version + func ConstraintError(err error) (code, constraint string, ok bool) + func IsNoRows(err error) bool + type Executor interface + Exec func(context.Context, string, ...any) (Result, error) + Query func(context.Context, string, ...any) (Rows, error) + QueryRow func(context.Context, string, ...any) Row + type Row = db.Row + type Rows = db.Rows v1.0.0 Nov 6, 2026 Changes in this version + const IdempotencySchema + func Classify(err error) error + type Client struct + func New(ctx context.Context, c Config) (*Client, error) + func (c *Client) AdvisoryLock(ctx context.Context, key int64) (func(context.Context) error, error) + func (c *Client) Batch(ctx context.Context, ops []Operation) (out []Result, err error) + func (c *Client) BeginTx(ctx context.Context, o TxOptions) (*Tx, error) + func (c *Client) Close() + func (c *Client) CopyFrom(ctx context.Context, table []string, columns []string, values [][]any) (int64, error) + func (c *Client) Exec(ctx context.Context, q string, args ...any) (Result, error) + func (c *Client) Get(ctx context.Context, dst any, q string, args ...any) error + func (c *Client) Listen(ctx context.Context, channel string, handler func(string) error) error + func (c *Client) Native() *pgxpool.Pool + func (c *Client) Notify(ctx context.Context, channel, payload string) error + func (c *Client) Ping(ctx context.Context) error + func (c *Client) Prepare(ctx context.Context, query string) (*Statement, error) + func (c *Client) Query(ctx context.Context, q string, args ...any) (db.Rows, error) + func (c *Client) QueryRow(ctx context.Context, q string, args ...any) db.Row + func (c *Client) SQLDB() *sql.DB + func (c *Client) Select(ctx context.Context, dst any, q string, args ...any) error + func (c *Client) Stats() Stats + func (c *Client) WithinTx(ctx context.Context, o TxOptions, fn func(*Tx) error) error + type Cluster struct + func NewCluster(ctx context.Context, cfg ClusterConfig) (*Cluster, error) + func (c *Cluster) Close() + func (c *Cluster) Reader(consistency Consistency) (*Client, error) + func (c *Cluster) Writer() *Client + type ClusterConfig struct + Primary Config + Replicas []Config + type Config struct + AfterConnect func(context.Context) error + AllowPlaintext bool + ApplicationName string + ConnectTimeout time.Duration + Hooks db.Hooks + MaxConnections int32 + MaxIdleTime time.Duration + MaxLifetime time.Duration + MinConnections int32 + Observer instrument.Hook + QueryLogger *slog.Logger + QueryTimeout time.Duration + ReadOnly bool + StatementTimeout time.Duration + TLS *tls.Config + URL string + type Consistency int + const Eventual + const Strong + type IdempotencyStore struct + func NewIdempotencyStore(c *Client) (*IdempotencyStore, error) + func (s *IdempotencyStore) Begin(ctx context.Context, key, fingerprint string, lease time.Duration) (idempotency.Record, error) + func (s *IdempotencyStore) CleanupExpired(ctx context.Context, limit int) (int64, error) + func (s *IdempotencyStore) Complete(ctx context.Context, key, token string, status int, ttl time.Duration) error + func (s *IdempotencyStore) Fail(ctx context.Context, key, token string, ttl time.Duration) error + func (s *IdempotencyStore) Renew(ctx context.Context, key, token string, ttl time.Duration) error + type NamedArgs map[string]any + type Operation struct + Args []any + SQL string + type Result struct + Command string + RowsAffected int64 + type Statement struct + func (s *Statement) Close() error + func (s *Statement) Exec(ctx context.Context, args ...any) (Result, error) + func (s *Statement) Get(ctx context.Context, dest any, args ...any) error + func (s *Statement) Native() *sql.Stmt + func (s *Statement) Query(ctx context.Context, args ...any) (db.Rows, error) + func (s *Statement) QueryRow(ctx context.Context, args ...any) db.Row + func (s *Statement) Select(ctx context.Context, dest any, args ...any) error + type Stats struct + AcquireCount int64 + AcquireDuration time.Duration + Acquired int32 + Idle int32 + Maximum int32 + Total int32 + type Tx struct + func (t *Tx) Commit(ctx context.Context) error + func (t *Tx) Exec(ctx context.Context, q string, a ...any) (Result, error) + func (t *Tx) Get(ctx context.Context, d any, q string, a ...any) error + func (t *Tx) Native() pgx.Tx + func (t *Tx) Query(ctx context.Context, q string, a ...any) (db.Rows, error) + func (t *Tx) QueryRow(ctx context.Context, q string, a ...any) db.Row + func (t *Tx) Rollback(ctx context.Context) error + func (t *Tx) Select(ctx context.Context, d any, q string, a ...any) error + func (t *Tx) WithinTx(ctx context.Context, fn func(*Tx) error) error + type TxOptions struct + Isolation string + ReadOnly bool