out

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterTypes added in v0.0.3

func RegisterTypes(ctx context.Context, conn *pgx.Conn) error

RegisterTypes registers custom Postgres types (composites and enums) with the pgx connection's TypeMap so that they can be scanned and encoded correctly. Call this once per connection after connecting.

For pgxpool.Pool, use config.AfterConnect:

config.AfterConnect = func(ctx context.Context, conn *pgx.Conn) error {
	return RegisterTypes(ctx, conn)
}

Types

type Alpha

type Alpha struct {
	Key *string `json:"key"`
}

Alpha represents the Postgres composite type "alpha".

type DBQuerier

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

func NewQuerier

func NewQuerier(conn genericConn) *DBQuerier

NewQuerier creates a DBQuerier that implements Querier. conn is typically *pgx.Conn, pgx.Tx, or *pgxpool.Pool.

func (*DBQuerier) Alpha

func (q *DBQuerier) Alpha(ctx context.Context) (string, error)

Alpha implements Querier.Alpha.

func (*DBQuerier) AlphaBatch

func (q *DBQuerier) AlphaBatch(batch genericBatch)

AlphaBatch implements Querier.AlphaBatch.

func (*DBQuerier) AlphaCompositeArray

func (q *DBQuerier) AlphaCompositeArray(ctx context.Context) ([]Alpha, error)

AlphaCompositeArray implements Querier.AlphaCompositeArray.

func (*DBQuerier) AlphaCompositeArrayBatch

func (q *DBQuerier) AlphaCompositeArrayBatch(batch genericBatch)

AlphaCompositeArrayBatch implements Querier.AlphaCompositeArrayBatch.

func (*DBQuerier) AlphaCompositeArrayScan

func (q *DBQuerier) AlphaCompositeArrayScan(results pgx.BatchResults) ([]Alpha, error)

AlphaCompositeArrayScan implements Querier.AlphaCompositeArrayScan.

func (*DBQuerier) AlphaNested

func (q *DBQuerier) AlphaNested(ctx context.Context) (string, error)

AlphaNested implements Querier.AlphaNested.

func (*DBQuerier) AlphaNestedBatch

func (q *DBQuerier) AlphaNestedBatch(batch genericBatch)

AlphaNestedBatch implements Querier.AlphaNestedBatch.

func (*DBQuerier) AlphaNestedScan

func (q *DBQuerier) AlphaNestedScan(results pgx.BatchResults) (string, error)

AlphaNestedScan implements Querier.AlphaNestedScan.

func (*DBQuerier) AlphaScan

func (q *DBQuerier) AlphaScan(results pgx.BatchResults) (string, error)

AlphaScan implements Querier.AlphaScan.

func (*DBQuerier) Bravo

func (q *DBQuerier) Bravo(ctx context.Context) (string, error)

Bravo implements Querier.Bravo.

func (*DBQuerier) BravoBatch

func (q *DBQuerier) BravoBatch(batch genericBatch)

BravoBatch implements Querier.BravoBatch.

func (*DBQuerier) BravoScan

func (q *DBQuerier) BravoScan(results pgx.BatchResults) (string, error)

BravoScan implements Querier.BravoScan.

type Querier

type Querier interface {
	AlphaNested(ctx context.Context) (string, error)
	// AlphaNestedBatch enqueues a AlphaNested query into batch to be executed
	// later by the batch.
	AlphaNestedBatch(batch genericBatch)
	// AlphaNestedScan scans the result of an executed AlphaNestedBatch query.
	AlphaNestedScan(results pgx.BatchResults) (string, error)

	AlphaCompositeArray(ctx context.Context) ([]Alpha, error)
	// AlphaCompositeArrayBatch enqueues a AlphaCompositeArray query into batch to be executed
	// later by the batch.
	AlphaCompositeArrayBatch(batch genericBatch)
	// AlphaCompositeArrayScan scans the result of an executed AlphaCompositeArrayBatch query.
	AlphaCompositeArrayScan(results pgx.BatchResults) ([]Alpha, error)

	Alpha(ctx context.Context) (string, error)
	// AlphaBatch enqueues a Alpha query into batch to be executed
	// later by the batch.
	AlphaBatch(batch genericBatch)
	// AlphaScan scans the result of an executed AlphaBatch query.
	AlphaScan(results pgx.BatchResults) (string, error)

	Bravo(ctx context.Context) (string, error)
	// BravoBatch enqueues a Bravo query into batch to be executed
	// later by the batch.
	BravoBatch(batch genericBatch)
	// BravoScan scans the result of an executed BravoBatch query.
	BravoScan(results pgx.BatchResults) (string, error)
}

Querier is a typesafe Go interface backed by SQL queries.

Methods ending with Batch enqueue a query to run later in a pgx.Batch. After calling SendBatch on pgx.Conn, pgxpool.Pool, or pgx.Tx, use the Scan methods to parse the results.

Jump to

Keyboard shortcuts

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