Documentation ¶
Index ¶
- func CanSkip(info *model.TableInfo, col *table.Column, value types.Datum) bool
- func CheckHandleExists(ctx sessionctx.Context, t table.Table, recordID int64, data []types.Datum) error
- func DecodeHandle(data []byte) (int64, error)
- func DecodeRawRowData(ctx sessionctx.Context, meta *model.TableInfo, h int64, cols []*table.Column, ...) ([]types.Datum, map[int64]types.Datum, error)
- func EncodeHandle(h int64) []byte
- func FindIndexByColName(t table.Table, name string) table.Index
- func GetColDefaultValue(ctx sessionctx.Context, col *table.Column, defaultVals []types.Datum) (colVal types.Datum, err error)
- func MockTableFromMeta(tblInfo *model.TableInfo) table.Table
- func NewIndex(physicalID int64, tblInfo *model.TableInfo, indexInfo *model.IndexInfo) table.Index
- func TableFromMeta(alloc autoid.Allocator, tblInfo *model.TableInfo) (table.Table, error)
- func TruncateIndexValuesIfNeeded(tblInfo *model.TableInfo, idxInfo *model.IndexInfo, ...) []types.Datum
- type PartitionExpr
- type Table
- func (t *Table) AddRecord(ctx sessionctx.Context, r []types.Datum, skipHandleCheck bool) (recordID int64, err error)
- func (t *Table) AllocAutoID(ctx sessionctx.Context) (int64, error)
- func (t *Table) Allocator(ctx sessionctx.Context) autoid.Allocator
- func (t *Table) Cols() []*table.Column
- func (t *Table) DeletableIndices() []table.Index
- func (t *Table) FirstKey() kv.Key
- func (t *Table) GetPhysicalID() int64
- func (t *Table) IndexPrefix() kv.Key
- func (t *Table) Indices() []table.Index
- func (t *Table) IterRecords(ctx sessionctx.Context, startKey kv.Key, cols []*table.Column, ...) error
- func (t *Table) Meta() *model.TableInfo
- func (t *Table) RebaseAutoID(ctx sessionctx.Context, newBase int64, isSetStep bool) error
- func (t *Table) RecordKey(h int64) kv.Key
- func (t *Table) RecordPrefix() kv.Key
- func (t *Table) RemoveRecord(ctx sessionctx.Context, h int64, r []types.Datum) error
- func (t *Table) Row(ctx sessionctx.Context, h int64) ([]types.Datum, error)
- func (t *Table) RowWithCols(ctx sessionctx.Context, h int64, cols []*table.Column) ([]types.Datum, error)
- func (t *Table) Seek(ctx sessionctx.Context, h int64) (int64, bool, error)
- func (t *Table) Type() table.Type
- func (t *Table) UpdateRecord(ctx sessionctx.Context, h int64, oldData, newData []types.Datum, ...) error
- func (t *Table) WritableCols() []*table.Column
- func (t *Table) WritableIndices() []table.Index
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CanSkip ¶
CanSkip is for these cases, we can skip the columns in encoded row: 1. the column is included in primary key; 2. the column's default value is null, and the value equals to that; 3. the column is virtual generated.
func CheckHandleExists ¶
func CheckHandleExists(ctx sessionctx.Context, t table.Table, recordID int64, data []types.Datum) error
CheckHandleExists check whether recordID key exists. if not exists, return nil, otherwise return kv.ErrKeyExists error.
func DecodeHandle ¶
DecodeHandle decodes handle in data.
func DecodeRawRowData ¶
func DecodeRawRowData(ctx sessionctx.Context, meta *model.TableInfo, h int64, cols []*table.Column, value []byte) ([]types.Datum, map[int64]types.Datum, error)
DecodeRawRowData decodes raw row data into a datum slice and a (columnID:columnValue) map.
func FindIndexByColName ¶
FindIndexByColName implements table.Table FindIndexByColName interface.
func GetColDefaultValue ¶
func GetColDefaultValue(ctx sessionctx.Context, col *table.Column, defaultVals []types.Datum) ( colVal types.Datum, err error)
GetColDefaultValue gets a column default value. The defaultVals is used to avoid calculating the default value multiple times.
func MockTableFromMeta ¶
MockTableFromMeta only serves for test.
func TableFromMeta ¶
TableFromMeta creates a Table instance from model.TableInfo.
Types ¶
type PartitionExpr ¶
type PartitionExpr struct { // Column is the column appeared in the by range expression, partition pruning need this to work. Column *expression.Column Ranges []expression.Expression UpperBounds []expression.Expression }
PartitionExpr is the partition definition expressions. There are two expressions exist, because Locate use binary search, which requires: Given a compare function, for any partition range i, if cmp[i] > 0, then cmp[i+1] > 0. While partition prune must use the accurate range to do prunning. partition by range (x)
(partition p1 values less than (y1) p2 values less than (y2) p3 values less than (y3))
Ranges: (x < y1 or x is null); (y1 <= x < y2); (y2 <= x < y3) UpperBounds: (x < y1); (x < y2); (x < y3)
type Table ¶
type Table struct {
// contains filtered or unexported fields
}
Table implements table.Table interface.
func (*Table) AddRecord ¶
func (t *Table) AddRecord(ctx sessionctx.Context, r []types.Datum, skipHandleCheck bool) (recordID int64, err error)
AddRecord implements table.Table AddRecord interface.
func (*Table) AllocAutoID ¶
func (t *Table) AllocAutoID(ctx sessionctx.Context) (int64, error)
AllocAutoID implements table.Table AllocAutoID interface.
func (*Table) Allocator ¶
func (t *Table) Allocator(ctx sessionctx.Context) autoid.Allocator
Allocator implements table.Table Allocator interface.
func (*Table) DeletableIndices ¶
DeletableIndices implements table.Table DeletableIndices interface.
func (*Table) GetPhysicalID ¶
GetPhysicalID implements table.Table GetPhysicalID interface.
func (*Table) IndexPrefix ¶
IndexPrefix implements table.Table interface.
func (*Table) IterRecords ¶
func (t *Table) IterRecords(ctx sessionctx.Context, startKey kv.Key, cols []*table.Column, fn table.RecordIterFunc) error
IterRecords implements table.Table IterRecords interface.
func (*Table) RebaseAutoID ¶
func (t *Table) RebaseAutoID(ctx sessionctx.Context, newBase int64, isSetStep bool) error
RebaseAutoID implements table.Table RebaseAutoID interface.
func (*Table) RecordPrefix ¶
RecordPrefix implements table.Table interface.
func (*Table) RemoveRecord ¶
RemoveRecord implements table.Table RemoveRecord interface.
func (*Table) RowWithCols ¶
func (t *Table) RowWithCols(ctx sessionctx.Context, h int64, cols []*table.Column) ([]types.Datum, error)
RowWithCols implements table.Table RowWithCols interface.
func (*Table) UpdateRecord ¶
func (t *Table) UpdateRecord(ctx sessionctx.Context, h int64, oldData, newData []types.Datum, touched []bool) error
UpdateRecord implements table.Table UpdateRecord interface. `touched` means which columns are really modified, used for secondary indices. Length of `oldData` and `newData` equals to length of `t.WritableCols()`.
func (*Table) WritableCols ¶
WritableCols implements table WritableCols interface.
func (*Table) WritableIndices ¶
WritableIndices implements table.Table WritableIndices interface.