domain

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Coupon

type Coupon struct {
	ddd.BaseEntity

	CouponID string // 券ID
	Rule     string // 规则描述
	Discount int64  // 折扣数
	// contains filtered or unexported fields
}

func (*Coupon) AfterCreate

func (c *Coupon) AfterCreate(ctx context.Context) error

type Order

type Order struct {
	ddd.BaseEntity

	ID          string
	UserID      string
	TotalAmount int64
	Remark      string
	Items       []*SaleItem
	Coupons     []*Coupon
}

func NewOrder

func NewOrder(userID string, items []*sale.SaleItem, coupons []*sale.Coupon) (*Order, error)

func (*Order) AddCoupon

func (o *Order) AddCoupon(couponID, rule string, discount int64) error

func (*Order) AddSaleItem

func (o *Order) AddSaleItem(code, name string, price int64, count int32)

func (*Order) AfterCreate

func (o *Order) AfterCreate(ctx context.Context) error

func (*Order) AfterDelete

func (o *Order) AfterDelete(ctx context.Context) error

func (*Order) DeleteCoupon

func (o *Order) DeleteCoupon(id string) error

func (*Order) DeleteSaleItem

func (o *Order) DeleteSaleItem(id string)

func (*Order) GetID

func (o *Order) GetID() string

func (*Order) SetID

func (o *Order) SetID(id string)

func (*Order) Update

func (o *Order) Update(opt UpdateOrderOpt)

type RuleEngine

type RuleEngine interface {
	Validate(order *Order, rule string) error
}

type SaleItem

type SaleItem struct {
	ddd.BaseEntity

	Code  string // 编码
	Name  string // 商品名
	Price int64  // 价格
	Count int32  // 数量
	// contains filtered or unexported fields
}

func (*SaleItem) AfterCreate

func (s *SaleItem) AfterCreate(ctx context.Context) error

type UpdateOrderOpt

type UpdateOrderOpt struct {
	Remark *string
}

Jump to

Keyboard shortcuts

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