order

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 25, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateTenantRow

type CreateTenantRow struct {
	TenantID int     `json:"tenant_id"`
	Rname    *string `json:"rname"`
	Name     string  `json:"name"`
}

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

func (q *DBQuerier) CreateTenantBatch(batch genericBatch, key string, name string)

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

func (q *DBQuerier) FindOrdersByCustomerBatch(batch genericBatch, customerID int32)

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

func (q *DBQuerier) FindOrdersByPriceBatch(batch genericBatch, minTotal pgtype.Numeric)

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

func (q *DBQuerier) FindProductsInOrderBatch(batch genericBatch, orderID int32)

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 FindOrdersByCustomerRow struct {
	OrderID    int32              `json:"order_id"`
	OrderDate  pgtype.Timestamptz `json:"order_date"`
	OrderTotal pgtype.Numeric     `json:"order_total"`
	CustomerID *int32             `json:"customer_id"`
}

type FindOrdersByPriceRow

type FindOrdersByPriceRow struct {
	OrderID    int32              `json:"order_id"`
	OrderDate  pgtype.Timestamptz `json:"order_date"`
	OrderTotal pgtype.Numeric     `json:"order_total"`
	CustomerID *int32             `json:"customer_id"`
}

type FindOrdersMRRRow

type FindOrdersMRRRow struct {
	Month    pgtype.Timestamptz `json:"month"`
	OrderMRR pgtype.Numeric     `json:"order_mrr"`
}

type FindProductsInOrderRow

type FindProductsInOrderRow struct {
	OrderID   *int32  `json:"order_id"`
	ProductID *int32  `json:"product_id"`
	Name      *string `json:"name"`
}

type InsertCustomerParams

type InsertCustomerParams struct {
	FirstName string `json:"first_name"`
	LastName  string `json:"last_name"`
	Email     string `json:"email"`
}

type InsertCustomerRow

type InsertCustomerRow struct {
	CustomerID int32  `json:"customer_id"`
	FirstName  string `json:"first_name"`
	LastName   string `json:"last_name"`
	Email      string `json:"email"`
}

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 InsertOrderRow struct {
	OrderID    int32              `json:"order_id"`
	OrderDate  pgtype.Timestamptz `json:"order_date"`
	OrderTotal pgtype.Numeric     `json:"order_total"`
	CustomerID *int32             `json:"customer_id"`
}

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL