Documentation
¶
Index ¶
- func PrepareAllQueries(ctx context.Context, p preparer) error
- type DBQuerier
- func (q *DBQuerier) ArrayNested2(ctx context.Context) ([]ProductImageType, error)
- func (q *DBQuerier) ArrayNested2Batch(batch genericBatch)
- func (q *DBQuerier) ArrayNested2Scan(results pgx.BatchResults) ([]ProductImageType, error)
- func (q *DBQuerier) Nested3(ctx context.Context) ([]ProductImageSetType, error)
- func (q *DBQuerier) Nested3Batch(batch genericBatch)
- func (q *DBQuerier) Nested3Scan(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 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 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) ArrayNested2 ¶
func (q *DBQuerier) ArrayNested2(ctx context.Context) ([]ProductImageType, error)
ArrayNested2 implements Querier.ArrayNested2.
func (*DBQuerier) ArrayNested2Batch ¶
func (q *DBQuerier) ArrayNested2Batch(batch genericBatch)
ArrayNested2Batch implements Querier.ArrayNested2Batch.
func (*DBQuerier) ArrayNested2Scan ¶
func (q *DBQuerier) ArrayNested2Scan(results pgx.BatchResults) ([]ProductImageType, error)
ArrayNested2Scan implements Querier.ArrayNested2Scan.
func (*DBQuerier) Nested3 ¶
func (q *DBQuerier) Nested3(ctx context.Context) ([]ProductImageSetType, error)
Nested3 implements Querier.Nested3.
func (*DBQuerier) Nested3Batch ¶
func (q *DBQuerier) Nested3Batch(batch genericBatch)
Nested3Batch implements Querier.Nested3Batch.
func (*DBQuerier) Nested3Scan ¶
func (q *DBQuerier) Nested3Scan(results pgx.BatchResults) ([]ProductImageSetType, error)
Nested3Scan implements Querier.Nested3Scan.
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 { ArrayNested2(ctx context.Context) ([]ProductImageType, error) // ArrayNested2Batch enqueues a ArrayNested2 query into batch to be executed // later by the batch. ArrayNested2Batch(batch genericBatch) // ArrayNested2Scan scans the result of an executed ArrayNested2Batch query. ArrayNested2Scan(results pgx.BatchResults) ([]ProductImageType, error) Nested3(ctx context.Context) ([]ProductImageSetType, error) // Nested3Batch enqueues a Nested3 query into batch to be executed // later by the batch. Nested3Batch(batch genericBatch) // Nested3Scan scans the result of an executed Nested3Batch query. Nested3Scan(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 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 }