Documentation ¶
Index ¶
- Variables
- type Fraction
- type Ingredient
- type Measurement
- type Recipe
- func (this *Recipe) AddDirection(direction string)
- func (this *Recipe) AddIngredient(numerator int, denominator int, unit string, name string) error
- func (this *Recipe) AddTag(tag string)
- func (this *Recipe) RemoveDirection(index int) error
- func (this *Recipe) RemoveIngredient(index int) error
- func (this *Recipe) RemoveTag(tag string)
- func (this *Recipe) ScaleDownRecipe(scalar int) error
- func (this *Recipe) ScaleUpRecipe(scalar int)
- func (this Recipe) String() string
- func (this *Recipe) SwapDirections(indexArray []int) error
- func (this *Recipe) SwapIngredients(indexArray []int) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrDivideByZero error = fmt.Errorf("fraction: can't divide by 0")
Functions ¶
This section is empty.
Types ¶
type Fraction ¶
func MakeCopyFraction ¶
type Ingredient ¶
type Ingredient struct { Measurement `json:"measurement"` Name string `json:"name"` }
func MakeIngredient ¶
func (Ingredient) String ¶
func (this Ingredient) String() string
type Measurement ¶
func MakeMeasurement ¶
func MakeMeasurement(numerator int, denominator int, unit string) (Measurement, error)
func (Measurement) String ¶
func (this Measurement) String() string
type Recipe ¶
type Recipe struct { Title string `json:"title"` Author string `json:"author"` Ingredients []Ingredient `json:"ingredients"` Directions []string `json:"directions"` Tags map[string]bool `json:"tags"` ID int `json:"id"` }
func MakeRecipe ¶
func (*Recipe) AddDirection ¶
func (*Recipe) AddIngredient ¶
func (*Recipe) RemoveDirection ¶
func (*Recipe) RemoveIngredient ¶
func (*Recipe) ScaleDownRecipe ¶
func (*Recipe) ScaleUpRecipe ¶
func (*Recipe) SwapDirections ¶
func (*Recipe) SwapIngredients ¶
Click to show internal directories.
Click to hide internal directories.