decodingutil

package
v3.2.5 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const MaxDepth = 10000

MaxDepth limits the nesting of arrays, maps and structs while decoding. Without it, deeply nested input exhausts the goroutine stack and the runtime aborts with a fatal error that cannot be recovered.

Variables

View Source
var ErrDeclaredLengthTooLarge = errors.New("declared length is too large")

ErrDeclaredLengthTooLarge is returned when a declared 32-bit length cannot be represented as a non-negative int (32-bit platforms).

Functions

func CheckMapKey added in v3.2.4

func CheckMapKey(key interface{}) error

CheckMapKey reports an error when key would panic as a map key.

func CheckMapKeyValue added in v3.2.4

func CheckMapKeyValue(key reflect.Value) error

CheckMapKeyValue is the reflect.Value variant of CheckMapKey.

func DepthError added in v3.2.4

func DepthError() error

DepthError reports that the nesting limit was exceeded.

func Int8FromByte

func Int8FromByte(v byte) int8

func Int8FromInt64

func Int8FromInt64(v int64, k reflect.Kind) (int8, error)

func Int16FromInt64

func Int16FromInt64(v int64, k reflect.Kind) (int16, error)

func Int32FromInt64

func Int32FromInt64(v int64, k reflect.Kind) (int32, error)

func Int64FromFloat64

func Int64FromFloat64(v float64, k reflect.Kind) (int64, error)

func Int64FromInt8Byte

func Int64FromInt8Byte(v byte) int64

func Int64FromInt16Bits

func Int64FromInt16Bits(v uint16) int64

func Int64FromInt32Bits

func Int64FromInt32Bits(v uint32) int64

func Int64FromInt64Bits

func Int64FromInt64Bits(v uint64) int64

func Int64FromUint64

func Int64FromUint64(v uint64, k reflect.Kind) (int64, error)

func IntFromInt64

func IntFromInt64(v int64, k reflect.Kind) (int, error)

func IntValueForKind

func IntValueForKind(v int64, k reflect.Kind) (int64, error)

func IsExtCode added in v3.2.4

func IsExtCode(code byte) bool

IsExtCode reports whether code starts an ext value. Map keys decoded from ext values come from user-provided decoders and may be unhashable, while other non-container codes always yield hashable values.

func LengthFromUint32 added in v3.2.5

func LengthFromUint32(u uint32) (int, error)

LengthFromUint32 converts a MessagePack-declared 32-bit length to int, rejecting values that are not representable as a non-negative int.

func MapKeyNeedsCheck added in v3.2.4

func MapKeyNeedsCheck(t reflect.Type) bool

MapKeyNeedsCheck reports whether a concrete map key type t may still hold unhashable values at runtime (e.g. a struct with an interface field). Interface key types are handled separately by the decoders.

func RangeError

func RangeError(value interface{}, k reflect.Kind) error

func Uint8FromUint64

func Uint8FromUint64(v uint64, k reflect.Kind) (uint8, error)

func Uint16FromUint64

func Uint16FromUint64(v uint64, k reflect.Kind) (uint16, error)

func Uint32FromUint64

func Uint32FromUint64(v uint64, k reflect.Kind) (uint32, error)

func Uint64FromInt64

func Uint64FromInt64(v int64, k reflect.Kind) (uint64, error)

func UintFromUint64

func UintFromUint64(v uint64, k reflect.Kind) (uint, error)

func UintValueForKind

func UintValueForKind(v uint64, k reflect.Kind) (uint64, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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