db

package
v0.0.0-...-4512218 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Course

type Course struct {
	ID        int32        `json:"id"`
	Course    string       `json:"course"`
	SortOrder int32        `json:"sort_order"`
	Active    sql.NullBool `json:"active"`
}

type CreateRecipeParams

type CreateRecipeParams struct {
	Title          string         `json:"title"`
	Description    string         `json:"description"`
	PrepTime       int32          `json:"prep_time"`
	CookTime       int32          `json:"cook_time"`
	ReadyIn        int32          `json:"ready_in"`
	Yelds          int32          `json:"yelds"`
	LevelID        int32          `json:"level_id"`
	CaloriesPerSrv int32          `json:"calories_per_srv"`
	CuisineID      int32          `json:"cuisine_id"`
	Source         sql.NullString `json:"source"`
	Rating         sql.NullInt32  `json:"rating"`
	ImagePath      string         `json:"image_path"`
}

type Cuisine

type Cuisine struct {
	ID        int32        `json:"id"`
	Cuisine   string       `json:"cuisine"`
	SortOrder int32        `json:"sort_order"`
	Active    sql.NullBool `json:"active"`
}

type DBTX

type DBTX interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	PrepareContext(context.Context, string) (*sql.Stmt, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

type FoodCategory

type FoodCategory struct {
	ID           int32        `json:"id"`
	FoodCategory string       `json:"food_category"`
	SortOrder    string       `json:"sort_order"`
	Active       sql.NullBool `json:"active"`
}

type Footnote

type Footnote struct {
	ID       int32          `json:"id"`
	RecipeID sql.NullInt32  `json:"recipe_id"`
	Footnote sql.NullString `json:"footnote"`
	Print    bool           `json:"print"`
}

type Ingredient

type Ingredient struct {
	ID         int32        `json:"id"`
	Ingredient string       `json:"ingredient"`
	SortOrder  int32        `json:"sort_order"`
	Active     sql.NullBool `json:"active"`
}

type Level

type Level struct {
	ID          int32        `json:"id"`
	Description string       `json:"description"`
	SortOrder   int32        `json:"sort_order"`
	Active      sql.NullBool `json:"active"`
}

type ListRecipesParams

type ListRecipesParams struct {
	Limit  int32 `json:"limit"`
	Offset int32 `json:"offset"`
}

type Measurement

type Measurement struct {
	ID                int32        `json:"id"`
	Measurement       string       `json:"measurement"`
	Abbreviation      string       `json:"abbreviation"`
	RecipeOrNutrition int32        `json:"recipe_or_nutrition"`
	SortOrder         int32        `json:"sort_order"`
	Active            sql.NullBool `json:"active"`
}
type Menu struct {
	ID          int32        `json:"id"`
	Menu        string       `json:"menu"`
	Description string       `json:"description"`
	SortOrder   int32        `json:"sort_order"`
	Active      sql.NullBool `json:"active"`
}
type MenuRecipe struct {
	ID       int32         `json:"id"`
	RecipeID sql.NullInt32 `json:"recipe_id"`
	MenuID   sql.NullInt32 `json:"menu_id"`
	Notes    string        `json:"notes"`
}

type NutritionalInfo

type NutritionalInfo struct {
	ID            int32         `json:"id"`
	Nutrition     string        `json:"nutrition"`
	MeasurementID sql.NullInt32 `json:"measurement_id"`
	SortOrder     string        `json:"sort_order"`
	Active        sql.NullBool  `json:"active"`
}

type PGStore

type PGStore struct {
	*Queries
	// contains filtered or unexported fields
}

Store provides all function to execure db queries and transactons

func (*PGStore) UpdateRecipeProc

func (store *PGStore) UpdateRecipeProc(ctx context.Context, params UpdateRecipeParams) (Recipe, error)

type Querier

type Querier interface {
	CreateRecipe(ctx context.Context, arg CreateRecipeParams) (Recipe, error)
	DeleteRecipe(ctx context.Context, id int32) error
	GetRecipeById(ctx context.Context, id int32) (Recipe, error)
	GetRecipeForUpdate(ctx context.Context, id int32) (Recipe, error)
	ListRecipes(ctx context.Context, arg ListRecipesParams) ([]Recipe, error)
	UpdateRecipe(ctx context.Context, arg UpdateRecipeParams) (Recipe, error)
}

type Queries

type Queries struct {
	// contains filtered or unexported fields
}

func New

func New(db DBTX) *Queries

func (*Queries) CreateRecipe

func (q *Queries) CreateRecipe(ctx context.Context, arg CreateRecipeParams) (Recipe, error)

func (*Queries) DeleteRecipe

func (q *Queries) DeleteRecipe(ctx context.Context, id int32) error

func (*Queries) GetRecipeById

func (q *Queries) GetRecipeById(ctx context.Context, id int32) (Recipe, error)

func (*Queries) GetRecipeForUpdate

func (q *Queries) GetRecipeForUpdate(ctx context.Context, id int32) (Recipe, error)

func (*Queries) ListRecipes

func (q *Queries) ListRecipes(ctx context.Context, arg ListRecipesParams) ([]Recipe, error)

func (*Queries) UpdateRecipe

func (q *Queries) UpdateRecipe(ctx context.Context, arg UpdateRecipeParams) (Recipe, error)

func (*Queries) WithTx

func (q *Queries) WithTx(tx *sql.Tx) *Queries

type Recipe

type Recipe struct {
	ID             int32          `json:"id"`
	Title          string         `json:"title"`
	Description    string         `json:"description"`
	PrepTime       int32          `json:"prep_time"`
	CookTime       int32          `json:"cook_time"`
	ReadyIn        int32          `json:"ready_in"`
	Yelds          int32          `json:"yelds"`
	LevelID        int32          `json:"level_id"`
	CaloriesPerSrv int32          `json:"calories_per_srv"`
	CuisineID      int32          `json:"cuisine_id"`
	Source         sql.NullString `json:"source"`
	Rating         sql.NullInt32  `json:"rating"`
	ImagePath      string         `json:"image_path"`
}

type RecipeCourse

type RecipeCourse struct {
	ID       int32         `json:"id"`
	RecipeID sql.NullInt32 `json:"recipe_id"`
	CourseID sql.NullInt32 `json:"course_id"`
}

type RecipeFoodCategory

type RecipeFoodCategory struct {
	ID             int32         `json:"id"`
	RecipeID       sql.NullInt32 `json:"recipe_id"`
	FoodCategoryID sql.NullInt32 `json:"food_category_id"`
}

type RecipeIngredient

type RecipeIngredient struct {
	ID            int32         `json:"id"`
	RecipeID      sql.NullInt32 `json:"recipe_id"`
	Amount        float64       `json:"amount"`
	MeasurementID sql.NullInt32 `json:"measurement_id"`
	IngredientID  sql.NullInt32 `json:"ingredient_id"`
	Instructions  string        `json:"instructions"`
}

type RecipeNutritionalInfo

type RecipeNutritionalInfo struct {
	ID                int32         `json:"id"`
	RecipeID          sql.NullInt32 `json:"recipe_id"`
	NutritionalInfoID sql.NullInt32 `json:"nutritional_info_id"`
}

type RecipePart

type RecipePart struct {
	ID            int32         `json:"id"`
	RecipeID      sql.NullInt32 `json:"recipe_id"`
	RecipieIDPart sql.NullInt32 `json:"recipie_id_part"`
	Title         string        `json:"title"`
}

type RecipeStep

type RecipeStep struct {
	ID           int32         `json:"id"`
	RecipeID     sql.NullInt32 `json:"recipe_id"`
	StepNumber   int32         `json:"step_number"`
	Instructions string        `json:"instructions"`
}

type Store

type Store interface {
	Querier
	UpdateRecipeProc(ctx context.Context, params UpdateRecipeParams) (Recipe, error)
}

func NewStore

func NewStore(db *sql.DB) Store

type UpdateRecipeParams

type UpdateRecipeParams struct {
	ID             int32          `json:"id"`
	Title          string         `json:"title"`
	Description    string         `json:"description"`
	PrepTime       int32          `json:"prep_time"`
	CookTime       int32          `json:"cook_time"`
	ReadyIn        int32          `json:"ready_in"`
	Yelds          int32          `json:"yelds"`
	LevelID        int32          `json:"level_id"`
	CaloriesPerSrv int32          `json:"calories_per_srv"`
	CuisineID      int32          `json:"cuisine_id"`
	Source         sql.NullString `json:"source"`
	Rating         sql.NullInt32  `json:"rating"`
	ImagePath      string         `json:"image_path"`
}

Jump to

Keyboard shortcuts

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