Documentation
¶
Index ¶
- Constants
- Variables
- func Convert(in interface{}, from interface{}, to interface{}) (float64, error)
- func ExactConvert(in interface{}, from interface{}, to interface{}) (float64, error)
- func MustConvert(in interface{}, from interface{}, to interface{}) float64
- func MustExactConvert(in interface{}, from interface{}, to interface{}) float64
- type Bytes
- type Distance
- func (self Distance) Beyond(other Distance) bool
- func (self Distance) Equal(other Distance) bool
- func (self Distance) ImperialString() string
- func (self Distance) MarshalJSON() ([]byte, error)
- func (self Distance) MetricString() string
- func (self Distance) String() string
- func (self *Distance) UnmarshalJSON(data []byte) error
- func (self Distance) Within(other Distance) bool
- type MeasurementSystem
- type SIExponents
- type Speed
- type Unit
- type UnitFamily
Constants ¶
View Source
const ( DistanceMeter = 1 DistanceKilometer = 1000 DistanceFoot = 0.3048 DistanceYard = 0.9144 DistanceMile = 1609.344 DistanceNauticalMile = 1852 )
View Source
const ( Yotta SIExponents = 24 Zetta = 21 Exa = 18 Peta = 15 Tera = 12 Giga = 9 Mega = 6 Kilo = 3 Hecto = 2 Deca = 1 Deci = -1 Centi = -2 Milli = -3 Micro = -6 Nano = -9 Pico = -12 Femto = -15 Atto = -18 Zepto = -21 Yocto = -24 )
View Source
const ( SpeedMetersPerSecond = 1 SpeedKPH = 0.277778 SpeedFeetPerSecond = 0.3048 SpeedMPH = 0.44704 SpeedMach = 340.29 )
Variables ¶
View Source
var ConvertRoundToPlaces = 6
View Source
var DistanceDisplayUnit = MeasurementSystem(Imperial)
View Source
var SpeedDisplayUnit = MeasurementSystem(Imperial)
Functions ¶
func ExactConvert ¶
func MustConvert ¶
func MustConvert(in interface{}, from interface{}, to interface{}) float64
func MustExactConvert ¶
func MustExactConvert(in interface{}, from interface{}, to interface{}) float64
Types ¶
type Bytes ¶ added in v1.6.22
type Bytes float64
const ( Byte Bytes = 1 Kilobyte Bytes = 1024 Megabyte Bytes = 1048576 Gigabyte Bytes = 1073741824 Terabyte Bytes = 1099511627776 Petabyte Bytes = 1125899906842624 Exabyte Bytes = 1152921504606846976 Zettabyte Bytes = 1180591620717411303424 Yottabyte Bytes = 1208925819614629174706176 Brontobyte Bytes = 1237940039285380274899124224 )
type Distance ¶ added in v1.6.35
type Distance float64
func MustParseDistance ¶ added in v1.6.35
func MustParseDistance(in interface{}) Distance
func ParseDistance ¶ added in v1.6.35
func (Distance) ImperialString ¶ added in v1.6.35
func (Distance) MarshalJSON ¶ added in v1.6.35
func (Distance) MetricString ¶ added in v1.6.35
func (*Distance) UnmarshalJSON ¶ added in v1.6.35
type MeasurementSystem ¶ added in v1.6.35
type MeasurementSystem string
const ( Metric MeasurementSystem = `metric` Imperial = `imperial` )
type SIExponents ¶ added in v1.6.22
type SIExponents int
type Speed ¶ added in v1.6.35
type Speed float64
func (Speed) FasterThan ¶ added in v1.6.35
func (Speed) MarshalJSON ¶ added in v1.6.35
func (Speed) SlowerThan ¶ added in v1.6.35
func (*Speed) UnmarshalJSON ¶ added in v1.6.35
type Unit ¶
type Unit int
func MustParseUnit ¶
func (Unit) Family ¶
func (self Unit) Family() UnitFamily
func (Unit) LongString ¶
type UnitFamily ¶
type UnitFamily int
const ( GeneralUnits UnitFamily = iota TemperatureUnits LengthUnits SpeedUnits AbsoluteUnit = math.MaxInt64 )
Click to show internal directories.
Click to hide internal directories.