models

package
v0.0.0-...-debf52e Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrOrderUIDRequired = errors.New("order uid field is required")
	ErrOrderUIDNotExist = errors.New("this order uid does not exist")
)

Functions

This section is empty.

Types

type Cache

type Cache struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewCache

func NewCache(_ context.Context) *Cache

func (*Cache) AddItem

func (c *Cache) AddItem(orderUID string, item Item)

func (*Cache) AddOrder

func (c *Cache) AddOrder(order Order)

func (*Cache) DeleteNewOrderUIDs

func (c *Cache) DeleteNewOrderUIDs()

func (*Cache) GetByOrderUID

func (c *Cache) GetByOrderUID(orderUID string) Order

func (*Cache) GetItemCount

func (c *Cache) GetItemCount() int

func (*Cache) GetLastOrderUIDs

func (c *Cache) GetLastOrderUIDs() []string

func (*Cache) GetNewOrders

func (c *Cache) GetNewOrders() []Order

func (*Cache) GetOrderCount

func (c *Cache) GetOrderCount() int

func (*Cache) NewOrderCount

func (c *Cache) NewOrderCount() int

type Delivery

type Delivery struct {
	OrderUID string `json:"-" db:"order_uid"`
	Name     string `json:"name" db:"name"`
	Phone    string `json:"phone" db:"phone"`
	Zip      string `json:"zip" db:"zip"`
	City     string `json:"city" db:"city"`
	Address  string `json:"address" db:"address"`
	Region   string `json:"region" db:"region"`
	Email    string `json:"email" db:"email"`
}

func (*Delivery) Validate

func (d *Delivery) Validate() error

type Item

type Item struct {
	ChrtId      int    `json:"chrt_id" db:"chrt_id"`
	TrackNumber string `json:"track_number" db:"track_number"`
	Price       int    `json:"price" db:"price"`
	Rid         string `json:"rid" db:"rid"`
	Name        string `json:"name" db:"name"`
	Sale        int    `json:"sale" db:"sale"`
	Size        string `json:"size" db:"size"`
	TotalPrice  int    `json:"total_price" db:"total_price"`
	NmId        int    `json:"nm_id" db:"nm_id"`
	Brand       string `json:"brand" db:"brand"`
	Status      int    `json:"status" db:"status"`
}

func (*Item) Validate

func (i *Item) Validate() error

type Order

type Order struct {
	OrderUID          string    `json:"order_uid" db:"order_uid"`
	TrackNumber       string    `json:"track_number" db:"track_number"`
	Entry             string    `json:"entry" db:"entry"`
	Delivery          Delivery  `json:"delivery"`
	Payment           Payment   `json:"payment"`
	Items             []Item    `json:"items"`
	Locale            string    `json:"locale" db:"locale"`
	InternalSignature string    `json:"internal_signature" db:"internal_signature"`
	CustomerId        string    `json:"customer_id" db:"customer_id"`
	DeliveryService   string    `json:"delivery_service" db:"delivery_service"`
	Shardkey          string    `json:"shardkey" db:"shardkey"`
	SmId              int       `json:"sm_id" db:"sm_id"`
	DateCreated       time.Time `json:"date_created" db:"date_created"`
	OofShard          string    `json:"oof_shard" db:"oof_shard"`
	InDB              bool      `json:"-"`
}

func (*Order) IsEmpty

func (o *Order) IsEmpty() bool

func (*Order) Validate

func (o *Order) Validate() error

type Payment

type Payment struct {
	Transaction  string `json:"transaction" db:"transaction"`
	RequestId    string `json:"request_id" db:"request_id"`
	Currency     string `json:"currency" db:"currency"`
	Provider     string `json:"provider" db:"provider"`
	Amount       int    `json:"amount" db:"amount"`
	PaymentDt    int    `json:"payment_dt" db:"payment_dt"`
	Bank         string `json:"bank" db:"bank"`
	DeliveryCost int    `json:"delivery_cost" db:"delivery_cost"`
	GoodsTotal   int    `json:"goods_total" db:"goods_total"`
	CustomFee    int    `json:"custom_fee" db:"custom_fee"`
}

func (*Payment) Validate

func (p *Payment) Validate() error

type Stats

type Stats struct {
	OrderCount    int      `json:"order_count"`
	ItemCount     int      `json:"item_count"`
	LastOrderUIDs []string `json:"last_order_uids"`
}

Jump to

Keyboard shortcuts

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