dao

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDefaultFillIngredients

func GetDefaultFillIngredients() []*models.Ingredient

func GetDefaultFillMeals

func GetDefaultFillMeals(tags []*models.Tag, ingredients []*models.Ingredient) []*models.Meal

func GetDefaultFillTags

func GetDefaultFillTags() []*models.Tag

Types

type Handler

type Handler struct {
	DB *gorm.DB
}

Handler is a thin layer over Gorm

func NewHandler

func NewHandler(config configs.Options) (*Handler, error)

func (*Handler) Close

func (dbHandler *Handler) Close()

func (*Handler) CreateIngredient

func (dbHandler *Handler) CreateIngredient(ingredient models.Ingredient) (models.Ingredient, error)

func (*Handler) CreateMeal

func (dbHandler *Handler) CreateMeal(meal models.Meal) (models.Meal, error)

func (*Handler) CreateTag

func (dbHandler *Handler) CreateTag(tag models.Tag) (models.Tag, error)

func (*Handler) DeleteMeal

func (dbHandler *Handler) DeleteMeal(id int64) error

func (*Handler) FindMealsByTag

func (dbHandler *Handler) FindMealsByTag(tagID *int64) ([]*models.Meal, error)

func (*Handler) GetIngredients

func (dbHandler *Handler) GetIngredients() ([]*models.Ingredient, error)

func (*Handler) GetMeal

func (dbHandler *Handler) GetMeal(id int64) (*models.Meal, error)

func (*Handler) GetTags

func (dbHandler *Handler) GetTags() ([]*models.Tag, error)

func (*Handler) UpdateMeal

func (dbHandler *Handler) UpdateMeal(m models.Meal) (models.Meal, error)

Jump to

Keyboard shortcuts

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