food

package
v1.20.2 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2017 License: BSD-3-Clause Imports: 2 Imported by: 2

Documentation

Index

Constants

View Source
const (
	UnitsGrams = "grams"

	ValueGramsMinimum = 0
	ValueGramsMaximum = 1000
)

Variables

This section is empty.

Functions

func NewDatum

func NewDatum() data.Datum

func Type

func Type() string

Types

type Carbohydrates

type Carbohydrates struct {
	Net   *int    `json:"net,omitempty" bson:"net,omitempty"`
	Units *string `json:"units,omitempty" bson:"units,omitempty"`
}

func NewCarbohydrates

func NewCarbohydrates() *Carbohydrates

func ParseCarbohydrates

func ParseCarbohydrates(parser data.ObjectParser) *Carbohydrates

func (*Carbohydrates) Normalize

func (c *Carbohydrates) Normalize(normalizer data.Normalizer)

func (*Carbohydrates) Parse

func (c *Carbohydrates) Parse(parser data.ObjectParser)

func (*Carbohydrates) Validate

func (c *Carbohydrates) Validate(validator data.Validator)

type Food

type Food struct {
	types.Base `bson:",inline"`

	Nutrition *Nutrition `json:"nutrition,omitempty" bson:"nutrition,omitempty"`
}

func Init

func Init() *Food

func New

func New() *Food

func (*Food) Init

func (f *Food) Init()

func (*Food) Normalize

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

func (*Food) Parse

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

func (*Food) Validate

func (f *Food) Validate(validator data.Validator) error

type Nutrition

type Nutrition struct {
	Carbohydrates *Carbohydrates `json:"carbohydrates,omitempty" bson:"carbohydrates,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 data.Validator)

Jump to

Keyboard shortcuts

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