Documentation ¶
Index ¶
- Constants
- func AbbreviatedKey(key []byte) uint64
- func Compare(a, b []byte) int
- func DecodeArray(b []byte, intAsDouble bool) types.Array
- func DecodeBlob(b []byte) ([]byte, int)
- func DecodeBoolean(b []byte) bool
- func DecodeDocument(b []byte, intAsDouble bool) types.Document
- func DecodeFloat(b []byte) (float64, int)
- func DecodeFloat64(b []byte) float64
- func DecodeInt(b []byte) (int64, int)
- func DecodeInt16(b []byte) int16
- func DecodeInt32(b []byte) int32
- func DecodeInt64(b []byte) int64
- func DecodeInt8(b []byte) int8
- func DecodeText(b []byte) (string, int)
- func DecodeUint16(b []byte) uint16
- func DecodeUint32(b []byte) uint32
- func DecodeUint64(b []byte) uint64
- func DecodeUint8(b []byte) uint8
- func DecodeValue(b []byte, intAsDouble bool) (types.Value, int)
- func EncodeArray(dst []byte, a types.Array) ([]byte, error)
- func EncodeArrayLength(dst []byte, l int) []byte
- func EncodeBlob(dst []byte, x []byte) []byte
- func EncodeBoolean(dst []byte, x bool) []byte
- func EncodeDocument(dst []byte, d types.Document) ([]byte, error)
- func EncodeDocumentLength(dst []byte, l int) []byte
- func EncodeFloat(dst []byte, x float64) []byte
- func EncodeFloat64(dst []byte, x float64) []byte
- func EncodeInt(dst []byte, n int64) []byte
- func EncodeInt16(dst []byte, n int16) []byte
- func EncodeInt32(dst []byte, n int32) []byte
- func EncodeInt64(dst []byte, n int64) []byte
- func EncodeInt8(dst []byte, n int8) []byte
- func EncodeNull(dst []byte) []byte
- func EncodeText(dst []byte, x string) []byte
- func EncodeUint(dst []byte, n uint64) []byte
- func EncodeUint16(dst []byte, n uint16) []byte
- func EncodeUint32(dst []byte, n uint32) []byte
- func EncodeUint64(dst []byte, n uint64) []byte
- func EncodeUint8(dst []byte, n uint8) []byte
- func EncodeValue(dst []byte, v types.Value) ([]byte, error)
- func Equal(a, b []byte) bool
- func Separator(dst, a, b []byte) (foo []byte)
- func Skip(b []byte) int
- func SkipArray(b []byte) int
- func SkipDocument(b []byte) int
- func Successor(dst, a []byte) []byte
- type EncodedArray
- type EncodedDocument
Constants ¶
const ( NullValue byte = 0x05 FalseValue byte = 0x10 // 0x10 - 0x00 = 0x10 = 16 TrueValue byte = 0x11 // 0x11 - 0x10 = 0x01 = 1 Int64Value byte = 0x20 // 0x20 - 0x11 = 0x0f = 15 Int32Value byte = 0x21 // 0x21 - 0x20 = 0x01 = 1 Int16Value byte = 0x22 // 0x22 - 0x21 = 0x01 = 1 Int8Value byte = 0x23 // 0x23 - 0x22 = 0x01 = 1 // until -32 IntSmallValue byte = 0x24 // 0x24 - 0x23 = 0x01 = 1 // until 127 Uint8Value byte = 0xC4 // 0xC3 - 0x23 = 0xA0 = 160 Uint16Value byte = 0xC5 // 0xC4 - 0xC3 = 0x01 = 1 Uint32Value byte = 0xC6 // 0xC5 - 0xC4 = 0x01 = 1 Uint64Value byte = 0xC7 // 0xC6 - 0xC5 = 0x01 = 1 Float64Value byte = 0xD0 // 0xD0 - 0xC6 = 0x0a = 10 Float32Value byte = 0xD1 // 0xD1 - 0xD0 = 0x01 = 1 | not included in keys TextValue byte = 0xDA // 0xDA - 0xD1 = 0x09 = 9 BlobValue byte = 0xE0 // 0xE0 - 0xDA = 0x06 = 6 ArrayValue byte = 0xE6 // 0xE6 - 0xE0 = 0x06 = 6 DocumentValue byte = 0xF0 // 0xF0 - 0xE6 = 0x0e = 14 )
additional types sorted from the smallest to the largest
Variables ¶
This section is empty.
Functions ¶
func AbbreviatedKey ¶
AbbreviatedKey returns a shortened version that is used for comparing keys during indexed batch comparisons. The key is not guaranteed to be unique, but it respects the same ordering as the original key. If two abbreviated keys are equal, Pebble will call the Equal function to determine if the original keys are equal. The key is constructed as follows: - 12 bits: the namespace, from 0 to 4096. If bigger than 4096, returns math.MaxUint64. - 4 bits: the Genji type of the first value. - 48 bits: a representation of the first value of the key, depending on its type.
func DecodeBlob ¶
func DecodeBoolean ¶
func DecodeFloat ¶
func DecodeFloat64 ¶
func DecodeInt16 ¶
func DecodeInt32 ¶
func DecodeInt64 ¶
func DecodeInt8 ¶
func DecodeText ¶
func DecodeUint16 ¶
func DecodeUint32 ¶
func DecodeUint64 ¶
func DecodeUint8 ¶
func EncodeArrayLength ¶
func EncodeBlob ¶
func EncodeBoolean ¶
func EncodeDocumentLength ¶
func EncodeFloat ¶
func EncodeFloat64 ¶
func EncodeInt16 ¶
func EncodeInt32 ¶
func EncodeInt64 ¶
func EncodeInt8 ¶
func EncodeNull ¶
func EncodeText ¶
func EncodeUint ¶
func EncodeUint16 ¶
func EncodeUint32 ¶
func EncodeUint64 ¶
func EncodeUint8 ¶
func SkipDocument ¶
Types ¶
type EncodedArray ¶
type EncodedArray struct {
// contains filtered or unexported fields
}
An EncodedArray implements the types.Array interface on top of an encoded representation of an array. It is useful for avoiding decoding the entire array when only a few values are needed.
func (*EncodedArray) GetByIndex ¶
func (e *EncodedArray) GetByIndex(idx int) (v types.Value, err error)
GetByIndex returns a value by index of the array.
func (*EncodedArray) Iterate ¶
Iterate goes through all the values of the array and calls the given function by passing each one of them. If the given function returns an error, the iteration stops.
func (*EncodedArray) MarshalJSON ¶
func (e *EncodedArray) MarshalJSON() ([]byte, error)
type EncodedDocument ¶
type EncodedDocument struct { Encoded []byte // contains filtered or unexported fields }
func (*EncodedDocument) GetByField ¶
func (e *EncodedDocument) GetByField(field string) (types.Value, error)
func (*EncodedDocument) MarshalJSON ¶
func (e *EncodedDocument) MarshalJSON() ([]byte, error)