Documentation ¶
Index ¶
- Constants
- Variables
- type CustomerRepository
- type InvoiceRepository
- type Item
- type NotificationRepository
- type Order
- func (o *Order) ApplyEvent(event ddd.Event) error
- func (o *Order) ApplySnapshot(snapshot es.Snapshot) error
- func (o *Order) Cancel() error
- func (o *Order) Complete(invoiceID string) error
- func (o *Order) CreateOrder(id, customerID, paymentID, shoppingID string, items []Item) error
- func (o Order) GetTotal() float64
- func (Order) Key() string
- func (o *Order) Ready() error
- func (o *Order) ToSnapshot() es.Snapshot
- type OrderCanceled
- type OrderCompleted
- type OrderCreated
- type OrderReadied
- type OrderRepository
- type OrderStatus
- type OrderV1
- type PaymentRepository
- type ShoppingRepository
Constants ¶
View Source
const ( OrderCreatedEvent = "ordering.OrderCreated" OrderCanceledEvent = "ordering.OrderCanceled" OrderReadiedEvent = "ordering.OrderReadied" OrderCompletedEvent = "ordering.OrderCompleted" )
View Source
const OrderAggregate = "ordering.Order"
Variables ¶
View Source
var ( ErrOrderAlreadyCreated = errors.Wrap(errors.ErrBadRequest, "the order cannot be recreated") ErrOrderHasNoItems = errors.Wrap(errors.ErrBadRequest, "the order has no items") ErrOrderCannotBeCancelled = errors.Wrap(errors.ErrBadRequest, "the order cannot be cancelled") ErrCustomerIDCannotBeBlank = errors.Wrap(errors.ErrBadRequest, "the customer id cannot be blank") ErrPaymentIDCannotBeBlank = errors.Wrap(errors.ErrBadRequest, "the payment id cannot be blank") )
Functions ¶
This section is empty.
Types ¶
type CustomerRepository ¶
type InvoiceRepository ¶
type NotificationRepository ¶
type Order ¶
type Order struct { es.Aggregate CustomerID string PaymentID string InvoiceID string ShoppingID string Items []Item Status OrderStatus }
func (*Order) CreateOrder ¶
func (*Order) ToSnapshot ¶
type OrderCanceled ¶
type OrderCanceled struct {
CustomerID string
}
func (OrderCanceled) Key ¶
func (OrderCanceled) Key() string
type OrderCompleted ¶
type OrderCompleted struct {
InvoiceID string
}
func (OrderCompleted) Key ¶
func (OrderCompleted) Key() string
type OrderCreated ¶
func (OrderCreated) Key ¶
func (OrderCreated) Key() string
type OrderReadied ¶
func (OrderReadied) Key ¶
func (OrderReadied) Key() string
type OrderRepository ¶
type OrderStatus ¶
type OrderStatus string
const ( OrderUnknown OrderStatus = "" OrderIsPending OrderStatus = "pending" OrderIsInProcess OrderStatus = "in-progress" OrderIsReady OrderStatus = "ready" OrderIsCompleted OrderStatus = "completed" OrderIsCancelled OrderStatus = "cancelled" )
func ToOrderStatus ¶
func ToOrderStatus(status string) OrderStatus
func (OrderStatus) String ¶
func (s OrderStatus) String() string
type OrderV1 ¶
type OrderV1 struct { CustomerID string PaymentID string InvoiceID string ShoppingID string Items []Item Status OrderStatus }
func (OrderV1) SnapshotName ¶
type PaymentRepository ¶
Click to show internal directories.
Click to hide internal directories.