MCPcopy Create free account

hub / github.com/alecthomas/units / functions

Functions26 in github.com/alecthomas/units

↓ 33 callersMethodString
()
bytes.go:39
↓ 10 callersFunctionParseBase2Bytes
ParseBase2Bytes supports both iB and B in base-2 multipliers. That is, KB and KiB are both 1024. However "kB", which is the correct SI spelling of 100
bytes.go:31
↓ 10 callersFunctionParseStrictBytes
ParseStrictBytes supports both iB and B suffixes for base 2 and metric, respectively. That is, KiB represents 1024 and kB, KB represent 1000.
bytes.go:203
↓ 9 callersMethodUnmarshalText
UnmarshalText implement encoding.TextUnmarshaler to process json/yaml.
bytes.go:49
↓ 8 callersMethodRound
Round returns Base2Bytes with all but the first n units zeroed out. So that e.g. 1GiB1MiB1KiB → 1GiB1MiB, if n is 2.
bytes.go:76
↓ 8 callersMethodRound
Round returns MetricBytes with all but the first n units zeroed out. So that e.g. 1GB1MB1KB → 1GB1MB, if n is 2.
bytes.go:165
↓ 5 callersFunctionParseMetricBytes
ParseMetricBytes parses base-10 metric byte units. That is, KB is 1000 bytes.
bytes.go:134
↓ 5 callersFunctionParseUnit
(s string, unitMap map[string]float64)
util.go:52
↓ 4 callersMethodFloor
Floor returns Base2Bytes with all but the largest unit zeroed out. So that e.g. 1GiB1MiB1KiB → 1GiB.
bytes.go:56
↓ 4 callersMethodFloor
Floor returns MetricBytes with all but the largest unit zeroed out. So that e.g. 1GB1MB1KB → 1GB.
bytes.go:145
↓ 3 callersFunctionMakeUnitMap
(suffix, shortSuffix string, scale int64)
si.go:16
↓ 2 callersFunctionToString
(n int64, scale int64, suffix, baseSuffix string)
util.go:13
↓ 2 callersFunctionleadingInt
never printed leadingInt consumes the leading [0-9]* from s.
util.go:36
MethodMarshalText
MarshalText implement encoding.TextMarshaler to process json/yaml.
bytes.go:44
MethodString
TODO: represents 1000B as uppercase "KB", while SI standard requires "kB".
bytes.go:140
FunctionTestBase2BytesString
(t *testing.T)
bytes_test.go:10
FunctionTestBase2BytesUnmarshalText
(t *testing.T)
bytes_test.go:45
FunctionTestBase2Floor
(t *testing.T)
bytes_test.go:75
FunctionTestBase2Round
(t *testing.T)
bytes_test.go:86
FunctionTestJSON
(t *testing.T)
bytes_test.go:194
FunctionTestMetricBytesString
(t *testing.T)
bytes_test.go:105
FunctionTestMetricFloor
(t *testing.T)
bytes_test.go:164
FunctionTestMetricRound
(t *testing.T)
bytes_test.go:175
FunctionTestParseBase2Bytes
(t *testing.T)
bytes_test.go:16
FunctionTestParseMetricBytes
(t *testing.T)
bytes_test.go:112
FunctionTestParseStrictBytes
(t *testing.T)
bytes_test.go:130