Documentation
¶
Index ¶
- type CreateTenantRow
- type DBQuerier
- func (q *DBQuerier) CreateTenant(ctx context.Context, key string, name string) (CreateTenantRow, error)
- func (q *DBQuerier) CreateTenantBatch(batch genericBatch, key string, name string)
- func (q *DBQuerier) CreateTenantScan(results pgx.BatchResults) (CreateTenantRow, error)
- func (q *DBQuerier) FindOrdersByCustomer(ctx context.Context, customerID int32) ([]FindOrdersByCustomerRow, error)
- func (q *DBQuerier) FindOrdersByCustomerBatch(batch genericBatch, customerID int32)
- func (q *DBQuerier) FindOrdersByCustomerScan(results pgx.BatchResults) ([]FindOrdersByCustomerRow, error)
- func (q *DBQuerier) FindOrdersByPrice(ctx context.Context, minTotal pgtype.Numeric) ([]FindOrdersByPriceRow, error)
- func (q *DBQuerier) FindOrdersByPriceBatch(batch genericBatch, minTotal pgtype.Numeric)
- func (q *DBQuerier) FindOrdersByPriceScan(results pgx.BatchResults) ([]FindOrdersByPriceRow, error)
- func (q *DBQuerier) FindOrdersMRR(ctx context.Context) ([]FindOrdersMRRRow, error)
- func (q *DBQuerier) FindOrdersMRRBatch(batch genericBatch)
- func (q *DBQuerier) FindOrdersMRRScan(results pgx.BatchResults) ([]FindOrdersMRRRow, error)
- func (q *DBQuerier) FindProductsInOrder(ctx context.Context, orderID int32) ([]FindProductsInOrderRow, error)
- func (q *DBQuerier) FindProductsInOrderBatch(batch genericBatch, orderID int32)
- func (q *DBQuerier) FindProductsInOrderScan(results pgx.BatchResults) ([]FindProductsInOrderRow, error)
- func (q *DBQuerier) InsertCustomer(ctx context.Context, params InsertCustomerParams) (InsertCustomerRow, error)
- func (q *DBQuerier) InsertCustomerBatch(batch genericBatch, params InsertCustomerParams)
- func (q *DBQuerier) InsertCustomerScan(results pgx.BatchResults) (InsertCustomerRow, error)
- func (q *DBQuerier) InsertOrder(ctx context.Context, params InsertOrderParams) (InsertOrderRow, error)
- func (q *DBQuerier) InsertOrderBatch(batch genericBatch, params InsertOrderParams)
- func (q *DBQuerier) InsertOrderScan(results pgx.BatchResults) (InsertOrderRow, error)
- type FindOrdersByCustomerRow
- type FindOrdersByPriceRow
- type FindOrdersMRRRow
- type FindProductsInOrderRow
- type InsertCustomerParams
- type InsertCustomerRow
- type InsertOrderParams
- type InsertOrderRow
- type Querier
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateTenantRow ¶
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) CreateTenant ¶
func (q *DBQuerier) CreateTenant(ctx context.Context, key string, name string) (CreateTenantRow, error)
CreateTenant implements Querier.CreateTenant.
func (*DBQuerier) CreateTenantBatch ¶
CreateTenantBatch implements Querier.CreateTenantBatch.
func (*DBQuerier) CreateTenantScan ¶
func (q *DBQuerier) CreateTenantScan(results pgx.BatchResults) (CreateTenantRow, error)
CreateTenantScan implements Querier.CreateTenantScan.
func (*DBQuerier) FindOrdersByCustomer ¶
func (q *DBQuerier) FindOrdersByCustomer(ctx context.Context, customerID int32) ([]FindOrdersByCustomerRow, error)
FindOrdersByCustomer implements Querier.FindOrdersByCustomer.
func (*DBQuerier) FindOrdersByCustomerBatch ¶
FindOrdersByCustomerBatch implements Querier.FindOrdersByCustomerBatch.
func (*DBQuerier) FindOrdersByCustomerScan ¶
func (q *DBQuerier) FindOrdersByCustomerScan(results pgx.BatchResults) ([]FindOrdersByCustomerRow, error)
FindOrdersByCustomerScan implements Querier.FindOrdersByCustomerScan.
func (*DBQuerier) FindOrdersByPrice ¶
func (q *DBQuerier) FindOrdersByPrice(ctx context.Context, minTotal pgtype.Numeric) ([]FindOrdersByPriceRow, error)
FindOrdersByPrice implements Querier.FindOrdersByPrice.
func (*DBQuerier) FindOrdersByPriceBatch ¶
FindOrdersByPriceBatch implements Querier.FindOrdersByPriceBatch.
func (*DBQuerier) FindOrdersByPriceScan ¶
func (q *DBQuerier) FindOrdersByPriceScan(results pgx.BatchResults) ([]FindOrdersByPriceRow, error)
FindOrdersByPriceScan implements Querier.FindOrdersByPriceScan.
func (*DBQuerier) FindOrdersMRR ¶
func (q *DBQuerier) FindOrdersMRR(ctx context.Context) ([]FindOrdersMRRRow, error)
FindOrdersMRR implements Querier.FindOrdersMRR.
func (*DBQuerier) FindOrdersMRRBatch ¶
func (q *DBQuerier) FindOrdersMRRBatch(batch genericBatch)
FindOrdersMRRBatch implements Querier.FindOrdersMRRBatch.
func (*DBQuerier) FindOrdersMRRScan ¶
func (q *DBQuerier) FindOrdersMRRScan(results pgx.BatchResults) ([]FindOrdersMRRRow, error)
FindOrdersMRRScan implements Querier.FindOrdersMRRScan.
func (*DBQuerier) FindProductsInOrder ¶
func (q *DBQuerier) FindProductsInOrder(ctx context.Context, orderID int32) ([]FindProductsInOrderRow, error)
FindProductsInOrder implements Querier.FindProductsInOrder.
func (*DBQuerier) FindProductsInOrderBatch ¶
FindProductsInOrderBatch implements Querier.FindProductsInOrderBatch.
func (*DBQuerier) FindProductsInOrderScan ¶
func (q *DBQuerier) FindProductsInOrderScan(results pgx.BatchResults) ([]FindProductsInOrderRow, error)
FindProductsInOrderScan implements Querier.FindProductsInOrderScan.
func (*DBQuerier) InsertCustomer ¶
func (q *DBQuerier) InsertCustomer(ctx context.Context, params InsertCustomerParams) (InsertCustomerRow, error)
InsertCustomer implements Querier.InsertCustomer.
func (*DBQuerier) InsertCustomerBatch ¶
func (q *DBQuerier) InsertCustomerBatch(batch genericBatch, params InsertCustomerParams)
InsertCustomerBatch implements Querier.InsertCustomerBatch.
func (*DBQuerier) InsertCustomerScan ¶
func (q *DBQuerier) InsertCustomerScan(results pgx.BatchResults) (InsertCustomerRow, error)
InsertCustomerScan implements Querier.InsertCustomerScan.
func (*DBQuerier) InsertOrder ¶
func (q *DBQuerier) InsertOrder(ctx context.Context, params InsertOrderParams) (InsertOrderRow, error)
InsertOrder implements Querier.InsertOrder.
func (*DBQuerier) InsertOrderBatch ¶
func (q *DBQuerier) InsertOrderBatch(batch genericBatch, params InsertOrderParams)
InsertOrderBatch implements Querier.InsertOrderBatch.
func (*DBQuerier) InsertOrderScan ¶
func (q *DBQuerier) InsertOrderScan(results pgx.BatchResults) (InsertOrderRow, error)
InsertOrderScan implements Querier.InsertOrderScan.
type FindOrdersByCustomerRow ¶
type FindOrdersByPriceRow ¶
type FindOrdersMRRRow ¶
type FindOrdersMRRRow struct {
Month pgtype.Timestamptz `json:"month"`
OrderMRR pgtype.Numeric `json:"order_mrr"`
}
type FindProductsInOrderRow ¶
type InsertCustomerParams ¶
type InsertCustomerRow ¶
type InsertOrderParams ¶
type InsertOrderParams struct {
OrderDate pgtype.Timestamptz `json:"order_date"`
OrderTotal pgtype.Numeric `json:"order_total"`
CustID int32 `json:"cust_id"`
}
type InsertOrderRow ¶
type Querier ¶
type Querier interface {
CreateTenant(ctx context.Context, key string, name string) (CreateTenantRow, error)
// CreateTenantBatch enqueues a CreateTenant query into batch to be executed
// later by the batch.
CreateTenantBatch(batch genericBatch, key string, name string)
// CreateTenantScan scans the result of an executed CreateTenantBatch query.
CreateTenantScan(results pgx.BatchResults) (CreateTenantRow, error)
FindOrdersByCustomer(ctx context.Context, customerID int32) ([]FindOrdersByCustomerRow, error)
// FindOrdersByCustomerBatch enqueues a FindOrdersByCustomer query into batch to be executed
// later by the batch.
FindOrdersByCustomerBatch(batch genericBatch, customerID int32)
// FindOrdersByCustomerScan scans the result of an executed FindOrdersByCustomerBatch query.
FindOrdersByCustomerScan(results pgx.BatchResults) ([]FindOrdersByCustomerRow, error)
FindProductsInOrder(ctx context.Context, orderID int32) ([]FindProductsInOrderRow, error)
// FindProductsInOrderBatch enqueues a FindProductsInOrder query into batch to be executed
// later by the batch.
FindProductsInOrderBatch(batch genericBatch, orderID int32)
// FindProductsInOrderScan scans the result of an executed FindProductsInOrderBatch query.
FindProductsInOrderScan(results pgx.BatchResults) ([]FindProductsInOrderRow, error)
InsertCustomer(ctx context.Context, params InsertCustomerParams) (InsertCustomerRow, error)
// InsertCustomerBatch enqueues a InsertCustomer query into batch to be executed
// later by the batch.
InsertCustomerBatch(batch genericBatch, params InsertCustomerParams)
// InsertCustomerScan scans the result of an executed InsertCustomerBatch query.
InsertCustomerScan(results pgx.BatchResults) (InsertCustomerRow, error)
InsertOrder(ctx context.Context, params InsertOrderParams) (InsertOrderRow, error)
// InsertOrderBatch enqueues a InsertOrder query into batch to be executed
// later by the batch.
InsertOrderBatch(batch genericBatch, params InsertOrderParams)
// InsertOrderScan scans the result of an executed InsertOrderBatch query.
InsertOrderScan(results pgx.BatchResults) (InsertOrderRow, error)
FindOrdersByPrice(ctx context.Context, minTotal pgtype.Numeric) ([]FindOrdersByPriceRow, error)
// FindOrdersByPriceBatch enqueues a FindOrdersByPrice query into batch to be executed
// later by the batch.
FindOrdersByPriceBatch(batch genericBatch, minTotal pgtype.Numeric)
// FindOrdersByPriceScan scans the result of an executed FindOrdersByPriceBatch query.
FindOrdersByPriceScan(results pgx.BatchResults) ([]FindOrdersByPriceRow, error)
FindOrdersMRR(ctx context.Context) ([]FindOrdersMRRRow, error)
// FindOrdersMRRBatch enqueues a FindOrdersMRR query into batch to be executed
// later by the batch.
FindOrdersMRRBatch(batch genericBatch)
// FindOrdersMRRScan scans the result of an executed FindOrdersMRRBatch query.
FindOrdersMRRScan(results pgx.BatchResults) ([]FindOrdersMRRRow, 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.