order

package
v0.0.0-...-1bf90d9 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MQSender

type MQSender interface {
	SendMessage(
		topicName string,
		key []byte,
		message []byte,
		headers map[string]string,
	) (partition int32, offset int64, err error)
}

type Repository

type Repository interface {
	Create(ctx context.Context, order ordermodels.NewOrder) (orderID int64, err error)
	SetStatus(ctx context.Context, orderID int64, status ordermodels.Status) error
	GetByID(ctx context.Context, orderID int64) (order ordermodels.Order, err error)
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(
	ctx context.Context,
	repo Repository,
	stockService StockService,
	txManager TxManager,
	mqSender MQSender,
	statusOutboxRepository StatusOutboxRepository,

) *Service

func (*Service) Close

func (s *Service) Close()

func (*Service) OrderCancel

func (s *Service) OrderCancel(ctx context.Context, orderID int64) (err error)

func (*Service) OrderCreate

func (s *Service) OrderCreate(ctx context.Context, create *requests.OrderCreate) (orderID int64, err error)

func (*Service) OrderInfo

func (s *Service) OrderInfo(ctx context.Context, orderID int64) (info responses.OrderInfo, err error)

func (*Service) OrderPay

func (s *Service) OrderPay(ctx context.Context, orderID int64) (err error)

func (*Service) StartStatusChangedEventDispatcher

func (s *Service) StartStatusChangedEventDispatcher(ctx context.Context)

type StatusOutboxRepository

type StatusOutboxRepository interface {
	CreateOrderStatusChangedEvent(ctx context.Context, orderID int64, status ordermodels.Status) error
	FetchNextOrderStatusChangedEvent(ctx context.Context) (ordermodels.StatusChangedEvent, error)
	MarkOrderStatusChangedEventAsSend(ctx context.Context, eventID int64) error
}

type StockService

type StockService interface {
	Reserve(ctx context.Context, item []ordermodels.Item) error
	ReserveRemove(ctx context.Context, item []stockmodels.ReserveItem) error
	ReserveCancel(ctx context.Context, item []stockmodels.ReserveItem) error
}

type TxManager

type TxManager interface {
	ReadCommitted(ctx context.Context, f func(context.Context) error) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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