Documentation ¶
Index ¶
- Constants
- func CarbohydrateUnits() []string
- func EnergyUnits() []string
- func EnergyValueRangeForUnits(units *string) (float64, float64)
- func FatUnits() []string
- func Meals() []string
- func ProteinUnits() []string
- type Amount
- type Carbohydrate
- type Energy
- type Fat
- type Food
- type Ingredient
- type IngredientArray
- type Nutrition
- type Protein
Constants ¶
View Source
const ( AmountUnitsLengthMaximum = 100 AmountValueMinimum = 0.0 )
View Source
const ( CarbohydrateDietaryFiberGramsMaximum = 1000 CarbohydrateDietaryFiberGramsMinimum = 0 CarbohydrateNetGramsMaximum = 1000 CarbohydrateNetGramsMinimum = 0 CarbohydrateSugarsGramsMaximum = 1000 CarbohydrateSugarsGramsMinimum = 0 CarbohydrateTotalGramsMaximum = 1000 CarbohydrateTotalGramsMinimum = 0 CarbohydrateUnitsGrams = "grams" )
View Source
const ( EnergyKilojoulesPerKilocalorie = 4.1858 EnergyUnitsCalories = "calories" EnergyUnitsJoules = "joules" EnergyUnitsKilocalories = "kilocalories" EnergyUnitsKilojoules = "kilojoules" EnergyValueCaloriesMaximum = EnergyValueKilocaloriesMaximum * 1000.0 EnergyValueCaloriesMinimum = EnergyValueKilocaloriesMinimum * 1000.0 EnergyValueJoulesMaximum = EnergyValueKilojoulesMaximum * 1000.0 EnergyValueJoulesMinimum = EnergyValueKilojoulesMinimum * 1000.0 EnergyValueKilocaloriesMaximum = 10000.0 EnergyValueKilocaloriesMinimum = 0.0 EnergyValueKilojoulesMaximum = EnergyValueKilocaloriesMaximum * EnergyKilojoulesPerKilocalorie EnergyValueKilojoulesMinimum = EnergyValueKilocaloriesMinimum * EnergyKilojoulesPerKilocalorie )
View Source
const ( FatTotalGramsMaximum = 1000 FatTotalGramsMinimum = 0 FatUnitsGrams = "grams" )
View Source
const ( Type = "food" BrandLengthMaximum = 100 CodeLengthMaximum = 100 MealBreakfast = "breakfast" MealDinner = "dinner" MealLunch = "lunch" MealOther = "other" MealOtherLengthMaximum = 100 MealSnack = "snack" NameLengthMaximum = 100 )
View Source
const ( IngredientArrayLengthMaximum = 100 IngredientBrandLengthMaximum = 100 IngredientCodeLengthMaximum = 100 IngredientNameLengthMaximum = 100 )
View Source
const ( ProteinTotalGramsMaximum = 1000 ProteinTotalGramsMinimum = 0 ProteinUnitsGrams = "grams" )
Variables ¶
This section is empty.
Functions ¶
func CarbohydrateUnits ¶ added in v1.26.0
func CarbohydrateUnits() []string
func EnergyUnits ¶ added in v1.26.0
func EnergyUnits() []string
func EnergyValueRangeForUnits ¶ added in v1.26.0
func ProteinUnits ¶ added in v1.26.0
func ProteinUnits() []string
Types ¶
type Amount ¶ added in v1.26.0
type Amount struct { Units *string `json:"units,omitempty" bson:"units,omitempty"` Value *float64 `json:"value,omitempty" bson:"value,omitempty"` }
func ParseAmount ¶ added in v1.26.0
func ParseAmount(parser data.ObjectParser) *Amount
func (*Amount) Normalize ¶ added in v1.26.0
func (a *Amount) Normalize(normalizer data.Normalizer)
func (*Amount) Parse ¶ added in v1.26.0
func (a *Amount) Parse(parser data.ObjectParser)
type Carbohydrate ¶ added in v1.26.0
type Carbohydrate struct { DietaryFiber *int `json:"dietaryFiber,omitempty" bson:"dietaryFiber,omitempty"` Net *int `json:"net,omitempty" bson:"net,omitempty"` Sugars *int `json:"sugars,omitempty" bson:"sugars,omitempty"` Total *int `json:"total,omitempty" bson:"total,omitempty"` Units *string `json:"units,omitempty" bson:"units,omitempty"` }
func NewCarbohydrate ¶ added in v1.26.0
func NewCarbohydrate() *Carbohydrate
func ParseCarbohydrate ¶ added in v1.26.0
func ParseCarbohydrate(parser data.ObjectParser) *Carbohydrate
func (*Carbohydrate) Normalize ¶ added in v1.26.0
func (c *Carbohydrate) Normalize(normalizer data.Normalizer)
func (*Carbohydrate) Parse ¶ added in v1.26.0
func (c *Carbohydrate) Parse(parser data.ObjectParser)
func (*Carbohydrate) Validate ¶ added in v1.26.0
func (c *Carbohydrate) Validate(validator structure.Validator)
type Energy ¶ added in v1.26.0
type Energy struct { Units *string `json:"units,omitempty" bson:"units,omitempty"` Value *float64 `json:"value,omitempty" bson:"value,omitempty"` }
func ParseEnergy ¶ added in v1.26.0
func ParseEnergy(parser data.ObjectParser) *Energy
func (*Energy) Normalize ¶ added in v1.26.0
func (e *Energy) Normalize(normalizer data.Normalizer)
func (*Energy) Parse ¶ added in v1.26.0
func (e *Energy) Parse(parser data.ObjectParser)
type Fat ¶ added in v1.26.0
type Fat struct { Total *int `json:"total,omitempty" bson:"total,omitempty"` Units *string `json:"units,omitempty" bson:"units,omitempty"` }
func ParseFat ¶ added in v1.26.0
func ParseFat(parser data.ObjectParser) *Fat
func (*Fat) Normalize ¶ added in v1.26.0
func (f *Fat) Normalize(normalizer data.Normalizer)
func (*Fat) Parse ¶ added in v1.26.0
func (f *Fat) Parse(parser data.ObjectParser)
type Food ¶
type Food struct { types.Base `bson:",inline"` Amount *Amount `json:"amount,omitempty" bson:"amount,omitempty"` Brand *string `json:"brand,omitempty" bson:"brand,omitempty"` Code *string `json:"code,omitempty" bson:"code,omitempty"` Ingredients *IngredientArray `json:"ingredients,omitempty" bson:"ingredients,omitempty"` Meal *string `json:"meal,omitempty" bson:"meal,omitempty"` MealOther *string `json:"mealOther,omitempty" bson:"mealOther,omitempty"` Name *string `json:"name,omitempty" bson:"name,omitempty"` Nutrition *Nutrition `json:"nutrition,omitempty" bson:"nutrition,omitempty"` }
func (*Food) Normalize ¶
func (f *Food) Normalize(normalizer data.Normalizer)
type Ingredient ¶ added in v1.26.0
type Ingredient struct { Amount *Amount `json:"amount,omitempty" bson:"amount,omitempty"` Brand *string `json:"brand,omitempty" bson:"brand,omitempty"` Code *string `json:"code,omitempty" bson:"code,omitempty"` Ingredients *IngredientArray `json:"ingredients,omitempty" bson:"ingredients,omitempty"` Name *string `json:"name,omitempty" bson:"name,omitempty"` Nutrition *Nutrition `json:"nutrition,omitempty" bson:"nutrition,omitempty"` }
func NewIngredient ¶ added in v1.26.0
func NewIngredient() *Ingredient
func ParseIngredient ¶ added in v1.26.0
func ParseIngredient(parser data.ObjectParser) *Ingredient
func (*Ingredient) Normalize ¶ added in v1.26.0
func (i *Ingredient) Normalize(normalizer data.Normalizer)
func (*Ingredient) Parse ¶ added in v1.26.0
func (i *Ingredient) Parse(parser data.ObjectParser)
func (*Ingredient) Validate ¶ added in v1.26.0
func (i *Ingredient) Validate(validator structure.Validator)
type IngredientArray ¶ added in v1.26.0
type IngredientArray []*Ingredient
func NewIngredientArray ¶ added in v1.26.0
func NewIngredientArray() *IngredientArray
func ParseIngredientArray ¶ added in v1.26.0
func ParseIngredientArray(parser data.ArrayParser) *IngredientArray
func (*IngredientArray) Normalize ¶ added in v1.26.0
func (i *IngredientArray) Normalize(normalizer data.Normalizer)
func (*IngredientArray) Parse ¶ added in v1.26.0
func (i *IngredientArray) Parse(parser data.ArrayParser)
func (*IngredientArray) Validate ¶ added in v1.26.0
func (i *IngredientArray) Validate(validator structure.Validator)
type Nutrition ¶
type Nutrition struct { Carbohydrate *Carbohydrate `json:"carbohydrate,omitempty" bson:"carbohydrate,omitempty"` Energy *Energy `json:"energy,omitempty" bson:"energy,omitempty"` Fat *Fat `json:"fat,omitempty" bson:"fat,omitempty"` Protein *Protein `json:"protein,omitempty" bson:"protein,omitempty"` }
func NewNutrition ¶
func NewNutrition() *Nutrition
func ParseNutrition ¶
func ParseNutrition(parser data.ObjectParser) *Nutrition
func (*Nutrition) Normalize ¶
func (n *Nutrition) Normalize(normalizer data.Normalizer)
func (*Nutrition) Parse ¶
func (n *Nutrition) Parse(parser data.ObjectParser)
type Protein ¶ added in v1.26.0
type Protein struct { Total *int `json:"total,omitempty" bson:"total,omitempty"` Units *string `json:"units,omitempty" bson:"units,omitempty"` }
func NewProtein ¶ added in v1.26.0
func NewProtein() *Protein
func ParseProtein ¶ added in v1.26.0
func ParseProtein(parser data.ObjectParser) *Protein
func (*Protein) Normalize ¶ added in v1.26.0
func (p *Protein) Normalize(normalizer data.Normalizer)
func (*Protein) Parse ¶ added in v1.26.0
func (p *Protein) Parse(parser data.ObjectParser)
Click to show internal directories.
Click to hide internal directories.