32 lines
569 B
Go
32 lines
569 B
Go
package recipe
|
|
|
|
import (
|
|
"autobrew/action"
|
|
"autobrew/ingredient"
|
|
)
|
|
|
|
type Step struct {
|
|
Ingredients []ingredient.Ingredient
|
|
Action action.StepAction
|
|
Turns int
|
|
}
|
|
|
|
func (f *Step) UnmarshalYAML(unmarshal func(any) error) error {
|
|
var t struct {
|
|
Ingredients []ingredient.Ingredient `yaml:"ingredients"`
|
|
Action action.StepAction `yaml:"action"`
|
|
Turns int `yaml:"turns"`
|
|
}
|
|
|
|
err := unmarshal(&t)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
f.Action = t.Action
|
|
f.Ingredients = t.Ingredients
|
|
f.Turns = t.Turns
|
|
|
|
return nil
|
|
}
|