Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var TableFromMeta func(schema string, alloc autoid.Allocator, tblInfo *model.TableInfo) Table
TableFromMeta builds a table.Table from *model.TableInfo. Currently, it is assigned to tables.TableFromMeta in tidb package's init function.
Functions ¶
This section is empty.
Types ¶
type Ident ¶
Ident is the table identifier composed of schema name and table name. TODO: Move out
type RecordIterFunc ¶
RecordIterFunc is used for low-level record iteration.
type Table ¶
type Table interface {
// IterRecords iterates records in the table and call fn.
IterRecords(ctx context.Context, startKey string, cols []*column.Col, fn RecordIterFunc) error
// RowWithCols returns a row that contains the given cols.
RowWithCols(ctx context.Context, h int64, cols []*column.Col) ([]interface{}, error)
// Row returns a row for all columns.
Row(ctx context.Context, h int64) ([]interface{}, error)
// RemoveRow removes the row of handle h.
RemoveRow(ctx context.Context, h int64) error
// RemoveRowIndex removes an index of a row.
RemoveRowIndex(ctx context.Context, h int64, vals []interface{}, idx *column.IndexedCol) error
// RemoveRowAllIndex removes all the indices of a row.
RemoveRowAllIndex(ctx context.Context, h int64, rec []interface{}) error
// BuildIndexForRow builds an index for a row.
BuildIndexForRow(ctx context.Context, h int64, vals []interface{}, idx *column.IndexedCol) error
// TableName returns table name.
TableName() model.CIStr
// Cols returns the columns of the table.
Cols() []*column.Col
// Indices returns the indices of the table.
Indices() []*column.IndexedCol
// AddIndex appends the index to the table, for internal usage and test.
AddIndex(*column.IndexedCol)
// FindIndexByColName finds the index by column name.
FindIndexByColName(name string) *column.IndexedCol
// KeyPrefix returns the key prefix string.
KeyPrefix() string
// IndexPrefix returns the index prefix string.
IndexPrefix() string
// FirstKey returns the first key string.
FirstKey() string
// RecordKey returns the key in KV storage for the column.
RecordKey(h int64, col *column.Col) []byte
// Truncate truncates the table.
Truncate(ctx context.Context) (err error)
// AddRecord inserts a row into the table.
AddRecord(ctx context.Context, r []interface{}) (recordID int64, err error)
// UpdateRecord updates a row in the table.
UpdateRecord(ctx context.Context, h int64, currData []interface{}, newData []interface{}, touched []bool) error
// TableID returns the ID of the table.
TableID() int64
// EncodeValue encodes a go value to bytes.
EncodeValue(raw interface{}) ([]byte, error)
// DecodeValue decodes bytes to go value.
DecodeValue(data []byte, col *column.Col) (interface{}, error)
// AllocAutoID allocates an auto_increment ID for a new row.
AllocAutoID() (int64, error)
// Meta returns TableInfo.
Meta() *model.TableInfo
// LockRow locks a row.
// If update is true, set row lock key to current txn.
LockRow(ctx context.Context, h int64, update bool) error
}
Table is used to retrieve and modify rows in table.
Click to show internal directories.
Click to hide internal directories.