Documentation ¶
Index ¶
- Constants
- 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 ¶
View Source
const ( ShoppingListCreatedEvent = "depot.ShoppingListCreated" ShoppingListCanceledEvent = "depot.ShoppingListCanceled" ShoppingListAssignedEvent = "depot.ShoppingListAssigned" ShoppingListCompletedEvent = "depot.ShoppingListCompleted" )
View Source
const ShoppingListAggregate = "depot.ShoppingList"
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.Aggregate OrderID string Stops Stops AssignedBotID string Status ShoppingListStatus }
func CreateShopping ¶
func CreateShopping(id, orderID string) *ShoppingList
func NewShoppingList ¶
func NewShoppingList(id 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
func (ShoppingList) Key ¶
func (ShoppingList) Key() string
type ShoppingListAssigned ¶
type ShoppingListAssigned struct { ShoppingList *ShoppingList BotID string }
func (ShoppingListAssigned) Key ¶
func (ShoppingListAssigned) Key() string
type ShoppingListCanceled ¶
type ShoppingListCanceled struct {
ShoppingList *ShoppingList
}
func (ShoppingListCanceled) Key ¶
func (ShoppingListCanceled) Key() string
type ShoppingListCompleted ¶
type ShoppingListCompleted struct {
ShoppingList *ShoppingList
}
func (ShoppingListCompleted) Key ¶
func (ShoppingListCompleted) Key() string
type ShoppingListCreated ¶
type ShoppingListCreated struct {
ShoppingList *ShoppingList
}
func (ShoppingListCreated) Key ¶
func (ShoppingListCreated) Key() string
type ShoppingListRepository ¶
type ShoppingListRepository interface { Find(ctx context.Context, shoppingListID 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.