tidb: github.com/pingcap/tidb/util/rowcodec Index | Files

package rowcodec

import "github.com/pingcap/tidb/util/rowcodec"

Index

Package Files

common.go decoder.go encoder.go row.go

Constants

const (
    NilFlag          byte = 0
    BytesFlag        byte = 1
    CompactBytesFlag byte = 2
    IntFlag          byte = 3
    UintFlag         byte = 4
    FloatFlag        byte = 5
    DecimalFlag      byte = 6
    VarintFlag       byte = 8
    VaruintFlag      byte = 9
    JSONFlag         byte = 10
)

First byte in the encoded value which specifies the encoding type.

const CodecVer = 128

CodecVer is the constant number that represent the new row format.

func FieldTypeFromModelColumn Uses

func FieldTypeFromModelColumn(col *model.ColumnInfo) *types.FieldType

FieldTypeFromModelColumn creates a types.FieldType from model.ColumnInfo. export for test case and CDC.

func IsNewFormat Uses

func IsNewFormat(rowData []byte) bool

IsNewFormat checks whether row data is in new-format.

func IsRowKey Uses

func IsRowKey(key []byte) bool

IsRowKey determine whether key is row key. this method will be used in unistore.

func NewDecoder Uses

func NewDecoder(columns []ColInfo, handleColIDs []int64, loc *time.Location) *decoder

NewDecoder creates a decoder.

type BytesDecoder Uses

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

BytesDecoder decodes the row to old datums bytes.

func NewByteDecoder Uses

func NewByteDecoder(columns []ColInfo, handleColIDs []int64, defBytes func(i int) ([]byte, error), loc *time.Location) *BytesDecoder

NewByteDecoder creates a BytesDecoder. defBytes: provided default value bytes in old datum format(flag+colData).

func (*BytesDecoder) DecodeToBytes Uses

func (decoder *BytesDecoder) DecodeToBytes(outputOffset map[int64]int, handle kv.Handle, value []byte, cacheBytes []byte) ([][]byte, error)

DecodeToBytes decodes raw byte slice to row data.

func (*BytesDecoder) DecodeToBytesNoHandle Uses

func (decoder *BytesDecoder) DecodeToBytesNoHandle(outputOffset map[int64]int, value []byte) ([][]byte, error)

DecodeToBytesNoHandle decodes raw byte slice to row dat without handle.

type ChunkDecoder Uses

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

ChunkDecoder decodes the row to chunk.Chunk.

func NewChunkDecoder Uses

func NewChunkDecoder(columns []ColInfo, handleColIDs []int64, defDatum func(i int, chk *chunk.Chunk) error, loc *time.Location) *ChunkDecoder

NewChunkDecoder creates a NewChunkDecoder.

func (*ChunkDecoder) DecodeToChunk Uses

func (decoder *ChunkDecoder) DecodeToChunk(rowData []byte, handle kv.Handle, chk *chunk.Chunk) error

DecodeToChunk decodes a row to chunk.

type ColInfo Uses

type ColInfo struct {
    ID            int64
    IsPKHandle    bool
    VirtualGenCol bool
    Ft            *types.FieldType
}

ColInfo is used as column meta info for row decoder.

type DatumMapDecoder Uses

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

DatumMapDecoder decodes the row to datum map.

func NewDatumMapDecoder Uses

func NewDatumMapDecoder(columns []ColInfo, handleColIDs []int64, loc *time.Location) *DatumMapDecoder

NewDatumMapDecoder creates a DatumMapDecoder.

func (*DatumMapDecoder) DecodeToDatumMap Uses

func (decoder *DatumMapDecoder) DecodeToDatumMap(rowData []byte, handle kv.Handle, row map[int64]types.Datum) (map[int64]types.Datum, error)

DecodeToDatumMap decodes byte slices to datum map.

type Encoder Uses

type Encoder struct {

    // Enable indicates whether this encoder should be use.
    Enable bool
    // contains filtered or unexported fields
}

Encoder is used to encode a row.

func (*Encoder) ColumnIsNull Uses

func (r *Encoder) ColumnIsNull(rowData []byte, colID int64, defaultVal []byte) (bool, error)

ColumnIsNull returns if the column value is null. Mainly used for count column aggregation. this method will used in unistore.

func (*Encoder) Encode Uses

func (encoder *Encoder) Encode(sc *stmtctx.StatementContext, colIDs []int64, values []types.Datum, buf []byte) ([]byte, error)

Encode encodes a row from a datums slice.

Package rowcodec imports 18 packages (graph) and is imported by 16 packages. Updated 2020-07-03. Refresh now. Tools for package owners.