Documentation
¶
Index ¶
- func RegisterTypes(ctx context.Context, conn *pgx.Conn) 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)
- 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) 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.