Documentation
¶
Index ¶
- Variables
- type Bot
- type BotStatus
- type Item
- type Items
- type OrderRepository
- type Product
- type ProductRepository
- type ShoppingList
- type ShoppingListAssigned
- type ShoppingListCanceled
- type ShoppingListCompleted
- type ShoppingListCreated
- type ShoppingListRepository
- type ShoppingListStatus
- type Stop
- type Stops
- type Store
- type StoreRepository
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrShoppingCannotBeCanceled = errors.Wrap(errors.ErrBadRequest, "the shopping list cannot be canceled") ErrShoppingCannotBeAssigned = errors.Wrap(errors.ErrBadRequest, "the shopping list cannot be assigned") ErrShoppingCannotBeCompleted = errors.Wrap(errors.ErrBadRequest, "the shopping list cannot be completed") )
Functions ¶
This section is empty.
Types ¶
type OrderRepository ¶
type ProductRepository ¶
type ShoppingList ¶
type ShoppingList struct { ddd.AggregateBase OrderID string Stops Stops AssignedBotID string Status ShoppingListStatus }
func CreateShopping ¶
func CreateShopping(id, orderID string) *ShoppingList
func (*ShoppingList) AddItem ¶
func (sl *ShoppingList) AddItem(store *Store, product *Product, quantity int) error
func (*ShoppingList) Assign ¶
func (sl *ShoppingList) Assign(id string) error
func (*ShoppingList) Cancel ¶
func (sl *ShoppingList) Cancel() error
func (*ShoppingList) Complete ¶
func (sl *ShoppingList) Complete() error
type ShoppingListAssigned ¶
type ShoppingListAssigned struct { ShoppingList *ShoppingList BotID string }
func (ShoppingListAssigned) EventName ¶
func (ShoppingListAssigned) EventName() string
type ShoppingListCanceled ¶
type ShoppingListCanceled struct {
ShoppingList *ShoppingList
}
func (ShoppingListCanceled) EventName ¶
func (ShoppingListCanceled) EventName() string
type ShoppingListCompleted ¶
type ShoppingListCompleted struct {
ShoppingList *ShoppingList
}
func (ShoppingListCompleted) EventName ¶
func (ShoppingListCompleted) EventName() string
type ShoppingListCreated ¶
type ShoppingListCreated struct {
ShoppingList *ShoppingList
}
func (ShoppingListCreated) EventName ¶
func (ShoppingListCreated) EventName() string
type ShoppingListRepository ¶
type ShoppingListRepository interface { Find(ctx context.Context, shoppingListID string) (*ShoppingList, error) FindByOrderID(ctx context.Context, orderID string) (*ShoppingList, error) Save(ctx context.Context, list *ShoppingList) error Update(ctx context.Context, list *ShoppingList) error }
type ShoppingListStatus ¶
type ShoppingListStatus string
const ( ShoppingListUnknown ShoppingListStatus = "" ShoppingListIsAvailable ShoppingListStatus = "available" ShoppingListIsAssigned ShoppingListStatus = "assigned" ShoppingListIsActive ShoppingListStatus = "active" ShoppingListIsCompleted ShoppingListStatus = "completed" ShoppingListIsCanceled ShoppingListStatus = "canceled" )
func ToShoppingListStatus ¶
func ToShoppingListStatus(status string) ShoppingListStatus
func (ShoppingListStatus) String ¶
func (s ShoppingListStatus) String() string
Click to show internal directories.
Click to hide internal directories.