Documentation
¶
Overview ¶
Package schema contains the schema for the database.
Index ¶
Constants ¶
View Source
const ( ColumnKeyPrimary = "PRI" // Primary key ColumnKeyUnique = "UNI" // Unique constraint ColumnKeyMulti = "MUL" // Non-unique index or first column of multi-column index )
ColumnKey constants represent the normalized key type of a column. Each database driver maps its native key type to these values.
View Source
const (
ColumnExtraAutoIncrement = "auto_increment"
)
ColumnExtra constants represent the normalized extra information of a column. Each database driver maps its native extra info to these values.
View Source
const (
IndexNamePrimary = "PRIMARY"
)
IndexName constants represent well-known index names.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Column ¶
type Column struct {
Table string
Name string // ColumnName
OrdinalPosition int
Default string // ColumnDefault
Nullable string
DataType string
ColumnType string
Key string // ColumnKey
Extra string
Comment string // ColumnComment
ForeignKey *ForeignKey
IndexName string
NonUnique int
IsMultiKey bool
}
func (*Column) IsAutoIncrement ¶
func (*Column) IsForeignKey ¶
func (*Column) IsNullable ¶
func (*Column) IsPrimaryKey ¶
func (*Column) IsUnsigned ¶
type Driver ¶
type Driver interface {
// Open creates a new Scheme for the given configuration.
Open(cfg *config.DB) (Scheme, error)
}
Driver is the interface for database driver registration. Each driver must register itself via init() to be discoverable.
type ForeignKey ¶
type Table ¶
type Table struct {
Name string
Comment string
Columns []*Column
ForeignKeys []ForeignKey
ReverseForeignKeys []ForeignKey // Foreign keys from other tables referencing this table
}
Click to show internal directories.
Click to hide internal directories.