service

package
v0.0.0-...-cd595cc Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CanTransferFunc

type CanTransferFunc func(originalInfo *ProductStateInfo) error

type ConstructTargetInfoFunc

type ConstructTargetInfoFunc func(originalInfo *ProductStateInfo) *ProductStateInfo

type ProductQueryService

type ProductQueryService struct{}

ProductQueryService product query service

func GetProductQueryServiceInstance

func GetProductQueryServiceInstance() *ProductQueryService

GetProductQueryServiceInstance single instance

func (*ProductQueryService) GetProduct

func (s *ProductQueryService) GetProduct(ctx context.Context, productId int64) (*entity.ProductEntity, error)

func (*ProductQueryService) ListProducts

func (s *ProductQueryService) ListProducts(ctx context.Context, name, spuName *string, status *int64) ([]*entity.ProductEntity, error)

func (*ProductQueryService) MGet2C

func (s *ProductQueryService) MGet2C(ctx context.Context, productIds []int64) ([]*entity.ProductEntity, error)

func (*ProductQueryService) Search

func (s *ProductQueryService) Search(ctx context.Context, name, description, spuName *string) ([]*entity.ProductEntity, error)

type ProductStateInfo

type ProductStateInfo struct {
	Status constant.ProductStatus
}

type ProductStateService

type ProductStateService struct{}

ProductStateService product state machine service

func GetProductStateService

func GetProductStateService() *ProductStateService

func (*ProductStateService) ConstructTargetInfo

func (s *ProductStateService) ConstructTargetInfo(originProduct *entity.ProductEntity,
	operation constant.StateOperationType,
) (*entity.ProductEntity, error)

ConstructTargetInfo change product status

func (*ProductStateService) GetCanTransferFunc

func (s *ProductStateService) GetCanTransferFunc(operationType constant.StateOperationType) (CanTransferFunc, error)

GetCanTransferFunc get the validating func

func (*ProductStateService) OperateProduct

func (s *ProductStateService) OperateProduct(ctx context.Context, origin, target *entity.ProductEntity) error

OperateProduct update product

type ProductStockService

type ProductStockService struct{}

func GetProductStockServiceInstance

func GetProductStockServiceInstance() *ProductStockService

func (*ProductStockService) DecreaseStockNum

func (s *ProductStockService) DecreaseStockNum(ctx context.Context, productId, decrNum int64) error

func (*ProductStockService) IncreaseStockNum

func (s *ProductStockService) IncreaseStockNum(ctx context.Context, productId, incrNum int64) error

type ProductUpdateService

type ProductUpdateService struct{}

ProductUpdateService product update service

func GetProductUpdateServiceInstance

func GetProductUpdateServiceInstance() *ProductUpdateService

func (*ProductUpdateService) AddProduct

func (s *ProductUpdateService) AddProduct(ctx context.Context, entity *entity.ProductEntity) error

func (*ProductUpdateService) EditProduct

func (s *ProductUpdateService) EditProduct(ctx context.Context, origin, target *entity.ProductEntity) error

Jump to

Keyboard shortcuts

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