diff options
Diffstat (limited to 'model/recipe.go')
| -rw-r--r-- | model/recipe.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/model/recipe.go b/model/recipe.go index 684b158..adcafa1 100644 --- a/model/recipe.go +++ b/model/recipe.go @@ -5,6 +5,8 @@ import ( "encoding/json" "errors" "fmt" + "log" + "strconv" ) type Recipe struct { @@ -19,11 +21,23 @@ type Recipe struct { IsFavorite bool `json:"is_favorite"` } +func NewRecipe() Object { + return &Recipe{} +} + func (r Recipe) String() string { b, _ := json.MarshalIndent(r, "", " ") return string(b) } +func (r *Recipe) SetID(id int) { + if r == nil { + log.Println("Got nil as recipe!") + } + + r.Id = strconv.Itoa(id) +} + func (r *Recipe) Validate() error { var err error |
