water

package
v1.30.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	AmountLitersPerGallon         = 3.7854118
	AmountOuncesPerGallon         = 128.0
	AmountUnitsGallons            = "gallons"
	AmountUnitsLiters             = "liters"
	AmountUnitsMilliliters        = "milliliters"
	AmountUnitsOunces             = "ounces"
	AmountValueGallonsMaximum     = 10.0
	AmountValueGallonsMinimum     = 0.0
	AmountValueLitersMaximum      = AmountValueGallonsMaximum * AmountLitersPerGallon
	AmountValueLitersMinimum      = AmountValueGallonsMinimum * AmountLitersPerGallon
	AmountValueMillilitersMaximum = AmountValueLitersMaximum * 1000.0
	AmountValueMillilitersMinimum = AmountValueLitersMinimum * 1000.0
	AmountValueOuncesMaximum      = AmountValueGallonsMaximum * AmountOuncesPerGallon
	AmountValueOuncesMinimum      = AmountValueGallonsMinimum * AmountOuncesPerGallon
)
View Source
const (
	Type = "water"
)

Variables

This section is empty.

Functions

func AmountUnits

func AmountUnits() []string

func AmountValueRangeForUnits

func AmountValueRangeForUnits(units *string) (float64, float64)

Types

type Amount

type Amount struct {
	Units *string  `json:"units,omitempty" bson:"units,omitempty"`
	Value *float64 `json:"value,omitempty" bson:"value,omitempty"`
}

func NewAmount

func NewAmount() *Amount

func ParseAmount

func ParseAmount(parser data.ObjectParser) *Amount

func (*Amount) Normalize

func (a *Amount) Normalize(normalizer data.Normalizer)

func (*Amount) Parse

func (a *Amount) Parse(parser data.ObjectParser)

func (*Amount) Validate

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

type Water

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

	Amount *Amount `json:"amount,omitempty" bson:"amount,omitempty"`
}

func New

func New() *Water

func (*Water) Normalize

func (w *Water) Normalize(normalizer data.Normalizer)

func (*Water) Parse

func (w *Water) Parse(parser data.ObjectParser) error

func (*Water) Validate

func (w *Water) Validate(validator structure.Validator)

Jump to

Keyboard shortcuts

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