schema

package
v2.0.0-alpha4+incompat... Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2015 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CAT_OTHER = iota
	CAT_NUMBER
	CAT_VARBINARY
)

Column categories

View Source
const (
	CACHE_NONE = 0
	CACHE_RW   = 1
	CACHE_W    = 2
)

Cache types

Variables

This section is empty.

Functions

This section is empty.

Types

type Index

type Index struct {
	Name        string
	Columns     []string
	Cardinality []uint64
	DataColumns []string
}

Index contains info about a table index.

func NewIndex

func NewIndex(name string) *Index

NewIndex creates a new Index.

func (*Index) AddColumn

func (idx *Index) AddColumn(name string, cardinality uint64)

AddColumn adds a column to the index.

func (*Index) FindColumn

func (idx *Index) FindColumn(name string) int

FindColumn finds a column in the index. It returns the index if found. Otherwise, it returns -1.

func (*Index) FindDataColumn

func (idx *Index) FindDataColumn(name string) int

FindDataColumn finds a data column in the index. It returns the index if found. Otherwise, it returns -1.

type Table

type Table struct {
	Name      string
	Columns   []TableColumn
	Indexes   []*Index
	PKColumns []int
	CacheType int

	// These vars can be accessed concurrently.
	TableRows   sync2.AtomicInt64
	DataLength  sync2.AtomicInt64
	IndexLength sync2.AtomicInt64
	DataFree    sync2.AtomicInt64
}

Table contains info about a table.

func NewTable

func NewTable(name string) *Table

NewTable creates a new Table.

func (*Table) AddColumn

func (ta *Table) AddColumn(name string, columnType string, defval sqltypes.Value, extra string)

AddColumn adds a column to the Table.

func (*Table) AddIndex

func (ta *Table) AddIndex(name string) (index *Index)

AddIndex adds an index to the table.

func (*Table) FindColumn

func (ta *Table) FindColumn(name string) int

FindColumn finds a column in the table. It returns the index if found. Otherwise, it returns -1.

func (*Table) GetPKColumn

func (ta *Table) GetPKColumn(index int) *TableColumn

GetPKColumn returns the pk column specified by the index.

func (*Table) SetMysqlStats

func (ta *Table) SetMysqlStats(tr, dl, il, df sqltypes.Value)

SetMysqlStats receives the values found in the mysql information_schema.tables table

type TableColumn

type TableColumn struct {
	Name     string
	Category int
	IsAuto   bool
	Default  sqltypes.Value
}

TableColumn contains info about a table's column.

Jump to

Keyboard shortcuts

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