Documentation ¶
Index ¶
- func Decode(b []byte) ([]types.Datum, error)
- func DecodeBytes(b []byte) ([]byte, []byte, error)
- func DecodeBytesDesc(b []byte) ([]byte, []byte, error)
- func DecodeCompactBytes(b []byte) ([]byte, []byte, error)
- func DecodeDecimal(b []byte) ([]byte, mysql.Decimal, error)
- func DecodeFloat(b []byte) ([]byte, float64, error)
- func DecodeFloatDesc(b []byte) ([]byte, float64, error)
- func DecodeInt(b []byte) ([]byte, int64, error)
- func DecodeIntDesc(b []byte) ([]byte, int64, error)
- func DecodeOne(b []byte) (remain []byte, d types.Datum, err error)
- func DecodeUint(b []byte) ([]byte, uint64, error)
- func DecodeUintDesc(b []byte) ([]byte, uint64, error)
- func DecodeUvarint(b []byte) ([]byte, uint64, error)
- func DecodeVarint(b []byte) ([]byte, int64, error)
- func EncodeBytes(b []byte, data []byte) []byte
- func EncodeBytesDesc(b []byte, data []byte) []byte
- func EncodeCompactBytes(b []byte, data []byte) []byte
- func EncodeDecimal(b []byte, d mysql.Decimal) []byte
- func EncodeFloat(b []byte, v float64) []byte
- func EncodeFloatDesc(b []byte, v float64) []byte
- func EncodeInt(b []byte, v int64) []byte
- func EncodeIntDesc(b []byte, v int64) []byte
- func EncodeKey(b []byte, v ...types.Datum) ([]byte, error)
- func EncodeUint(b []byte, v uint64) []byte
- func EncodeUintDesc(b []byte, v uint64) []byte
- func EncodeUvarint(b []byte, v uint64) []byte
- func EncodeValue(b []byte, v ...types.Datum) ([]byte, error)
- func EncodeVarint(b []byte, v int64) []byte
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decode ¶
Decode decodes values from a byte slice generated with EncodeKey or EncodeValue before.
func DecodeBytes ¶
DecodeBytes decodes bytes which is encoded by EncodeBytes before, returns the leftover bytes and decoded value if no error.
func DecodeBytesDesc ¶
DecodeBytesDesc decodes bytes which is encoded by EncodeBytesDesc before, returns the leftover bytes and decoded value if no error.
func DecodeCompactBytes ¶
DecodeCompactBytes decodes bytes which is encoded by EncodeCompactBytes before.
func DecodeDecimal ¶
DecodeDecimal decodes bytes to decimal. DecodeFloat decodes a float from a byte slice Decimal decoding: Byte -> value sign Byte -> exp sign DecodeInt -> exp value DecodeBytes -> abs value bytes
func DecodeFloat ¶
DecodeFloat decodes a float from a byte slice generated with EncodeFloat before.
func DecodeFloatDesc ¶
DecodeFloatDesc decodes a float from a byte slice generated with EncodeFloatDesc before.
func DecodeInt ¶
DecodeInt decodes value encoded by EncodeInt before. It returns the leftover un-decoded slice, decoded value if no error.
func DecodeIntDesc ¶
DecodeIntDesc decodes value encoded by EncodeInt before. It returns the leftover un-decoded slice, decoded value if no error.
func DecodeOne ¶
DecodeOne decodes on datum from a byte slice generated with EncodeKey or EncodeValue.
func DecodeUint ¶
DecodeUint decodes value encoded by EncodeUint before. It returns the leftover un-decoded slice, decoded value if no error.
func DecodeUintDesc ¶
DecodeUintDesc decodes value encoded by EncodeInt before. It returns the leftover un-decoded slice, decoded value if no error.
func DecodeUvarint ¶
DecodeUvarint decodes value encoded by EncodeUvarint before. It returns the leftover un-decoded slice, decoded value if no error.
func DecodeVarint ¶
DecodeVarint decodes value encoded by EncodeVarint before. It returns the leftover un-decoded slice, decoded value if no error.
func EncodeBytes ¶
EncodeBytes guarantees the encoded value is in ascending order for comparison, encoding with the following rule:
[group1][marker1]...[groupN][markerN] group is 8 bytes slice which is padding with 0. marker is `0xFF - padding 0 count`
For example:
[] -> [0, 0, 0, 0, 0, 0, 0, 0, 247] [1, 2, 3] -> [1, 2, 3, 0, 0, 0, 0, 0, 250] [1, 2, 3, 0] -> [1, 2, 3, 0, 0, 0, 0, 0, 251] [1, 2, 3, 4, 5, 6, 7, 8] -> [1, 2, 3, 4, 5, 6, 7, 8, 255, 0, 0, 0, 0, 0, 0, 0, 0, 247]
Refer: https://github.com/facebook/mysql-5.6/wiki/MyRocks-record-format#memcomparable-format
func EncodeBytesDesc ¶
EncodeBytesDesc first encodes bytes using EncodeBytes, then bitwise reverses encoded value to guarantee the encoded value is in descending order for comparison.
func EncodeCompactBytes ¶
EncodeCompactBytes joins bytes with its length into a byte slice. It is more efficient in both space and time compare to EncodeBytes. Note that the encoded result is not memcomparable.
func EncodeDecimal ¶
EncodeDecimal encodes a decimal d into a byte slice which can be sorted lexicographically later. EncodeDecimal guarantees that the encoded value is in ascending order for comparison. Decimal encoding: Byte -> value sign EncodeInt -> exp value EncodeBytes -> abs value bytes
func EncodeFloat ¶
EncodeFloat encodes a float v into a byte slice which can be sorted lexicographically later. EncodeFloat guarantees that the encoded value is in ascending order for comparison.
func EncodeFloatDesc ¶
EncodeFloatDesc encodes a float v into a byte slice which can be sorted lexicographically later. EncodeFloatDesc guarantees that the encoded value is in descending order for comparison.
func EncodeInt ¶
EncodeInt appends the encoded value to slice b and returns the appended slice. EncodeInt guarantees that the encoded value is in ascending order for comparison.
func EncodeIntDesc ¶
EncodeIntDesc appends the encoded value to slice b and returns the appended slice. EncodeIntDesc guarantees that the encoded value is in descending order for comparison.
func EncodeKey ¶
EncodeKey appends the encoded values to byte slice b, returns the appended slice. It guarantees the encoded value is in ascending order for comparison.
func EncodeUint ¶
EncodeUint appends the encoded value to slice b and returns the appended slice. EncodeUint guarantees that the encoded value is in ascending order for comparison.
func EncodeUintDesc ¶
EncodeUintDesc appends the encoded value to slice b and returns the appended slice. EncodeUintDesc guarantees that the encoded value is in descending order for comparison.
func EncodeUvarint ¶
EncodeUvarint appends the encoded value to slice b and returns the appended slice. Note that the encoded result is not memcomparable.
func EncodeValue ¶
EncodeValue appends the encoded values to byte slice b, returning the appended slice. It does not guarantee the order for comparison.
func EncodeVarint ¶
EncodeVarint appends the encoded value to slice b and returns the appended slice. Note that the encoded result is not memcomparable.
Types ¶
This section is empty.