Documentation
¶
Index ¶
- func Seed(db *gorm.DB) error
- type Database
- func (s *Database) GetIngredients() (result *Ingredients, err error)
- func (s *Database) GetRecipe(id uint) (result *RecipeV1, err error)
- func (s *Database) GetServing(id uint) (result *ServingV1, err error)
- func (s *Database) GetUnits() (result *[]UnitV1, err error)
- func (s *Database) LoadRecipes(page int, pageSize int, searchTerm string) (result *Recipes, err error)
- func (s *Database) LoadServings() (result *[]ServingV1, err error)
- func (s *Database) Migrate() error
- func (s *Database) SaveIngredient(ingredient *IngredientV1) (err error)
- func (s *Database) SaveRecipe(recipe *RecipeV1) (savedRecipe *RecipeV1, err error)
- func (s *Database) SaveServing(serving *ServingV1) (err error)
- func (s *Database) SaveSyncJob(job *JobV1) (savedJob *JobV1, err error)
- type Day
- type IngredientV1
- type Ingredients
- type JobStatus
- type JobV1
- type PantryV1
- type RecipeDifficultyV1
- type RecipeV1
- type RecipeV1IngredientV1
- type Recipes
- type ServingV1
- type UnitV1
- type Week
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
func NewDatabase ¶
NewDatabase makes persistent sqlite based store
func (*Database) GetIngredients ¶
func (s *Database) GetIngredients() (result *Ingredients, err error)
func (*Database) LoadRecipes ¶
func (*Database) LoadServings ¶
func (*Database) SaveIngredient ¶
func (s *Database) SaveIngredient(ingredient *IngredientV1) (err error)
func (*Database) SaveRecipe ¶
func (*Database) SaveServing ¶
type IngredientV1 ¶
type PantryV1 ¶
type PantryV1 struct {
IngredientV1ID uint
Ingredient IngredientV1 `gorm:"foreignKey:IngredientV1ID"`
Amount float64
}
type RecipeDifficultyV1 ¶
type RecipeV1 ¶
type RecipeV1 struct {
ID uint `gorm:"primaryKey;autoIncrement"`
Title string `gorm:"type:varchar(255);unique;not null"`
Description string `gorm:"type:varchar(4000)"`
Ingredients []RecipeV1IngredientV1 `gorm:"foreignKey:RecipeV1ID"`
PreparationTimeInMinutes uint
CookingTimeInMinutes uint
ThumbnailUrl sql.NullString
PdfUrl sql.NullString
RecipeDifficultyID uint
RecipeDifficulty RecipeDifficultyV1 `gorm:"foreignKey:RecipeDifficultyID"`
Rating float64 `gorm:"default:0.0"`
RatingCount uint `gorm:"default:0"`
Servings []ServingV1 `gorm:"foreignKey:RecipeID"`
CreatedAt time.Time
UpdatedAt sql.NullTime
}
type RecipeV1IngredientV1 ¶
Click to show internal directories.
Click to hide internal directories.