impl

package
v0.0.0-...-0b85c92 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const NotFoundError = "order not found"
View Source
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

Jump to

Keyboard shortcuts

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