Documentation ¶
Index ¶
- Constants
- func CastValue(ctx sessionctx.Context, val types.Datum, col *model.ColumnInfo, ...) (casted types.Datum, err error)
- func CheckOnce(cols []string) (map[string]struct{}, error)
- func EvalColDefaultExpr(ctx sessionctx.Context, col *model.ColumnInfo, defaultExpr ast.ExprNode) (types.Datum, error)
- func GetColDefaultValue(ctx sessionctx.Context, col *model.ColumnInfo) (types.Datum, error)
- func GetZeroValue(col *model.ColumnInfo) types.Datum
- func IsFlexible(cf *model.ColumnFamilyMeta) bool
- func MakeTableFromMeta(tableMeta *model.TableMeta) table.Table
- func NewResultIter(limit int64) *resultIter
- func NewZettaIndex(physicalID int64, tblInfo *parser_model.TableInfo, ...) table.Index
- func TableFromMeta(tableMeta *model.TableMeta, txn kv.Transaction) table.Table
- type Field
- type IndexInfo
- func (ii *IndexInfo) BuildIndex(tbMeta *model.TableMeta, recordKey, recordValue kv.Key) ([]byte, []byte, error)
- func (ii *IndexInfo) FieldTypes() []*types.FieldType
- func (ii *IndexInfo) FromTableMeta(tbl *model.TableMeta, colIndex map[string]int)
- func (ii *IndexInfo) Init(tbMeta *model.TableMeta)
- func (ii *IndexInfo) Keys() []*model.ColumnMeta
- type KeyValue
- type Table
- func (t *Table) AddRecord(ctx sctx.Context, row []types.Datum) error
- func (t *Table) BatchGet(ctx sctx.Context, idxVals [][]types.Datum, cols []*table.Column, idxID int64, ...) error
- func (t *Table) Cols() []*table.Column
- func (t *Table) ColumnFamilies() []*model.ColumnFamilyMeta
- func (t *Table) Delete(ctx context.Context, keySet *tspb.KeySet, family string, columns []string) error
- func (t *Table) FetchRecordsByIndex(ctx sctx.Context, idxVals []types.Datum, cols []*table.Column, idxID int64, ...) error
- func (t *Table) GetPhysicalID() int64
- func (t *Table) IndexPrefix() kv.Key
- func (t *Table) IndexScan(ctx sctx.Context, idxMeta *model.IndexMeta, lower, upper []byte, ...) error
- func (t *Table) Insert(ctx context.Context, pkey *tspb.KeySet, family string, columns []string, ...) error
- func (t *Table) InsertOrUpdate(ctx context.Context, pkeyset *tspb.KeySet, family string, columns []string, ...) error
- func (t *Table) IterRecords(ctx sctx.Context, startKey, endKey kv.Key, cols []*table.Column, reverse bool, ...) error
- func (t *Table) Meta() *model.TableMeta
- func (t *Table) ReadSparse(ctx context.Context, req *tspb.SparseReadRequest) (*resultIter, error)
- func (t *Table) ReadStore(ctx context.Context, rr *tspb.ReadRequest) (*resultIter, error)
- func (t *Table) RecordPrefix() kv.Key
- func (t *Table) RemoveRecord(ctx sctx.Context, row []types.Datum) error
- func (t *Table) Replace(ctx context.Context, pkey *tspb.KeySet, family string, columns []string, ...) error
- func (t *Table) Scan(ctx sctx.Context, idxVals []types.Datum, idxMeta *model.IndexMeta, ...) error
- func (t *Table) ScanStore(ctx context.Context, scanReq *table.ScanRequest) (*resultIter, error)
- func (t *Table) SparseScan(ctx context.Context, req *tspb.SparseScanRequest) (*resultIter, error)
- func (t *Table) Update(ctx context.Context, pkey *tspb.KeySet, family string, columns []string, ...) error
- func (t *Table) UpdateRecord(ctx sctx.Context, row []types.Datum, vals map[int64]types.Datum) error
Constants ¶
const ( DefaultColumnFamily = "default" AttrKeyMode = "mode" AttrKeyLayout = "layout" AttrFlexible = "flexible" AttrFixed = "fixed" AttrCompact = "compact" AttrSparse = "sparse" )
Variables ¶
This section is empty.
Functions ¶
func CastValue ¶
func CastValue(ctx sessionctx.Context, val types.Datum, col *model.ColumnInfo, returnOverflow, forceIgnoreTruncate bool) (casted types.Datum, err error)
CastValue casts a value based on column type. If forceIgnoreTruncate is true, truncated errors will be ignored. If returnOverflow is true, don't handle overflow errors in this function. It's safe now and it's the same as the behavior of select statement. Set it to true only in FillVirtualColumnValue and UnionScanExec.Next() If the handle of err is changed latter, the behavior of forceIgnoreTruncate also need to change. TODO: change the third arg to TypeField. Not pass ColumnInfo.
func EvalColDefaultExpr ¶
func EvalColDefaultExpr(ctx sessionctx.Context, col *model.ColumnInfo, defaultExpr ast.ExprNode) (types.Datum, error)
EvalColDefaultExpr eval default expr node to explicit default value.
func GetColDefaultValue ¶
func GetColDefaultValue(ctx sessionctx.Context, col *model.ColumnInfo) (types.Datum, error)
GetColDefaultValue gets default value of the column.
func GetZeroValue ¶
func GetZeroValue(col *model.ColumnInfo) types.Datum
GetZeroValue gets zero value for given column type.
func IsFlexible ¶
func IsFlexible(cf *model.ColumnFamilyMeta) bool
func NewResultIter ¶
func NewResultIter(limit int64) *resultIter
func NewZettaIndex ¶
func NewZettaIndex(physicalID int64, tblInfo *parser_model.TableInfo, indexInfo *parser_model.IndexInfo) table.Index
func TableFromMeta ¶
Types ¶
type IndexInfo ¶
type IndexInfo struct { ID int64 IndexName string IndexPrefix kv.Key // contains filtered or unexported fields }
func NewIndexInfo ¶
func (*IndexInfo) BuildIndex ¶
func (ii *IndexInfo) BuildIndex(tbMeta *model.TableMeta, recordKey, recordValue kv.Key) ([]byte, []byte, error)
BuildIndex build the index based on recordKey
func (*IndexInfo) FieldTypes ¶
func (*IndexInfo) FromTableMeta ¶
func (*IndexInfo) Keys ¶
func (ii *IndexInfo) Keys() []*model.ColumnMeta
type Table ¶
type Table struct {
// contains filtered or unexported fields
}
func (*Table) ColumnFamilies ¶
func (t *Table) ColumnFamilies() []*model.ColumnFamilyMeta
func (*Table) FetchRecordsByIndex ¶
func (t *Table) FetchRecordsByIndex(ctx sctx.Context, idxVals []types.Datum, cols []*table.Column, idxID int64, uniq bool, fn table.RecordIterFunc) error
FetchRecordsByIndex gets records by index. When uniq is true, we do a PointGet or BatchGet on tikv, based on number of keys. When uniq is false, we do a scan on tikv.
func (*Table) GetPhysicalID ¶
func (*Table) IndexPrefix ¶
func (*Table) IndexScan ¶
func (t *Table) IndexScan(ctx sctx.Context, idxMeta *model.IndexMeta, lower, upper []byte, cols []*table.Column, fn table.RecordIterFunc, limit int64) error
func (t *tableCommon) IndexScan(ctx sctx.Context, idxVals []types.Datum, idxMeta *model.IndexMeta, reverse bool, cols []*table.Column, fn table.RecordIterFunc, limit int64) error {
func (*Table) InsertOrUpdate ¶
func (*Table) IterRecords ¶
func (t *Table) IterRecords(ctx sctx.Context, startKey, endKey kv.Key, cols []*table.Column, reverse bool, fn table.RecordIterFunc) error
Only support directly scan and primary key index scan.
func (*Table) ReadSparse ¶
func (t *Table) ReadSparse(ctx context.Context, req *tspb.SparseReadRequest) (*resultIter, error)
func (*Table) ReadStore ¶
func (t *Table) ReadStore(ctx context.Context, rr *tspb.ReadRequest) (*resultIter, error)
func (*Table) RecordPrefix ¶
func (*Table) RemoveRecord ¶
func (*Table) Scan ¶
func (t *Table) Scan(ctx sctx.Context, idxVals []types.Datum, idxMeta *model.IndexMeta, isPrimay bool, lower, upper []byte, cols []*table.Column, fn table.RecordIterFunc, limit int64) error
Scan scan the table by index or primary. We do not provide a end bound here, use limit.
func (*Table) ScanStore ¶
func (t *Table) ScanStore(ctx context.Context, scanReq *table.ScanRequest) (*resultIter, error)
func (*Table) SparseScan ¶
func (t *Table) SparseScan(ctx context.Context, req *tspb.SparseScanRequest) (*resultIter, error)