Documentation ¶
Index ¶
- func PrepareAllQueries(ctx context.Context, p preparer) error
- type DBQuerier
- func (q *DBQuerier) ParamArrayInt(ctx context.Context, ints []int) ([]int, error)
- func (q *DBQuerier) ParamArrayIntBatch(batch genericBatch, ints []int)
- func (q *DBQuerier) ParamArrayIntScan(results pgx.BatchResults) ([]int, error)
- func (q *DBQuerier) ParamNested1(ctx context.Context, dimensions Dimensions) (Dimensions, error)
- func (q *DBQuerier) ParamNested1Batch(batch genericBatch, dimensions Dimensions)
- func (q *DBQuerier) ParamNested1Scan(results pgx.BatchResults) (Dimensions, error)
- func (q *DBQuerier) ParamNested2(ctx context.Context, image ProductImageType) (ProductImageType, error)
- func (q *DBQuerier) ParamNested2Array(ctx context.Context, images []ProductImageType) ([]ProductImageType, error)
- func (q *DBQuerier) ParamNested2ArrayBatch(batch genericBatch, images []ProductImageType)
- func (q *DBQuerier) ParamNested2ArrayScan(results pgx.BatchResults) ([]ProductImageType, error)
- func (q *DBQuerier) ParamNested2Batch(batch genericBatch, image ProductImageType)
- func (q *DBQuerier) ParamNested2Scan(results pgx.BatchResults) (ProductImageType, error)
- func (q *DBQuerier) ParamNested3(ctx context.Context, imageSet ProductImageSetType) (ProductImageSetType, error)
- func (q *DBQuerier) ParamNested3Batch(batch genericBatch, imageSet ProductImageSetType)
- func (q *DBQuerier) ParamNested3Scan(results pgx.BatchResults) (ProductImageSetType, error)
- func (q *DBQuerier) WithTx(tx pgx.Tx) (*DBQuerier, error)
- type Dimensions
- type ProductImageSetType
- type ProductImageType
- type Querier
- type QuerierConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PrepareAllQueries ¶
PrepareAllQueries executes a PREPARE statement for all pggen 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 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) ParamArrayInt ¶
ParamArrayInt implements Querier.ParamArrayInt.
func (*DBQuerier) ParamArrayIntBatch ¶
ParamArrayIntBatch implements Querier.ParamArrayIntBatch.
func (*DBQuerier) ParamArrayIntScan ¶
ParamArrayIntScan implements Querier.ParamArrayIntScan.
func (*DBQuerier) ParamNested1 ¶
func (q *DBQuerier) ParamNested1(ctx context.Context, dimensions Dimensions) (Dimensions, error)
ParamNested1 implements Querier.ParamNested1.
func (*DBQuerier) ParamNested1Batch ¶
func (q *DBQuerier) ParamNested1Batch(batch genericBatch, dimensions Dimensions)
ParamNested1Batch implements Querier.ParamNested1Batch.
func (*DBQuerier) ParamNested1Scan ¶
func (q *DBQuerier) ParamNested1Scan(results pgx.BatchResults) (Dimensions, error)
ParamNested1Scan implements Querier.ParamNested1Scan.
func (*DBQuerier) ParamNested2 ¶
func (q *DBQuerier) ParamNested2(ctx context.Context, image ProductImageType) (ProductImageType, error)
ParamNested2 implements Querier.ParamNested2.
func (*DBQuerier) ParamNested2Array ¶
func (q *DBQuerier) ParamNested2Array(ctx context.Context, images []ProductImageType) ([]ProductImageType, error)
ParamNested2Array implements Querier.ParamNested2Array.
func (*DBQuerier) ParamNested2ArrayBatch ¶
func (q *DBQuerier) ParamNested2ArrayBatch(batch genericBatch, images []ProductImageType)
ParamNested2ArrayBatch implements Querier.ParamNested2ArrayBatch.
func (*DBQuerier) ParamNested2ArrayScan ¶
func (q *DBQuerier) ParamNested2ArrayScan(results pgx.BatchResults) ([]ProductImageType, error)
ParamNested2ArrayScan implements Querier.ParamNested2ArrayScan.
func (*DBQuerier) ParamNested2Batch ¶
func (q *DBQuerier) ParamNested2Batch(batch genericBatch, image ProductImageType)
ParamNested2Batch implements Querier.ParamNested2Batch.
func (*DBQuerier) ParamNested2Scan ¶
func (q *DBQuerier) ParamNested2Scan(results pgx.BatchResults) (ProductImageType, error)
ParamNested2Scan implements Querier.ParamNested2Scan.
func (*DBQuerier) ParamNested3 ¶
func (q *DBQuerier) ParamNested3(ctx context.Context, imageSet ProductImageSetType) (ProductImageSetType, error)
ParamNested3 implements Querier.ParamNested3.
func (*DBQuerier) ParamNested3Batch ¶
func (q *DBQuerier) ParamNested3Batch(batch genericBatch, imageSet ProductImageSetType)
ParamNested3Batch implements Querier.ParamNested3Batch.
func (*DBQuerier) ParamNested3Scan ¶
func (q *DBQuerier) ParamNested3Scan(results pgx.BatchResults) (ProductImageSetType, error)
ParamNested3Scan implements Querier.ParamNested3Scan.
type Dimensions ¶
Dimensions represents the Postgres composite type "dimensions".
type ProductImageSetType ¶
type ProductImageSetType struct { Name string `json:"name"` OrigImage ProductImageType `json:"orig_image"` Images []ProductImageType `json:"images"` }
ProductImageSetType represents the Postgres composite type "product_image_set_type".
type ProductImageType ¶
type ProductImageType struct { Source string `json:"source"` Dimensions Dimensions `json:"dimensions"` }
ProductImageType represents the Postgres composite type "product_image_type".
type Querier ¶
type Querier interface { ParamArrayInt(ctx context.Context, ints []int) ([]int, error) // ParamArrayIntBatch enqueues a ParamArrayInt query into batch to be executed // later by the batch. ParamArrayIntBatch(batch genericBatch, ints []int) // ParamArrayIntScan scans the result of an executed ParamArrayIntBatch query. ParamArrayIntScan(results pgx.BatchResults) ([]int, error) ParamNested1(ctx context.Context, dimensions Dimensions) (Dimensions, error) // ParamNested1Batch enqueues a ParamNested1 query into batch to be executed // later by the batch. ParamNested1Batch(batch genericBatch, dimensions Dimensions) // ParamNested1Scan scans the result of an executed ParamNested1Batch query. ParamNested1Scan(results pgx.BatchResults) (Dimensions, error) ParamNested2(ctx context.Context, image ProductImageType) (ProductImageType, error) // ParamNested2Batch enqueues a ParamNested2 query into batch to be executed // later by the batch. ParamNested2Batch(batch genericBatch, image ProductImageType) // ParamNested2Scan scans the result of an executed ParamNested2Batch query. ParamNested2Scan(results pgx.BatchResults) (ProductImageType, error) ParamNested2Array(ctx context.Context, images []ProductImageType) ([]ProductImageType, error) // ParamNested2ArrayBatch enqueues a ParamNested2Array query into batch to be executed // later by the batch. ParamNested2ArrayBatch(batch genericBatch, images []ProductImageType) // ParamNested2ArrayScan scans the result of an executed ParamNested2ArrayBatch query. ParamNested2ArrayScan(results pgx.BatchResults) ([]ProductImageType, error) ParamNested3(ctx context.Context, imageSet ProductImageSetType) (ProductImageSetType, error) // ParamNested3Batch enqueues a ParamNested3 query into batch to be executed // later by the batch. ParamNested3Batch(batch genericBatch, imageSet ProductImageSetType) // ParamNested3Scan scans the result of an executed ParamNested3Batch query. ParamNested3Scan(results pgx.BatchResults) (ProductImageSetType, 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 pggen-generated pgtype.ValueTranscoder. // // If OIDs are available for an input parameter type and all of its // transitive dependencies, pggen will use the binary encoding format for // the input parameter. DataTypes []pgtype.DataType }