Documentation
¶
Index ¶
- Constants
- func GetTagGroups(tags []*Tag) []string
- func Schema() *jsonschema.Schema
- func SeedToYAML(path string) error
- func Slugify(name string) string
- type Equipment
- type Filter
- func (f Filter) Clear() Filter
- func (f Filter) HasEquipmentRules() bool
- func (f Filter) HasIngredientRules() bool
- func (f Filter) HasTagRules() bool
- func (f Filter) IsEmpty() bool
- func (f Filter) WithAddEquipment(equipment string, searchType string) Filter
- func (f Filter) WithAddIngredient(ingredient string, searchType string) Filter
- func (f Filter) WithAddTag(tag string, searchType string) Filter
- func (f Filter) WithName(name string) Filter
- func (f Filter) WithNewFirst(b bool) Filter
- func (f Filter) WithRemoveEquipment(equipment string, searchType string) Filter
- func (f Filter) WithRemoveIngredient(ingredient string, searchType string) Filter
- func (f Filter) WithRemoveTag(tag string, searchType string) Filter
- type Idea
- type Ingredient
- type Instruction
- type Nutrition
- type Product
- type Recipe
- func (r *Recipe) EquipmentJSONString() string
- func (r *Recipe) IdeasJSONString() string
- func (r *Recipe) IngredientsJSONString() string
- func (r *Recipe) InstructionsJSONString() string
- func (r *Recipe) JSONString() string
- func (r *Recipe) Link(baseURL string) string
- func (r *Recipe) MetaJSONString() string
- func (r *Recipe) PostProcess()
- func (r *Recipe) ShareText() string
- func (r *Recipe) SourcesJSONString() string
- func (r *Recipe) TagsJSONString() string
- type Source
- type Tag
Constants ¶
View Source
const ( SearchTypeInclude = "include" SearchTypeExclude = "exclude" )
View Source
const ( NutritionPrecisionExact = "exact" NutritionPrecisionApprox = "approx" NutritionPrecisionProfessional = "professional" // calculated by a professional NutritionPrecisionAuto = "auto" // calculated by the system LangEn = "en" LangRu = "ru" )
View Source
const (
TagSeparator = ":"
)
Variables ¶
This section is empty.
Functions ¶
func GetTagGroups ¶
func Schema ¶
func Schema() *jsonschema.Schema
func SeedToYAML ¶
SeedToYAML saves each seed recipe to a file (using Recipe.Slug as file name)
Types ¶
type Equipment ¶
type Equipment struct {
ID uuid.UUID `json:"-" yaml:"-"`
Name string `json:"name"`
Slug string `json:"-" yaml:"-"`
}
func EquipmentFromJSONString ¶
type Filter ¶
type Filter struct {
NameContains string
Locale string
Equipment []string
EquipmentNot []string
Tag []string
TagNot []string
Ingredient []string
IngredientNot []string
Limit int
Offset int
NewFirst bool
WithEdges bool
}
func (Filter) HasEquipmentRules ¶
func (Filter) HasIngredientRules ¶
func (Filter) HasTagRules ¶
func (Filter) WithAddEquipment ¶
func (Filter) WithAddIngredient ¶
func (Filter) WithNewFirst ¶
func (Filter) WithRemoveEquipment ¶
func (Filter) WithRemoveIngredient ¶
type Idea ¶
func IdeasFromJSONString ¶
type Ingredient ¶
type Ingredient struct {
ID uuid.UUID `json:"-" yaml:"-"`
Product *Product `json:"product"`
Quantity string `json:"quantity"`
Unit string `json:"unit"`
Optional bool `json:"optional,omitempty" yaml:",omitempty"`
}
func IngredientsFromJSONString ¶
func IngredientsFromJSONString(data string) []*Ingredient
func (*Ingredient) Slugify ¶
func (i *Ingredient) Slugify()
type Instruction ¶
func InstructionsFromJSONString ¶
func InstructionsFromJSONString(data string) []Instruction
type Nutrition ¶
type Nutrition struct {
Calories int `json:"calories"`
Fat int `json:"fat"`
Carbs int `json:"carbs"`
Protein int `json:"protein"`
Precision string `json:"precision"`
Benefits []string `json:"benefits"`
}
func NutritionFromJSONString ¶
func (*Nutrition) JSONString ¶
type Recipe ¶
type Recipe struct {
ID uuid.UUID `json:"-" yaml:"-"`
Slug string `json:"-" yaml:"-"`
Name string `json:"name"`
Description string `json:"description"` // Short description for catalog
Text string `json:"text"` // Long description for recipe page
Tags []*Tag `json:"tags"`
Ingredients []*Ingredient `json:"ingredients"`
Equipment []*Equipment `json:"equipment"`
Instructions []Instruction `json:"instructions"` // Steps to prepare the recipe
Ideas []*Idea `json:"ideas"` // Ideas for variations
Time time.Duration `json:"time"`
Servings int `json:"servings"`
Nutrition *Nutrition `json:"nutrition"`
Meta map[string]string `json:"meta"`
Lang string `json:"lang"`
Rating float32 `json:"rating"`
Sources []*Source `json:"sources"`
ModerationStatus string `json:"moderation_status" yaml:"-"`
Published bool `json:"published"`
}
func LoadFromYAML ¶
func LoadRecipeFromString ¶
func PumpkinBuns ¶
func PumpkinBuns() *Recipe
func PumpkinSoup ¶
func PumpkinSoup() *Recipe
func (*Recipe) EquipmentJSONString ¶
func (*Recipe) IdeasJSONString ¶
func (*Recipe) IngredientsJSONString ¶
func (*Recipe) InstructionsJSONString ¶
func (*Recipe) JSONString ¶
func (*Recipe) MetaJSONString ¶
func (*Recipe) PostProcess ¶
func (r *Recipe) PostProcess()
func (*Recipe) SourcesJSONString ¶
func (*Recipe) TagsJSONString ¶
type Source ¶
type Source struct {
ID uuid.UUID `json:"-" yaml:"-"`
Name string `json:"name"`
Description string `json:"description"`
URL string `json:"url"`
}
func SourcesFromJSONString ¶
type Tag ¶
type Tag struct {
ID uuid.UUID `json:"-" yaml:"-"`
Name string `json:"name"`
Group string `json:"group"`
Slug string `json:"-" yaml:"-"`
}
func FilterTagsByGroup ¶
func TagFromTitle ¶
func TagsFromJSONString ¶
Click to show internal directories.
Click to hide internal directories.