model

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2017 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ColumnContainer

type ColumnContainer interface {
	AddColumns(...string)
	Columns() chan string
}

type ColumnType

type ColumnType int
const (
	ColumnTypeInvalid ColumnType = iota
	ColumnTypeBit
	ColumnTypeTinyInt
	ColumnTypeSmallInt
	ColumnTypeMediumInt
	ColumnTypeInt
	ColumnTypeInteger
	ColumnTypeBigInt
	ColumnTypeReal
	ColumnTypeDouble
	ColumnTypeFloat
	ColumnTypeDecimal
	ColumnTypeNumeric
	ColumnTypeDate
	ColumnTypeTime
	ColumnTypeTimestamp
	ColumnTypeDateTime
	ColumnTypeYear
	ColumnTypeChar
	ColumnTypeVarChar
	ColumnTypeBinary
	ColumnTypeVarBinary
	ColumnTypeTinyBlob
	ColumnTypeBlob
	ColumnTypeMediumBlob
	ColumnTypeLongBlob
	ColumnTypeTinyText
	ColumnTypeText
	ColumnTypeMediumText
	ColumnTypeLongText

	ColumnTypeMax
)

func (ColumnType) String

func (c ColumnType) String() string

type Database

type Database interface {
	Stmt

	Name() string
	IsIfNotExists() bool
	SetIfNotExists(bool)
	// contains filtered or unexported methods
}

func NewDatabase

func NewDatabase(n string) Database

type Index

type Index interface {
	Stmt
	ColumnContainer

	HasName() bool
	HasSymbol() bool
	Name() string
	Reference() Reference
	SetReference(Reference)
	SetSymbol(string)
	SetType(IndexType)
	SetName(string)
	Symbol() string
	IsBtree() bool
	IsHash() bool
	IsPrimaryKey() bool
	IsNormal() bool
	IsUnique() bool
	IsFullText() bool
	IsSpatial() bool
	IsForeginKey() bool
}

func NewIndex

func NewIndex(kind IndexKind) Index

type IndexKind

type IndexKind int
const (
	IndexKindInvalid IndexKind = iota
	IndexKindPrimaryKey
	IndexKindNormal
	IndexKindUnique
	IndexKindFullText
	IndexKindSpatial
	IndexKindForeignKey
)

type IndexType

type IndexType int
const (
	IndexTypeNone IndexType = iota
	IndexTypeBtree
	IndexTypeHash
)

type Length

type Length interface {
	HasDecimal() bool
	Decimal() string
	SetDecimal(string)
	Length() string
}

func NewLength

func NewLength(v string) Length

type NullState

type NullState int
const (
	NullStateNone NullState = iota
	NullStateNull
	NullStateNotNull
)

type Reference

type Reference interface {
	ColumnContainer

	String() string
	TableName() string
	OnDelete() ReferenceOption
	OnUpdate() ReferenceOption
	SetTableName(string)
	SetMatch(ReferenceMatch)
	SetOnDelete(ReferenceOption)
	SetOnUpdate(ReferenceOption)
	MatchFull() bool
	MatchPartial() bool
	MatchSimple() bool
}

func NewReference

func NewReference() Reference

type ReferenceMatch

type ReferenceMatch int
const (
	ReferenceMatchNone ReferenceMatch = iota
	ReferenceMatchFull
	ReferenceMatchPartial
	ReferenceMatchSimple
)

type ReferenceOption

type ReferenceOption int
const (
	ReferenceOptionNone ReferenceOption = iota
	ReferenceOptionRestrict
	ReferenceOptionCascade
	ReferenceOptionSetNull
	ReferenceOptionNoAction
)

type Stmt

type Stmt interface {
	ID() string
}

type Stmts

type Stmts []Stmt

func (Stmts) Lookup

func (s Stmts) Lookup(id string) (Stmt, bool)

type Table

type Table interface {
	Stmt

	Name() string
	IsTemporary() bool
	SetTemporary(bool)
	IsIfNotExists() bool
	SetIfNotExists(bool)

	AddColumn(TableColumn)
	Columns() chan TableColumn
	AddIndex(Index)
	Indexes() chan Index
	AddOption(TableOption)
	Options() chan TableOption

	LookupColumn(string) (TableColumn, bool)
	LookupIndex(string) (Index, bool)
}

func NewTable

func NewTable(name string) Table

type TableColumn

type TableColumn interface {
	Stmt

	Name() string
	Type() ColumnType
	SetType(ColumnType)

	HasLength() bool
	Length() Length
	SetLength(Length)
	HasCharacterSet() bool
	CharacterSet() string
	HasCollation() bool
	Collation() string
	HasDefault() bool
	Default() string
	IsQuotedDefault() bool
	SetDefault(string, bool)
	HasComment() bool
	Comment() string
	SetComment(string)

	NullState() NullState
	SetNullState(NullState)

	IsAutoIncrement() bool
	SetAutoIncrement(bool)
	IsBinary() bool
	SetBinary(bool)
	IsKey() bool
	SetKey(bool)
	IsPrimary() bool
	SetPrimary(bool)
	IsUnique() bool
	SetUnique(bool)
	IsUnsigned() bool
	SetUnsigned(bool)
	IsZeroFill() bool
	SetZeroFill(bool)
}

func NewTableColumn

func NewTableColumn(name string) TableColumn

type TableOption

type TableOption interface {
	Stmt
	Key() string
	Value() string
}

func NewTableOption

func NewTableOption(k, v string) TableOption

Jump to

Keyboard shortcuts

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