Documentation ¶
Index ¶
- Constants
- type OrderService
- func (s *OrderService) AddOrder(order spec.Order) error
- func (s *OrderService) EmailNotify(order spec.Order) error
- func (s *OrderService) GetOrder(orderID string) (*spec.Order, error)
- func (s *OrderService) GetOrdersForUser(userID string) ([]string, error)
- func (s *OrderService) ProcessOrder(order spec.Order) error
- func (s *OrderService) PubSubOrderReceiver(event *pubsub.CloudEvent) error
- func (s *OrderService) SaveReport(order spec.Order) error
- func (s *OrderService) SetStatus(order *spec.Order, status spec.OrderStatus) error
- type OrdersError
Constants ¶
const NotFoundError = "order not found"
const StatusError = "order status invalid"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type OrderService ¶
type OrderService struct {
// contains filtered or unexported fields
}
OrderService is a Dapr based implementation of OrderService interface
func NewService ¶
func NewService(serviceName string) *OrderService
NewService creates a new OrderService
func (*OrderService) AddOrder ¶
func (s *OrderService) AddOrder(order spec.Order) error
AddOrder stores an order in Dapr state store
func (*OrderService) EmailNotify ¶
func (s *OrderService) EmailNotify(order spec.Order) error
EmailNotify uses Dapr SendGrid output binding to send an email See: https://docs.dapr.io/reference/components-reference/supported-bindings/sendgrid/
func (*OrderService) GetOrder ¶
func (s *OrderService) GetOrder(orderID string) (*spec.Order, error)
GetOrder fetches an order from Dapr state store
func (*OrderService) GetOrdersForUser ¶
func (s *OrderService) GetOrdersForUser(userID string) ([]string, error)
GetOrdersForUser fetches a list of order ids for a given user
func (*OrderService) ProcessOrder ¶
func (s *OrderService) ProcessOrder(order spec.Order) error
ProcessOrder is a fake set of order processing tasks, mainly progressing the status
func (*OrderService) PubSubOrderReceiver ¶
func (s *OrderService) PubSubOrderReceiver(event *pubsub.CloudEvent) error
pubSubOrderReceiver is an adaptor of sorts, not part of the OrderService spec It is registered as the receiver for new messages on the Dapr pub/sub order topic
func (*OrderService) SaveReport ¶
func (s *OrderService) SaveReport(order spec.Order) error
SaveReport uses Dapr Azure Blob output binding to store a order report See: https://docs.dapr.io/reference/components-reference/supported-bindings/blobstorage/
func (*OrderService) SetStatus ¶
func (s *OrderService) SetStatus(order *spec.Order, status spec.OrderStatus) error
SetStatus updates the status of an order
type OrdersError ¶
type OrdersError struct {
// contains filtered or unexported fields
}
func OrderNotFoundError ¶
func OrderNotFoundError() OrdersError
func OrderStatusError ¶
func OrderStatusError() OrdersError
func (OrdersError) Error ¶
func (e OrdersError) Error() string