models

package
v0.0.0-...-b6fae9c Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: MulanPSL-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SecKillAction

type SecKillAction struct {
	gorm.Model
	No        string    `gorm:"type:char(36);unique;not null;comment:秒杀活动唯一编号"`
	StartTime time.Time `gorm:"type:datetime;index;not null;comment:开始时间"`
	Duration  uint64    `gorm:"type:tinyint(1);not null;default:1;comment:活动持续时间(h)"`
	State     string    `` /* 127-byte string literal not displayed */
}

秒杀活动表

func NewSecKillAction

func NewSecKillAction() *SecKillAction

func (*SecKillAction) GetSecKillActions

func (sa *SecKillAction) GetSecKillActions() (list []*SecKillAction, err error)

type SecKillGood

type SecKillGood struct {
	gorm.Model
	ActionID     uint   `gorm:"type:int(11);index:idx_action_good;not null;comment:秒杀活动ID"`
	GoodID       uint   `gorm:"type:int(11);index:idx_action_good;not null;comment:秒杀活动商品ID"`
	No           string `gorm:"type:char(36);index;not null;comment:秒杀活动编号"`
	SecKillStock uint64 `gorm:"type:int(11);not null;default:0;comment:秒杀活动商品库存"`
	SecKillPrice string `gorm:"type:decimal(10,2);not null;default:0.00;comment:秒杀价格"`
}

秒杀商品记录

func NewSecKillGood

func NewSecKillGood() *SecKillGood

func (*SecKillGood) GetSecKillGoodsByActionID

func (sg *SecKillGood) GetSecKillGoodsByActionID(actionID ...uint) (list []*SecKillGood, err error)

func (*SecKillGood) UpdateStock

func (sg *SecKillGood) UpdateStock(id uint, delta int) error

Jump to

Keyboard shortcuts

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