domain

package
v0.0.0-...-76fafce Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ShoppingListCreatedEvent   = "depot.ShoppingListCreated"
	ShoppingListCanceledEvent  = "depot.ShoppingListCanceled"
	ShoppingListInitiatedEvent = "depot.ShoppingListInitiated"
	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")
	ErrShoppingCannotBeInitiated = errors.Wrap(errors.ErrBadRequest, "the shopping list cannot be initiated")
	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 Bot

type Bot struct {
	ID     string
	Name   string
	Status BotStatus
}

type BotStatus

type BotStatus string
const (
	BotUnknown  BotStatus = ""
	BotIsIdle   BotStatus = "idle"
	BotIsActive BotStatus = "active"
)

func ToBotStatus

func ToBotStatus(status string) BotStatus

func (BotStatus) String

func (s BotStatus) String() string

type FakeProductCacheRepository

type FakeProductCacheRepository struct {
	// contains filtered or unexported fields
}

func NewFakeProductCacheRepository

func NewFakeProductCacheRepository() *FakeProductCacheRepository

func (*FakeProductCacheRepository) Add

func (r *FakeProductCacheRepository) Add(ctx context.Context, productID, storeID, name string) error

func (*FakeProductCacheRepository) Find

func (r *FakeProductCacheRepository) Find(ctx context.Context, productID string) (*Product, error)

func (*FakeProductCacheRepository) Rebrand

func (r *FakeProductCacheRepository) Rebrand(ctx context.Context, productID, name string) error

func (*FakeProductCacheRepository) Remove

func (r *FakeProductCacheRepository) Remove(ctx context.Context, productID string) error

func (*FakeProductCacheRepository) Reset

func (r *FakeProductCacheRepository) Reset(products ...*Product)

type FakeStoreCacheRepository

type FakeStoreCacheRepository struct {
	// contains filtered or unexported fields
}

func NewFakeStoreCacheRepository

func NewFakeStoreCacheRepository() *FakeStoreCacheRepository

func (*FakeStoreCacheRepository) Add

func (r *FakeStoreCacheRepository) Add(ctx context.Context, storeID, name, location string) error

func (*FakeStoreCacheRepository) Find

func (r *FakeStoreCacheRepository) Find(ctx context.Context, storeID string) (*Store, error)

func (*FakeStoreCacheRepository) Rename

func (r *FakeStoreCacheRepository) Rename(ctx context.Context, storeID, name string) error

func (*FakeStoreCacheRepository) Reset

func (r *FakeStoreCacheRepository) Reset(stores ...*Store)

type Item

type Item struct {
	ProductName string
	Quantity    int
}

type Items

type Items map[string]*Item

type MockOrderRepository

type MockOrderRepository struct {
	mock.Mock
}

MockOrderRepository is an autogenerated mock type for the OrderRepository type

func NewMockOrderRepository

func NewMockOrderRepository(t mockConstructorTestingTNewMockOrderRepository) *MockOrderRepository

NewMockOrderRepository creates a new instance of MockOrderRepository. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*MockOrderRepository) Ready

func (_m *MockOrderRepository) Ready(ctx context.Context, orderID string) error

Ready provides a mock function with given fields: ctx, orderID

type MockProductCacheRepository

type MockProductCacheRepository struct {
	mock.Mock
}

MockProductCacheRepository is an autogenerated mock type for the ProductCacheRepository type

func NewMockProductCacheRepository

func NewMockProductCacheRepository(t mockConstructorTestingTNewMockProductCacheRepository) *MockProductCacheRepository

NewMockProductCacheRepository creates a new instance of MockProductCacheRepository. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*MockProductCacheRepository) Add

func (_m *MockProductCacheRepository) Add(ctx context.Context, productID string, storeID string, name string) error

Add provides a mock function with given fields: ctx, productID, storeID, name

func (*MockProductCacheRepository) Find

func (_m *MockProductCacheRepository) Find(ctx context.Context, productID string) (*Product, error)

Find provides a mock function with given fields: ctx, productID

func (*MockProductCacheRepository) Rebrand

func (_m *MockProductCacheRepository) Rebrand(ctx context.Context, productID string, name string) error

Rebrand provides a mock function with given fields: ctx, productID, name

func (*MockProductCacheRepository) Remove

func (_m *MockProductCacheRepository) Remove(ctx context.Context, productID string) error

Remove provides a mock function with given fields: ctx, productID

type MockProductRepository

type MockProductRepository struct {
	mock.Mock
}

MockProductRepository is an autogenerated mock type for the ProductRepository type

func NewMockProductRepository

func NewMockProductRepository(t mockConstructorTestingTNewMockProductRepository) *MockProductRepository

NewMockProductRepository creates a new instance of MockProductRepository. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*MockProductRepository) Find

func (_m *MockProductRepository) Find(ctx context.Context, productID string) (*Product, error)

Find provides a mock function with given fields: ctx, productID

type MockShoppingListRepository

type MockShoppingListRepository struct {
	mock.Mock
}

MockShoppingListRepository is an autogenerated mock type for the ShoppingListRepository type

func NewMockShoppingListRepository

func NewMockShoppingListRepository(t mockConstructorTestingTNewMockShoppingListRepository) *MockShoppingListRepository

NewMockShoppingListRepository creates a new instance of MockShoppingListRepository. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*MockShoppingListRepository) Find

func (_m *MockShoppingListRepository) Find(ctx context.Context, shoppingListID string) (*ShoppingList, error)

Find provides a mock function with given fields: ctx, shoppingListID

func (*MockShoppingListRepository) Save

Save provides a mock function with given fields: ctx, list

func (*MockShoppingListRepository) Update

Update provides a mock function with given fields: ctx, list

type MockStoreCacheRepository

type MockStoreCacheRepository struct {
	mock.Mock
}

MockStoreCacheRepository is an autogenerated mock type for the StoreCacheRepository type

func NewMockStoreCacheRepository

func NewMockStoreCacheRepository(t mockConstructorTestingTNewMockStoreCacheRepository) *MockStoreCacheRepository

NewMockStoreCacheRepository creates a new instance of MockStoreCacheRepository. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*MockStoreCacheRepository) Add

func (_m *MockStoreCacheRepository) Add(ctx context.Context, storeID string, name string, location string) error

Add provides a mock function with given fields: ctx, storeID, name, location

func (*MockStoreCacheRepository) Find

func (_m *MockStoreCacheRepository) Find(ctx context.Context, storeID string) (*Store, error)

Find provides a mock function with given fields: ctx, storeID

func (*MockStoreCacheRepository) Rename

func (_m *MockStoreCacheRepository) Rename(ctx context.Context, storeID string, name string) error

Rename provides a mock function with given fields: ctx, storeID, name

type MockStoreRepository

type MockStoreRepository struct {
	mock.Mock
}

MockStoreRepository is an autogenerated mock type for the StoreRepository type

func NewMockStoreRepository

func NewMockStoreRepository(t mockConstructorTestingTNewMockStoreRepository) *MockStoreRepository

NewMockStoreRepository creates a new instance of MockStoreRepository. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*MockStoreRepository) Find

func (_m *MockStoreRepository) Find(ctx context.Context, storeID string) (*Store, error)

Find provides a mock function with given fields: ctx, storeID

type OrderRepository

type OrderRepository interface {
	Ready(ctx context.Context, orderID string) error
}

type Product

type Product struct {
	ID      string
	StoreID string
	Name    string
}

type ProductCacheRepository

type ProductCacheRepository interface {
	Add(ctx context.Context, productID, storeID, name string) error
	Rebrand(ctx context.Context, productID, name string) error
	Remove(ctx context.Context, productID string) error
	ProductRepository
}

type ProductRepository

type ProductRepository interface {
	Find(ctx context.Context, productID string) (*Product, error)
}

type ShoppingList

type ShoppingList struct {
	ddd.Aggregate
	OrderID       string
	Stops         Stops
	AssignedBotID string
	Status        ShoppingListStatus
}

func CreateShoppingList

func CreateShoppingList(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) Initiate

func (sl *ShoppingList) Initiate() error

func (ShoppingList) Key

func (ShoppingList) Key() string

type ShoppingListAssigned

type ShoppingListAssigned struct {
	ShoppingList *ShoppingList
	BotID        string
}

func (ShoppingListAssigned) Key

type ShoppingListCanceled

type ShoppingListCanceled struct {
	ShoppingList *ShoppingList
}

func (ShoppingListCanceled) Key

type ShoppingListCompleted

type ShoppingListCompleted struct {
	ShoppingList *ShoppingList
}

func (ShoppingListCompleted) Key

type ShoppingListCreated

type ShoppingListCreated struct {
	ShoppingList *ShoppingList
}

func (ShoppingListCreated) Key

type ShoppingListInitiated

type ShoppingListInitiated struct {
	ShoppingList *ShoppingList
}

func (ShoppingListInitiated) Key

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 = ""
	ShoppingListIsPending   ShoppingListStatus = "pending"
	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

type Stop

type Stop struct {
	StoreName     string
	StoreLocation string
	Items         Items
}

func (*Stop) AddItem

func (s *Stop) AddItem(product *Product, quantity int) error

type Stops

type Stops map[string]*Stop

type Store

type Store struct {
	ID       string
	Name     string
	Location string
}

type StoreCacheRepository

type StoreCacheRepository interface {
	Add(ctx context.Context, storeID, name, location string) error
	Rename(ctx context.Context, storeID, name string) error
	StoreRepository
}

type StoreRepository

type StoreRepository interface {
	Find(ctx context.Context, storeID string) (*Store, error)
}

Jump to

Keyboard shortcuts

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