Documentation
¶
Index ¶
- func RegisterTypes(ctx context.Context, conn *pgx.Conn) error
- type DBQuerier
- func (q *DBQuerier) GetBools(ctx context.Context, data []bool) ([]bool, error)
- func (q *DBQuerier) GetBoolsBatch(batch genericBatch, data []bool)
- func (q *DBQuerier) GetBoolsScan(results pgx.BatchResults) ([]bool, error)
- func (q *DBQuerier) GetManyTimestamps(ctx context.Context, data []*time.Time) ([]*time.Time, error)
- func (q *DBQuerier) GetManyTimestampsBatch(batch genericBatch, data []*time.Time)
- func (q *DBQuerier) GetManyTimestampsScan(results pgx.BatchResults) ([]*time.Time, error)
- func (q *DBQuerier) GetManyTimestamptzs(ctx context.Context, data []time.Time) ([]*time.Time, error)
- func (q *DBQuerier) GetManyTimestamptzsBatch(batch genericBatch, data []time.Time)
- func (q *DBQuerier) GetManyTimestamptzsScan(results pgx.BatchResults) ([]*time.Time, error)
- func (q *DBQuerier) GetOneTimestamp(ctx context.Context, data *time.Time) (*time.Time, error)
- func (q *DBQuerier) GetOneTimestampBatch(batch genericBatch, data *time.Time)
- func (q *DBQuerier) GetOneTimestampScan(results pgx.BatchResults) (*time.Time, error)
- 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) GetBoolsBatch ¶
GetBoolsBatch implements Querier.GetBoolsBatch.
func (*DBQuerier) GetBoolsScan ¶
func (q *DBQuerier) GetBoolsScan(results pgx.BatchResults) ([]bool, error)
GetBoolsScan implements Querier.GetBoolsScan.
func (*DBQuerier) GetManyTimestamps ¶
GetManyTimestamps implements Querier.GetManyTimestamps.
func (*DBQuerier) GetManyTimestampsBatch ¶
GetManyTimestampsBatch implements Querier.GetManyTimestampsBatch.
func (*DBQuerier) GetManyTimestampsScan ¶
GetManyTimestampsScan implements Querier.GetManyTimestampsScan.
func (*DBQuerier) GetManyTimestamptzs ¶
func (q *DBQuerier) GetManyTimestamptzs(ctx context.Context, data []time.Time) ([]*time.Time, error)
GetManyTimestamptzs implements Querier.GetManyTimestamptzs.
func (*DBQuerier) GetManyTimestamptzsBatch ¶
GetManyTimestamptzsBatch implements Querier.GetManyTimestamptzsBatch.
func (*DBQuerier) GetManyTimestamptzsScan ¶
GetManyTimestamptzsScan implements Querier.GetManyTimestamptzsScan.
func (*DBQuerier) GetOneTimestamp ¶
GetOneTimestamp implements Querier.GetOneTimestamp.
func (*DBQuerier) GetOneTimestampBatch ¶
GetOneTimestampBatch implements Querier.GetOneTimestampBatch.
func (*DBQuerier) GetOneTimestampScan ¶
GetOneTimestampScan implements Querier.GetOneTimestampScan.
type Querier ¶
type Querier interface {
GetBools(ctx context.Context, data []bool) ([]bool, error)
// GetBoolsBatch enqueues a GetBools query into batch to be executed
// later by the batch.
GetBoolsBatch(batch genericBatch, data []bool)
// GetBoolsScan scans the result of an executed GetBoolsBatch query.
GetBoolsScan(results pgx.BatchResults) ([]bool, error)
GetOneTimestamp(ctx context.Context, data *time.Time) (*time.Time, error)
// GetOneTimestampBatch enqueues a GetOneTimestamp query into batch to be executed
// later by the batch.
GetOneTimestampBatch(batch genericBatch, data *time.Time)
// GetOneTimestampScan scans the result of an executed GetOneTimestampBatch query.
GetOneTimestampScan(results pgx.BatchResults) (*time.Time, error)
GetManyTimestamptzs(ctx context.Context, data []time.Time) ([]*time.Time, error)
// GetManyTimestamptzsBatch enqueues a GetManyTimestamptzs query into batch to be executed
// later by the batch.
GetManyTimestamptzsBatch(batch genericBatch, data []time.Time)
// GetManyTimestamptzsScan scans the result of an executed GetManyTimestamptzsBatch query.
GetManyTimestamptzsScan(results pgx.BatchResults) ([]*time.Time, error)
GetManyTimestamps(ctx context.Context, data []*time.Time) ([]*time.Time, error)
// GetManyTimestampsBatch enqueues a GetManyTimestamps query into batch to be executed
// later by the batch.
GetManyTimestampsBatch(batch genericBatch, data []*time.Time)
// GetManyTimestampsScan scans the result of an executed GetManyTimestampsBatch query.
GetManyTimestampsScan(results pgx.BatchResults) ([]*time.Time, 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.