Documentation
¶
Index ¶
- Constants
- func Decode(buf []byte) (any, error)
- func DecodeMapAny(seq *SeqGetAccess) (map[string]any, error)
- func DecodeOrdered(buf []byte) (any, error)
- func DecodeOrderedMapAny(seq *SeqGetAccess) (*typetags.OrderedMapAny, error)
- func DecodePrimitive(typ typetags.Type, buf []byte) (interface{}, error)
- func DecodeTuple(seq *SeqGetAccess) ([]any, error)
- func DecodeTupleGeneric(seq *SeqGetAccess, root bool, ordered bool) ([]any, error)
- func DecodeTupleOrdered(seq *SeqGetAccess) ([]any, error)
- func GetAny(g *GetAccess, pos int) (any, error)
- func ReleasePutAccess(pa *PutAccess)
- func WriteBool(buffer []byte, pos int, v bool) int
- func WriteBytes(buffer []byte, pos int, b []byte) int
- func WriteFloat32(buffer []byte, pos int, v float32) int
- func WriteFloat64(buffer []byte, pos int, v float64) int
- func WriteInt8(buffer []byte, pos int, v int8) int
- func WriteInt16(buffer []byte, pos int, v int16) int
- func WriteInt32(buffer []byte, pos int, v int32) int
- func WriteInt64(buffer []byte, pos int, v int64) int
- func WriteNullableBool(buffer []byte, pos int, v *bool) int
- func WriteNullableFloat32(buffer []byte, pos int, v *float32) int
- func WriteNullableFloat64(buffer []byte, pos int, v *float64) int
- func WriteNullableInt8(buffer []byte, pos int, v *int8) int
- func WriteNullableInt16(buffer []byte, pos int, v *int16) int
- func WriteNullableInt32(buffer []byte, pos int, v *int32) int
- func WriteNullableInt64(buffer []byte, pos int, v *int64) int
- func WriteNullableUint8(buffer []byte, pos int, v *uint8) int
- func WriteNullableUint16(buffer []byte, pos int, v *uint16) int
- func WriteNullableUint32(buffer []byte, pos int, v *uint32) int
- func WriteNullableUint64(buffer []byte, pos int, v *uint64) int
- func WriteString(buffer []byte, pos int, s string) int
- func WriteTypeHeader(buffer []byte, pos int, encodedPos int, t typetags.Type) (newPos int)
- func WriteUint8(buffer []byte, pos int, v uint8) int
- func WriteUint16(buffer []byte, pos int, v uint16) int
- func WriteUint32(buffer []byte, pos int, v uint32) int
- func WriteUint64(buffer []byte, pos int, v uint64) int
- type GetAccess
- func (g *GetAccess) GetAsPackable(pos int) (Packable, error)
- func (g *GetAccess) GetBool(pos int) (bool, error)
- func (g *GetAccess) GetBytes(pos int) ([]byte, error)
- func (g *GetAccess) GetCopyBytes(pos int) ([]byte, error)
- func (g *GetAccess) GetFloat32(pos int) (float32, error)
- func (g *GetAccess) GetFloat64(pos int) (float64, error)
- func (g *GetAccess) GetFloating(pos int) (any, int, error)
- func (g *GetAccess) GetInt(pos int) (any, int, error)
- func (g *GetAccess) GetInt8(pos int) (int8, error)
- func (g *GetAccess) GetInt16(pos int) (int16, error)
- func (g *GetAccess) GetInt32(pos int) (int32, error)
- func (g *GetAccess) GetInt64(pos int) (int64, error)
- func (g *GetAccess) GetMapAny(pos int) (map[string]any, error)
- func (g *GetAccess) GetMapOrderedAny(pos int) (*typetags.OrderedMapAny, error)
- func (g *GetAccess) GetMapStr(pos int) (map[string]string, error)
- func (g *GetAccess) GetNestedGetAccess(pos int) (*GetAccess, typetags.Type, error)
- func (g *GetAccess) GetNullableBool(pos int) (*bool, error)
- func (g *GetAccess) GetNullableFloat32(pos int) (*float32, error)
- func (g *GetAccess) GetNullableFloat64(pos int) (*float64, error)
- func (g *GetAccess) GetNullableInt8(pos int) (*int8, error)
- func (g *GetAccess) GetNullableInt16(pos int) (*int16, error)
- func (g *GetAccess) GetNullableInt32(pos int) (*int32, error)
- func (g *GetAccess) GetNullableInt64(pos int) (*int64, error)
- func (g *GetAccess) GetNullableUint8(pos int) (*uint8, error)
- func (g *GetAccess) GetNullableUint16(pos int) (*uint16, error)
- func (g *GetAccess) GetNullableUint32(pos int) (*uint32, error)
- func (g *GetAccess) GetNullableUint64(pos int) (*uint64, error)
- func (g *GetAccess) GetString(pos int) (string, error)
- func (g *GetAccess) GetStringUnsafe(pos int) (string, error)
- func (g *GetAccess) GetTypeAndValue(pos int) (typetags.Type, []byte)
- func (g *GetAccess) GetUint8(pos int) (uint8, error)
- func (g *GetAccess) GetUint16(pos int) (uint16, error)
- func (g *GetAccess) GetUint32(pos int) (uint32, error)
- func (g *GetAccess) GetUint64(pos int) (uint64, error)
- type Packable
- type PackableTagValue
- type PutAccess
- func (p *PutAccess) AddAny(m any, useNumeric bool) error
- func (p *PutAccess) AddAnyTuple(m []interface{}, useNumeric bool) error
- func (p *PutAccess) AddAnyTupleSortedMap(m []interface{}, useNumeric bool) error
- func (p *PutAccess) AddBool(b bool)
- func (p *PutAccess) AddBytes(b []byte)
- func (p *PutAccess) AddFloat32(v float32)
- func (p *PutAccess) AddFloat64(v float64)
- func (p *PutAccess) AddInt8(b int8)
- func (p *PutAccess) AddInt16(v int16)
- func (p *PutAccess) AddInt32(v int32)
- func (p *PutAccess) AddInt64(v int64)
- func (p *PutAccess) AddIntegerCompressed(val int64)
- func (p *PutAccess) AddMap(m map[string][]byte)
- func (p *PutAccess) AddMapAny(m map[string]any, useNumeric bool) error
- func (p *PutAccess) AddMapAnyOrdered(om *typetags.OrderedMap[any], useNumeric bool) error
- func (p *PutAccess) AddMapAnySortedKey(m map[string]any, useNumeric bool) error
- func (p *PutAccess) AddMapSortedKey(m map[string][]byte)
- func (p *PutAccess) AddMapSortedKeyStr(m map[string]string)
- func (p *PutAccess) AddMapStr(m map[string]string)
- func (p *PutAccess) AddNull(m []interface{})
- func (p *PutAccess) AddNullableBool(v *bool)
- func (p *PutAccess) AddNullableFloat32(v *float32)
- func (p *PutAccess) AddNullableFloat64(v *float64)
- func (p *PutAccess) AddNullableInt8(v *int8)
- func (p *PutAccess) AddNullableInt16(v *int16)
- func (p *PutAccess) AddNullableInt32(v *int32)
- func (p *PutAccess) AddNullableInt64(v *int64)
- func (p *PutAccess) AddNullableUint8(v *uint8)
- func (p *PutAccess) AddNullableUint16(v *uint16)
- func (p *PutAccess) AddNullableUint32(v *uint32)
- func (p *PutAccess) AddNullableUint64(v *uint64)
- func (p *PutAccess) AddNumeric(v float64)
- func (p *PutAccess) AddNumericString(val string) error
- func (p *PutAccess) AddPackable(v Packable)
- func (p *PutAccess) AddString(s string)
- func (p *PutAccess) AddStringArray(arr []string)
- func (p *PutAccess) AddUint8(b uint8)
- func (p *PutAccess) AddUint16(v uint16)
- func (p *PutAccess) AddUint32(v uint32)
- func (p *PutAccess) AddUint64(v uint64)
- func (p *PutAccess) AddUnsignedCompressed(val uint64)
- func (p *PutAccess) AppendTagAndValue(tag typetags.Type, val []byte)
- func (p *PutAccess) BeginMap() *PutAccess
- func (p *PutAccess) BeginTuple() *PutAccess
- func (p *PutAccess) EndNested(nested *PutAccess)
- func (p *PutAccess) Pack() []byte
- func (p *PutAccess) PackAppend(buf []byte) []byte
- func (p *PutAccess) PackBuff(buffer []byte) (int, error)
- func (p *PutAccess) PackSize() int
- type SeqGetAccess
- func (s *SeqGetAccess) Advance() error
- func (s *SeqGetAccess) ArgCount() int
- func (s *SeqGetAccess) CurrentIndex() int
- func (s *SeqGetAccess) GetPayload(width int) ([]byte, error)
- func (s *SeqGetAccess) Next() ([]byte, typetags.Type, error)
- func (s *SeqGetAccess) NextOffsetWidth() (int, int, typetags.Type, error)
- func (s *SeqGetAccess) PeekNestedSeq() (*SeqGetAccess, error)
- func (s *SeqGetAccess) PeekTypeWidth() (typetags.Type, int, error)
- func (s *SeqGetAccess) UnderlineBuffer() []byte
Constants ¶
const HeaderTagSize = 2
Variables ¶
This section is empty.
Functions ¶
func Decode ¶
Decode: convenience entry point for decoding a buffer that contains a top-level tuple. Decode decodes a buffer into Go values. Maps inside tuples are decoded as plain map[string]any.
func DecodeMapAny ¶
func DecodeMapAny(seq *SeqGetAccess) (map[string]any, error)
DecodeMapAny: decode a map[string]any from the current position in a SeqGetAccess.
func DecodeOrdered ¶
DecodeOrdered decodes a buffer into Go values. Maps inside tuples are decoded as *typetags.OrderedMapAny.
func DecodeOrderedMapAny ¶
func DecodeOrderedMapAny(seq *SeqGetAccess) (*typetags.OrderedMapAny, error)
DecodeOrderedMapAny decodes a map from the sequence into an OrderedMapAny, preserving insertion order of keys.
func DecodePrimitive ¶
DecodePrimitive interprets a primitive payload directly using type tag and width. It returns a Go value (int, float, string, []byte as string, bool, nil).
func DecodeTupleGeneric ¶
func DecodeTupleGeneric(seq *SeqGetAccess, root bool, ordered bool) ([]any, error)
DecodeTupleGeneric: decode a []any from the current position in a SeqGetAccess. If root is true, the caller already consumed the tuple header. If ordered is true, maps inside the tuple are decoded as *typetags.OrderedMapAny.
func DecodeTupleOrdered ¶
func DecodeTupleOrdered(seq *SeqGetAccess) ([]any, error)
func ReleasePutAccess ¶
func ReleasePutAccess(pa *PutAccess)
func WriteBytes ¶
WriteBytes writes a byte slice to the buffer.
func WriteFloat32 ¶
WriteFloat32 writesa float32 to the buffer.
func WriteFloat64 ¶
WriteFloat64 writesa float64 to the buffer.
func WriteInt16 ¶
WriteInt16 writes an int16 value to the buffer.
func WriteInt32 ¶
WriteInt32 writes an int32 value to the buffer.
func WriteInt64 ¶
WriteInt64 writes an int64 value to the buffer.
func WriteNullableBool ¶
WriteNullableBool writes a pointer to a boolean to the buffer.
func WriteNullableFloat32 ¶
WriteNullableFloat32 writes a pointer to a float32 to the buffer.
func WriteNullableFloat64 ¶
WriteNullableFloat64 writes a pointer to a float64 to the buffer.
func WriteNullableInt8 ¶
WriteNullableInt8 writes a pointer to an int8 to the buffer.
func WriteNullableInt16 ¶
WriteNullableInt16 writes a pointer to an int16 to the buffer.
func WriteNullableInt32 ¶
WriteNullableInt32 writes a pointer to an int32 to the buffer.
func WriteNullableInt64 ¶
WriteNullableInt64 writes a pointer to an int64 to the buffer.
func WriteNullableUint8 ¶
WriteNullableUint8 writes a pointer to a uint8 to the buffer.
func WriteNullableUint16 ¶
WriteNullableUint16 writes a pointer to a uint16 to the buffer.
func WriteNullableUint32 ¶
WriteNullableUint32 writes a pointer to a uint32 to the buffer.
func WriteNullableUint64 ¶
WriteNullableUint64 writes a pointer to a uint64 to the buffer.
func WriteString ¶
WriteString writes a string to the buffer.
func WriteTypeHeader ¶
WriteTypeHeader writes a header to the buffer at pos and returns the new position.
func WriteUint8 ¶
WriteUint8 writes a uint8 value to the buffer.
func WriteUint16 ¶
WriteUint16 writes a uint16 value to the buffer.
func WriteUint32 ¶
WriteUint32 writes a uint32 value to the buffer.
Types ¶
type GetAccess ¶
type GetAccess struct {
// contains filtered or unexported fields
}
func NewGetAccess ¶
func (*GetAccess) GetCopyBytes ¶
GetCopyBytes decodes and returns a fresh copy of the byte slice. Use this to avoid retention of the entire GetAccess buffer in memory, which prevents the garbage collector from reclaiming the large backing array.
func (*GetAccess) GetFloat32 ¶
GetFloat32 decodes a float32 at position pos
func (*GetAccess) GetFloat64 ¶
GetFloat64 decodes a float64 at position pos
func (*GetAccess) GetMapOrderedAny ¶
func (g *GetAccess) GetMapOrderedAny(pos int) (*typetags.OrderedMapAny, error)
GetMapOrderedAny decodes a map at the given position into an OrderedMapAny, preserving insertion order of keys.
func (*GetAccess) GetNestedGetAccess ¶
func (*GetAccess) GetNullableFloat32 ¶
GetNullableFloat32 decodes a nullable float32 at position pos
func (*GetAccess) GetNullableFloat64 ¶
GetNullableFloat64 decodes a nullable float64 at position pos
func (*GetAccess) GetNullableUint16 ¶
func (*GetAccess) GetNullableUint32 ¶
func (*GetAccess) GetNullableUint64 ¶
func (*GetAccess) GetStringUnsafe ¶
GetStringUnsafe decodes a string at position pos using unsafe.String
func (*GetAccess) GetTypeAndValue ¶
function to get type and value, which can be used for repacking or other purposes
type PackableTagValue ¶
type PackableTagValue struct {
// contains filtered or unexported fields
}
func (*PackableTagValue) HeaderType ¶
func (px *PackableTagValue) HeaderType() typetags.Type
func (*PackableTagValue) PackInto ¶
func (px *PackableTagValue) PackInto(p *PutAccess)
func (*PackableTagValue) ValueSize ¶
func (px *PackableTagValue) ValueSize() int
type PutAccess ¶
type PutAccess struct {
// contains filtered or unexported fields
}
func GetPutAccess ¶
func GetPutAccess() *PutAccess
func GetPutAccessZero ¶
func GetPutAccessZero() *PutAccess
func NewPutAccess ¶
func NewPutAccess() *PutAccess
func NewPutAccessFromPool ¶
func NewPutAccessFromPool() *PutAccess
func NewPutAccessFromPoolZero ¶
func NewPutAccessFromPoolZero() *PutAccess
func (*PutAccess) AddAnyTuple ¶
func (*PutAccess) AddAnyTupleSortedMap ¶
func (*PutAccess) AddFloat32 ¶
func (*PutAccess) AddFloat64 ¶
func (*PutAccess) AddIntegerCompressed ¶
func (*PutAccess) AddMapAnyOrdered ¶
AddMapAnyOrdered encodes an OrderedMap[string→any] preserving insertion order.
func (*PutAccess) AddMapAnySortedKey ¶
func (*PutAccess) AddMapSortedKey ¶
func (*PutAccess) AddMapSortedKeyStr ¶
func (*PutAccess) AddNullableBool ¶
func (*PutAccess) AddNullableFloat32 ¶
func (*PutAccess) AddNullableFloat64 ¶
func (*PutAccess) AddNullableInt8 ¶
func (*PutAccess) AddNullableInt16 ¶
func (*PutAccess) AddNullableInt32 ¶
func (*PutAccess) AddNullableInt64 ¶
func (*PutAccess) AddNullableUint8 ¶
func (*PutAccess) AddNullableUint16 ¶
func (*PutAccess) AddNullableUint32 ¶
func (*PutAccess) AddNullableUint64 ¶
func (*PutAccess) AddNumeric ¶
AddNumeric chooses the smallest fitting integer type if v is integral, otherwise stores it as a float64.
func (*PutAccess) AddNumericString ¶
func (*PutAccess) AddPackable ¶
func (*PutAccess) AddStringArray ¶
AddStringArray packs a []string as a tuple
func (*PutAccess) AddUnsignedCompressed ¶
func (*PutAccess) AppendTagAndValue ¶
func (*PutAccess) BeginTuple ¶
func (*PutAccess) PackAppend ¶
type SeqGetAccess ¶
type SeqGetAccess struct {
// contains filtered or unexported fields
}
func NewSeqGetAccess ¶
func NewSeqGetAccess(buf []byte) (*SeqGetAccess, error)
func (*SeqGetAccess) Advance ¶
func (s *SeqGetAccess) Advance() error
func (*SeqGetAccess) ArgCount ¶
func (s *SeqGetAccess) ArgCount() int
func (*SeqGetAccess) CurrentIndex ¶
func (s *SeqGetAccess) CurrentIndex() int
func (*SeqGetAccess) GetPayload ¶
func (s *SeqGetAccess) GetPayload(width int) ([]byte, error)
func (*SeqGetAccess) NextOffsetWidth ¶
func (*SeqGetAccess) PeekNestedSeq ¶
func (s *SeqGetAccess) PeekNestedSeq() (*SeqGetAccess, error)
func (*SeqGetAccess) PeekTypeWidth ¶
func (s *SeqGetAccess) PeekTypeWidth() (typetags.Type, int, error)
func (*SeqGetAccess) UnderlineBuffer ¶
func (s *SeqGetAccess) UnderlineBuffer() []byte