orderedcodec

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 5, 2022 License: Apache-2.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DecodedItem

type DecodedItem struct {
	Value                    interface{}
	ValueType                ValueType   // int,uint,uint64,...,float
	SectionType              SectionType //belongs to which section
	OffsetInUndecodedKey     int         //the position in undecoded bytes
	RawBytes                 []byte      //the byte that holds the item
	BytesCountInUndecodedKey int         //the count of bytes in undecoded bytes
	ID                       uint32      //the attribute id
}

func NewDecodeItem

func NewDecodeItem(v interface{}, vt ValueType, st SectionType, oiu int, bciu int) *DecodedItem

func (*DecodedItem) GetBytes

func (di *DecodedItem) GetBytes() ([]byte, error)

func (*DecodedItem) GetBytesCountInUndecodedKey

func (di *DecodedItem) GetBytesCountInUndecodedKey() int

func (*DecodedItem) GetDate

func (di *DecodedItem) GetDate() (types.Date, error)

func (*DecodedItem) GetDatetime

func (di *DecodedItem) GetDatetime() (types.Datetime, error)

func (*DecodedItem) GetFloat32

func (di *DecodedItem) GetFloat32() (float32, error)

func (*DecodedItem) GetFloat64

func (di *DecodedItem) GetFloat64() (float64, error)

func (*DecodedItem) GetID

func (di *DecodedItem) GetID() uint32

func (*DecodedItem) GetInt8

func (di *DecodedItem) GetInt8() (int8, error)

func (*DecodedItem) GetInt16

func (di *DecodedItem) GetInt16() (int16, error)

func (*DecodedItem) GetInt32

func (di *DecodedItem) GetInt32() (int32, error)

func (*DecodedItem) GetInt64

func (di *DecodedItem) GetInt64() (int64, error)

func (*DecodedItem) GetOffsetInUndecodedKey

func (di *DecodedItem) GetOffsetInUndecodedKey() int

func (*DecodedItem) GetSectionType

func (di *DecodedItem) GetSectionType() SectionType

func (*DecodedItem) GetUint8

func (di *DecodedItem) GetUint8() (uint8, error)

func (*DecodedItem) GetUint16

func (di *DecodedItem) GetUint16() (uint16, error)

func (*DecodedItem) GetUint32

func (di *DecodedItem) GetUint32() (uint32, error)

func (*DecodedItem) GetUint64

func (di *DecodedItem) GetUint64() (uint64, error)

func (*DecodedItem) GetValue

func (di *DecodedItem) GetValue() interface{}

func (*DecodedItem) GetValueType

func (di *DecodedItem) GetValueType() ValueType

func (*DecodedItem) IsSectionType

func (di *DecodedItem) IsSectionType(st SectionType) bool

func (*DecodedItem) IsValueType

func (di *DecodedItem) IsValueType(vt ValueType) bool

func (*DecodedItem) SetBytesCountInUndecodedKey

func (di *DecodedItem) SetBytesCountInUndecodedKey(b int)

func (*DecodedItem) SetID

func (di *DecodedItem) SetID(id uint32)

func (*DecodedItem) SetOffsetInUndecodedKey

func (di *DecodedItem) SetOffsetInUndecodedKey(o int)

func (*DecodedItem) SetSectionType

func (di *DecodedItem) SetSectionType(st SectionType)

func (*DecodedItem) SetValue

func (di *DecodedItem) SetValue(v interface{})

func (*DecodedItem) SetValueType

func (di *DecodedItem) SetValueType(vt ValueType)

type EncodedItem

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

type OrderedDecoder

type OrderedDecoder struct {
}

func NewOrderedDecoder

func NewOrderedDecoder() *OrderedDecoder

func (*OrderedDecoder) DecodeBytes

func (od *OrderedDecoder) DecodeBytes(data []byte) ([]byte, *DecodedItem, error)

DecodeBytes decodes the bytes from the encoded bytes.

func (*OrderedDecoder) DecodeFloat

func (od *OrderedDecoder) DecodeFloat(data []byte) ([]byte, *DecodedItem, error)

func (*OrderedDecoder) DecodeInt64

func (od *OrderedDecoder) DecodeInt64(data []byte) ([]byte, *DecodedItem, error)

DecodeInt64 decodes the int64 with the variable length encoding and returns the bytes after the int64

func (*OrderedDecoder) DecodeKey

func (od *OrderedDecoder) DecodeKey(data []byte, valueType ValueType) ([]byte, *DecodedItem, error)

DecodeKey decodes

func (*OrderedDecoder) DecodeString

func (od *OrderedDecoder) DecodeString(data []byte) ([]byte, *DecodedItem, error)

DecodeString decodes string from the encoded bytes

func (*OrderedDecoder) DecodeUint64

func (od *OrderedDecoder) DecodeUint64(data []byte) ([]byte, *DecodedItem, error)

DecodeUint64 decodes the uint64 with the variable length encoding and returns the bytes after the uint64

func (*OrderedDecoder) DecodeUint64ForFloat

func (od *OrderedDecoder) DecodeUint64ForFloat(data []byte) ([]byte, *DecodedItem, error)

func (*OrderedDecoder) IsNull

func (od *OrderedDecoder) IsNull(data []byte) ([]byte, *DecodedItem, error)

isNll decodes the NULL and returns the bytes after the null.

type OrderedEncoder

type OrderedEncoder struct {
}

func NewOrderedEncoder

func NewOrderedEncoder() *OrderedEncoder

func (*OrderedEncoder) EncodeBool

func (oe *OrderedEncoder) EncodeBool(data []byte, value bool) ([]byte, *EncodedItem)

func (*OrderedEncoder) EncodeBytes

func (oe *OrderedEncoder) EncodeBytes(data []byte, value []byte) ([]byte, *EncodedItem)

EncodeBytes encodes the bytes with escaping and appends them to the buffer.

func (*OrderedEncoder) EncodeDate

func (oe *OrderedEncoder) EncodeDate(data []byte, value types.Date) ([]byte, *EncodedItem)

func (*OrderedEncoder) EncodeDatetime

func (oe *OrderedEncoder) EncodeDatetime(data []byte, value types.Datetime) ([]byte, *EncodedItem)

func (*OrderedEncoder) EncodeFloat32

func (oe *OrderedEncoder) EncodeFloat32(data []byte, value float32) ([]byte, *EncodedItem)

func (*OrderedEncoder) EncodeFloat64

func (oe *OrderedEncoder) EncodeFloat64(data []byte, value float64) ([]byte, *EncodedItem)

func (*OrderedEncoder) EncodeInt8

func (oe *OrderedEncoder) EncodeInt8(data []byte, value int8) ([]byte, *EncodedItem)

func (*OrderedEncoder) EncodeInt16

func (oe *OrderedEncoder) EncodeInt16(data []byte, value int16) ([]byte, *EncodedItem)

func (*OrderedEncoder) EncodeInt32

func (oe *OrderedEncoder) EncodeInt32(data []byte, value int32) ([]byte, *EncodedItem)

func (*OrderedEncoder) EncodeInt64

func (oe *OrderedEncoder) EncodeInt64(data []byte, value int64) ([]byte, *EncodedItem)

func (*OrderedEncoder) EncodeKey

func (oe *OrderedEncoder) EncodeKey(data []byte, value interface{}) ([]byte, *EncodedItem)

EncodeKey encodes the value into the ordered bytes

func (*OrderedEncoder) EncodeNull

func (oe *OrderedEncoder) EncodeNull(data []byte) ([]byte, *EncodedItem)

EncodeNull encodes the NULL and appends the result to the buffer

func (*OrderedEncoder) EncodeString

func (oe *OrderedEncoder) EncodeString(data []byte, value string) ([]byte, *EncodedItem)

EncodeString encods the string into bytes with escaping and appends them to the buffer.

func (*OrderedEncoder) EncodeUint8

func (oe *OrderedEncoder) EncodeUint8(data []byte, value uint8) ([]byte, *EncodedItem)

func (*OrderedEncoder) EncodeUint16

func (oe *OrderedEncoder) EncodeUint16(data []byte, value uint16) ([]byte, *EncodedItem)

func (*OrderedEncoder) EncodeUint32

func (oe *OrderedEncoder) EncodeUint32(data []byte, value uint32) ([]byte, *EncodedItem)

func (*OrderedEncoder) EncodeUint64

func (oe *OrderedEncoder) EncodeUint64(data []byte, value uint64) ([]byte, *EncodedItem)

EncodeUint64 encodes the uint64 into ordered bytes with uvarint encoding and appends them to the buffer. The variable length is encoded into the first byte.

func (*OrderedEncoder) EncodeUint64ForFloat

func (oe *OrderedEncoder) EncodeUint64ForFloat(data []byte, value uint64) ([]byte, *EncodedItem)

type SectionType

type SectionType int
const (
	SECTION_TYPE_TABLEID           SectionType = 0x0
	SECTION_TYPE_INDEXID           SectionType = 0x1
	SECTION_TYPE_PRIMARYKEYFIELD   SectionType = 0x2
	SECTION_TYPE_SECONDARYKEYFIELD SectionType = 0x3
	SECTION_TYPE_IMPLICITFIELD     SectionType = 0x4
	SECTION_TYPE_COMPOSITEFIELD    SectionType = 0x5
	SECTION_TYPE_STOREFIELD        SectionType = 0x6
	SECTION_TYPE_COLUMNGROUP       SectionType = 0x7
	SECTION_TYPE_DATABASEID        SectionType = 0x8
	SECTION_TYPE_VALUE             SectionType = 0x9
)

type ValueType

type ValueType int
const (
	VALUE_TYPE_UNKOWN   ValueType = 0x0
	VALUE_TYPE_NULL     ValueType = 0x1
	VALUE_TYPE_BOOL     ValueType = 0x2
	VALUE_TYPE_UINT64   ValueType = 0x3
	VALUE_TYPE_BYTES    ValueType = 0x4
	VALUE_TYPE_STRING   ValueType = 0x5
	VALUE_TYPE_INT8     ValueType = 0x6
	VALUE_TYPE_INT16    ValueType = 0x7
	VALUE_TYPE_INT32    ValueType = 0x8
	VALUE_TYPE_INT64    ValueType = 0x9
	VALUE_TYPE_UINT8    ValueType = 0xa
	VALUE_TYPE_UINT16   ValueType = 0xb
	VALUE_TYPE_UINT32   ValueType = 0xc
	VALUE_TYPE_FLOAT32  ValueType = 0xd
	VALUE_TYPE_FLOAT64  ValueType = 0xe
	VALUE_TYPE_DATE     ValueType = 0xf
	VALUE_TYPE_DATETIME ValueType = 0x10
)

Jump to

Keyboard shortcuts

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