convert

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 17, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package convert implements conversions to and from data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesToFloat64 added in v0.3.0

func BytesToFloat64(b []byte) float64

BytesToFloat64 converts bytes to float64.

func BytesToInt64

func BytesToInt64(b []byte) int64

BytesToInt64 converts bytes to int64.

func BytesToString added in v0.5.0

func BytesToString(b []byte) string

BytesToString converts bytes to string.

func BytesToUint32

func BytesToUint32(b []byte) uint32

BytesToUint32 converts bytes to uint32.

func BytesToUint64

func BytesToUint64(b []byte) uint64

BytesToUint64 converts bytes to uint64.

func Float64ToBytes added in v0.3.0

func Float64ToBytes(f float64) []byte

Float64ToBytes converts float64 to byes.

func Hash

func Hash(key []byte) uint64

Hash computes the 64-bit Hash digest of key.

func HashStr

func HashStr(key string) uint64

HashStr computes the 64-bit Hash digest of key.

func Int64ToBytes

func Int64ToBytes(i int64) []byte

Int64ToBytes converts int64 to bytes.

func ParseSize added in v0.4.0

func ParseSize(sizeStr string) (int64, error)

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

func StringToBytes(s string) (b []byte)

StringToBytes converts string to bytes.

func Uint32ToBytes

func Uint32ToBytes(u uint32) []byte

Uint32ToBytes converts uint32 to bytes.

func Uint64ToBytes

func Uint64ToBytes(u uint64) []byte

Uint64ToBytes converts uint64 to bytes.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL