pkg

package
v0.0.0-...-e809d31 Latest Latest
Warning

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

Go to latest
Published: May 17, 2023 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrGetUserInfoFailed = errors.New("get user info failed")
View Source
var ErrNoSuchProduct = errors.New("no such product")

Functions

This section is empty.

Types

type Consumer

type Consumer struct {
	Consumer *nsq.Consumer
}

func NewConsumer

func NewConsumer() (consumer *Consumer, err error)

func (*Consumer) Consume

func (c *Consumer) Consume(dao *dao.Order) error

type ConsumerMsg

type ConsumerMsg struct {
	OrderID int64 `json:"order_id"`
	Status  int8  `json:"status"`
}

type Producer

type Producer struct {
	Producer *nsq.Producer
}

func NewPublisher

func NewPublisher() (pro *Producer, err error)

func (*Producer) Produce

func (p *Producer) Produce(msg ProducerMsg) error

type ProducerMsg

type ProducerMsg struct {
	OrderID int64 `json:"order_id"`
	Amount  int64 `json:"amount"`
}

type ProductManage

type ProductManage struct {
	ProductService productservice.Client
}

func (*ProductManage) GetProductInfo

func (p *ProductManage) GetProductInfo(ctx context.Context, pid int64) (*common.Product, error)

func (*ProductManage) UpdateStock

func (p *ProductManage) UpdateStock(ctx context.Context, pid, stock int64) error

type UserManager

type UserManager struct {
	UserService userservice.Client
}

func (UserManager) GetUserInfo

func (u UserManager) GetUserInfo(ctx context.Context, uid int64) error

Jump to

Keyboard shortcuts

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