tablecodec

package
v0.0.0-...-2bc18d8 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2017 License: BSD-2-Clause, Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ColumnsToProto

func ColumnsToProto(columns []*model.ColumnInfo, pkIsHandle bool) []*tipb.ColumnInfo

ColumnsToProto converts a slice of model.ColumnInfo to a slice of tipb.ColumnInfo.

func DecodeIndexKey

func DecodeIndexKey(key kv.Key) ([]types.Datum, error)

DecodeIndexKey decodes datums from an index key.

func DecodeRowKey

func DecodeRowKey(key kv.Key) (handle int64, err error)

DecodeRowKey decodes the key and gets the handle.

func DecodeValues

func DecodeValues(data []byte, fts []*types.FieldType, inIndex bool) ([]types.Datum, error)

DecodeValues decodes a byte slice into datums with column types.

func EncodeColumnKey

func EncodeColumnKey(tableID int64, handle int64, columnID int64) kv.Key

EncodeColumnKey encodes the table id, row handle and columnID into a kv.Key

func EncodeIndexRanges

func EncodeIndexRanges(tid, idxID int64, rans []*tipb.KeyRange) []kv.KeyRange

EncodeIndexRanges encodes index ranges into kv.KeyRanges.

func EncodeIndexSeekKey

func EncodeIndexSeekKey(tableID int64, idxID int64, encodedValue []byte) kv.Key

EncodeIndexSeekKey encodes an index value to kv.Key.

func EncodeRowKey

func EncodeRowKey(tableID int64, encodedHandle []byte) kv.Key

EncodeRowKey encodes the table id and record handle into a kv.Key

func EncodeTableRanges

func EncodeTableRanges(tid int64, rans []*tipb.KeyRange) []kv.KeyRange

EncodeTableRanges encodes table ranges into kv.KeyRanges.

func IndexToProto

func IndexToProto(t *model.TableInfo, idx *model.IndexInfo) *tipb.IndexInfo

IndexToProto converts a model.IndexInfo to a tipb.IndexInfo.

func ProtoColumnsToFieldTypes

func ProtoColumnsToFieldTypes(pColumns []*tipb.ColumnInfo) []*types.FieldType

ProtoColumnsToFieldTypes converts tipb column info slice to FieldTyps slice.

func TruncateToRowKeyLen

func TruncateToRowKeyLen(key kv.Key) kv.Key

TruncateToRowKeyLen truncates the key to row key length if the key is longer than row key.

Types

This section is empty.

Jump to

Keyboard shortcuts

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