column

package
v0.0.0-...-2e22c79 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2015 License: Apache-2.0 Imports: 11 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 []interface{}, cols []*Col) (err error)

CastValues casts values based on columns type.

func CheckNotNull

func CheckNotNull(cols []*Col, row []interface{}) 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) (c *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 have OnUpdateNow flag.

func (*Col) CastValue

func (c *Col) CastValue(ctx context.Context, val interface{}) (casted interface{}, err error)

CastValue casts a value based on column's type.

func (*Col) CheckNotNull

func (c *Col) CheckNotNull(data interface{}) error

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

func (*Col) String

func (c *Col) String() string

String implements fmt.Stringer interface.

func (*Col) TypeError

func (c *Col) TypeError(v interface{}) error

TypeError returns error for invalid value type.

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 []interface{}) ([]interface{}, 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