food

package
v1.29.0-mobile.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2018 License: BSD-2-Clause Imports: 6 Imported by: 2

Documentation

Index

Constants

View Source
const (
	AmountUnitsLengthMaximum = 100
	AmountValueMinimum       = 0.0
)
View Source
const (
	CarbohydrateDietaryFiberGramsMaximum = 1000.0
	CarbohydrateDietaryFiberGramsMinimum = 0.0
	CarbohydrateNetGramsMaximum          = 1000.0
	CarbohydrateNetGramsMinimum          = 0.0
	CarbohydrateSugarsGramsMaximum       = 1000.0
	CarbohydrateSugarsGramsMinimum       = 0.0
	CarbohydrateTotalGramsMaximum        = 1000.0
	CarbohydrateTotalGramsMinimum        = 0.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.0
	FatTotalGramsMinimum = 0.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.0
	ProteinTotalGramsMinimum = 0.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 EnergyValueRangeForUnits(units *string) (float64, float64)

func FatUnits added in v1.26.0

func FatUnits() []string

func Meals added in v1.26.0

func Meals() []string

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 NewAmount added in v1.26.0

func NewAmount() *Amount

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)

func (*Amount) Validate added in v1.26.0

func (a *Amount) Validate(validator structure.Validator)

type Carbohydrate added in v1.26.0

type Carbohydrate struct {
	DietaryFiber *float64 `json:"dietaryFiber,omitempty" bson:"dietaryFiber,omitempty"`
	Net          *float64 `json:"net,omitempty" bson:"net,omitempty"`
	Sugars       *float64 `json:"sugars,omitempty" bson:"sugars,omitempty"`
	Total        *float64 `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 NewEnergy added in v1.26.0

func NewEnergy() *Energy

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)

func (*Energy) Validate added in v1.26.0

func (e *Energy) Validate(validator structure.Validator)

type Fat added in v1.26.0

type Fat struct {
	Total *float64 `json:"total,omitempty" bson:"total,omitempty"`
	Units *string  `json:"units,omitempty" bson:"units,omitempty"`
}

func NewFat added in v1.26.0

func NewFat() *Fat

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)

func (*Fat) Validate added in v1.26.0

func (f *Fat) Validate(validator structure.Validator)

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 New

func New() *Food

func (*Food) Normalize

func (f *Food) Normalize(normalizer data.Normalizer)

func (*Food) Parse

func (f *Food) Parse(parser data.ObjectParser) error

func (*Food) Validate

func (f *Food) Validate(validator structure.Validator)

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)

func (*Nutrition) Validate

func (n *Nutrition) Validate(validator structure.Validator)

type Protein added in v1.26.0

type Protein struct {
	Total *float64 `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)

func (*Protein) Validate added in v1.26.0

func (p *Protein) Validate(validator structure.Validator)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL