out

package
v0.0.0-...-1a642c0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrepareAllQueries

func PrepareAllQueries(ctx context.Context, p preparer) error

PrepareAllQueries executes a PREPARE statement for all sqlgen generated SQL queries in querier files. Typical usage is as the AfterConnect callback for pgxpool.Config

pgx will use the prepared statement if available. Calling PrepareAllQueries is an optional optimization to avoid a network round-trip the first time pgx runs a query if pgx statement caching is enabled.

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 NewQuerierConfig

func NewQuerierConfig(conn genericConn, cfg QuerierConfig) *DBQuerier

NewQuerierConfig creates a DBQuerier that implements Querier with the given config. 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.

func (*DBQuerier) WithTx

func (q *DBQuerier) WithTx(tx pgx.Tx) (*DBQuerier, error)

WithTx creates a new DBQuerier that uses the transaction to run all queries.

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.

type QuerierConfig

type QuerierConfig struct {
	// DataTypes contains pgtype.Value to use for encoding and decoding instead
	// of sqlgen-generated pgtype.ValueTranscoder.
	//
	// If OIDs are available for an input parameter type and all of its
	// transitive dependencies, sqlgen will use the binary encoding format for
	// the input parameter.
	DataTypes []pgtype.DataType
}

Jump to

Keyboard shortcuts

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