limits

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2020 License: GPL-3.0 Imports: 2 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateFraction

func ValidateFraction(val float64) (err error)

func ValidatePercent

func ValidatePercent(val float64) (err error)

Types

type FloatLimiter

type FloatLimiter struct {
	// contains filtered or unexported fields
}

* Helper structure for validating float values. It can be used to * check whether a floating point value is in a given range.

func NewFloatLimiter

func NewFloatLimiter(min, max float64) (f FloatLimiter)

func (FloatLimiter) InRange

func (f FloatLimiter) InRange(val float64) (b bool)

func (FloatLimiter) InRangeErr

func (f FloatLimiter) InRangeErr(val float64) (err error)

func (FloatLimiter) Limit

func (f FloatLimiter) Limit(val float64) (fl float64)

func (FloatLimiter) LimitTo

func (f FloatLimiter) LimitTo(val *float64)

type Fraction

type Fraction float64

func (Fraction) String

func (f Fraction) String() (s string)

func (*Fraction) UnmarshalJSON

func (f *Fraction) UnmarshalJSON(b []byte) (err error)

func (*Fraction) Validate

func (f *Fraction) Validate() (err error)

type NotInRange

type NotInRange struct {
	// contains filtered or unexported fields
}

func (NotInRange) Error

func (e NotInRange) Error() (s string)

Jump to

Keyboard shortcuts

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