Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ColumnContainer ¶
ColumnContainer is the interface for objects that can contain column names
type ColumnType ¶
type ColumnType int
ColumnType describes the possible types that a column may take
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 )
List of possible ColumnType values
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 }
Database represents a database definition
func NewDatabase ¶
NewDatabase creates a new database mode with th given name
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 }
Index describes an index on a table.
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 }
Reference describes a possible reference from one table to another
type ReferenceMatch ¶
type ReferenceMatch int
ReferenceMatch describes the mathing method of a reference
const ( ReferenceMatchNone ReferenceMatch = iota ReferenceMatchFull ReferenceMatchPartial ReferenceMatchSimple )
List of possible ReferenceMatch values
type ReferenceOption ¶
type ReferenceOption int
ReferenceOption describes the actions that could be taken when a table/column referered by the reference has been deleted
const ( ReferenceOptionNone ReferenceOption = iota ReferenceOptionRestrict ReferenceOptionCascade ReferenceOptionSetNull ReferenceOptionNoAction )
List of possible ReferenceOption values
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) }
Table describes a table model
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) }
TableColumn describes a model object that describes a column definition of a table
func NewTableColumn ¶
func NewTableColumn(name string) TableColumn
NewTableColumn creates a new TableColumn with the given name
type TableOption ¶
TableOption describes a possible table option, such as `ENGINE=InnoDB`
func NewTableOption ¶
func NewTableOption(k, v string) TableOption
NewTableOption creates a new table option with the given name and value