service

package
v0.0.0-...-aec1c34 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBasicInventoryService

func NewBasicInventoryService() *basicInventoryService

NewBasicInventoryService returns a naive, stateless implementation of IInventoryService

Types

type IInventoryService

type IInventoryService interface {
	// Handlers of the events
	HandleAccountCreatedEvent(ctx context.Context, aid uint, role string) error
	HandlePolicyUpdatedEvent(ctx context.Context, method, sub, rtype, rid, act string) error
	HandleOrderCreatedEvent(ctx context.Context, oid, pid uuid.UUID, status string, qty int, aid uint) error
	HandleOrderApprovedEvent(ctx context.Context, oid uuid.UUID) error
	HandleOrderCanceledEvent(ctx context.Context, oid uuid.UUID) error

	CreateMerchant(ctx context.Context, aid uint, name string) dto.CreateMerchantResponse
	ListMerchant(ctx context.Context, mids []uuid.UUID) dto.ListMerchantResponse

	CreateProduct(ctx context.Context, aid uint, mid uuid.UUID, name, desc string, qty int, price float32) dto.CreateProductResponse
	ListProduct(ctx context.Context, pids []uuid.UUID, qp *dto.BasicQueryParam) dto.ListProductResponse
}

func New

func New(logger *cl.CustomLogger, mws []Middleware, svcconfs ...SvcConf) IInventoryService

New returns a InventoryService implementation with all of the expected config/middleware wired in.

type Middleware

type Middleware func(IInventoryService) IInventoryService

Middleware represents service middleware type

func NewAuthzMW

func NewAuthzMW(pe svcpe.PolicyEnforcer) Middleware

type SvcConf

type SvcConf func(*basicInventoryService) error

func WithNATSEncodedConn

func WithNATSEncodedConn(nc *nats.EncodedConn) SvcConf

func WithPolicyStorage

func WithPolicyStorage(ps svcpe.PolicyStorage) SvcConf

func WithRepo

func WithRepo(r repo.InventoryRepository) SvcConf

Jump to

Keyboard shortcuts

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