model

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2024 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB added in v0.5.0

type DB sql.DB

func OpenDB added in v0.5.0

func OpenDB(path string) (*DB, error)

func (*DB) Close added in v0.5.0

func (db *DB) Close() error

func (*DB) CreateExamples added in v0.5.0

func (db *DB) CreateExamples() error

func (*DB) Migrate added in v0.5.0

func (db *DB) Migrate() error

func (*DB) Transaction added in v0.5.0

func (db *DB) Transaction(f func(*sql.Tx) error) error

type Ingredient

type Ingredient struct {
	Id     string `json:"id"`
	Index  string `json:"index"`
	Amount string `json:"amount"`
	Unit   string `json:"unit"`
	Type   string `json:"type"`
	Step   string `json:"step"`
}

func (*Ingredient) Create

func (i *Ingredient) Create(tx *sql.Tx) error

func (*Ingredient) Delete

func (i *Ingredient) Delete(tx *sql.Tx) error

func (*Ingredient) Read

func (i *Ingredient) Read(tx *sql.Tx) error

func (Ingredient) String added in v0.5.0

func (i Ingredient) String() string

func (*Ingredient) Update

func (i *Ingredient) Update(tx *sql.Tx) error

func (*Ingredient) Validate

func (i *Ingredient) Validate() error

type Object

type Object interface {
	Create(tx *sql.Tx) error
	Read(tx *sql.Tx) error
	Update(tx *sql.Tx) error
	Delete(tx *sql.Tx) error
}

type Recipe

type Recipe struct {
	Id          string `json:"id"`
	Title       string `json:"title"`
	Portions    string `json:"portions"`
	Url         string `json:"url"`
	Notes       string `json:"notes"`
	Created     string `json:"created"`
	LastChanged string `json:"last_changed"`
	Steps       []Step `json:"steps"`
	IsFavorite  bool   `json:"is_favorite"`
}

func RecipeTestData

func RecipeTestData() []Recipe

func (*Recipe) Create

func (r *Recipe) Create(tx *sql.Tx) error

func (*Recipe) Delete

func (r *Recipe) Delete(tx *sql.Tx) error

func (*Recipe) Read

func (r *Recipe) Read(tx *sql.Tx) error

func (Recipe) String

func (r Recipe) String() string

func (*Recipe) Update

func (r *Recipe) Update(tx *sql.Tx) error

func (*Recipe) Validate

func (r *Recipe) Validate() error

type Recipes

type Recipes []RecipesElement

func RecipesTestData

func RecipesTestData() Recipes

func (*Recipes) Create added in v0.5.0

func (r *Recipes) Create(tx *sql.Tx) error

func (*Recipes) Delete added in v0.5.0

func (r *Recipes) Delete(tx *sql.Tx) error

func (*Recipes) Read

func (r *Recipes) Read(tx *sql.Tx) error

func (*Recipes) Update added in v0.5.0

func (r *Recipes) Update(tx *sql.Tx) error

type RecipesElement

type RecipesElement struct {
	Id         int64 // TODO change to string
	Title      string
	IsFavorite bool
}

type Step

type Step struct {
	Id          string       `json:"id"`
	Index       string       `json:"index"`
	Text        string       `json:"text"`
	Recipe      string       `json:"recipe"`
	Ingredients []Ingredient `json:"ingredients"`
}

func (*Step) Create

func (s *Step) Create(tx *sql.Tx) error

func (*Step) Delete

func (s *Step) Delete(tx *sql.Tx) error

func (*Step) Read

func (s *Step) Read(tx *sql.Tx) error

func (Step) String

func (s Step) String() string

func (*Step) Update

func (s *Step) Update(tx *sql.Tx) error

func (*Step) Validate

func (s *Step) Validate() error

type Storage

type Storage struct {
	Path string
}

func NewStorage

func NewStorage(path string) Storage

func (Storage) Create

func (s Storage) Create()

func (Storage) Exists

func (s Storage) Exists() bool

Source Files

  • db.go
  • ingredient.go
  • object.go
  • recipe.go
  • recipes.go
  • step.go
  • storage.go
  • validation.go

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL