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 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

Jump to

Keyboard shortcuts

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