tables

package
v0.0.0-...-74d5ce4 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2017 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindIndexByColName

func FindIndexByColName(t table.Table, name string) table.Index

FindIndexByColName implements table.Table FindIndexByColName interface.

func GetColDefaultValue

func GetColDefaultValue(ctx context.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 MemoryTableFromMeta

func MemoryTableFromMeta(alloc autoid.Allocator, tblInfo *model.TableInfo) table.Table

MemoryTableFromMeta creates a Table instance from model.TableInfo.

func MockTableFromMeta

func MockTableFromMeta(tableInfo *model.TableInfo) table.Table

MockTableFromMeta only serves for test.

func NewIndex

func NewIndex(tableInfo *model.TableInfo, indexInfo *model.IndexInfo) table.Index

NewIndex builds a new Index object.

func TableFromMeta

func TableFromMeta(alloc autoid.Allocator, tblInfo *model.TableInfo) (table.Table, error)

TableFromMeta creates a Table instance from model.TableInfo.

Types

type MemoryTable

type MemoryTable struct {
	ID      int64
	Name    model.CIStr
	Columns []*table.Column
	// contains filtered or unexported fields
}

MemoryTable implements table.Table interface.

func (*MemoryTable) AddRecord

func (t *MemoryTable) AddRecord(ctx context.Context, r []types.Datum) (recordID int64, err error)

AddRecord implements table.Table AddRecord interface.

func (*MemoryTable) AllocAutoID

func (t *MemoryTable) AllocAutoID() (int64, error)

AllocAutoID implements table.Table AllocAutoID interface.

func (*MemoryTable) Allocator

func (t *MemoryTable) Allocator() autoid.Allocator

Allocator implements table.Table Allocator interface.

func (*MemoryTable) Cols

func (t *MemoryTable) Cols() []*table.Column

Cols implements table.Table Cols interface.

func (*MemoryTable) DeletableIndices

func (t *MemoryTable) DeletableIndices() []table.Index

DeletableIndices implements table.Table DeletableIndices interface.

func (*MemoryTable) FirstKey

func (t *MemoryTable) FirstKey() kv.Key

FirstKey implements table.Table FirstKey interface.

func (*MemoryTable) IndexPrefix

func (t *MemoryTable) IndexPrefix() kv.Key

IndexPrefix implements table.Table IndexPrefix interface.

func (*MemoryTable) Indices

func (t *MemoryTable) Indices() []table.Index

Indices implements table.Table Indices interface.

func (*MemoryTable) IterRecords

func (t *MemoryTable) IterRecords(ctx context.Context, startKey kv.Key, cols []*table.Column,
	fn table.RecordIterFunc) error

IterRecords implements table.Table IterRecords interface.

func (*MemoryTable) Meta

func (t *MemoryTable) Meta() *model.TableInfo

Meta implements table.Table Meta interface.

func (*MemoryTable) RebaseAutoID

func (t *MemoryTable) RebaseAutoID(newBase int64, isSetStep bool) error

RebaseAutoID implements table.Table RebaseAutoID interface.

func (*MemoryTable) RecordKey

func (t *MemoryTable) RecordKey(h int64) kv.Key

RecordKey implements table.Table RecordKey interface.

func (*MemoryTable) RecordPrefix

func (t *MemoryTable) RecordPrefix() kv.Key

RecordPrefix implements table.Table RecordPrefix interface.

func (*MemoryTable) RemoveRecord

func (t *MemoryTable) RemoveRecord(ctx context.Context, h int64, r []types.Datum) error

RemoveRecord implements table.Table RemoveRecord interface.

func (*MemoryTable) Row

func (t *MemoryTable) Row(ctx context.Context, h int64) ([]types.Datum, error)

Row implements table.Table Row interface.

func (*MemoryTable) RowWithCols

func (t *MemoryTable) RowWithCols(ctx context.Context, h int64, cols []*table.Column) ([]types.Datum, error)

RowWithCols implements table.Table RowWithCols interface.

func (*MemoryTable) Seek

func (t *MemoryTable) Seek(ctx context.Context, handle int64) (int64, bool, error)

Seek seeks the handle

func (*MemoryTable) Truncate

func (t *MemoryTable) Truncate()

Truncate drops all data in Memory Table.

func (*MemoryTable) UpdateRecord

func (t *MemoryTable) UpdateRecord(ctx context.Context, h int64, oldData, newData []types.Datum, touched []bool) error

UpdateRecord implements table.Table UpdateRecord interface.

func (*MemoryTable) WritableCols

func (t *MemoryTable) WritableCols() []*table.Column

WritableCols implements table.Table WritableCols interface.

func (*MemoryTable) WritableIndices

func (t *MemoryTable) WritableIndices() []table.Index

WritableIndices implements table.Table WritableIndices interface.

type Table

type Table struct {
	ID      int64
	Name    model.CIStr
	Columns []*table.Column
	// contains filtered or unexported fields
}

Table implements table.Table interface.

func (*Table) AddRecord

func (t *Table) AddRecord(ctx context.Context, r []types.Datum) (recordID int64, err error)

AddRecord implements table.Table AddRecord interface.

func (*Table) AllocAutoID

func (t *Table) AllocAutoID() (int64, error)

AllocAutoID implements table.Table AllocAutoID interface.

func (*Table) Allocator

func (t *Table) Allocator() autoid.Allocator

Allocator implements table.Table Allocator interface.

func (*Table) Cols

func (t *Table) Cols() []*table.Column

Cols implements table.Table Cols interface.

func (*Table) DeletableIndices

func (t *Table) DeletableIndices() []table.Index

DeletableIndices implements table.Table DeletableIndices interface.

func (*Table) FirstKey

func (t *Table) FirstKey() kv.Key

FirstKey implements table.Table FirstKey interface.

func (*Table) IndexPrefix

func (t *Table) IndexPrefix() kv.Key

IndexPrefix implements table.Table IndexPrefix interface.

func (*Table) Indices

func (t *Table) Indices() []table.Index

Indices implements table.Table Indices interface.

func (*Table) IterRecords

func (t *Table) IterRecords(ctx context.Context, startKey kv.Key, cols []*table.Column,
	fn table.RecordIterFunc) error

IterRecords implements table.Table IterRecords interface.

func (*Table) Meta

func (t *Table) Meta() *model.TableInfo

Meta implements table.Table Meta interface.

func (*Table) RebaseAutoID

func (t *Table) RebaseAutoID(newBase int64, isSetStep bool) error

RebaseAutoID implements table.Table RebaseAutoID interface.

func (*Table) RecordKey

func (t *Table) RecordKey(h int64) kv.Key

RecordKey implements table.Table RecordKey interface.

func (*Table) RecordPrefix

func (t *Table) RecordPrefix() kv.Key

RecordPrefix implements table.Table RecordPrefix interface.

func (*Table) RemoveRecord

func (t *Table) RemoveRecord(ctx context.Context, h int64, r []types.Datum) error

RemoveRecord implements table.Table RemoveRecord interface.

func (*Table) Row

func (t *Table) Row(ctx context.Context, h int64) ([]types.Datum, error)

Row implements table.Table Row interface.

func (*Table) RowWithCols

func (t *Table) RowWithCols(ctx context.Context, h int64, cols []*table.Column) ([]types.Datum, error)

RowWithCols implements table.Table RowWithCols interface.

func (*Table) Seek

func (t *Table) Seek(ctx context.Context, h int64) (int64, bool, error)

Seek implements table.Table Seek interface.

func (*Table) UpdateRecord

func (t *Table) UpdateRecord(ctx context.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

func (t *Table) WritableCols() []*table.Column

WritableCols implements table WritableCols interface.

func (*Table) WritableIndices

func (t *Table) WritableIndices() []table.Index

WritableIndices implements table.Table WritableIndices interface.

Jump to

Keyboard shortcuts

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