domain

package
v0.0.0-...-e82a045 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2022 License: MIT Imports: 2 Imported by: 0

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 IngredientID

type IngredientID string

Value objects

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
}

Jump to

Keyboard shortcuts

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