Documentation
¶
Overview ¶
Package msgpack implements EDB's MessagePack struct encoding. Like Fast1, MessagePack remains supported, with migration to Fast2 or Compact2 intended.
Index ¶
- Variables
- func Decode(src []byte, value reflect.Value)
- func Encode(dst []byte, value reflect.Value) []byte
- func TryDecode(src []byte, value reflect.Value) error
- func TryEncode(dst []byte, value reflect.Value) ([]byte, error)
- type FieldEdit
- type Iterator
- type View
- func (v View) Apply(edits []FieldEdit) View
- func (v View) Bool() bool
- func (v View) Bytes() []byte
- func (v View) Delete(name string) View
- func (v View) Float() float64
- func (v View) Int() int64
- func (v View) Iter() Iterator
- func (v View) Lookup(name string) View
- func (v View) Missing() bool
- func (v View) Nil() bool
- func (v View) Raw() []byte
- func (v View) Set(name string, value []byte) View
- func (v View) Time() values.Value
- func (v View) Uint() uint64
Constants ¶
This section is empty.
Variables ¶
var ErrDepth = errors.New("MessagePack nesting exceeds 256")
var ErrFormat = errors.New("invalid MessagePack value")
Functions ¶
Types ¶
type FieldEdit ¶
FieldEdit replaces a string-keyed map field. A nil Value deletes the field; []byte{0xc0} stores explicit null. Values must contain one complete value.
type Iterator ¶
type Iterator struct {
// contains filtered or unexported fields
}
Iterator borrows successive encoded children. Maps return keys and values; arrays return a missing key. No Go map, slice or element is decoded.
type View ¶
type View struct {
// contains filtered or unexported fields
}
View borrows one encoded MessagePack value. It never constructs a Go object. Trusted is for stored bytes; accessors still check boundaries before reading.
func BuildArray ¶
BuildArray copies raw elements into one new array.
func BuildMap ¶
BuildMap copies raw entries into one new map, preserving their encodings. capacity is a sizing hint; nil values represent MessagePack null.
func (View) Apply ¶
Apply copies the enclosing map once, preserving untouched bytes and key order. Repeated edits to a name use the last edit, including for duplicate wire keys. The input and result never share writable storage.
func (View) Delete ¶
Delete removes all occurrences of a map key, preserving every other encoded entry verbatim. An absent key leaves the original view unchanged.
func (View) Lookup ¶
Lookup scans encoded field boundaries and borrows only the selected value. It checks all keys so duplicate keys retain MessagePack's last-value semantics.
func (View) Set ¶
Set replaces a map field while copying every untouched key and value verbatim. The result is owned, and does not mutate or retain spare capacity in the input.