diff options
-rw-r--r-- | model/recipe.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/model/recipe.go b/model/recipe.go index e5cf0a6..760fe79 100644 --- a/model/recipe.go +++ b/model/recipe.go @@ -90,11 +90,18 @@ SET WHERE id = ?` - _, err := db.Exec(query, r.Title, r.Portions, r.Url, r.Notes, + res, err := db.Exec(query, r.Title, r.Portions, r.Url, r.Notes, r.Created, r.LastChanged, r.Id) if err != nil { return err } + affected, err := res.RowsAffected() + if err != nil { + return err + } + if affected != 1 { + return fmt.Errorf("Recipe update affected %d rows instead of 1", affected) + } return nil } |