Documentation
¶
Index ¶
- type Column
- type ColumnDefault
- type ColumnDefaultType
- type Enum
- type ForeignKey
- type PrimaryKey
- type Schema
- type Sequence
- type Table
- func (t *Table) AddColumn(col *Column)
- func (t *Table) AddEnum(enum *Enum)
- func (t *Table) ColumnsNames() []string
- func (t *Table) GetColumn(name string) *Column
- func (t *Table) GetFirstUniqueKey() *UniqueKey
- func (t *Table) GetPKColumns() []*Column
- func (t *Table) HasForeignKeyTo(tableName string) bool
- func (t *Table) HasSingleUniqueKey() bool
- func (t *Table) HasUniqueKeys() bool
- type TableMap
- func (m *TableMap) Add(table *Table)
- func (m *TableMap) Clone() *TableMap
- func (m *TableMap) Each(callback func(table *Table))
- func (m *TableMap) EachWithErr(callback func(table *Table) error) error
- func (m *TableMap) Get(name gds.String) (*Table, bool)
- func (m *TableMap) Has(name gds.String) bool
- func (m *TableMap) Len() int
- func (m *TableMap) List() []*Table
- type Type
- type UniqueKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Column ¶
type Column struct {
Name gds.String `db:"name"`
TableName gds.String `db:"table_name"`
Type Type `db:"-"`
TypeRaw gds.String `db:"type_raw"`
Nullable bool `db:"nullable"`
PrimaryKey *PrimaryKey `db:"-"`
UniqueKey *UniqueKey `db:"-"`
ForeignKey *ForeignKey `db:"-"`
Comment gds.String `db:"comment"`
DefaultRaw sql.NullString `db:"default_value"`
Default *ColumnDefault `db:"-"`
UsingSequences map[string]*Sequence `db:"-"`
Enum *Enum `db:"-"`
IsAutoincrement bool `db:"-"`
}
func (*Column) HasForeignKey ¶
func (*Column) IsPrimaryKey ¶
func (*Column) IsUniqueKey ¶
func (*Column) IsUniqueOrPrimaryKey ¶ added in v0.1.1
type ColumnDefault ¶ added in v0.3.0
type ColumnDefault struct {
Type ColumnDefaultType
Value interface{}
}
type ColumnDefaultType ¶ added in v0.3.0
type ColumnDefaultType int
const ( ColumnDefaultTypeUnknown ColumnDefaultType = iota ColumnDefaultTypeFunc // @todo need refactor to expression ColumnDefaultTypeValue ColumnDefaultTypeAutoincrement )
type ForeignKey ¶
type PrimaryKey ¶
func CreatePrimaryKeyForColumn ¶ added in v0.4.0
func CreatePrimaryKeyForColumn(col *Column) *PrimaryKey
type Schema ¶
type Schema struct {
Tables *TableMap
Sequences map[string]*Sequence
Enums map[string]*Enum
Driver config.DatabaseDriver
}
func NewSchema ¶ added in v0.4.0
func NewSchema(driver config.DatabaseDriver) *Schema
func (*Schema) OnlyTables ¶ added in v0.4.0
func (*Schema) SortByRelations ¶
func (s *Schema) SortByRelations()
func (*Schema) TablesNames ¶
type Sequence ¶ added in v0.3.0
type Sequence struct {
Name string `db:"name"`
DataType Type `db:"-"`
DataTypeRaw string `db:"data_type_raw"`
Used int `db:"-"`
}
func CreateSequenceForColumn ¶ added in v0.4.0
type Table ¶
type Table struct {
Name gds.String `db:"Name"`
Columns []*Column `db:"-"`
PrimaryKey *PrimaryKey `db:"-"`
ForeignKeys map[string]*ForeignKey `db:"-"`
UniqueKeys map[string]*UniqueKey `db:"-"`
UsingSequences map[string]*Sequence `db:"-"`
UsingEnums map[string]*Enum `db:"-"`
Comment string
// contains filtered or unexported fields
}
func (*Table) ColumnsNames ¶
func (*Table) GetFirstUniqueKey ¶
func (*Table) GetPKColumns ¶ added in v0.3.0
func (*Table) HasForeignKeyTo ¶
func (*Table) HasSingleUniqueKey ¶
func (*Table) HasUniqueKeys ¶
type TableMap ¶
type TableMap struct {
// contains filtered or unexported fields
}
func NewTableMap ¶
func (*TableMap) EachWithErr ¶
type Type ¶ added in v0.4.0
type Type struct {
Name string
Length string
IsNumeric bool
IsInteger bool
IsFloat bool
IsUUID bool
IsStringable bool
IsDatetime bool
IsDate bool
IsBoolean bool
IsBinary bool
IsJSON bool
}
func (*Type) MarkAsUUID ¶ added in v0.4.0
func (*Type) WithLength ¶ added in v0.4.0
Click to show internal directories.
Click to hide internal directories.