order

package
v0.0.0-...-3bb7120 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2024 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 Address

type Address struct {
	ID            int64
	UserID        int64
	DefaultFor    NullAddressDefaultType
	Name          string
	AddressLine1  string
	AddressLine2  *string
	City          string
	StateProvince *string
	PostalCode    *string
	Country       *string
	Phone         *string
	CreatedAt     pgtype.Timestamptz
	UpdatedAt     pgtype.Timestamptz
}

type AddressDefaultType

type AddressDefaultType string
const (
	AddressDefaultTypeShipping AddressDefaultType = "Shipping"
	AddressDefaultTypeBilling  AddressDefaultType = "Billing"
)

func (*AddressDefaultType) Scan

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

type CreateOrderItemsParams

type CreateOrderItemsParams struct {
	OrderID           int64
	VariantID         int64
	Qty               int32
	Price             decimal.Decimal
	Thumbnail         string
	ProductName       string
	VariantAttributes []byte
}

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
	CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, rowSrc pgx.CopyFromSource) (int64, error)
}

type ListActiveWithPaymentAndAddressByUserIDRow

type ListActiveWithPaymentAndAddressByUserIDRow struct {
	Order             Order
	Address           Address
	StripeCardPayment StripeCardPayment
}

type ListUnpaidWithPaymentAndAddressByUserIDRow

type ListUnpaidWithPaymentAndAddressByUserIDRow struct {
	Order             Order
	Address           Address
	StripeCardPayment StripeCardPayment
}

type ListWithPaymentAndAddressByUserIDRow

type ListWithPaymentAndAddressByUserIDRow struct {
	Order             Order
	Address           Address
	StripeCardPayment StripeCardPayment
}

type NullAddressDefaultType

type NullAddressDefaultType struct {
	AddressDefaultType AddressDefaultType
	Valid              bool // Valid is true if AddressDefaultType is not NULL
}

func (*NullAddressDefaultType) Scan

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

Scan implements the Scanner interface.

func (NullAddressDefaultType) Value

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

Value implements the driver Valuer interface.

type NullOrderStatus

type NullOrderStatus struct {
	OrderStatus OrderStatus
	Valid       bool // Valid is true if OrderStatus is not NULL
}

func (*NullOrderStatus) Scan

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

Scan implements the Scanner interface.

func (NullOrderStatus) Value

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

Value implements the driver Valuer interface.

type NullPaymentMethod

type NullPaymentMethod struct {
	PaymentMethod PaymentMethod
	Valid         bool // Valid is true if PaymentMethod is not NULL
}

func (*NullPaymentMethod) Scan

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

Scan implements the Scanner interface.

func (NullPaymentMethod) Value

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

Value implements the driver Valuer interface.

type NullPaymentStatus

type NullPaymentStatus struct {
	PaymentStatus PaymentStatus
	Valid         bool // Valid is true if PaymentStatus is not NULL
}

func (*NullPaymentStatus) Scan

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

Scan implements the Scanner interface.

func (NullPaymentStatus) Value

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

Value implements the driver Valuer interface.

type Order

type Order struct {
	ID                int64
	UserID            int64
	CartID            int64
	PaymentMethod     PaymentMethod
	PaymentStatus     PaymentStatus
	Status            OrderStatus
	ShippingAddressID int64
	IsPickup          bool
	Amount            decimal.Decimal
	Currency          string
	CreatedAt         pgtype.Timestamptz
	UpdatedAt         pgtype.Timestamptz
}

type OrderItem

type OrderItem struct {
	ID                int64
	OrderID           int64
	VariantID         int64
	Qty               int32
	Price             decimal.Decimal
	Thumbnail         string
	ProductName       string
	VariantAttributes []byte
	CreatedAt         pgtype.Timestamptz
	UpdatedAt         pgtype.Timestamptz
}

type OrderStatus

type OrderStatus string
const (
	OrderStatusPending    OrderStatus = "Pending"
	OrderStatusProcessing OrderStatus = "Processing"
	OrderStatusShipped    OrderStatus = "Shipped"
	OrderStatusDelivered  OrderStatus = "Delivered"
	OrderStatusCancelled  OrderStatus = "Cancelled"
	OrderStatusFulfilled  OrderStatus = "Fulfilled"
)

func (*OrderStatus) Scan

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

type PaymentMethod

type PaymentMethod string
const (
	PaymentMethodStripeCard      PaymentMethod = "StripeCard"
	PaymentMethodPaypal          PaymentMethod = "Paypal"
	PaymentMethodAnorInstallment PaymentMethod = "AnorInstallment"
	PaymentMethodPayOnDelivery   PaymentMethod = "PayOnDelivery"
)

func (*PaymentMethod) Scan

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

type PaymentStatus

type PaymentStatus string
const (
	PaymentStatusPending PaymentStatus = "Pending"
	PaymentStatusPaid    PaymentStatus = "Paid"
)

func (*PaymentStatus) Scan

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

type Querier

type Querier interface {
	Create(ctx context.Context, userID int64, cartID int64, paymentMethod PaymentMethod, paymentStatus PaymentStatus, status OrderStatus, shippingAddressID int64, isPickup bool, amount decimal.Decimal, currency string) (*Order, error)
	CreateOrderItems(ctx context.Context, arg []CreateOrderItemsParams) (int64, error)
	Get(ctx context.Context, id int64) (*Order, error)
	GetItemByOrderIds(ctx context.Context, orderids []int64) ([]*OrderItem, error)
	GetOrders(ctx context.Context, cartID int64) ([]*Order, error)
	ListActiveByUserID(ctx context.Context, userID int64, limit int32, offset int32) ([]*Order, error)
	ListActiveWithPaymentAndAddressByUserID(ctx context.Context, userID int64, limit int32, offset int32) ([]*ListActiveWithPaymentAndAddressByUserIDRow, error)
	ListByUserID(ctx context.Context, userID int64, limit int32, offset int32) ([]*Order, error)
	ListUnpaidPaymentByUserID(ctx context.Context, userID int64, limit int32, offset int32) ([]*Order, error)
	ListUnpaidWithPaymentAndAddressByUserID(ctx context.Context, userID int64, limit int32, offset int32) ([]*ListUnpaidWithPaymentAndAddressByUserIDRow, error)
	ListWithPaymentAndAddressByUserID(ctx context.Context, userID int64, limit int32, offset int32) ([]*ListWithPaymentAndAddressByUserIDRow, error)
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) Create

func (q *Queries) Create(ctx context.Context, userID int64, cartID int64, paymentMethod PaymentMethod, paymentStatus PaymentStatus, status OrderStatus, shippingAddressID int64, isPickup bool, amount decimal.Decimal, currency string) (*Order, error)

func (*Queries) CreateOrderItems

func (q *Queries) CreateOrderItems(ctx context.Context, arg []CreateOrderItemsParams) (int64, error)

func (*Queries) Get

func (q *Queries) Get(ctx context.Context, id int64) (*Order, error)

func (*Queries) GetItemByOrderIds

func (q *Queries) GetItemByOrderIds(ctx context.Context, orderids []int64) ([]*OrderItem, error)

func (*Queries) GetOrders

func (q *Queries) GetOrders(ctx context.Context, cartID int64) ([]*Order, error)

func (*Queries) ListActiveByUserID

func (q *Queries) ListActiveByUserID(ctx context.Context, userID int64, limit int32, offset int32) ([]*Order, error)

func (*Queries) ListActiveWithPaymentAndAddressByUserID

func (q *Queries) ListActiveWithPaymentAndAddressByUserID(ctx context.Context, userID int64, limit int32, offset int32) ([]*ListActiveWithPaymentAndAddressByUserIDRow, error)

func (*Queries) ListByUserID

func (q *Queries) ListByUserID(ctx context.Context, userID int64, limit int32, offset int32) ([]*Order, error)

func (*Queries) ListUnpaidPaymentByUserID

func (q *Queries) ListUnpaidPaymentByUserID(ctx context.Context, userID int64, limit int32, offset int32) ([]*Order, error)

func (*Queries) ListUnpaidWithPaymentAndAddressByUserID

func (q *Queries) ListUnpaidWithPaymentAndAddressByUserID(ctx context.Context, userID int64, limit int32, offset int32) ([]*ListUnpaidWithPaymentAndAddressByUserIDRow, error)

func (*Queries) ListWithPaymentAndAddressByUserID

func (q *Queries) ListWithPaymentAndAddressByUserID(ctx context.Context, userID int64, limit int32, offset int32) ([]*ListWithPaymentAndAddressByUserIDRow, error)

func (*Queries) WithTx

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

type Repository

type Repository interface {
	Querier
}

func NewRepository

func NewRepository(db *pgxpool.Pool) Repository

type StripeCardPayment

type StripeCardPayment struct {
	ID               int64
	OrderID          int64
	UserID           *int64
	BillingAddressID int64
	PaymentIntentID  string
	PaymentMethodID  *string
	Amount           decimal.Decimal
	Currency         string
	Status           string
	ClientSecret     *string
	LastError        *string
	CardLast4        string
	CardBrand        string
	CreatedAt        pgtype.Timestamptz
	UpdatedAt        pgtype.Timestamptz
}

Jump to

Keyboard shortcuts

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