Documentation
¶
Index ¶
- type CreateRow
- type DBQuerier
- func (q *DBQuerier) Create(ctx context.Context, data []byte, metadata []byte) (CreateRow, error)
- func (q *DBQuerier) CreateBatch(batch genericBatch, data []byte, metadata []byte)
- func (q *DBQuerier) CreateScan(results pgx.BatchResults) (CreateRow, error)
- func (q *DBQuerier) FindByID(ctx context.Context, id pgtype.UUID) (FindByIDRow, error)
- func (q *DBQuerier) FindByIDBatch(batch genericBatch, id pgtype.UUID)
- func (q *DBQuerier) FindByIDScan(results pgx.BatchResults) (FindByIDRow, error)
- func (q *DBQuerier) ListAll(ctx context.Context) ([]ListAllRow, error)
- func (q *DBQuerier) ListAllBatch(batch genericBatch)
- func (q *DBQuerier) ListAllScan(results pgx.BatchResults) ([]ListAllRow, error)
- type FindByIDRow
- type ListAllRow
- type Querier
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
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) CreateBatch ¶
CreateBatch implements Querier.CreateBatch.
func (*DBQuerier) CreateScan ¶
func (q *DBQuerier) CreateScan(results pgx.BatchResults) (CreateRow, error)
CreateScan implements Querier.CreateScan.
func (*DBQuerier) FindByIDBatch ¶
FindByIDBatch implements Querier.FindByIDBatch.
func (*DBQuerier) FindByIDScan ¶
func (q *DBQuerier) FindByIDScan(results pgx.BatchResults) (FindByIDRow, error)
FindByIDScan implements Querier.FindByIDScan.
func (*DBQuerier) ListAll ¶
func (q *DBQuerier) ListAll(ctx context.Context) ([]ListAllRow, error)
ListAll implements Querier.ListAll.
func (*DBQuerier) ListAllBatch ¶
func (q *DBQuerier) ListAllBatch(batch genericBatch)
ListAllBatch implements Querier.ListAllBatch.
func (*DBQuerier) ListAllScan ¶
func (q *DBQuerier) ListAllScan(results pgx.BatchResults) ([]ListAllRow, error)
ListAllScan implements Querier.ListAllScan.
type FindByIDRow ¶
type ListAllRow ¶
type Querier ¶
type Querier interface {
FindByID(ctx context.Context, id pgtype.UUID) (FindByIDRow, error)
// FindByIDBatch enqueues a FindByID query into batch to be executed
// later by the batch.
FindByIDBatch(batch genericBatch, id pgtype.UUID)
// FindByIDScan scans the result of an executed FindByIDBatch query.
FindByIDScan(results pgx.BatchResults) (FindByIDRow, error)
Create(ctx context.Context, data []byte, metadata []byte) (CreateRow, error)
// CreateBatch enqueues a Create query into batch to be executed
// later by the batch.
CreateBatch(batch genericBatch, data []byte, metadata []byte)
// CreateScan scans the result of an executed CreateBatch query.
CreateScan(results pgx.BatchResults) (CreateRow, error)
ListAll(ctx context.Context) ([]ListAllRow, error)
// ListAllBatch enqueues a ListAll query into batch to be executed
// later by the batch.
ListAllBatch(batch genericBatch)
// ListAllScan scans the result of an executed ListAllBatch query.
ListAllScan(results pgx.BatchResults) ([]ListAllRow, 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.