hopperpgx

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2026 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Overview

Package hopperpgx is hopper's reference driver: PostgreSQL through pgx v5.

client, err := hopper.NewClient(hopperpgx.New(pool), cfg)

The driver is generic over pgx.Tx, so InsertTx accepts only a pgx transaction. Objects live in the configurable Schema (default "hopper"), independently of the connection's search_path.

The SQL and the logic around it are shared with hoppersql; this package adds what pgx alone offers: COPY for bulk inserts, LISTEN, and pipelined statements.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Schema is the PostgreSQL namespace for all Hopper objects. Empty means "hopper".
	Schema string
	// ListenConnConfig is used for the LISTEN connection instead of the
	// pool's connection settings. Set it to a direct Postgres address when
	// the pool goes through a transaction pooler such as PgBouncer, which
	// cannot carry LISTEN.
	ListenConnConfig *pgx.ConnConfig
}

Config tunes the driver. The zero value is fine for a pool that connects directly to Postgres.

type Driver

type Driver struct {
	// contains filtered or unexported fields
}

Driver implements driver.Driver[pgx.Tx] on a pgxpool.Pool.

func New

func New(pool *pgxpool.Pool) *Driver

New returns a driver on pool. The pool is shared with the application; the driver does not close it.

func NewWithConfig

func NewWithConfig(pool *pgxpool.Pool, cfg *Config) *Driver

NewWithConfig is New with driver settings.

func (*Driver) Capabilities

func (d *Driver) Capabilities() driver.Capabilities

Capabilities implements driver.Driver.

func (*Driver) Executor

func (d *Driver) Executor() driver.Executor

Executor implements driver.Driver.

func (*Driver) Listener

func (d *Driver) Listener(ctx context.Context) (driver.Listener, error)

Listener implements driver.Driver. It opens a dedicated connection.

func (*Driver) Migrator

func (d *Driver) Migrator() driver.Migrator

Migrator implements driver.Driver.

func (*Driver) Pool

func (d *Driver) Pool() *pgxpool.Pool

Pool returns the underlying pool.

func (*Driver) UnwrapTx

func (d *Driver) UnwrapTx(tx pgx.Tx) driver.Executor

UnwrapTx implements driver.Driver.

Jump to

Keyboard shortcuts

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