diff options
Diffstat (limited to 'model/recipes.go')
-rw-r--r-- | model/recipes.go | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/model/recipes.go b/model/recipes.go index fd8115f..324589a 100644 --- a/model/recipes.go +++ b/model/recipes.go @@ -1,7 +1,9 @@ package model import ( + "database/sql" "errors" + "fmt" ) type RecipesElement struct { @@ -11,14 +13,18 @@ type RecipesElement struct { type Recipes []RecipesElement -func (r *Recipes) Read() error { +func (r *Recipes) Create(tx *sql.Tx) error { + return fmt.Errorf("Impossible to create a recipe list") +} + +func (r *Recipes) Read(tx *sql.Tx) error { if len(*r) != 0 { return errors.New("Recipes has to contain zero elements for .Read()") } query := `SELECT id, title FROM recipes` - rows, err := db.Query(query) + rows, err := tx.Query(query) if err != nil { return err } @@ -36,6 +42,14 @@ func (r *Recipes) Read() error { return nil } +func (r *Recipes) Update(tx *sql.Tx) error { + return fmt.Errorf("Impossible to update a recipe list") +} + +func (r *Recipes) Delete(tx *sql.Tx) error { + return fmt.Errorf("Impossible to delete a recipe list") +} + func RecipesTestData() Recipes { return []RecipesElement{ { |