Documentation
¶
Index ¶
Constants ¶
View Source
const IngredientEpsilon = 0.05
IngredientEpsilon defines threshold of ingredient amount. If remained amount of ingredient is less than this value, ingredient is treated as consumed (or deleted). NOTE: without IngredientEpsilon, the system will suffer from rounding error!
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Ingredient ¶
type Ingredient struct {
ID IngredientID
Kind IngredientKind
Amount IngredientAmount
}
aggregate roots
type IngredientAmount ¶
type IngredientAmount float64
type IngredientFactory ¶
type IngredientFactory interface {
New(IngredientKind, IngredientAmount) *Ingredient
}
func NewIngredientFacotry ¶
func NewIngredientFacotry(idGenerator func() string) IngredientFactory
type IngredientKind ¶
type IngredientKind string
type IngredientRepository ¶
type IngredientRepository interface {
List(context.Context) ([]*Ingredient, error)
Get(context.Context, IngredientID) (*Ingredient, error)
Upsert(context.Context, *Ingredient) error
Delete(context.Context, *Ingredient) error
}
Click to show internal directories.
Click to hide internal directories.