column

package
v0.0.0-...-887f819 Latest Latest
Warning

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

Go to latest
Published: May 4, 2016 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const PrimaryKeyName = "PRIMARY"

PrimaryKeyName defines primary key name.

Variables

This section is empty.

Functions

func CastValues

func CastValues(ctx context.Context, rec []types.Datum, cols []*Col) (err error)

CastValues casts values based on columns type.

func CheckNotNull

func CheckNotNull(cols []*Col, row []types.Datum) error

CheckNotNull checks if row has nil value set to a column with NotNull flag set.

func CheckOnce

func CheckOnce(cols []*Col) error

CheckOnce checks if there are duplicated column names in cols.

func ColDescFieldNames

func ColDescFieldNames(full bool) []string

ColDescFieldNames returns the fields name in result set for desc and show columns.

Types

type Col

type Col struct {
	model.ColumnInfo
}

Col provides meta data describing a table column.

func FindCol

func FindCol(cols []*Col, name string) *Col

FindCol finds column in cols by name.

func FindCols

func FindCols(cols []*Col, names []string) ([]*Col, error)

FindCols finds columns in cols by names.

func FindOnUpdateCols

func FindOnUpdateCols(cols []*Col) []*Col

FindOnUpdateCols finds columns which have OnUpdateNow flag.

func (*Col) CheckNotNull

func (c *Col) CheckNotNull(data types.Datum) error

CheckNotNull checks if nil value set to a column with NotNull flag is set.

func (*Col) GetTypeDesc

func (c *Col) GetTypeDesc() string

GetTypeDesc gets the description for column type.

func (*Col) IsPKHandleColumn

func (c *Col) IsPKHandleColumn(tbInfo *model.TableInfo) bool

IsPKHandleColumn checks if the column is primary key handle column.

func (*Col) String

func (c *Col) String() string

String implements fmt.Stringer interface.

type ColDesc

type ColDesc struct {
	Field        string
	Type         string
	Collation    string
	Null         string
	Key          string
	DefaultValue interface{}
	Extra        string
	Privileges   string
	Comment      string
}

ColDesc describes column information like MySQL desc and show columns do.

func NewColDesc

func NewColDesc(col *Col) *ColDesc

NewColDesc returns a new ColDesc for a column.

type IndexedCol

type IndexedCol struct {
	model.IndexInfo
	X kv.Index
}

IndexedCol defines an index with info.

func (*IndexedCol) FetchValues

func (idx *IndexedCol) FetchValues(r []types.Datum) ([]types.Datum, error)

FetchValues fetches indexed values from a row.

Jump to

Keyboard shortcuts

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