internal

package
v0.0.0-...-7d3ed53 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateSaleParams

type CreateSaleParams struct {
	Region        string         `json:"region"`
	Country       string         `json:"country"`
	ItemType      string         `json:"item_type"`
	SalesChannel  ESalesChannel  `json:"sales_channel"`
	OrderPriority EOrderPriority `json:"order_priority"`
	OrderDate     time.Time      `json:"order_date"`
	OrderID       int64          `json:"order_id"`
	ShipDate      time.Time      `json:"ship_date"`
	UnitsSold     int32          `json:"units_sold"`
	UnitPrice     float32        `json:"unit_price"`
	UnitCost      float32        `json:"unit_cost"`
	TotalRevenue  pgtype.Numeric `json:"total_revenue"`
	TotalCost     pgtype.Numeric `json:"total_cost"`
	TotalProfit   pgtype.Numeric `json:"total_profit"`
}

type DBTX

type DBTX interface {
	Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error)
	Query(context.Context, string, ...interface{}) (pgx.Rows, error)
	QueryRow(context.Context, string, ...interface{}) pgx.Row
}

type EOrderPriority

type EOrderPriority string
const (
	EOrderPriorityC EOrderPriority = "C"
	EOrderPriorityH EOrderPriority = "H"
	EOrderPriorityM EOrderPriority = "M"
	EOrderPriorityL EOrderPriority = "L"
)

func (*EOrderPriority) Scan

func (e *EOrderPriority) Scan(src interface{}) error

type ESalesChannel

type ESalesChannel string
const (
	ESalesChannelOffline ESalesChannel = "Offline"
	ESalesChannelOnline  ESalesChannel = "Online"
)

func (*ESalesChannel) Scan

func (e *ESalesChannel) Scan(src interface{}) error

type ListSalesParams

type ListSalesParams struct {
	Limit  int32 `json:"limit"`
	Offset int32 `json:"offset"`
}

type NullEOrderPriority

type NullEOrderPriority struct {
	EOrderPriority EOrderPriority `json:"e_order_priority"`
	Valid          bool           `json:"valid"` // Valid is true if EOrderPriority is not NULL
}

func (*NullEOrderPriority) Scan

func (ns *NullEOrderPriority) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullEOrderPriority) Value

func (ns NullEOrderPriority) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type NullESalesChannel

type NullESalesChannel struct {
	ESalesChannel ESalesChannel `json:"e_sales_channel"`
	Valid         bool          `json:"valid"` // Valid is true if ESalesChannel is not NULL
}

func (*NullESalesChannel) Scan

func (ns *NullESalesChannel) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullESalesChannel) Value

func (ns NullESalesChannel) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type Querier

type Querier interface {
	CreateSale(ctx context.Context, arg CreateSaleParams) (Sale, error)
	GetSale(ctx context.Context, id int64) (Sale, error)
	GetSaleForUpdate(ctx context.Context, id int64) (Sale, error)
	ListSales(ctx context.Context, arg ListSalesParams) ([]Sale, error)
}

type Queries

type Queries struct {
	// contains filtered or unexported fields
}

func New

func New(db DBTX) *Queries

func (*Queries) CreateSale

func (q *Queries) CreateSale(ctx context.Context, arg CreateSaleParams) (Sale, error)

func (*Queries) GetSale

func (q *Queries) GetSale(ctx context.Context, id int64) (Sale, error)

func (*Queries) GetSaleForUpdate

func (q *Queries) GetSaleForUpdate(ctx context.Context, id int64) (Sale, error)

func (*Queries) ListSales

func (q *Queries) ListSales(ctx context.Context, arg ListSalesParams) ([]Sale, error)

func (*Queries) WithTx

func (q *Queries) WithTx(tx pgx.Tx) *Queries

type Sale

type Sale struct {
	ID            int64          `json:"id"`
	Region        string         `json:"region"`
	Country       string         `json:"country"`
	ItemType      string         `json:"item_type"`
	SalesChannel  ESalesChannel  `json:"sales_channel"`
	OrderPriority EOrderPriority `json:"order_priority"`
	OrderDate     time.Time      `json:"order_date"`
	OrderID       int64          `json:"order_id"`
	ShipDate      time.Time      `json:"ship_date"`
	UnitsSold     int32          `json:"units_sold"`
	UnitPrice     float32        `json:"unit_price"`
	UnitCost      float32        `json:"unit_cost"`
	TotalRevenue  pgtype.Numeric `json:"total_revenue"`
	TotalCost     pgtype.Numeric `json:"total_cost"`
	TotalProfit   pgtype.Numeric `json:"total_profit"`
	CreatedAt     time.Time      `json:"created_at"`
}

type Store

type Store struct {
	*Queries
	// contains filtered or unexported fields
}

type TxStore

type TxStore interface {
	Querier
}

func NewStore

func NewStore(pool *pgxpool.Pool) TxStore

Jump to

Keyboard shortcuts

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