Documentation
¶
Index ¶
- func RegisterTypes(ctx context.Context, conn *pgx.Conn) 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)
- type Dimensions
- type ProductImageSetType
- type ProductImageType
- type Querier
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterTypes ¶ added in v0.0.3
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 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) ParamArrayInt ¶
ParamArrayInt implements Querier.ParamArrayInt.
func (*DBQuerier) ParamArrayIntBatch ¶
ParamArrayIntBatch implements Querier.ParamArrayIntBatch.
func (*DBQuerier) ParamArrayIntScan ¶
func (q *DBQuerier) ParamArrayIntScan(results pgx.BatchResults) ([]int, error)
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.