Documentation
¶
Index ¶
- Variables
- func IngredientToProto(mongoEntity *Ingredient) (*pbNutrition.Ingredient, error)
- func MacrosToProto(mongoEntity *Macros) (*pbNutrition.Macros, error)
- func MealToProto(mongoEntity *Meal) (*pbNutrition.Meal, error)
- func RecipeToProto(mongoEntity *Recipe) (*pbNutrition.Recipe, error)
- func WeightedIngredientToProto(mongoEntity *WeightedIngredient) (*pbNutrition.WeightedIngredient, error)
- type Ingredient
- type Macros
- type Meal
- type Recipe
- type WeightedIngredient
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidId = errors.New("invalid id")
View Source
var ErrNilInstance = errors.New("nil instance")
Functions ¶
func IngredientToProto ¶
func IngredientToProto(mongoEntity *Ingredient) (*pbNutrition.Ingredient, error)
func MacrosToProto ¶
func MacrosToProto(mongoEntity *Macros) (*pbNutrition.Macros, error)
func MealToProto ¶
func MealToProto(mongoEntity *Meal) (*pbNutrition.Meal, error)
func RecipeToProto ¶
func RecipeToProto(mongoEntity *Recipe) (*pbNutrition.Recipe, error)
func WeightedIngredientToProto ¶
func WeightedIngredientToProto(mongoEntity *WeightedIngredient) (*pbNutrition.WeightedIngredient, error)
Types ¶
type Ingredient ¶
type Ingredient struct {
Id primitive.ObjectID `bson:"_id,omitempty"`
Name string `bson:"name"`
ImagePath string `bson:"image_path"`
MacrosNormalizedTo100g *Macros `bson:"macros_normalized_to_100g"`
}
func IngredientFromProto ¶
func IngredientFromProto(protoEntity *pbNutrition.Ingredient) (*Ingredient, error)
type Macros ¶
type Macros struct {
Proteins float32 `bson:"proteins"`
Carbs float32 `bson:"carbs"`
Fats float32 `bson:"fats"`
Calories float32 `bson:"calories"`
}
func MacrosFromProto ¶
func MacrosFromProto(protoEntity *pbNutrition.Macros) (*Macros, error)
type Meal ¶
type Meal struct {
Id primitive.ObjectID `bson:"_id,omitempty"`
Author string `bson:"author"`
ImagePath string `bson:"image_path"`
BaseRecipeId primitive.ObjectID `bson:"base_recipe_id,omitempty"`
WeightedIngredients []*WeightedIngredient `bson:"weighted_ingredients"`
ConsumptionTimestamp int64 `bson:"consumption_timestamp"`
}
func MealFromProto ¶
func MealFromProto(protoEntity *pbNutrition.Meal) (*Meal, error)
type Recipe ¶
type Recipe struct {
Id primitive.ObjectID `bson:"_id,omitempty"`
Name string `bson:"name"`
ImagePath string `bson:"image_path"`
TasteDescription string `bson:"taste_description"`
CookingStepsDescription string `bson:"cooking_steps_description"`
OriginalIngredientsProportion []*WeightedIngredient `bson:"original_ingredients_proportion"`
}
func RecipeFromProto ¶
func RecipeFromProto(protoEntity *pbNutrition.Recipe) (*Recipe, error)
type WeightedIngredient ¶
type WeightedIngredient struct {
IngredientId primitive.ObjectID `bson:"ingredient_id"`
Mass float32 `bson:"mass"`
}
func WeightedIngredientFromProto ¶
func WeightedIngredientFromProto(protoEntity *pbNutrition.WeightedIngredient) (*WeightedIngredient, error)
Click to show internal directories.
Click to hide internal directories.