Documentation
¶
Index ¶
- type Builder
- func (b *Builder) AlterTable(name string, fn func(*Table)) error
- func (b *Builder) CreateTable(name string, fn func(*Table)) error
- func (b *Builder) CreateTableIfNotExists(name string, fn func(*Table)) error
- func (b *Builder) DropTable(name string) error
- func (b *Builder) DropTableIfExists(name string) error
- func (b *Builder) HasTable(name string) (bool, error)
- type Column
- type Dialect
- type Executor
- type ForeignKey
- type Index
- type Table
- func (t *Table) AddColumn(name, colType string) *Column
- func (t *Table) AddIndex(columns ...string)
- func (t *Table) AddUniqueIndex(columns ...string)
- func (t *Table) BigInteger(name string) *Column
- func (t *Table) Boolean(name string) *Column
- func (t *Table) Decimal(name string, precision, scale int) *Column
- func (t *Table) DropColumn(name string)
- func (t *Table) DropIndex(name string)
- func (t *Table) Float(name string) *Column
- func (t *Table) Foreign(column string) *ForeignKey
- func (t *Table) ID()
- func (t *Table) Integer(name string) *Column
- func (t *Table) RenameColumn(old, new string)
- func (t *Table) SoftDeletes()
- func (t *Table) String(name string, length int) *Column
- func (t *Table) Text(name string) *Column
- func (t *Table) Timestamp(name string) *Column
- func (t *Table) Timestamps()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Column ¶
type Column struct {
Name string
Type string
IsNullable bool
IsUnique bool
IsPrimary bool
IsAuto bool
DefaultValue any
ReferenceTable string
ReferenceCol string
}
func (*Column) AutoIncrement ¶
func (*Column) References ¶
type ForeignKey ¶
func (*ForeignKey) References ¶
func (fk *ForeignKey) References(table, column string)
type Table ¶
type Table struct {
Name string
Columns []*Column
Indices []Index
Uniques []Index
Foreigns []*ForeignKey
// contains filtered or unexported fields
}
func (*Table) AddUniqueIndex ¶
func (*Table) BigInteger ¶
func (*Table) DropColumn ¶
func (*Table) Foreign ¶
func (t *Table) Foreign(column string) *ForeignKey
func (*Table) RenameColumn ¶
func (*Table) SoftDeletes ¶
func (t *Table) SoftDeletes()
func (*Table) Timestamps ¶
func (t *Table) Timestamps()
Click to show internal directories.
Click to hide internal directories.