Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

v1 source pure

Functions 14

func DecodeInt32

1func DecodeInt32(key string) int32
source

DecodeInt32 decodes a four-byte order-preserving big-endian string.

Parameters:

  • key: Exactly four bytes produced by EncodeInt32.

Returns:

  • value: The signed int32 recovered after reversing the sign-bit transform.

Panics if key is not exactly four bytes long.

func DecodeUint16

1func DecodeUint16(key string) uint16
source

DecodeUint16 decodes a fixed-width two-byte big-endian string.

Parameters:

  • key: Exactly two encoded bytes, with the most-significant byte first.

Returns:

  • value: The uint16 represented by key.

Panics if key is not exactly two bytes long.

func DecodeUint256

1func DecodeUint256(encoded string) *u256.Uint
source

DecodeUint256 decodes a fixed-width 32-byte big-endian uint256 encoding.

Parameters:

  • encoded: Exactly 32 bytes containing the most-significant byte first.

Returns:

  • value: A new *u256.Uint populated from encoded.

Panics if encoded is not exactly 32 bytes long.

func DecodeUint64

1func DecodeUint64(key string) uint64
source

DecodeUint64 decodes a fixed-width eight-byte big-endian string.

Parameters:

  • key: Exactly eight encoded bytes, with the most-significant byte first.

Returns:

  • value: The uint64 represented by key.

Panics if key is not exactly eight bytes long.

func EncodeInt32

1func EncodeInt32(value int32) string
source

EncodeInt32 converts an int32 to a fixed-width four-byte big-endian string. Flipping the sign bit makes lexicographic order match signed numeric order.

Parameters:

  • value: Signed 32-bit integer to encode.

Returns:

  • encoded: Exactly four order-preserving big-endian bytes.

func EncodeUint16

1func EncodeUint16(value uint16) string
source

EncodeUint16 converts a uint16 to a fixed-width two-byte big-endian string.

Parameters:

  • value: Unsigned 16-bit integer to encode.

Returns:

  • encoded: Exactly two bytes in big-endian order; lexicographic order matches numeric order.

func EncodeUint256

1func EncodeUint256(value *u256.Uint) string
source

EncodeUint256 converts a 256-bit unsigned integer to a fixed-width 32-byte big-endian string, emitting the most-significant limb first.

Parameters:

  • value: Non-nil *u256.Uint value to encode.

Returns:

  • encoded: Exactly 32 big-endian bytes representing value.

func EncodeUint64

1func EncodeUint64(value uint64) string
source

EncodeUint64 converts a uint64 to a fixed-width eight-byte big-endian string.

Parameters:

  • value: Unsigned 64-bit integer to encode.

Returns:

  • encoded: Exactly eight bytes in big-endian order.

func FormatBool

1func FormatBool(v bool) string
source

FormatBool converts a boolean to "true" or "false".

Parameters:

  • v: the boolean to format

Returns:

  • text: "true" or "false" corresponding to v

func FormatInt

1func FormatInt(v any) string
source

FormatInt converts any signed integer type to its base-10 string representation. It accepts int8, int16, int32, int64 and int, and panics on any other type.

Parameters:

  • v: the value to format; it must have type int8, int16, int32, int64, or int

Returns:

  • decimal: the base-10 representation of the supported signed integer

func FormatUint

1func FormatUint(v any) string
source

FormatUint converts any unsigned integer type to its base-10 string representation. It accepts uint8, uint16, uint32, uint64 and uint, and panics on any other type.

Parameters:

  • v: the value to format; it must have type uint8, uint16, uint32, uint64, or uint

Returns:

  • decimal: the base-10 representation of the supported unsigned integer

func Int64ToString

1func Int64ToString(v int64) string
source

Int64ToString returns the base-10 string representation of an int64.

Parameters:

  • v: the signed 64-bit integer to format

Returns:

  • decimal: the base-10 representation of v

func SafeParseInt64

1func SafeParseInt64(value string) int64
source

SafeParseInt64 parses a base-10 string into an int64, panicking when the input is not a valid int64.

Parameters:

  • value: the base-10 text to parse as an int64

Returns:

  • value: the parsed int64; invalid or out-of-range text panics

func Uint64ToString

1func Uint64ToString(v uint64) string
source

Uint64ToString returns the base-10 string representation of a uint64.

Parameters:

  • v: the unsigned 64-bit integer to format

Returns:

  • decimal: the base-10 representation of v

Imports 3

Source Files 3