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 ¶
View Source
var BinaryPrefixes = []BinaryPrefix{BinaryPrefixKibi, BinaryPrefixMebi, BinaryPrefixGibi, BinaryPrefixTebi}
View Source
var MetricPrefixes = []MetricPrefix{MetricPrefixKilo, MetricPrefixMega, MetricPrefixGiga, MetricPrefixTera}
Functions ¶
This section is empty.
Types ¶
type BinaryPrefix ¶
type BinaryPrefix string
BinaryPrefix is a base 2 prefix for data storage.
func (BinaryPrefix) Scale ¶ added in v1.300036.0
func (b BinaryPrefix) Scale() float64
Scale returns the scale from the base unit or -1 if invalid.
func (BinaryPrefix) String ¶ added in v1.300036.0
func (b BinaryPrefix) String() string
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) Scale ¶ added in v1.300036.0
func (m MetricPrefix) Scale() float64
Scale returns the scale from the base unit or -1 if invalid.
func (MetricPrefix) String ¶ added in v1.300036.0
func (m MetricPrefix) String() string
Click to show internal directories.
Click to hide internal directories.