encoding

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2023 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ActionTypeSetVar   actionType = 1
	ActionTypeUnsetVar actionType = 2
)
View Source
const (
	VarScopeProcess     varScope = 0
	VarScopeSession     varScope = 1
	VarScopeTransaction varScope = 2
	VarScopeRequest     varScope = 3
	VarScopeResponse    varScope = 4
)

Variables

View Source
var (
	ErrUnterminatedSequence = fmt.Errorf("unterminated sequence")
	ErrInsufficientSpace    = fmt.Errorf("insufficient space in buffer")
)

Functions

func PutAddr

func PutAddr(b []byte, ip netip.Addr) (int, error)

func PutBytes

func PutBytes(b []byte, v []byte) (int, error)

func ReleaseActionWriter

func ReleaseActionWriter(w *ActionWriter)

func ReleaseKVEntry

func ReleaseKVEntry(k *KVEntry)

func ReleaseKVScanner

func ReleaseKVScanner(s *KVScanner)

func ReleaseKVWriter

func ReleaseKVWriter(w *KVWriter)

func ReleaseMessage

func ReleaseMessage(m *Message)

func ReleaseMessageScanner

func ReleaseMessageScanner(s *MessageScanner)

Types

type ActionWriter

type ActionWriter struct {
	// contains filtered or unexported fields
}

func AcquireActionWriter

func AcquireActionWriter(buf []byte, off int) *ActionWriter

func NewActionWriter

func NewActionWriter(buf []byte, off int) *ActionWriter

func (*ActionWriter) Bytes

func (aw *ActionWriter) Bytes() []byte

func (*ActionWriter) Off

func (aw *ActionWriter) Off() int

func (*ActionWriter) SetAddr

func (aw *ActionWriter) SetAddr(s varScope, name string, v netip.Addr) error

func (*ActionWriter) SetBinary

func (aw *ActionWriter) SetBinary(s varScope, name string, v []byte) error

func (*ActionWriter) SetBool

func (aw *ActionWriter) SetBool(s varScope, name string, v bool) error

func (*ActionWriter) SetInt32

func (aw *ActionWriter) SetInt32(s varScope, name string, v int32) error

func (*ActionWriter) SetInt64

func (aw *ActionWriter) SetInt64(s varScope, name string, v int64) error

func (*ActionWriter) SetNull

func (aw *ActionWriter) SetNull(s varScope, name string) error

func (*ActionWriter) SetString

func (aw *ActionWriter) SetString(s varScope, name string, v string) error

func (*ActionWriter) SetStringBytes

func (aw *ActionWriter) SetStringBytes(s varScope, name string, v []byte) error

func (*ActionWriter) SetUInt32

func (aw *ActionWriter) SetUInt32(s varScope, name string, v uint32) error

func (*ActionWriter) SetUInt64

func (aw *ActionWriter) SetUInt64(s varScope, name string, v uint64) error

func (*ActionWriter) Unset

func (aw *ActionWriter) Unset(s varScope, name string) error

type DataType

type DataType byte
const (
	DataTypeNull   DataType = 0
	DataTypeBool   DataType = 1
	DataTypeInt32  DataType = 2
	DataTypeUInt32 DataType = 3
	DataTypeInt64  DataType = 4
	DataTypeUInt64 DataType = 5
	DataTypeIPV4   DataType = 6
	DataTypeIPV6   DataType = 7
	DataTypeString DataType = 8
	DataTypeBinary DataType = 9
)

type KVEntry

type KVEntry struct {
	// contains filtered or unexported fields
}

func AcquireKVEntry

func AcquireKVEntry() *KVEntry

func (*KVEntry) NameBytes

func (k *KVEntry) NameBytes() []byte

func (*KVEntry) NameEquals

func (k *KVEntry) NameEquals(s string) bool

func (*KVEntry) Reset

func (k *KVEntry) Reset()

func (*KVEntry) Type

func (k *KVEntry) Type() DataType

func (*KVEntry) Value

func (k *KVEntry) Value() any

Value returns the typed value for the KVEntry. It can allocate memory which is why assertions and direct type access is recommended.

func (*KVEntry) ValueAddr

func (k *KVEntry) ValueAddr() netip.Addr

func (*KVEntry) ValueBool

func (k *KVEntry) ValueBool() bool

func (*KVEntry) ValueBytes

func (k *KVEntry) ValueBytes() []byte

func (*KVEntry) ValueInt

func (k *KVEntry) ValueInt() int64

type KVScanner

type KVScanner struct {
	// contains filtered or unexported fields
}

func AcquireKVScanner

func AcquireKVScanner(b []byte, count int) *KVScanner

func NewKVScanner

func NewKVScanner(b []byte, count int) *KVScanner

func (*KVScanner) Discard

func (k *KVScanner) Discard() error

func (*KVScanner) Error

func (k *KVScanner) Error() error

func (*KVScanner) Next

func (k *KVScanner) Next(e *KVEntry) bool

func (*KVScanner) RemainingBuf

func (k *KVScanner) RemainingBuf() int

RemainingBuf returns the remaining length of the buffer

type KVWriter

type KVWriter struct {
	// contains filtered or unexported fields
}

func AcquireKVWriter

func AcquireKVWriter(buf []byte, off int) *KVWriter

func NewKVWriter

func NewKVWriter(buf []byte, off int) *KVWriter

func (*KVWriter) Bytes

func (aw *KVWriter) Bytes() []byte

func (*KVWriter) Off

func (aw *KVWriter) Off() int

func (*KVWriter) SetAddr

func (aw *KVWriter) SetAddr(name string, v netip.Addr) error

func (*KVWriter) SetBinary

func (aw *KVWriter) SetBinary(name string, v []byte) error

func (*KVWriter) SetBool

func (aw *KVWriter) SetBool(name string, v bool) error

func (*KVWriter) SetInt32

func (aw *KVWriter) SetInt32(name string, v int32) error

func (*KVWriter) SetInt64

func (aw *KVWriter) SetInt64(name string, v int64) error

func (*KVWriter) SetNull

func (aw *KVWriter) SetNull(name string) error

func (*KVWriter) SetString

func (aw *KVWriter) SetString(name string, v string) error

func (*KVWriter) SetUInt32

func (aw *KVWriter) SetUInt32(name string, v uint32) error

func (*KVWriter) SetUInt64

func (aw *KVWriter) SetUInt64(name string, v uint64) error

type Message

type Message struct {
	KV *KVScanner
	// contains filtered or unexported fields
}

func AcquireMessage

func AcquireMessage() *Message

func (*Message) NameBytes

func (m *Message) NameBytes() []byte

type MessageScanner

type MessageScanner struct {
	// contains filtered or unexported fields
}

func AcquireMessageScanner

func AcquireMessageScanner(buf []byte) *MessageScanner

func NewMessageScanner

func NewMessageScanner(b []byte) *MessageScanner

func (*MessageScanner) Error

func (s *MessageScanner) Error() error

func (*MessageScanner) Next

func (s *MessageScanner) Next(m *Message) bool

Jump to

Keyboard shortcuts

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