coldef

package
Version: v0.0.0-...-7f9930a Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2015 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DBOptNone = iota
	DBOptCharset
	DBOptCollate
)

DB Options.

View Source
const (
	ConstrNoConstr = iota
	ConstrPrimaryKey
	ConstrForeignKey
	ConstrNotNull
	ConstrAutoIncrement
	ConstrDefaultValue
	ConstrUniq
	ConstrIndex
	ConstrUniqIndex
	ConstrKey
	ConstrUniqKey
	ConstrNull
	ConstrOnUpdate
	ConstrFulltext
)

Constraints.

View Source
const (
	TblOptNone = iota
	TblOptEngine
	TblOptCharset
	TblOptCollate
	TblOptAutoIncrement
)

Table Options.

Variables

This section is empty.

Functions

This section is empty.

Types

type CharsetOpt

type CharsetOpt struct {
	Chs string
	Col string
}

CharsetOpt is used for parsing charset option from SQL.

func (*CharsetOpt) String

func (o *CharsetOpt) String() string

String implements fmt.Stringer interface.

type ColumnDef

type ColumnDef struct {
	Name        string
	Tp          *types.FieldType
	Constraints []*ConstraintOpt
}

ColumnDef is used for parsing column definition from SQL.

func (*ColumnDef) String

func (c *ColumnDef) String() string

String implements fmt.Stringer interface.

type ConstraintOpt

type ConstraintOpt struct {
	Tp     int
	Bvalue bool
	Evalue expression.Expression
}

ConstraintOpt is used for parsing column constraint info from SQL.

func (*ConstraintOpt) String

func (c *ConstraintOpt) String() string

String implements fmt.Stringer interface.

type DatabaseOpt

type DatabaseOpt struct {
	Tp    int
	Value string
}

DatabaseOpt is used for parsing database option from SQL.

type FloatOpt

type FloatOpt struct {
	Flen    int
	Decimal int
}

FloatOpt is used for parsing floating-point type option from SQL. TODO: add reference doc.

type IndexColName

type IndexColName struct {
	ColumnName string
	Length     int
}

IndexColName is used for parsing index column name from SQL.

func (*IndexColName) String

func (icn *IndexColName) String() string

String implements fmt.Stringer interface.

type LockType

type LockType int

LockType is select lock type.

const (
	SelectLockNone LockType = iota
	SelectLockForUpdate
	SelectLockInShareMode
)

Select Lock Type.

type ReferenceDef

type ReferenceDef struct {
	TableIdent    table.Ident
	IndexColNames []*IndexColName
}

ReferenceDef is used for parsing foreign key reference option from SQL. See: http://dev.mysql.com/doc/refman/5.7/en/create-table-foreign-keys.html

func (*ReferenceDef) Clone

func (rd *ReferenceDef) Clone() *ReferenceDef

Clone clones a new ReferenceDef from old ReferenceDef.

func (*ReferenceDef) String

func (rd *ReferenceDef) String() string

String implements fmt.Stringer interface.

type TableConstraint

type TableConstraint struct {
	Tp         int
	ConstrName string

	// Used for PRIMARY KEY, UNIQUE, ......
	Keys []*IndexColName

	// Used for foreign key.
	Refer *ReferenceDef
}

TableConstraint is constraint for table definition.

func ColumnDefToCol

func ColumnDefToCol(offset int, colDef *ColumnDef) (*column.Col, []*TableConstraint, error)

ColumnDefToCol converts converts ColumnDef to Col and TableConstraints.

func (*TableConstraint) Clone

func (tc *TableConstraint) Clone() *TableConstraint

Clone clones a new TableConstraint from old TableConstraint.

func (*TableConstraint) String

func (tc *TableConstraint) String() string

String implements fmt.Stringer interface.

type TableOpt

type TableOpt struct {
	Tp        int
	StrValue  string
	UintValue uint64
}

TableOpt is used for parsing table option from SQL.

type TableOption

type TableOption struct {
	Engine        string
	Charset       string
	Collate       string
	AutoIncrement uint64 // TODO: apply this value to autoid.Allocator.
}

TableOption is the collection of table options. TODO: rename TableOpt or TableOption.

func (*TableOption) String

func (o *TableOption) String() string

String implements fmt.Stringer interface.

Source Files

Jump to

Keyboard shortcuts

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