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 ¶
- type Config
- type Driver
- func (d *Driver) Capabilities() driver.Capabilities
- func (d *Driver) Executor() driver.Executor
- func (d *Driver) Listener(ctx context.Context) (driver.Listener, error)
- func (d *Driver) Migrator() driver.Migrator
- func (d *Driver) Pool() *pgxpool.Pool
- func (d *Driver) UnwrapTx(tx pgx.Tx) driver.Executor
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 ¶
New returns a driver on pool. The pool is shared with the application; the driver does not close it.
func NewWithConfig ¶
NewWithConfig is New with driver settings.
func (*Driver) Capabilities ¶
func (d *Driver) Capabilities() driver.Capabilities
Capabilities implements driver.Driver.