stock

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

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

Go to latest
Published: Feb 23, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New("not found")
)

Functions

This section is empty.

Types

type Stock

type Stock interface {
	// 设置库存,并设置过期时间
	Set(val int64, expire int64) error
	// 直接返回剩余库存
	Get() (int64, error)
	// 尝试扣减一个库存,并返回剩余库存
	Sub(uid string) (int64, error)
	// 删除库存数据
	Del() error
	// 返回活动 ID
	EventID() string
	// 返回商品 ID
	GoodsID() string
}

func NewMemStock

func NewMemStock(eventID string, goodsID string) (Stock, error)

func NewRedisStock

func NewRedisStock(eventID string, goodsID string) (Stock, error)

Jump to

Keyboard shortcuts

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