models

package
v0.0.0-...-10ef84c Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OrderProjectionToProto

func OrderProjectionToProto(order *OrderProjection) *orderService.Order

func OrderProjectionsToProto

func OrderProjectionsToProto(orderProjections []*OrderProjection) []*orderService.Order

func OrderToProto

func OrderToProto(order *Order, id string) *orderService.Order

func PaymentToProto

func PaymentToProto(payment Payment) *orderService.Payment

func ShopItemToProto

func ShopItemToProto(shopItem *ShopItem) *orderService.ShopItem

func ShopItemsToProto

func ShopItemsToProto(shopItems []*ShopItem) []*orderService.ShopItem

Types

type Order

type Order struct {
	ID              string      `json:"id" bson:"_id,omitempty"`
	ShopItems       []*ShopItem `json:"shopItems" bson:"shopItems,omitempty"`
	AccountEmail    string      `json:"accountEmail" bson:"accountEmail,omitempty"`
	DeliveryAddress string      `json:"deliveryAddress" bson:"deliveryAddress,omitempty"`
	CancelReason    string      `json:"cancelReason" bson:"cancelReason,omitempty"`
	TotalPrice      float64     `json:"totalPrice" bson:"totalPrice,omitempty"`
	DeliveredTime   time.Time   `json:"deliveredTime" bson:"deliveredTime,omitempty"`
	Paid            bool        `json:"paid" bson:"paid,omitempty"`
	Submitted       bool        `json:"submitted" bson:"submitted,omitempty"`
	Completed       bool        `json:"completed" bson:"completed,omitempty"`
	Canceled        bool        `json:"canceled" bson:"canceled,omitempty"`
	Payment         Payment     `json:"payment" bson:"payment,omitempty"`
}

func NewOrder

func NewOrder() *Order

func (*Order) String

func (o *Order) String() string

type OrderProjection

type OrderProjection struct {
	ID              string      `json:"id" bson:"_id,omitempty"`
	OrderID         string      `json:"orderId,omitempty" bson:"orderId,omitempty"`
	ShopItems       []*ShopItem `json:"shopItems,omitempty" bson:"shopItems,omitempty"`
	AccountEmail    string      `json:"accountEmail,omitempty" bson:"accountEmail,omitempty" validate:"required,email"`
	DeliveryAddress string      `json:"deliveryAddress,omitempty" bson:"deliveryAddress,omitempty"`
	CancelReason    string      `json:"cancelReason,omitempty" bson:"cancelReason,omitempty"`
	TotalPrice      float64     `json:"totalPrice,omitempty" bson:"totalPrice,omitempty"`
	DeliveredTime   time.Time   `json:"deliveredTime,omitempty" bson:"deliveredTime,omitempty"`
	Paid            bool        `json:"paid,omitempty" bson:"paid,omitempty"`
	Submitted       bool        `json:"submitted,omitempty" bson:"submitted,omitempty"`
	Completed       bool        `json:"completed,omitempty" bson:"completed,omitempty"`
	Canceled        bool        `json:"canceled,omitempty" bson:"canceled,omitempty"`
	Payment         Payment     `json:"payment,omitempty" bson:"payment,omitempty"`
}

func (*OrderProjection) String

func (o *OrderProjection) String() string

type Payment

type Payment struct {
	PaymentID string    `json:"paymentID" bson:"paymentID,omitempty" validate:"required"`
	Timestamp time.Time `json:"timestamp" bson:"timestamp,omitempty" validate:"required"`
}

func PaymentFromProto

func PaymentFromProto(payment *orderService.Payment) Payment

func (*Payment) String

func (p *Payment) String() string

type ShopItem

type ShopItem struct {
	ID          string  `json:"id" bson:"id,omitempty"`
	Title       string  `json:"title" bson:"title,omitempty"`
	Description string  `json:"description" bson:"description,omitempty"`
	Quantity    uint64  `json:"quantity" bson:"quantity,omitempty"`
	Price       float64 `json:"price" bson:"price,omitempty"`
}

func ShopItemFromProto

func ShopItemFromProto(shopItem *orderService.ShopItem) *ShopItem

func ShopItemsFromProto

func ShopItemsFromProto(shopItems []*orderService.ShopItem) []*ShopItem

func (*ShopItem) String

func (s *ShopItem) String() string

func (*ShopItem) ToProto

func (s *ShopItem) ToProto() *orderService.ShopItem

Jump to

Keyboard shortcuts

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