Documentation ¶
Overview ¶
Package models provides various abstractions/representations of real-world concepts or objects.
Index ¶
- Variables
- func EnsureNutritionUnitForString(nutritionValue any, nutritionProperty string) string
- type AdvancedSearch
- type AppInfo
- type AuthToken
- type AzureDIError
- type AzureDILayout
- type Broker
- func (b *Broker) Add(userID int64, c *websocket.Conn)
- func (b *Broker) Clone() *Broker
- func (b *Broker) Has(userID int64) bool
- func (b *Broker) HideNotification(userID int64)
- func (b *Broker) Monitor()
- func (b *Broker) SendFile(fileName string, data *bytes.Buffer, userID int64)
- func (b *Broker) SendProgress(title string, value, numValues int, userID int64)
- func (b *Broker) SendProgressStatus(title string, isToastVisible bool, value, numValues int, userID int64)
- func (b *Broker) SendToast(toast Toast, userID int64)
- type Category
- type Cookbook
- type CookingMethod
- type Counts
- type Cuisine
- type Description
- type FFProbe
- type FileType
- type HowToItem
- type Image
- type Ingredients
- type Instructions
- type Keywords
- type Message
- type NextcloudRecipes
- type NutrientFDC
- type NutrientsFDC
- type Nutrition
- type NutritionSchema
- type PaprikaRecipe
- type Progress
- type Recipe
- type RecipeSchema
- type Recipes
- type Replace
- type Report
- type ReportLog
- type ReportType
- type SchemaType
- type SearchOptionsRecipes
- type Share
- type Sort
- type ThumbnailURL
- type Times
- type Toast
- func NewErrorAuthToast(message string) Toast
- func NewErrorDBToast(message string) Toast
- func NewErrorFilesToast(message string) Toast
- func NewErrorFormToast(message string) Toast
- func NewErrorGeneralToast(message string) Toast
- func NewErrorReqToast(message string) Toast
- func NewErrorToast(title, message, action string) Toast
- func NewInfoToast(title, message, action string) Toast
- func NewWarningToast(title, message, action string) Toast
- func NewWarningWSToast(message string) Toast
- type Tools
- type User
- type UserBackup
- type UserSettings
- type VideoObject
- type Videos
- type ViewMode
- type Website
- type Websites
- type Yield
Constants ¶
This section is empty.
Variables ¶
var ( ErrIsAccuChef = errors.New("accuchef") // TODO: Place errors somewhere else. ErrIsEasyRecipeDeluxe = errors.New("easy recipe deluxe") )
Errors to signal specific applications.
Functions ¶
func EnsureNutritionUnitForString ¶ added in v1.2.0
EnsureNutritionUnitForString extracts digits from nutritional property and appends metric unit. Returns a string value.
Types ¶
type AdvancedSearch ¶ added in v1.2.0
type AdvancedSearch struct { Category string Cuisine string Description string Ingredients string Instructions string Keywords string Name string Source string Text string Tools string }
AdvancedSearch stores the components of an advanced search query.
func NewAdvancedSearch ¶ added in v1.2.0
func NewAdvancedSearch(query string) AdvancedSearch
NewAdvancedSearch creates an AdvancedSearch object from a search query.
type AppInfo ¶ added in v1.1.0
type AppInfo struct { IsUpdateAvailable bool LastUpdatedAt time.Time LastCheckedUpdateAt time.Time }
AppInfo holds information on the application.
type AuthToken ¶
type AuthToken struct { ID int64 Selector string HashValidator string Expires time.Time UserID int64 }
AuthToken holds details on an authentication token.
type AzureDIError ¶ added in v1.2.0
type AzureDIError struct { Error struct { Code string `json:"code"` Message string `json:"message"` } `json:"error"` }
AzureDIError holds the data of an Azure AI Document Intelligence error.
type AzureDILayout ¶ added in v1.2.0
type AzureDILayout struct { Status string `json:"status"` CreatedDateTime time.Time `json:"createdDateTime"` LastUpdatedDateTime time.Time `json:"lastUpdatedDateTime"` AnalyzeResult struct { APIVersion string `json:"apiVersion"` ModelID string `json:"modelId"` StringIndexType string `json:"stringIndexType"` Content string `json:"content"` Pages []struct { PageNumber int `json:"pageNumber"` Angle float64 `json:"angle"` Width float64 `json:"width"` Height float64 `json:"height"` Unit string `json:"unit"` Words []struct { Content string `json:"content"` Polygon []float64 `json:"polygon"` Confidence float64 `json:"confidence"` Span struct { Offset int `json:"offset"` Length int `json:"length"` } `json:"span"` } `json:"words"` Lines []struct { Content string `json:"content"` Polygon []float64 `json:"polygon"` Spans []struct { Offset int `json:"offset"` Length int `json:"length"` } `json:"spans"` } `json:"lines"` Spans []struct { Offset int `json:"offset"` Length int `json:"length"` } `json:"spans"` } `json:"pages"` Tables []interface{} `json:"tables"` Paragraphs []azureDIParagraph `json:"paragraphs"` Styles []struct { Confidence float64 `json:"confidence"` Spans []struct { Offset int `json:"offset"` Length int `json:"length"` } `json:"spans"` IsHandwritten bool `json:"isHandwritten"` } `json:"styles"` ContentFormat string `json:"contentFormat"` Sections []struct { Spans []struct { Offset int `json:"offset"` Length int `json:"length"` } `json:"spans"` Elements []string `json:"elements"` } `json:"sections"` } `json:"analyzeResult"` }
AzureDILayout holds the data contained in the response of a call to the Azure AI Document Intelligence layout analysis endpoint.
func (*AzureDILayout) Recipe ¶ added in v1.2.0
func (a *AzureDILayout) Recipe() Recipe
Recipe converts an AzureDILayout to a Recipe.
type Broker ¶
type Broker struct {
// contains filtered or unexported fields
}
Broker represents a message broker that manages WebSocket connections for subscribers.
func NewBroker ¶
func NewBroker() *Broker
NewBroker creates a subscribes a new Broker for a specific user.
func (*Broker) Has ¶ added in v1.2.0
Has checks whether a subscriber with the given userID exists in the Broker's subscribers map.
func (*Broker) HideNotification ¶
HideNotification hides the websocket's frontend notification.
func (*Broker) Monitor ¶ added in v1.2.0
func (b *Broker) Monitor()
Monitor monitors the websocket connections to clean those closed.
func (*Broker) SendProgress ¶
SendProgress sends a progress update with a title and value to the client. The isToastVisible parameter controls whether the progress bar is displayed in a toast notification.
type Category ¶
type Category struct {
Value string
}
Category holds a recipe's category.
func NewCategory ¶ added in v1.2.0
NewCategory creates an initialized Category. The default value of a Category is 'uncategorized'.
func (*Category) MarshalJSON ¶
MarshalJSON encodes the category.
func (*Category) UnmarshalJSON ¶
UnmarshalJSON decodes the category according to the schema (https://schema.org/recipeCategory). The schema specifies that the expected value is of type Text. However, some websites send the category in an array, which explains the need for this function.
type Cookbook ¶
Cookbook is the struct that holds information on a cookbook.
func (Cookbook) DominantCategories ¶
DominantCategories returns the `n` most common categories of recipes in the cookbook. If there are fewer than `n` categories, all categories are returned.
type CookingMethod ¶
type CookingMethod struct {
Value string
}
CookingMethod holds a recipe's cooking method.
func (*CookingMethod) MarshalJSON ¶
func (c *CookingMethod) MarshalJSON() ([]byte, error)
MarshalJSON encodes the cuisine.
func (*CookingMethod) UnmarshalJSON ¶
func (c *CookingMethod) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes the cooking method according to the schema (https://schema.org/cookingMethod). The schema specifies that the expected value is of type Text. However, some websites send the cuisine in an array, which explains the need for this function.
type Cuisine ¶
type Cuisine struct {
Value string
}
Cuisine holds a recipe's cuisine type.
func (*Cuisine) MarshalJSON ¶
MarshalJSON encodes the cuisine.
func (*Cuisine) UnmarshalJSON ¶
UnmarshalJSON decodes the cuisine according to the schema (https://schema.org/recipeCuisine). The schema specifies that the expected value is of type Text. However, some websites send the cuisine in an array, which explains the need for this function.
type Description ¶
type Description struct {
Value string
}
Description holds a description.
func (*Description) MarshalJSON ¶
func (d *Description) MarshalJSON() ([]byte, error)
MarshalJSON encodes the description.
func (*Description) UnmarshalJSON ¶
func (d *Description) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes the description field of a recipe.
type FFProbe ¶ added in v1.2.0
type FFProbe struct { Format struct { Duration string `json:"duration"` } `json:"format"` }
FFProbe represents the output JSON of the FFprobe program.
type FileType ¶
type FileType int64
FileType is an alias for a file type, e.g. JSON and PDF.
These constants enumerate all possible file types used by the software.
func NewFileType ¶
NewFileType creates a FileType from the file type name.
type HowToItem ¶ added in v1.2.0
type HowToItem struct { Image string `json:"image,omitempty"` Quantity int `json:"requiredQuantity,omitempty"` Name string `json:"name,omitempty"` Text string `json:"text,omitempty"` Type string `json:"@type,omitempty"` URL string `json:"url,omitempty"` }
HowToItem is a representation of the HowToItem schema (https://schema.org/HowToItem).
func NewHowToStep ¶ added in v1.2.0
NewHowToStep creates an initialized HowToStep struct.
func NewHowToTool ¶ added in v1.2.0
NewHowToTool creates an initialized HowToTool struct.
func (*HowToItem) StringQuantity ¶ added in v1.2.0
StringQuantity stringifies the HowToItem as `{Quantity} {Name}`.
type Image ¶
type Image struct {
Value string
}
Image holds a recipe's image.
func (*Image) MarshalJSON ¶
MarshalJSON encodes the image.
func (*Image) UnmarshalJSON ¶
UnmarshalJSON decodes the image according to the schema (https://schema.org/image).
type Ingredients ¶
type Ingredients struct {
Values []string
}
Ingredients holds a recipe's list of ingredients.
func (*Ingredients) MarshalJSON ¶
func (i *Ingredients) MarshalJSON() ([]byte, error)
MarshalJSON encodes the ingredients.
func (*Ingredients) UnmarshalJSON ¶
func (i *Ingredients) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes the ingredients according to the schema (https://schema.org/recipeInstructions).
type Instructions ¶
type Instructions struct {
Values []HowToItem
}
Instructions holds a recipe's list of instructions.
func (*Instructions) MarshalJSON ¶
func (i *Instructions) MarshalJSON() ([]byte, error)
MarshalJSON encodes the list of instructions.
func (*Instructions) UnmarshalJSON ¶
func (i *Instructions) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes the instructions according to the schema (https://schema.org/recipeInstructions).
type Keywords ¶
type Keywords struct {
Values string
}
Keywords holds keywords as a single string.
func (*Keywords) MarshalJSON ¶
MarshalJSON encodes the keywords.
func (*Keywords) UnmarshalJSON ¶
UnmarshalJSON decodes the recipe's keywords according to the schema (https://schema.org/keywords). Some websites store the keywords in an array, which explains the need for a custom decoder.
type Message ¶
type Message struct { Type string `json:"type"` // Message type, e.g. file. FileName string `json:"fileName"` // File name (applicable for "file" type). Data string `json:"data"` // Message data to pass. Base64-encoded if type is "file". Toast Toast `json:"toast"` // Toast to display to the user. }
Message represents the data format for file and progress updates sent to the client.
type NextcloudRecipes ¶
type NextcloudRecipes struct { Category string `json:"category"` DateCreated string `json:"dateCreated"` DateModified string `json:"dateModified"` ID int64 `json:"recipe_id"` ImagePlaceholderURL string `json:"imagePlaceholderUrl"` ImageURL string `json:"imageUrl"` Keywords string `json:"keywords"` }
NextcloudRecipes holds a Nextcloud recipe's metadata obtained from the Nextcloud Cookbook's /recipes endpoint.
type NutrientFDC ¶
type NutrientFDC struct { ID int64 Name string Amount float64 UnitName string Reference units.Measurement }
NutrientFDC holds the nutrient data from the FDC database.
func (NutrientFDC) Value ¶
func (n NutrientFDC) Value() float64
Value calculates the amount of the nutrient scaled to the reference, in grams.
type NutrientsFDC ¶
type NutrientsFDC []NutrientFDC
NutrientsFDC is a type alias for a slice of NutrientFDC.
func (NutrientsFDC) NutritionFact ¶
func (n NutrientsFDC) NutritionFact(weight float64) Nutrition
NutritionFact calculates the nutrition facts from the nutrients. The values in the nutrition table are per 100 grams. The weight is the sum of all ingredient quantities in grams.
type Nutrition ¶
type Nutrition struct { Calories string Cholesterol string Fiber string IsPerServing bool Protein string TotalFat string SaturatedFat string UnsaturatedFat string TransFat string Sodium string Sugars string TotalCarbohydrates string }
Nutrition holds nutrition facts.
func (*Nutrition) Clean ¶ added in v1.2.0
func (n *Nutrition) Clean()
Clean empties any negligent field of the Nutrition.
func (*Nutrition) Schema ¶
func (n *Nutrition) Schema(servings string) *NutritionSchema
Schema creates the schema representation of the Nutrition.
type NutritionSchema ¶
type NutritionSchema struct { Calories string `json:"calories,omitempty"` Carbohydrates string `json:"carbohydrateContent,omitempty"` Cholesterol string `json:"cholesterolContent,omitempty"` Fat string `json:"fatContent,omitempty"` Fiber string `json:"fiberContent,omitempty"` Protein string `json:"proteinContent,omitempty"` SaturatedFat string `json:"saturatedFatContent,omitempty"` Servings string `json:"servingSize,omitempty"` Sodium string `json:"sodiumContent,omitempty"` Sugar string `json:"sugarContent,omitempty"` TransFat string `json:"transFatContent,omitempty"` UnsaturatedFat string `json:"unsaturatedFatContent,omitempty"` }
NutritionSchema is a representation of the nutrition schema (https://schema.org/NutritionInformation).
func (*NutritionSchema) Equal ¶ added in v1.2.0
func (n *NutritionSchema) Equal(other NutritionSchema) bool
Equal verifies whether the NutritionSchema equals the other.
func (*NutritionSchema) UnmarshalJSON ¶
func (n *NutritionSchema) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes the nutrition according to the schema.
type PaprikaRecipe ¶ added in v1.2.0
type PaprikaRecipe struct { UID string `json:"uid"` Created string `json:"created"` Hash string `json:"hash"` Name string `json:"name"` Description string `json:"description"` Ingredients string `json:"ingredients"` Directions string `json:"directions"` Notes string `json:"notes"` NutritionalInfo string `json:"nutritional_info"` PrepTime string `json:"prep_time"` CookTime string `json:"cook_time"` TotalTime string `json:"total_time"` Difficulty string `json:"difficulty"` Servings string `json:"servings"` Rating int `json:"rating"` Source string `json:"source"` SourceURL string `json:"source_url"` Photo string `json:"photo"` PhotoLarge any `json:"photo_large"` PhotoHash string `json:"photo_hash"` ImageURL string `json:"image_url"` Categories []string `json:"categories"` PhotoData string `json:"photo_data"` Photos []struct { Name string `json:"name"` Filename string `json:"filename"` Hash string `json:"hash"` Data string `json:"data"` } `json:"photos"` }
PaprikaRecipe holds a Paprika recipe's JSON data.
type Progress ¶
Progress represents a current value and the total number of values. It is used to calculate progress as a percentage.
type Recipe ¶
type Recipe struct { Category string CreatedAt time.Time Cuisine string Description string ID int64 Images []uuid.UUID Ingredients []string Instructions []string Keywords []string Name string Nutrition Nutrition Times Times Tools []HowToItem UpdatedAt time.Time URL string Videos []VideoObject Yield int16 }
Recipe is the struct that holds a recipe's information.
func NewBaseRecipe ¶ added in v1.1.0
func NewBaseRecipe() Recipe
NewBaseRecipe creates a new, empty Recipe.
func NewRecipeFromCrouton ¶ added in v1.2.0
func NewRecipeFromCrouton(r io.Reader, uploadImageFunc func(rc io.ReadCloser) (uuid.UUID, error)) Recipe
NewRecipeFromCrouton create a Recipe from the content of a Crouton file.
func NewRecipeFromTextFile ¶ added in v1.1.0
NewRecipeFromTextFile extracts the recipe from a text file.
func (*Recipe) ConvertMeasurementSystem ¶
ConvertMeasurementSystem converts a recipe to another units.System.
func (*Recipe) Normalize ¶
func (r *Recipe) Normalize()
Normalize normalizes texts for readability. It normalizes quantities, i.e. 1l -> 1L and 1 ml -> 1 mL.
func (*Recipe) Schema ¶
func (r *Recipe) Schema() RecipeSchema
Schema creates the schema representation of the Recipe.
type RecipeSchema ¶
type RecipeSchema struct { AtContext string `json:"@context"` AtGraph []*RecipeSchema `json:"@graph,omitempty"` AtType *SchemaType `json:"@type"` Category *Category `json:"recipeCategory,omitempty"` CookTime string `json:"cookTime,omitempty"` CookingMethod *CookingMethod `json:"cookingMethod,omitempty"` Cuisine *Cuisine `json:"recipeCuisine,omitempty"` DateCreated string `json:"dateCreated,omitempty"` DateModified string `json:"dateModified,omitempty"` DatePublished string `json:"datePublished,omitempty"` Description *Description `json:"description"` Keywords *Keywords `json:"keywords,omitempty"` Image *Image `json:"image,omitempty"` Ingredients *Ingredients `json:"recipeIngredient,omitempty"` Instructions *Instructions `json:"recipeInstructions,omitempty"` Name string `json:"name,omitempty"` NutritionSchema *NutritionSchema `json:"nutrition,omitempty"` PrepTime string `json:"prepTime,omitempty"` ThumbnailURL *ThumbnailURL `json:"thumbnailUrl,omitempty"` Tools *Tools `json:"tool,omitempty"` TotalTime string `json:"totalTime,omitempty"` Yield *Yield `json:"recipeYield,omitempty"` URL string `json:"url,omitempty"` Video *Videos `json:"video,omitempty"` }
RecipeSchema is a representation of the Recipe schema (https://schema.org/Recipe).
func NewRecipeSchema ¶ added in v1.2.0
func NewRecipeSchema() RecipeSchema
NewRecipeSchema creates an initialized RecipeSchema.
func (*RecipeSchema) Equal ¶ added in v1.2.0
func (r *RecipeSchema) Equal(other RecipeSchema) bool
Equal verifies whether a RecipeSchema is equal to the other.
func (*RecipeSchema) Recipe ¶
func (r *RecipeSchema) Recipe() (*Recipe, error)
Recipe transforms the RecipeSchema to a Recipe.
type Recipes ¶
type Recipes []Recipe
Recipes is the type for a slice of recipes.
func NewRecipesFromAccuChef ¶ added in v1.2.0
NewRecipesFromAccuChef extracts all recipes from an exported Accuchef file.
func NewRecipesFromCML ¶ added in v1.2.0
func NewRecipesFromCML(r io.Reader, file *multipart.FileHeader, uploadImageFunc func(rc io.ReadCloser) (uuid.UUID, error)) Recipes
NewRecipesFromCML extracts all recipes from a CookML file.
func NewRecipesFromEasyRecipeDeluxe ¶ added in v1.2.0
NewRecipesFromEasyRecipeDeluxe extracts the recipes from a MasterCook file.
func NewRecipesFromMasterCook ¶
NewRecipesFromMasterCook extracts the recipes from a MasterCook file.
func NewRecipesFromRecipeKeeper ¶ added in v1.2.0
NewRecipesFromRecipeKeeper extracts the recipes from a Recipe Keeper export.
func (Recipes) Categories ¶
Categories returns the category of every recipe. The resulting slice has no duplicates.
type Replace ¶ added in v1.2.0
Replace holds the old and new values for a strings.ReplaceAll operation.
type Report ¶ added in v1.1.0
type Report struct { CreatedAt time.Time ExecTime time.Duration ID int64 Logs []ReportLog Type ReportType }
Report holds information on a report.
func NewReport ¶ added in v1.1.0
func NewReport(reportType ReportType) Report
NewReport creates a new, initialized and empty Report of the given ReportType.
type ReportLog ¶ added in v1.1.0
ReportLog holds information on a report's log.
func NewReportLog ¶ added in v1.2.0
NewReportLog creates a new ReportLog from the title and error.
type ReportType ¶ added in v1.1.0
type ReportType int64
ReportType represents
const ImportReportType ReportType = 1
ImportReportType is the ReportType for importing recipes, either from files or the web.
type SchemaType ¶
type SchemaType struct {
Value string
}
SchemaType holds the type of the schema. It should be "Recipe".
func (*SchemaType) MarshalJSON ¶
func (s *SchemaType) MarshalJSON() ([]byte, error)
MarshalJSON encodes the schema's type.
func (*SchemaType) UnmarshalJSON ¶
func (s *SchemaType) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes the type of the schema. The type "Recipe" will be searched for if the data is an array.
type SearchOptionsRecipes ¶
type SearchOptionsRecipes struct { Advanced AdvancedSearch CookbookID int64 Query string Page uint64 Sort Sort }
SearchOptionsRecipes defines the options for searching recipes.
func NewSearchOptionsRecipe ¶ added in v1.1.0
func NewSearchOptionsRecipe(query url.Values) SearchOptionsRecipes
NewSearchOptionsRecipe creates a SearchOptionsRecipe struct configured for the search method.
func (*SearchOptionsRecipes) Arg ¶ added in v1.2.0
func (s *SearchOptionsRecipes) Arg() string
Arg returns combines the field values of the struct, ready for FTS.
func (*SearchOptionsRecipes) IsBasic ¶ added in v1.2.0
func (s *SearchOptionsRecipes) IsBasic() bool
IsBasic verifies whether the search is basic.
type Share ¶
type Share struct {}
Share stores the ID of a recipe and the ID of the user who shared it.
type Sort ¶ added in v1.1.0
type Sort struct { IsAToZ bool IsZToA bool IsNewestToOldest bool IsOldestToNewest bool IsDefault bool IsRandom bool }
Sort defines sorting options.
type ThumbnailURL ¶ added in v1.2.0
type ThumbnailURL struct {
Value string
}
ThumbnailURL holds a recipe's thumbnail.
func (*ThumbnailURL) MarshalJSON ¶ added in v1.2.0
func (t *ThumbnailURL) MarshalJSON() ([]byte, error)
MarshalJSON encodes the thumbnail URL.
func (*ThumbnailURL) UnmarshalJSON ¶ added in v1.2.0
func (t *ThumbnailURL) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes the thumbnail URL according to the schema (https://schema.org/URL).
type Times ¶
Times holds a variety of intervals.
type Toast ¶ added in v1.1.0
type Toast struct { Action string `json:"action"` Background string `json:"background"` Message string `json:"message"` Title string `json:"title"` }
Toast holds data related to a notification toast.
func NewErrorAuthToast ¶ added in v1.1.0
NewErrorAuthToast creates an action-less error Toast with the title of "Auth Error".
func NewErrorDBToast ¶ added in v1.1.0
NewErrorDBToast creates an action-less error Toast with the title of "Database Error".
func NewErrorFilesToast ¶ added in v1.1.0
NewErrorFilesToast creates an action-less error Toast with the title of "Files Error".
func NewErrorFormToast ¶ added in v1.1.0
NewErrorFormToast creates an action-less error Toast with the title of "Form Error".
func NewErrorGeneralToast ¶ added in v1.1.0
NewErrorGeneralToast creates an action-less error Toast with the title of "General Error".
func NewErrorReqToast ¶ added in v1.1.0
NewErrorReqToast creates an action-less error Toast with the title of "Request Error".
func NewErrorToast ¶ added in v1.1.0
NewErrorToast creates a new error notification.
func NewInfoToast ¶ added in v1.1.0
NewInfoToast creates a new info notification.
func NewWarningToast ¶ added in v1.1.0
NewWarningToast creates a new warning notification.
func NewWarningWSToast ¶ added in v1.1.0
NewWarningWSToast creates an action-less warning Toast with the title of "Websocket".
type Tools ¶
type Tools struct {
Values []HowToItem
}
Tools holds the list of tools used for a recipe.
func (*Tools) MarshalJSON ¶
MarshalJSON encodes the list of tools.
func (*Tools) UnmarshalJSON ¶
UnmarshalJSON decodes the tools according to the schema (https://schema.org/tool).
type UserBackup ¶ added in v1.1.0
type UserBackup struct { DeleteSQL string ImagesPath string InsertSQL string Recipes Recipes UserID int64 }
UserBackup holds components related to a user backup.
type UserSettings ¶
type UserSettings struct { CalculateNutritionFact bool ConvertAutomatically bool CookbooksViewMode ViewMode MeasurementSystem units.System }
UserSettings holds the user's settings.
func (*UserSettings) IsCalculateNutrition ¶
func (u *UserSettings) IsCalculateNutrition(recipe *Recipe) bool
IsCalculateNutrition verifies whether the nutrition facts should be calculated for the recipe.
type VideoObject ¶ added in v1.2.0
type VideoObject struct { AtID string `json:"@id"` AtType string `json:"@type"` ContentURL string `json:"contentUrl,omitempty"` Description string `json:"description,omitempty"` Duration string `json:"duration,omitempty"` EmbedURL string `json:"embedUrl,omitempty"` Expires time.Time `json:"expires,omitempty"` ID uuid.UUID `json:"-"` IsIFrame bool `json:"_"` Name string `json:"name,omitempty"` ThumbnailURL *ThumbnailURL `json:"thumbnailUrl,omitempty"` UploadDate time.Time `json:"uploadDate,omitempty"` }
VideoObject is a representation of the VideoObject schema (https://schema.org/VideoObject).
type Videos ¶ added in v1.2.0
type Videos struct {
Values []VideoObject
}
Videos holds a list of VideoObject.
func (*Videos) MarshalJSON ¶ added in v1.2.0
MarshalJSON encodes the value of the yield.
func (*Videos) UnmarshalJSON ¶ added in v1.2.0
UnmarshalJSON decodes the Videos according to the schema (https://schema.org/VideoObject).
type ViewMode ¶
type ViewMode int
ViewMode is an integer type alias for various data view modes.
These constants enumerate all possible viewing modes.
func ViewModeFromInt ¶
ViewModeFromInt returns the ViewMode for the respective integer.
func ViewModeFromString ¶
ViewModeFromString returns the ViewMode for the respective string.
type Yield ¶
type Yield struct {
Value int16
}
Yield holds a recipe's yield.
func (*Yield) MarshalJSON ¶
MarshalJSON encodes the value of the yield.
func (*Yield) UnmarshalJSON ¶
UnmarshalJSON decodes the yield according to the schema (https://schema.org/recipeYield).