Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewBasicOrderService ¶
func NewBasicOrderService() *basicOrderService
NewBasicOrderService returns a naive, stateless implementation of OrderService
Types ¶
type IOrderService ¶
type IOrderService interface {
// Handlers of the events
HandleAccountCreatedEvent(ctx context.Context, accntID uint, role string) error
HandlePolicyUpdatedEvent(ctx context.Context, method, sub, rtype, rid, act string) error
HandleErrReservingProductEvent(ctx context.Context, oid uuid.UUID) error
HandleProductReservedEvent(ctx context.Context, oid uuid.UUID) error
HandlePaymentEvent(ctx context.Context, oid uuid.UUID, aid uint, status string) error
ListOrder(ctx context.Context, oids []uuid.UUID, qp *dto.BasicQueryParam) dto.ListOrderResponse
CreateOrder(ctx context.Context, pid uuid.UUID, qty int) (uuid.UUID, error)
}
func New ¶
func New(logger *cl.CustomLogger, mws []Middleware, svcconfs ...SvcConf) IOrderService
New returns a OrderService implementation with all of the expected config/middleware wired in.
type Middleware ¶
type Middleware func(IOrderService) IOrderService
Middleware represents service middleware type
func NewAuthzMW ¶
func NewAuthzMW(pe svcpe.PolicyEnforcer) Middleware
type SvcConf ¶
type SvcConf func(*basicOrderService) error
func WithNATSEncodedConn ¶
func WithNATSEncodedConn(nc *nats.EncodedConn) SvcConf
func WithPolicyStorage ¶
func WithPolicyStorage(ps svcpe.PolicyStorage) SvcConf
func WithRepo ¶
func WithRepo(r repo.OrderRepository) SvcConf
Click to show internal directories.
Click to hide internal directories.