Documentation ¶
Overview ¶
Package convert implements conversions to and from data.
Index ¶
- func BytesToFloat64(b []byte) float64
- func BytesToInt64(b []byte) int64
- func BytesToString(b []byte) string
- func BytesToUint32(b []byte) uint32
- func BytesToUint64(b []byte) uint64
- func Float64ToBytes(f float64) []byte
- func Hash(key []byte) uint64
- func HashStr(key string) uint64
- func Int64ToBytes(i int64) []byte
- func JSONToString(marshaler json.Marshaler) string
- func ParseSize(sizeStr string) (int64, error)
- func StringToBytes(s string) (b []byte)
- func Uint32ToBytes(u uint32) []byte
- func Uint64ToBytes(u uint64) []byte
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BytesToFloat64 ¶ added in v0.3.0
BytesToFloat64 converts bytes to float64.
func BytesToString ¶ added in v0.5.0
BytesToString converts bytes to string. It work well until the referenced memory won’t be changed.
func Float64ToBytes ¶ added in v0.3.0
Float64ToBytes converts float64 to byes.
func JSONToString ¶ added in v0.7.0
JSONToString converts a JSON marshaler to its JSON string representation.
func ParseSize ¶ added in v0.4.0
ParseSize parses a string like "1.5GB" or "1000" and returns the number of bytes. The following units are supported:
B, K, KB, M, MB, G, GB, T, TB, P, PB KI, KIB, MI, MIB, GI, GIB, TI, TIB, PI, PIB
The units are case insensitive.
func StringToBytes ¶ added in v0.5.0
StringToBytes converts string to bytes. It work well until the referenced memory won’t be changed.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.