service

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ORDER_STATUS_UNSET     OrderStatus = ""
	ORDER_STATUS_RECEIVED              = "Recebido"
	ORDER_STATUS_PREPARING             = "Em Preparação"
	ORDER_STATUS_DONE                  = "Pronto"
	ORDER_STATUS_FINISHED              = "Finalizado"
	ORDER_STATUS_CANCELED              = "Cancelado"
)

Variables

View Source
var ErrRecordNotFound = errors.New("no matching key found")

Functions

This section is empty.

Types

type CacheService

type CacheService interface {
	SaveOrderStatusChanged(ctx context.Context, order Order) error
	GetOrder(ctx context.Context, orderID uuid.UUID) (*Order, error)
	SubscribeToIncomingOrders()
}

func NewCacheService

func NewCacheService(client datastore.RedisStore, log kitlog.Logger) CacheService

type Order

type Order struct {
	ID        uuid.UUID   `json:"id"`
	UpdatedAt time.Time   `json:"updated_at"`
	Status    OrderStatus `json:"status"`
}

func OrderFromOrderSentMessage added in v1.0.5

func OrderFromOrderSentMessage(msg messages.OrderSentMessage) (*Order, error)

func OrderFromProductionStatusChangedMessage added in v1.0.5

func OrderFromProductionStatusChangedMessage(msg messages.ProductionStatusChangedMessage) (*Order, error)

func (*Order) ToProductionStatusChangedMessage added in v1.0.5

func (o *Order) ToProductionStatusChangedMessage() messages.ProductionStatusChangedMessage

type OrderStatus

type OrderStatus string

type ProductionService

type ProductionService interface {
	UpdateOrderStatus(ctx context.Context, orderID uuid.UUID, status OrderStatus) (*Order, error)
	SubscribeToIncomingOrders()
}

func NewProductionService

func NewProductionService(cacheSvc CacheService, svc Publisher) ProductionService

type Publisher

type Publisher interface {
	PublishOrderStatusChanged(ctx context.Context, channel string, order messages.ProductionStatusChangedMessage) error
}

func NewPublisher

func NewPublisher(client datastore.RedisStore) Publisher

Jump to

Keyboard shortcuts

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