Documentation ¶
Index ¶
Constants ¶
View Source
const ( MetricPrefixKilo MetricPrefix = "k" MetricPrefixMega = "M" MetricPrefixGiga = "G" MetricPrefixTera = "T" )
View Source
const ( BinaryPrefixKibi BinaryPrefix = "Ki" BinaryPrefixMebi = "Mi" BinaryPrefixGibi = "Gi" BinaryPrefixTebi = "Ti" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BinaryPrefix ¶
type BinaryPrefix string
BinaryPrefix is a base 2 prefix for data storage.
func (BinaryPrefix) Value ¶
func (b BinaryPrefix) Value() float64
Value returns the scale from the base unit or -1 if invalid.
type MetricPrefix ¶
type MetricPrefix string
MetricPrefix is a base 10 prefix used by the metric system.
func ConvertToMetric ¶
func ConvertToMetric(binaryPrefix BinaryPrefix) (MetricPrefix, float64, error)
ConvertToMetric returns the mapped metric prefix and a scale factor for adjusting values.
func (MetricPrefix) Value ¶
func (m MetricPrefix) Value() float64
Value returns the scale from the base unit or -1 if invalid.
Click to show internal directories.
Click to hide internal directories.