Documentation ¶
Index ¶
- Variables
- func InitDB(conf config.DBConfig) error
- type CreateRecipe
- type CreateRecipeInfo
- type CreateUser
- type Label
- type PantryItem
- type PantryLocation
- type ReadRecipe
- type Recipe
- type RecipeInfo
- type RecipeInfoYields
- type RecipeIngredient
- type RecipeStep
- type TimeBase
- type UUIDBase
- type UpdateIngredient
- type UpdateRecipe
- type UpdateRecipeInfo
- type UpdateStep
- type User
Constants ¶
This section is empty.
Variables ¶
View Source
var DB *gorm.DB
Functions ¶
Types ¶
type CreateRecipe ¶
type CreateRecipe struct { Title string `json:"title" validate:"required,min=1,max=60"` Info CreateRecipeInfo `json:"info,omitempty"` ShortDescription *string `json:"shortDescription,omitempty" validate:"omitempty,max=256"` LongDescription *string `json:"longDescription,omitempty"` Ingredients []RecipeIngredient `json:"ingredients,omitempty"` Steps []RecipeStep `json:"steps,omitempty"` Labels []string `json:"labels,omitempty" validate:"dive,min=1,max=60"` }
func (*CreateRecipe) IntoRecipe ¶
type CreateRecipeInfo ¶
type CreateRecipeInfo RecipeInfo
type CreateUser ¶
type CreateUser struct { Username string `json:"username" validate:"required,alphanum,min=3,max=30"` Password string `json:"password" validate:"required"` }
func (*CreateUser) IntoUser ¶
func (u *CreateUser) IntoUser() User
type PantryItem ¶
type PantryItem struct { UUIDBase TimeBase Name string `gorm:"not null;size:60" json:"name"` LocationId uuid.UUID `gorm:"not null;type:uuid" json:"locationId"` Quantity uint `gorm:"not null;default:1" json:"quantity"` Notes *string `json:"notes,omitempty"` Expiry *time.Time `json:"expiry,omitempty"` Labels []Label `gorm:"many2many:pantry_item_labels" json:"-"` Location PantryLocation `json:"-"` }
type PantryLocation ¶
type ReadRecipe ¶
type ReadRecipe struct { UUIDBase TimeBase OwnerID uuid.UUID `json:"ownerId"` Title string `json:"title"` Info RecipeInfo `json:"info"` ShortDescription *string `json:"shortDescription,omitempty"` LongDescription *string `json:"longDescription,omitempty"` Ingredients *[]RecipeIngredient `json:"ingredients,omitempty"` Steps *[]RecipeStep `json:"steps,omitempty"` ImageID *uuid.UUID `json:"imageId"` Labels []string `json:"labels"` }
type Recipe ¶
type Recipe struct { UUIDBase TimeBase OwnerID uuid.UUID `gorm:"not null;type:uuid" json:"ownerId"` Title string `gorm:"not null;type:varchar(60)" json:"title"` Info RecipeInfo `gorm:"embedded;embeddedPrefix:info_" json:"info"` ShortDescription *string `gorm:"type:varchar(256)" json:"shortDescription,omitempty"` LongDescription *string `json:"longDescription,omitempty"` Ingredients *datatypes.JSONType[[]RecipeIngredient] `gorm:"type:json" json:"ingredients,omitempty"` Steps *datatypes.JSONType[[]RecipeStep] `gorm:"type:json" json:"steps,omitempty"` ImageID *uuid.UUID `gorm:"type:uuid" json:"imageId"` Labels []Label `gorm:"many2many:recipe_labels" json:"-"` }
func (*Recipe) IntoReadRecipe ¶
func (r *Recipe) IntoReadRecipe() ReadRecipe
type RecipeInfo ¶
type RecipeInfo struct { Yields *datatypes.JSONType[RecipeInfoYields] `gorm:"type:json" json:"yields,omitempty"` CookTime uint `gorm:"not null;default:0" json:"cookTime,omitempty"` PrepTime uint `gorm:"not null;default:0" json:"prepTime,omitempty"` Freezable bool `gorm:"not null;default:false" json:"freezable"` MicrowaveOnly bool `gorm:"not null;default:false" json:"microwaveOnly"` Source *string `json:"source,omitempty"` }
type RecipeInfoYields ¶
type RecipeIngredient ¶
type RecipeStep ¶
type UpdateIngredient ¶
type UpdateRecipe ¶
type UpdateRecipe struct { Title *string `json:"title,omitempty" validate:"omitempty,min=1,max=60"` Info UpdateRecipeInfo `json:"info,omitempty"` ShortDescription *string `json:"shortDescription,omitempty" validate:"omitempty,max=256"` LongDescription *string `json:"longDescription,omitempty"` Ingredients *[]UpdateIngredient `json:"ingredients,omitempty"` Steps *[]UpdateStep `json:"steps,omitempty"` ImageID *uuid.UUID `json:"-"` Labels *[]string `json:"labels,omitempty" validate:"omitempty,dive,min=1,max=60"` }
func (*UpdateRecipe) IntoRecipe ¶
func (r *UpdateRecipe) IntoRecipe() Recipe
type UpdateRecipeInfo ¶
type UpdateRecipeInfo RecipeInfo
type UpdateStep ¶
type User ¶
type User struct { UUIDBase TimeBase Username string `gorm:"uniqueIndex;not null;type:varchar(30)" json:"username"` HashedPassword []byte `gorm:"not null" json:"-"` Recipes []Recipe `gorm:"foreignKey:OwnerID" json:"-"` PantryLocations []PantryLocation `gorm:"foreignKey:OwnerId" json:"-"` }
func (*User) IsPasswordMatch ¶
func (*User) SetPassword ¶
Click to show internal directories.
Click to hide internal directories.