Documentation ¶
Index ¶
- func IsNotExistError(err error) bool
- type AddAttr
- type AddCheck
- type AddColumn
- type AddForeignKey
- type AddIndex
- type AddSchema
- type AddTable
- type Attr
- type BinaryOption
- type BinaryType
- type BoolType
- type Change
- type ChangeKind
- type Charset
- type Check
- type Clause
- type Collation
- type Column
- func NewBinaryColumn(name, typ string, opts ...BinaryOption) *Column
- func NewBoolColumn(name, typ string) *Column
- func NewColumn(name string) *Column
- func NewDecimalColumn(name, typ string, opts ...DecimalOption) *Column
- func NewEnumColumn(name string, opts ...EnumOption) *Column
- func NewFloatColumn(name, typ string, opts ...FloatOption) *Column
- func NewIntColumn(name, typ string) *Column
- func NewJSONColumn(name, typ string) *Column
- func NewNullBinaryColumn(name, typ string, opts ...BinaryOption) *Column
- func NewNullBoolColumn(name, typ string) *Column
- func NewNullColumn(name string) *Column
- func NewNullDecimalColumn(name, typ string, opts ...DecimalOption) *Column
- func NewNullEnumColumn(name string, opts ...EnumOption) *Column
- func NewNullFloatColumn(name, typ string, opts ...FloatOption) *Column
- func NewNullIntColumn(name, typ string) *Column
- func NewNullJSONColumn(name, typ string) *Column
- func NewNullSpatialColumn(name, typ string) *Column
- func NewNullStringColumn(name, typ string, opts ...StringOption) *Column
- func NewNullTimeColumn(name, typ string) *Column
- func NewNullUintColumn(name, typ string) *Column
- func NewSpatialColumn(name, typ string) *Column
- func NewStringColumn(name, typ string, opts ...StringOption) *Column
- func NewTimeColumn(name, typ string) *Column
- func NewUintColumn(name, typ string) *Column
- func (c *Column) AddAttrs(attrs ...Attr) *Column
- func (c *Column) SetCharset(v string) *Column
- func (c *Column) SetCollation(v string) *Column
- func (c *Column) SetComment(v string) *Column
- func (c *Column) SetDefault(x Expr) *Column
- func (c *Column) SetNull(b bool) *Column
- func (c *Column) SetType(t Type) *Column
- func (c *Column) UnsetCharset() *Column
- func (c *Column) UnsetCollation() *Column
- type ColumnType
- type Comment
- type DecimalOption
- type DecimalType
- type Differ
- type DropAttr
- type DropCheck
- type DropColumn
- type DropForeignKey
- type DropIndex
- type DropSchema
- type DropTable
- type EnumOption
- type EnumType
- type ExecQuerier
- type Expr
- type FloatOption
- type FloatType
- type ForeignKey
- func (f *ForeignKey) AddColumns(columns ...*Column) *ForeignKey
- func (f *ForeignKey) AddRefColumns(columns ...*Column) *ForeignKey
- func (f *ForeignKey) Column(name string) (*Column, bool)
- func (f *ForeignKey) RefColumn(name string) (*Column, bool)
- func (f *ForeignKey) SetOnDelete(o ReferenceOption) *ForeignKey
- func (f *ForeignKey) SetOnUpdate(o ReferenceOption) *ForeignKey
- func (f *ForeignKey) SetRefTable(t *Table) *ForeignKey
- func (f *ForeignKey) SetTable(t *Table) *ForeignKey
- type IfExists
- type IfNotExists
- type Index
- func (i *Index) AddAttrs(attrs ...Attr) *Index
- func (i *Index) AddColumns(columns ...*Column) *Index
- func (i *Index) AddExprs(exprs ...Expr) *Index
- func (i *Index) AddParts(parts ...*IndexPart) *Index
- func (i *Index) SetComment(v string) *Index
- func (i *Index) SetName(name string) *Index
- func (i *Index) SetTable(t *Table) *Index
- func (i *Index) SetUnique(b bool) *Index
- type IndexPart
- type InspectOptions
- type InspectRealmOption
- type InspectTableOptions
- type Inspector
- type IntegerType
- type JSONType
- type Literal
- type ModifyAttr
- type ModifyCheck
- type ModifyColumn
- type ModifyForeignKey
- type ModifyIndex
- type ModifySchema
- type ModifyTable
- type NotExistError
- type RawExpr
- type Realm
- type ReferenceOption
- type Schema
- func (s *Schema) AddAttrs(attrs ...Attr) *Schema
- func (s *Schema) AddTables(tables ...*Table) *Schema
- func (s *Schema) SetCharset(v string) *Schema
- func (s *Schema) SetCollation(v string) *Schema
- func (s *Schema) SetComment(v string) *Schema
- func (s *Schema) SetRealm(r *Realm) *Schema
- func (s *Schema) Table(name string) (*Table, bool)
- func (s *Schema) UnsetCharset() *Schema
- func (s *Schema) UnsetCollation() *Schema
- type SpatialType
- type StringOption
- type StringType
- type Table
- func (t *Table) AddAttrs(attrs ...Attr) *Table
- func (t *Table) AddChecks(checks ...*Check) *Table
- func (t *Table) AddColumns(columns ...*Column) *Table
- func (t *Table) AddForeignKeys(fks ...*ForeignKey) *Table
- func (t *Table) AddIndexes(indexes ...*Index) *Table
- func (t *Table) Column(name string) (*Column, bool)
- func (t *Table) ForeignKey(symbol string) (*ForeignKey, bool)
- func (t *Table) Index(name string) (*Index, bool)
- func (t *Table) SetCharset(v string) *Table
- func (t *Table) SetCollation(v string) *Table
- func (t *Table) SetComment(v string) *Table
- func (t *Table) SetPrimaryKey(pk *Index) *Table
- func (t *Table) SetSchema(s *Schema) *Table
- func (t *Table) UnsetCharset() *Table
- func (t *Table) UnsetCollation() *Table
- type TimeType
- type Type
- type UnsupportedType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsNotExistError ¶
IsNotExistError reports if an error is a NotExistError.
Types ¶
type AddCheck ¶ added in v0.2.0
type AddCheck struct {
C *Check
}
AddCheck describes a CHECK constraint creation change.
type AddForeignKey ¶
type AddForeignKey struct {
F *ForeignKey
}
AddForeignKey describes a foreign-key creation change.
type AddSchema ¶ added in v0.2.0
AddSchema describes a schema (named database) creation change. Unlike table creation, schemas and their elements are described with separate changes. For example, "AddSchema" and "AddTable"
type Attr ¶
type Attr interface {
// contains filtered or unexported methods
}
Attr represents the interface that all attributes implement.
type BinaryOption ¶ added in v0.2.0
type BinaryOption func(*BinaryType)
BinaryOption allows configuring BinaryType using functional options.
func BinarySize ¶ added in v0.2.0
func BinarySize(size int) BinaryOption
BinarySize configures the size of the binary type.
type BinaryType ¶
BinaryType represents a type that stores a binary data.
type Change ¶
type Change interface {
// contains filtered or unexported methods
}
A Change represents a schema change. The types below implement this interface and can be used for describing schema changes.
The Change interface can also be implemented outside this package as follows:
type RenameType struct { schema.Change From, To string } var t schema.Change = &RenameType{From: "old", To: "new"}
type ChangeKind ¶
type ChangeKind uint
A ChangeKind describes a change kind that can be combined using a set of flags. The zero kind is no change.
const ( // NoChange holds the zero value of a change kind. NoChange ChangeKind = 0 // ChangeAttr describes attributes change of an element. // For example, a table CHECK was added or changed. ChangeAttr ChangeKind = 1 << (iota - 1) // ChangeCharset describes character-set change. ChangeCharset // ChangeCollation describes collation/encoding change. ChangeCollation // ChangeComment describes comment chang (of any element). ChangeComment // ChangeNull describe a change to the NULL constraint. ChangeNull // ChangeType describe a column type change. ChangeType // ChangeDefault describe a column default change. ChangeDefault // ChangeUnique describes a change to the uniqueness constraint. // For example, an index was changed from non-unique to unique. ChangeUnique // ChangeParts describes a change to one or more of the index parts. // For example, index keeps its previous name, but the columns order // was changed. ChangeParts // ChangeColumn describes a change to the foreign-key (child) columns. ChangeColumn // ChangeRefColumn describes a change to the foreign-key (parent) columns. ChangeRefColumn // ChangeRefTable describes a change to the foreign-key (parent) table. ChangeRefTable // ChangeUpdateAction describes a change to the foreign-key update action. ChangeUpdateAction // ChangeDeleteAction describes a change to the foreign-key delete action. ChangeDeleteAction )
func (ChangeKind) Is ¶
func (k ChangeKind) Is(c ChangeKind) bool
Is reports whether c is match the given change kind.
type Charset ¶
type Charset struct {
V string
}
Charset describes a column or a table character set setting.
type Check ¶ added in v0.2.0
type Check struct { Name string // Optional constraint name. Expr string // Actual CHECK. Attrs []Attr // Additional attributes (e.g. ENFORCED). }
Check describes a CHECK constraint.
func (*Check) AddAttrs ¶ added in v0.3.0
AddAttrs adds additional attributes to the check constraint.
type Clause ¶ added in v0.2.0
type Clause interface {
// contains filtered or unexported methods
}
Clause carries additional information that can be added to schema changes. The Clause interface can be implemented outside this package as follows:
type Authorization struct { schema.Clause UserName string } var c schema.Clause = &Authorization{UserName: "a8m"}
type Collation ¶
type Collation struct {
V string
}
Collation describes a column or a table collation setting.
type Column ¶
type Column struct { Name string Type *ColumnType Default Expr Attrs []Attr Indexes []*Index // Foreign keys that this column is // part of their child columns. ForeignKeys []*ForeignKey }
A Column represents a column definition.
func NewBinaryColumn ¶ added in v0.2.0
func NewBinaryColumn(name, typ string, opts ...BinaryOption) *Column
NewBinaryColumn creates a new BinaryType column.
func NewBoolColumn ¶ added in v0.2.0
NewBoolColumn creates a new BoolType column.
func NewDecimalColumn ¶ added in v0.2.0
func NewDecimalColumn(name, typ string, opts ...DecimalOption) *Column
NewDecimalColumn creates a new DecimalType column.
func NewEnumColumn ¶ added in v0.2.0
func NewEnumColumn(name string, opts ...EnumOption) *Column
NewEnumColumn creates a new EnumType column.
func NewFloatColumn ¶ added in v0.2.0
func NewFloatColumn(name, typ string, opts ...FloatOption) *Column
NewFloatColumn creates a new FloatType column.
func NewIntColumn ¶ added in v0.2.0
NewIntColumn creates a new IntegerType column.
func NewJSONColumn ¶ added in v0.2.0
NewJSONColumn creates a new JSONType column.
func NewNullBinaryColumn ¶ added in v0.2.0
func NewNullBinaryColumn(name, typ string, opts ...BinaryOption) *Column
NewNullBinaryColumn creates a new nullable BinaryType column.
func NewNullBoolColumn ¶ added in v0.2.0
NewNullBoolColumn creates a new nullable BoolType column.
func NewNullColumn ¶ added in v0.2.0
NewNullColumn creates a new nullable column with the given name.
func NewNullDecimalColumn ¶ added in v0.2.0
func NewNullDecimalColumn(name, typ string, opts ...DecimalOption) *Column
NewNullDecimalColumn creates a new nullable DecimalType column.
func NewNullEnumColumn ¶ added in v0.2.0
func NewNullEnumColumn(name string, opts ...EnumOption) *Column
NewNullEnumColumn creates a new nullable EnumType column.
func NewNullFloatColumn ¶ added in v0.2.0
func NewNullFloatColumn(name, typ string, opts ...FloatOption) *Column
NewNullFloatColumn creates a new nullable FloatType column.
func NewNullIntColumn ¶ added in v0.2.0
NewNullIntColumn creates a new nullable IntegerType column.
func NewNullJSONColumn ¶ added in v0.2.0
NewNullJSONColumn creates a new nullable JSONType column.
func NewNullSpatialColumn ¶ added in v0.2.0
NewNullSpatialColumn creates a new nullable SpatialType column.
func NewNullStringColumn ¶ added in v0.2.0
func NewNullStringColumn(name, typ string, opts ...StringOption) *Column
NewNullStringColumn creates a new nullable StringType column.
func NewNullTimeColumn ¶ added in v0.2.0
NewNullTimeColumn creates a new nullable TimeType column.
func NewNullUintColumn ¶ added in v0.2.0
NewNullUintColumn creates a new nullable unsigned IntegerType column.
func NewSpatialColumn ¶ added in v0.2.0
NewSpatialColumn creates a new SpatialType column.
func NewStringColumn ¶ added in v0.2.0
func NewStringColumn(name, typ string, opts ...StringOption) *Column
NewStringColumn creates a new StringType column.
func NewTimeColumn ¶ added in v0.2.0
NewTimeColumn creates a new TimeType column.
func NewUintColumn ¶ added in v0.2.0
NewUintColumn creates a new unsigned IntegerType column.
func (*Column) SetCharset ¶ added in v0.2.0
SetCharset sets or appends the Charset attribute to the column with the given value.
func (*Column) SetCollation ¶ added in v0.2.0
SetCollation sets or appends the Collation attribute to the column with the given value.
func (*Column) SetComment ¶ added in v0.2.0
SetComment sets or appends the Comment attribute to the column with the given value.
func (*Column) SetDefault ¶ added in v0.2.0
SetDefault configures the default of the column
func (*Column) UnsetCharset ¶ added in v0.3.0
UnsetCharset unsets the Charset attribute.
func (*Column) UnsetCollation ¶ added in v0.3.0
UnsetCollation the Collation attribute.
type ColumnType ¶
ColumnType represents a column type that is implemented by the dialect.
type DecimalOption ¶ added in v0.2.0
type DecimalOption func(*DecimalType)
DecimalOption allows configuring DecimalType using functional options.
func DecimalPrecision ¶ added in v0.2.0
func DecimalPrecision(precision int) DecimalOption
DecimalPrecision configures the precision of the decimal type.
func DecimalScale ¶ added in v0.2.0
func DecimalScale(scale int) DecimalOption
DecimalScale configures the scale of the decimal type.
type DecimalType ¶
DecimalType represents a fixed-point type that stores exact numeric values.
type Differ ¶
type Differ interface { // RealmDiff returns a diff report for migrating a realm // (or a database) from state "from" to state "to". An error // is returned if such step is not possible. RealmDiff(from, to *Realm) ([]Change, error) // SchemaDiff returns a diff report for migrating a schema // from state "from" to state "to". An error is returned // if such step is not possible. SchemaDiff(from, to *Schema) ([]Change, error) // TableDiff returns a diff report for migrating a table // from state "from" to state "to". An error is returned // if such step is not possible. TableDiff(from, to *Table) ([]Change, error) }
Differ is the interface implemented by the different drivers for comparing and diffing schema top elements.
type DropCheck ¶ added in v0.2.0
type DropCheck struct {
C *Check
}
DropCheck describes a CHECK constraint removal change.
type DropColumn ¶
type DropColumn struct {
C *Column
}
DropColumn describes a column removal change.
type DropForeignKey ¶
type DropForeignKey struct {
F *ForeignKey
}
DropForeignKey describes a foreign-key removal change.
type DropSchema ¶ added in v0.2.0
DropSchema describes a schema (named database) removal change.
type EnumOption ¶ added in v0.2.0
type EnumOption func(*EnumType)
EnumOption allows configuring EnumType using functional options.
func EnumName ¶ added in v0.2.0
func EnumName(name string) EnumOption
EnumName configures the name of the name. This option is useful for databases like PostgreSQL that supports user-defined types for enums.
func EnumValues ¶ added in v0.2.0
func EnumValues(values ...string) EnumOption
EnumValues configures the values of the enum.
type ExecQuerier ¶
type ExecQuerier interface { QueryRow(query string, args ...interface{}) *sql.Row QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row Query(query string, args ...interface{}) (*sql.Rows, error) QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error) }
ExecQuerier wraps the standard sql.DB methods.
type Expr ¶
type Expr interface {
// contains filtered or unexported methods
}
Expr defines an SQL expression in schema DDL.
type FloatOption ¶ added in v0.2.0
type FloatOption func(*FloatType)
FloatOption allows configuring FloatType using functional options.
func FloatPrecision ¶ added in v0.2.0
func FloatPrecision(precision int) FloatOption
FloatPrecision configures the precision of the float type.
type ForeignKey ¶
type ForeignKey struct { Symbol string Table *Table Columns []*Column RefTable *Table RefColumns []*Column OnUpdate ReferenceOption OnDelete ReferenceOption }
A ForeignKey represents an index definition.
func NewForeignKey ¶ added in v0.2.0
func NewForeignKey(symbol string) *ForeignKey
NewForeignKey creates a new foreign-key with the given constraints/symbol name.
func (*ForeignKey) AddColumns ¶ added in v0.2.0
func (f *ForeignKey) AddColumns(columns ...*Column) *ForeignKey
AddColumns appends columns to the child-table columns.
func (*ForeignKey) AddRefColumns ¶ added in v0.2.0
func (f *ForeignKey) AddRefColumns(columns ...*Column) *ForeignKey
AddRefColumns appends columns to the parent-table columns.
func (*ForeignKey) Column ¶
func (f *ForeignKey) Column(name string) (*Column, bool)
Column returns the first column that matches the given name.
func (*ForeignKey) RefColumn ¶
func (f *ForeignKey) RefColumn(name string) (*Column, bool)
RefColumn returns the first referenced column that matches the given name.
func (*ForeignKey) SetOnDelete ¶ added in v0.2.0
func (f *ForeignKey) SetOnDelete(o ReferenceOption) *ForeignKey
SetOnDelete sets the ON DELETE constraint action.
func (*ForeignKey) SetOnUpdate ¶ added in v0.2.0
func (f *ForeignKey) SetOnUpdate(o ReferenceOption) *ForeignKey
SetOnUpdate sets the ON UPDATE constraint action.
func (*ForeignKey) SetRefTable ¶ added in v0.2.0
func (f *ForeignKey) SetRefTable(t *Table) *ForeignKey
SetRefTable configures the referenced/parent table.
func (*ForeignKey) SetTable ¶ added in v0.2.0
func (f *ForeignKey) SetTable(t *Table) *ForeignKey
SetTable configures the table that holds the foreign-key (child table).
type IfExists ¶ added in v0.2.0
type IfExists struct{}
IfExists represents a clause in a schema change that is commonly supported by multiple statements (e.g. DROP TABLE or DROP SCHEMA).
type IfNotExists ¶ added in v0.2.0
type IfNotExists struct{}
IfNotExists represents a clause in a schema change that is commonly supported by multiple statements (e.g. CREATE TABLE or CREATE SCHEMA).
type Index ¶
An Index represents an index definition.
func NewPrimaryKey ¶ added in v0.2.0
NewPrimaryKey creates a new primary-key index for the given columns.
func NewUniqueIndex ¶ added in v0.2.0
NewUniqueIndex creates a new unique index with the given name.
func (*Index) AddColumns ¶ added in v0.2.0
AddColumns adds the columns to index parts.
func (*Index) SetComment ¶ added in v0.3.0
SetComment sets or appends the Comment attribute to the index with the given value.
type IndexPart ¶
An IndexPart represents an index part that can be either an expression or a column.
func NewIndexPart ¶ added in v0.2.0
NewIndexPart creates a new index part.
func (*IndexPart) AddAttrs ¶ added in v0.2.0
AddAttrs adds and additional attributes to the index-part.
type InspectOptions ¶
type InspectOptions struct { // Tables to inspect. Empty means all tables in the schema. Tables []string }
InspectOptions describes options for Inspector.
type InspectRealmOption ¶
type InspectRealmOption struct { // Schemas to inspect. Empty means all tables in the schema. Schemas []string }
InspectRealmOption describes options for RealmInspector.
type InspectTableOptions ¶
type InspectTableOptions struct { // Schema defines an optional schema to inspect. Schema string }
InspectTableOptions describes options for TableInspector.
type Inspector ¶
type Inspector interface { // InspectSchema returns the schema description by its name. A NotExistError // error is returned if the schema does not exists in the database. InspectSchema(ctx context.Context, name string, opts *InspectOptions) (*Schema, error) // InspectTable returns the table description by its name. A NotExistError // error is returned if the table does not exists in the database. InspectTable(ctx context.Context, name string, opts *InspectTableOptions) (*Table, error) // InspectRealm returns the description of the connected database. InspectRealm(ctx context.Context, opts *InspectRealmOption) (*Realm, error) }
Inspector is the interface implemented by the different database drivers for inspecting multiple tables.
type IntegerType ¶
IntegerType represents an int type.
type Literal ¶
type Literal struct {
V string
}
Literal represents a basic literal expression like 1, or '1'. String literals are usually quoted with single or double quotes.
type ModifyAttr ¶
type ModifyAttr struct {
From, To Attr
}
ModifyAttr describes a change that modifies an element attribute.
type ModifyCheck ¶ added in v0.2.0
type ModifyCheck struct {
From, To *Check
Change ChangeKind
}
ModifyCheck describes a change that modifies a check.
type ModifyColumn ¶
type ModifyColumn struct {
From, To *Column
Change ChangeKind
}
ModifyColumn describes a change that modifies a column.
type ModifyForeignKey ¶
type ModifyForeignKey struct {
From, To *ForeignKey
Change ChangeKind
}
ModifyForeignKey describes a change that modifies a foreign-key.
type ModifyIndex ¶
type ModifyIndex struct {
From, To *Index
Change ChangeKind
}
ModifyIndex describes an index modification.
type ModifySchema ¶ added in v0.2.0
ModifySchema describes a modification change for schema attributes.
type ModifyTable ¶
ModifyTable describes a table modification change.
type NotExistError ¶
type NotExistError struct {
Err error
}
A NotExistError wraps another error to retain its original text but makes it possible to the migrator to catch it.
func (NotExistError) Error ¶
func (e NotExistError) Error() string
type RawExpr ¶
type RawExpr struct {
X string
}
RawExpr represents a raw expression like "uuid()" or "current_timestamp()". Unlike literals, raw expression are usually inlined as is on migration.
type Realm ¶
A Realm or a database describes a domain of schema resources that are logically connected and can be accessed and queried in the same connection (e.g. a physical database instance).
type ReferenceOption ¶
type ReferenceOption string
ReferenceOption for constraint actions.
const ( NoAction ReferenceOption = "NO ACTION" Restrict ReferenceOption = "RESTRICT" Cascade ReferenceOption = "CASCADE" SetNull ReferenceOption = "SET NULL" SetDefault ReferenceOption = "SET DEFAULT" )
Reference options (actions) specified by ON UPDATE and ON DELETE subclauses of the FOREIGN KEY clause.
type Schema ¶
A Schema describes a database schema (i.e. named database).
func (*Schema) SetCharset ¶ added in v0.2.0
SetCharset sets or appends the Charset attribute to the schema with the given value.
func (*Schema) SetCollation ¶ added in v0.2.0
SetCollation sets or appends the Collation attribute to the schema with the given value.
func (*Schema) SetComment ¶ added in v0.2.0
SetComment sets or appends the Comment attribute to the schema with the given value.
func (*Schema) UnsetCharset ¶ added in v0.3.0
UnsetCharset unsets the Charset attribute.
func (*Schema) UnsetCollation ¶ added in v0.3.0
UnsetCollation the Collation attribute.
type SpatialType ¶
type SpatialType struct {
T string
}
SpatialType represents a spatial/geometric type.
type StringOption ¶ added in v0.2.0
type StringOption func(*StringType)
StringOption allows configuring StringType using functional options.
func StringSize ¶ added in v0.2.0
func StringSize(size int) StringOption
StringSize configures the size of the string type.
type Table ¶
type Table struct { Name string Schema *Schema Columns []*Column Indexes []*Index PrimaryKey *Index ForeignKeys []*ForeignKey Attrs []Attr // Attrs, constraints and options. }
A Table represents a table definition.
func (*Table) AddColumns ¶ added in v0.2.0
AddColumns appends the given columns to the table column list.
func (*Table) AddForeignKeys ¶ added in v0.2.0
func (t *Table) AddForeignKeys(fks ...*ForeignKey) *Table
AddForeignKeys appends the given foreign-keys to the table foreign-key list.
func (*Table) AddIndexes ¶ added in v0.2.0
AddIndexes appends the given indexes to the table index list.
func (*Table) ForeignKey ¶
func (t *Table) ForeignKey(symbol string) (*ForeignKey, bool)
ForeignKey returns the first foreign-key that matched the given symbol (constraint name).
func (*Table) SetCharset ¶ added in v0.2.0
SetCharset sets or appends the Charset attribute to the table with the given value.
func (*Table) SetCollation ¶ added in v0.2.0
SetCollation sets or appends the Collation attribute to the table with the given value.
func (*Table) SetComment ¶ added in v0.2.0
SetComment sets or appends the Comment attribute to the table with the given value.
func (*Table) SetPrimaryKey ¶ added in v0.2.0
SetPrimaryKey sets the primary-key of the table.
func (*Table) UnsetCharset ¶ added in v0.3.0
UnsetCharset unsets the Charset attribute.
func (*Table) UnsetCollation ¶ added in v0.3.0
UnsetCollation the Collation attribute.
type Type ¶
type Type interface {
// contains filtered or unexported methods
}
A Type represents a database type. The types below implements this interface and can be used for describing schemas.
The Type interface can also be implemented outside this package as follows:
type SpatialType struct { schema.Type T string } var t schema.Type = &SpatialType{T: "point"}
type UnsupportedType ¶
type UnsupportedType struct {
T string
}
UnsupportedType represents a type that is not supported by the drivers.