pbuf

package
v0.0.0-...-8f74a13 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendBool

func AppendBool(buf []byte, val bool) []byte

func AppendBytes

func AppendBytes(buf []byte, val []byte) []byte

func AppendFloatInt

func AppendFloatInt(buf []byte, val float64, digits int) []byte

func AppendFloatIntRounded

func AppendFloatIntRounded(buf []byte, val float64, digits int) []byte

func AppendItems

func AppendItems[T any](buf []byte, appendItem func([]byte, T) []byte, items ...T) []byte

func AppendItemsPtr

func AppendItemsPtr[T any](buf []byte, appendItem func([]byte, *T) []byte, items ...T) []byte

func AppendString

func AppendString(buf []byte, val string) []byte

func AppendVarInt

func AppendVarInt(buf []byte, val uint64) []byte

func AppendVarInt128

func AppendVarInt128(buf []byte, high, low uint64) []byte

func AppendVarInt1k

func AppendVarInt1k(buf []byte, val uint64) []byte

func BoolTo

func BoolTo[T uint8 | int8 | uint16 | int16 | uint32 | int32 | uint64 | int64 | uint | int](val bool) T

func BoolToInt

func BoolToInt(val bool) int

func ConsumeVarInt

func ConsumeVarInt(buf []byte) (val uint64, byteCount int)

func ConsumeVarInt128

func ConsumeVarInt128(buf []byte) (high, low uint64, byteCount int)

func ExtAppendBits

func ExtAppendBits(buf []byte, bits ...bool) []byte

func ExtAppendDictAsRawString

func ExtAppendDictAsRawString(buf []byte, dict *ExtDict[string], val string) []byte

func ExtAppendDictString

func ExtAppendDictString(buf []byte, dict *ExtDict[string], val string) []byte

func ExtAppendDualVarInt

func ExtAppendDualVarInt(buf []byte, high, low uint64, lowBits int) []byte

func ExtAppendDynDictString

func ExtAppendDynDictString(buf []byte, dict *ExtDict[string], val string) []byte

func ExtAppendDynDictString1k

func ExtAppendDynDictString1k(buf []byte, dict *ExtDict[string], val string) []byte

func ExtAppendDynDictUint64

func ExtAppendDynDictUint64(buf []byte, dict *ExtDict[uint64], val uint64) []byte

func ExtAppendPrice

func ExtAppendPrice(buf []byte, val float64) []byte

func ExtAppendPriceCents

func ExtAppendPriceCents(buf []byte, val int) []byte

func ExtAppendRleString

func ExtAppendRleString(buf []byte, val string) []byte

func ExtAppendSlice

func ExtAppendSlice[T KeyTypes](buf []byte, val []T) []byte

func ExtAppendSliceFunc

func ExtAppendSliceFunc[T any](buf []byte, val []T, appendFunc func(buf []byte, val *T) []byte) []byte

func ExtAppendTs

func ExtAppendTs(buf []byte, ts int64) []byte

func ExtReadBits

func ExtReadBits(buf []byte, ofs int, bits ...*bool) int

func ExtReadBitsSlice

func ExtReadBitsSlice(buf []byte, ofs int, bits []bool) int

func ExtReadDictString

func ExtReadDictString(buf []byte, ofs int, dict *ExtDict[string], val *string) int

func ExtReadDualVarInt

func ExtReadDualVarInt(buf []byte, ofs int, high, low *uint64, lowBits int) int

func ExtReadDynDictString

func ExtReadDynDictString(buf []byte, ofs int, dict *ExtDict[string], val *string) int

func ExtReadDynDictString1k

func ExtReadDynDictString1k(buf []byte, ofs int, dict *ExtDict[string], val *string) int

func ExtReadDynDictUint64

func ExtReadDynDictUint64(buf []byte, ofs int, dict *ExtDict[uint64], val *uint64) int

func ExtReadPrice

func ExtReadPrice(buf []byte, ofs int, val *float64) int

func ExtReadPriceCents

func ExtReadPriceCents(buf []byte, ofs int, val *int) int

func ExtReadRleString

func ExtReadRleString(buf []byte, ofs int, val *string) int

func ExtReadSlice

func ExtReadSlice[T KeyTypes](buf []byte, ofs int, val *[]T) int

func ExtReadSliceFunc

func ExtReadSliceFunc[T any](buf []byte, ofs int, val *[]T, readFunc func(buf []byte, ofs int, val *T) int) int

func ExtReadTs

func ExtReadTs(buf []byte, ofs int, val *int64) int

func FloatFromInt

func FloatFromInt(val int, digits int) float64

func FloatToInt

func FloatToInt(val float64, digits int) int

func FloatToIntRounded

func FloatToIntRounded(val float64, digits int) int

func InsertVarInt

func InsertVarInt(buf []byte, pos int, val uint64) []byte

func InsertVarIntUsePlaceholder

func InsertVarIntUsePlaceholder(buf []byte, pos, placeholderBytes int, val uint64) []byte

func IntToBool

func IntToBool[T uint8 | int8 | uint16 | int16 | uint32 | int32 | uint64 | int64 | uint | int](val T) bool

func RawAppendBool

func RawAppendBool(buf []byte, val bool) []byte

func RawAppendComplex128

func RawAppendComplex128(buf []byte, val complex128) []byte

func RawAppendComplex64

func RawAppendComplex64(buf []byte, val complex64) []byte

func RawAppendFloat32

func RawAppendFloat32(buf []byte, val float32) []byte

func RawAppendFloat64

func RawAppendFloat64(buf []byte, val float64) []byte

func RawAppendFloat64Lite

func RawAppendFloat64Lite(buf []byte, val float64) []byte

func RawAppendInt

func RawAppendInt(buf []byte, val int) []byte

func RawAppendInt16

func RawAppendInt16(buf []byte, val int16) []byte

func RawAppendInt24

func RawAppendInt24(buf []byte, val int32) []byte

func RawAppendInt32

func RawAppendInt32(buf []byte, val int32) []byte

func RawAppendInt40

func RawAppendInt40(buf []byte, val int64) []byte

func RawAppendInt48

func RawAppendInt48(buf []byte, val int64) []byte

func RawAppendInt56

func RawAppendInt56(buf []byte, val int64) []byte

func RawAppendInt64

func RawAppendInt64(buf []byte, val int64) []byte

func RawAppendInt8

func RawAppendInt8(buf []byte, val int8) []byte

func RawAppendUint

func RawAppendUint(buf []byte, val uint) []byte

func RawAppendUint16

func RawAppendUint16(buf []byte, val uint16) []byte

func RawAppendUint24

func RawAppendUint24(buf []byte, val uint32) []byte

func RawAppendUint32

func RawAppendUint32(buf []byte, val uint32) []byte

func RawAppendUint40

func RawAppendUint40(buf []byte, val uint64) []byte

func RawAppendUint48

func RawAppendUint48(buf []byte, val uint64) []byte

func RawAppendUint56

func RawAppendUint56(buf []byte, val uint64) []byte

func RawAppendUint64

func RawAppendUint64(buf []byte, val uint64) []byte

func RawAppendUint8

func RawAppendUint8(buf []byte, val uint8) []byte

func RawReadBool

func RawReadBool(buf []byte, ofs int, val *bool) int

func RawReadComplex128

func RawReadComplex128(buf []byte, ofs int, val *complex128) int

func RawReadComplex64

func RawReadComplex64(buf []byte, ofs int, val *complex64) int

func RawReadFloat32

func RawReadFloat32(buf []byte, ofs int, val *float32) int

func RawReadFloat64

func RawReadFloat64(buf []byte, ofs int, val *float64) int

func RawReadFloat64Lite

func RawReadFloat64Lite(buf []byte, ofs int, val *float64) int

func RawReadInt

func RawReadInt(buf []byte, ofs int, val *int) int

func RawReadInt16

func RawReadInt16(buf []byte, ofs int, val *int16) int

func RawReadInt24

func RawReadInt24(buf []byte, ofs int, val *int32) int

func RawReadInt32

func RawReadInt32(buf []byte, ofs int, val *int32) int

func RawReadInt40

func RawReadInt40(buf []byte, ofs int, val *int64) int

func RawReadInt48

func RawReadInt48(buf []byte, ofs int, val *int64) int

func RawReadInt56

func RawReadInt56(buf []byte, ofs int, val *int64) int

func RawReadInt64

func RawReadInt64(buf []byte, ofs int, val *int64) int

func RawReadInt8

func RawReadInt8(buf []byte, ofs int, val *int8) int

func RawReadUint

func RawReadUint(buf []byte, ofs int, val *uint) int

func RawReadUint16

func RawReadUint16(buf []byte, ofs int, val *uint16) int

func RawReadUint24

func RawReadUint24(buf []byte, ofs int, val *uint32) int

func RawReadUint32

func RawReadUint32(buf []byte, ofs int, val *uint32) int

func RawReadUint40

func RawReadUint40(buf []byte, ofs int, val *uint64) int

func RawReadUint48

func RawReadUint48(buf []byte, ofs int, val *uint64) int

func RawReadUint56

func RawReadUint56(buf []byte, ofs int, val *uint64) int

func RawReadUint64

func RawReadUint64(buf []byte, ofs int, val *uint64) int

func RawReadUint8

func RawReadUint8(buf []byte, ofs int, val *uint8) int

func ReadBool

func ReadBool(buf []byte, ofs int, val *bool) (byteCount int)

func ReadBytes

func ReadBytes(buf []byte, ofs int) (val []byte, byteCount int)

func ReadBytesUnsafe

func ReadBytesUnsafe(buf []byte, ofs int) (val []byte, byteCount int)

func ReadFloatInt

func ReadFloatInt(buf []byte, ofs int, val *float64, digits int) int

func ReadString

func ReadString(buf []byte, ofs int, val *string) (byteCount int)

func ReadStringUnsafe

func ReadStringUnsafe(buf []byte, ofs int) (val string, byteCount int)

func ReadVarInt

func ReadVarInt(buf []byte, ofs int, val *uint64) (byteCount int)

func ReadVarInt128

func ReadVarInt128(buf []byte, ofs int, high, low *uint64) (byteCount int)

func ReadVarInt1k

func ReadVarInt1k(buf []byte, ofs int, val *uint64) (byteCount int)

func ReadVarIntFromReader

func ReadVarIntFromReader(r io.Reader) (val uint64, byteCount int, err error)

func SetVarInt

func SetVarInt(buf []byte, val uint64) (byteCount int)

func SetVarIntFixSize

func SetVarIntFixSize(buf []byte, val uint64, fixByteCount int) (byteCount int)

func SizeBytes

func SizeBytes(val []byte) int

func SizeString

func SizeString(val string) int

func SizeVarInt

func SizeVarInt(v uint64) int

func SqlAppendBlob

func SqlAppendBlob(buf []byte, val []byte) []byte

func SqlAppendBool

func SqlAppendBool(buf []byte, val bool) []byte

func SqlAppendByte

func SqlAppendByte(buf []byte, val byte) []byte

func SqlAppendFloat64

func SqlAppendFloat64(buf []byte, val float64) []byte

func SqlAppendInt

func SqlAppendInt(buf []byte, val int) []byte

func SqlAppendInt16

func SqlAppendInt16(buf []byte, val int16) []byte

func SqlAppendInt1k

func SqlAppendInt1k(buf []byte, val int) []byte

func SqlAppendInt32

func SqlAppendInt32(buf []byte, val int32) []byte

func SqlAppendInt64

func SqlAppendInt64(buf []byte, val int64) []byte

func SqlAppendNullBool

func SqlAppendNullBool(buf []byte, val sql.NullBool) []byte

func SqlAppendNullByte

func SqlAppendNullByte(buf []byte, val sql.NullByte) []byte

func SqlAppendNullFloat64

func SqlAppendNullFloat64(buf []byte, val sql.NullFloat64) []byte

func SqlAppendNullInt16

func SqlAppendNullInt16(buf []byte, val sql.NullInt16) []byte

func SqlAppendNullInt32

func SqlAppendNullInt32(buf []byte, val sql.NullInt32) []byte

func SqlAppendNullInt64

func SqlAppendNullInt64(buf []byte, val sql.NullInt64) []byte

func SqlAppendNullString

func SqlAppendNullString(buf []byte, val sql.NullString) []byte

func SqlAppendNullTime

func SqlAppendNullTime(buf []byte, val sql.NullTime) []byte

func SqlAppendString

func SqlAppendString(buf []byte, val string) []byte

func SqlAppendTime

func SqlAppendTime(buf []byte, val time.Time) []byte

func SqlAppendUint

func SqlAppendUint(buf []byte, val uint) []byte

func SqlAppendUint16

func SqlAppendUint16(buf []byte, val uint16) []byte

func SqlAppendUint1k

func SqlAppendUint1k(buf []byte, val uint) []byte

func SqlAppendUint32

func SqlAppendUint32(buf []byte, val uint32) []byte

func SqlAppendUint64

func SqlAppendUint64(buf []byte, val uint64) []byte

func SqlReadBlob

func SqlReadBlob(buf []byte, ofs int, val *[]byte) int

func SqlReadBool

func SqlReadBool(buf []byte, ofs int, val *bool) int

func SqlReadByte

func SqlReadByte(buf []byte, ofs int, val *byte) int

func SqlReadFloat64

func SqlReadFloat64(buf []byte, ofs int, val *float64) int

func SqlReadInt

func SqlReadInt(buf []byte, ofs int, val *int) int

func SqlReadInt16

func SqlReadInt16(buf []byte, ofs int, val *int16) int

func SqlReadInt1k

func SqlReadInt1k(buf []byte, ofs int, val *int) int

func SqlReadInt32

func SqlReadInt32(buf []byte, ofs int, val *int32) int

func SqlReadInt64

func SqlReadInt64(buf []byte, ofs int, val *int64) int

func SqlReadNullBool

func SqlReadNullBool(buf []byte, ofs int, val *sql.NullBool) int

func SqlReadNullByte

func SqlReadNullByte(buf []byte, ofs int, val *sql.NullByte) int

func SqlReadNullFloat64

func SqlReadNullFloat64(buf []byte, ofs int, val *sql.NullFloat64) int

func SqlReadNullInt16

func SqlReadNullInt16(buf []byte, ofs int, val *sql.NullInt16) int

func SqlReadNullInt32

func SqlReadNullInt32(buf []byte, ofs int, val *sql.NullInt32) int

func SqlReadNullInt64

func SqlReadNullInt64(buf []byte, ofs int, val *sql.NullInt64) int

func SqlReadNullString

func SqlReadNullString(buf []byte, ofs int, val *sql.NullString) int

func SqlReadNullTime

func SqlReadNullTime(buf []byte, ofs int, val *sql.NullTime) int

func SqlReadString

func SqlReadString(buf []byte, ofs int, val *string) int

func SqlReadTime

func SqlReadTime(buf []byte, ofs int, val *time.Time) int

func SqlReadUint

func SqlReadUint(buf []byte, ofs int, val *uint) int

func SqlReadUint16

func SqlReadUint16(buf []byte, ofs int, val *uint16) int

func SqlReadUint1k

func SqlReadUint1k(buf []byte, ofs int, val *uint) int

func SqlReadUint32

func SqlReadUint32(buf []byte, ofs int, val *uint32) int

func SqlReadUint64

func SqlReadUint64(buf []byte, ofs int, val *uint64) int

func UnZigZag

func UnZigZag(val uint64) int64

func UnsafeBytesToString

func UnsafeBytesToString(val []byte) string

func UnsafeStringToBytes

func UnsafeStringToBytes(val string) []byte

func WriteBytes

func WriteBytes(buf []byte, ofs int, val []byte) (byteCount int)

func WriteString

func WriteString(buf []byte, ofs int, val string) (byteCount int)

func WriteVarInt

func WriteVarInt(buf []byte, ofs int, val uint64) (byteCount int)

func ZigZag

func ZigZag(val int64) uint64

Types

type ExtChanger

type ExtChanger[T comparable] struct {
	LastValue T
	// contains filtered or unexported fields
}

func NewExtChanger

func NewExtChanger[T comparable](qappend func(buf []byte, val T) []byte, qread func(buf []byte, ofs int, val *T) int, startValue T) *ExtChanger[T]

func NewExtChangerByte

func NewExtChangerByte() *ExtChanger[byte]

func NewExtChangerDictString

func NewExtChangerDictString(dict *ExtDict[string]) *ExtChanger[string]

func NewExtChangerInt

func NewExtChangerInt() *ExtChanger[int]

func NewExtChangerInt16

func NewExtChangerInt16() *ExtChanger[int16]

func NewExtChangerString

func NewExtChangerString() *ExtChanger[string]

func NewExtChangerUint

func NewExtChangerUint() *ExtChanger[uint]

func (*ExtChanger[T]) AppendNext

func (ec *ExtChanger[T]) AppendNext(buf []byte) []byte

func (*ExtChanger[T]) AppendNextForce

func (ec *ExtChanger[T]) AppendNextForce(buf []byte) []byte

func (*ExtChanger[T]) Clone

func (ec *ExtChanger[T]) Clone() *ExtChanger[T]

func (*ExtChanger[T]) PrepareNext

func (ec *ExtChanger[T]) PrepareNext(val T) (changed bool)

func (*ExtChanger[T]) ReadNext

func (ec *ExtChanger[T]) ReadNext(buf []byte, ofs int, changed bool, val *T) int

func (*ExtChanger[T]) Reset

func (ec *ExtChanger[T]) Reset()

func (*ExtChanger[T]) ResetValue

func (ec *ExtChanger[T]) ResetValue(val T)

type ExtDict

type ExtDict[T comparable] struct {
	SearchMap map[T]uint64
	UseMap    []T
}

func NewExtDict

func NewExtDict[T comparable](values ...T) (result *ExtDict[T])

func (*ExtDict[T]) Add

func (dict *ExtDict[T]) Add(val T) uint64

type ExtDiffer

type ExtDiffer[T any] struct {
	LastValue T
	// contains filtered or unexported fields
}

func NewExtDiffer

func NewExtDiffer[T any](encoder func(last, next T) (diff T), decoder func(last, diff T) (next T), qappend func(buf []byte, val T) []byte, qread func(buf []byte, ofs int, val *T) int, startValue T) *ExtDiffer[T]

func NewExtDifferInt

func NewExtDifferInt() *ExtDiffer[int]

func NewExtDifferInt1k

func NewExtDifferInt1k() *ExtDiffer[int]

func NewExtDifferPrice

func NewExtDifferPrice() *ExtDiffer[float64]

func NewExtDifferUint

func NewExtDifferUint() *ExtDiffer[uint]

func NewExtDifferUint1k

func NewExtDifferUint1k() *ExtDiffer[uint]

func NewExtDifferUintDec

func NewExtDifferUintDec() *ExtDiffer[uint]

func NewExtDifferUintDec1k

func NewExtDifferUintDec1k() *ExtDiffer[uint]

func NewFloatIntDiffer

func NewFloatIntDiffer(digits int) *ExtDiffer[float64]

func NewFloatIntDifferRounded

func NewFloatIntDifferRounded(digits int) *ExtDiffer[float64]

func (*ExtDiffer[T]) AppendNext

func (ed *ExtDiffer[T]) AppendNext(buf []byte, val T) []byte

func (*ExtDiffer[T]) AppendNextDifErr

func (ed *ExtDiffer[T]) AppendNextDifErr(buf []byte, val T) ([]byte, T)

func (*ExtDiffer[T]) Clone

func (ed *ExtDiffer[T]) Clone() *ExtDiffer[T]

func (*ExtDiffer[T]) ReadNext

func (ed *ExtDiffer[T]) ReadNext(buf []byte, ofs int, val *T) int

func (*ExtDiffer[T]) ReadNextDifErr

func (ed *ExtDiffer[T]) ReadNextDifErr(buf []byte, ofs int, val *T) (int, T)

func (*ExtDiffer[T]) Reset

func (ed *ExtDiffer[T]) Reset()

func (*ExtDiffer[T]) ResetValue

func (ed *ExtDiffer[T]) ResetValue(val T)

type Indexer

type Indexer[T KeyTypes] struct {
	// contains filtered or unexported fields
}

func NewIndexer

func NewIndexer[T KeyTypes]() *Indexer[T]

func (*Indexer[T]) Add

func (idx *Indexer[T]) Add(key T, pos, length int)

func (*Indexer[T]) AddEndPos

func (idx *Indexer[T]) AddEndPos(key T, endPos int)

func (*Indexer[T]) AddStartPos

func (idx *Indexer[T]) AddStartPos(key T, startPos int)

func (*Indexer[T]) Get

func (idx *Indexer[T]) Get(key T) IndexerIndex

func (*Indexer[T]) GetKeys

func (idx *Indexer[T]) GetKeys() []T

func (*Indexer[T]) GetKeysSortedByPos

func (idx *Indexer[T]) GetKeysSortedByPos() []T

func (*Indexer[T]) Qappend

func (idx *Indexer[T]) Qappend(buf []byte) []byte

func (*Indexer[T]) Qread

func (idx *Indexer[T]) Qread(buf []byte) int

type IndexerIndex

type IndexerIndex struct {
	Pos uint
	Len uint
}

func (IndexerIndex) CutSlice

func (pos IndexerIndex) CutSlice(slice []byte) []byte

type KeyTypes

type KeyTypes interface {
	int | uint | int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | time.Duration | float32 | float64 | string
}

type Qhandler

type Qhandler interface {
	Qappend(buf []byte) []byte
	Qread(buf []byte) int
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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