util

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesToUint16 added in v0.4.0

func BytesToUint16(bytes []byte) uint16

BytesToUint16 returns uint16 from []byte if you have more than two bytes in your []byte this wont work like you think

func BytesToUint32 added in v0.4.0

func BytesToUint32(bytes []byte) uint32

BytesToUint32 returns uint32 from []byte if you have more than four bytes in your []byte this wont work like you think

func BytesToUint64 added in v0.4.0

func BytesToUint64(bytes []byte) uint64

BytesToUint64 returns uint64 from []byte if you have more than eight bytes in your []byte this wont work like you think

func BytesToUint8 added in v0.4.0

func BytesToUint8(bytes []byte) uint8

BytesToUint8 returns uint8 from []byte if you have more than one byte in your []byte this wont work like you think

func FormatBytes

func FormatBytes(bytes types.Uint128) string

FormatBytes takes bytes as input and outputs a human friendly version

func GenerateRequestID added in v0.7.0

func GenerateRequestID() string

GenerateRequestID generates a random string to use as a request ID

func ShiftNBytes added in v0.4.0

func ShiftNBytes(numBytes uint, bytes []byte) ([]byte, []byte, error)

ShiftNBytes returns the specified number of bytes from the start of the provided []byte and removes them from the original byte slice First returned value is the requested number of bytes from the beginning of the original byte slice Second returned value is the new original byte slice with the requested number of bytes removed from the front of it

func Uint16ToBytes added in v0.4.0

func Uint16ToBytes(num uint16) []byte

Uint16ToBytes Converts uint16 to []byte

func Uint32ToBytes added in v0.4.0

func Uint32ToBytes(num uint32) []byte

Uint32ToBytes Converts uint32 to []byte

func Uint64ToBytes added in v0.4.0

func Uint64ToBytes(num uint64) []byte

Uint64ToBytes Converts uint64 to []byte

func Uint8ToBytes added in v0.4.0

func Uint8ToBytes(num uint8) []byte

Uint8ToBytes Converts uint8 to []byte Kind of pointless, since byte is uint8, but here for consistency with the other methods

Types

This section is empty.

Jump to

Keyboard shortcuts

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