Versions in this module Expand all Collapse all v1 v1.0.1 Apr 12, 2022 Changes in this version + const DefaultStringLen + const MaxTypes + const Null + const PrimaryKey + const TypeTable + const UniqueKey + type Applier interface + Apply func(context.Context, dialect.ExecQuerier, *migrate.Plan) error + type ApplyFunc func(context.Context, dialect.ExecQuerier, *migrate.Plan) error + func (f ApplyFunc) Apply(ctx context.Context, conn dialect.ExecQuerier, plan *migrate.Plan) error + type ApplyHook func(Applier) Applier + type ChangeKind uint + const AddCheck + const AddColumn + const AddForeignKey + const AddIndex + const AddSchema + const AddTable + const DropCheck + const DropColumn + const DropForeignKey + const DropIndex + const DropSchema + const DropTable + const ModifyCheck + const ModifyColumn + const ModifyForeignKey + const ModifyIndex + const ModifySchema + const ModifyTable + const NoChange + func (k ChangeKind) Is(c ChangeKind) bool + type Column struct + Attr string + Collation string + Default interface{} + Enums []string + Increment bool + Key string + Name string + Nullable bool + SchemaType map[string]string + Size int64 + Type field.Type + Unique bool + func (c *Column) ConvertibleTo(d *Column) bool + func (c *Column) PrimaryKey() bool + func (c *Column) ScanDefault(value string) error + func (c *Column) UniqueKey() bool + func (c Column) FloatType() bool + func (c Column) IntType() bool + func (c Column) UintType() bool + type CreateFunc func(context.Context, ...*Table) error + func (f CreateFunc) Create(ctx context.Context, tables ...*Table) error + type Creator interface + Create func(context.Context, ...*Table) error + type DiffFunc func(current, desired *schema.Schema) ([]schema.Change, error) + func (f DiffFunc) Diff(current, desired *schema.Schema) ([]schema.Change, error) + type DiffHook func(Differ) Differ + type Differ interface + Diff func(current, desired *schema.Schema) ([]schema.Change, error) + type ForeignKey struct + Columns []*Column + OnDelete ReferenceOption + OnUpdate ReferenceOption + RefColumns []*Column + RefTable *Table + Symbol string + func (fk ForeignKey) DSL() *sql.ForeignKeyBuilder + type Hook func(Creator) Creator + type Index struct + Annotation *entsql.IndexAnnotation + Columns []*Column + Name string + Unique bool + func (i *Index) Builder(table string) *sql.IndexBuilder + func (i *Index) DropBuilder(table string) *sql.DropIndexBuilder + type Indexes []*Index + type InspectOption func(inspect *Inspector) + func WithSchema(schema string) InspectOption + type Inspector struct + func NewInspect(d dialect.Driver, opts ...InspectOption) (*Inspector, error) + func (i *Inspector) Tables(ctx context.Context) ([]*Table, error) + type Migrate struct + func NewMigrate(d dialect.Driver, opts ...MigrateOption) (*Migrate, error) + func (m *Migrate) Create(ctx context.Context, tables ...*Table) error + func (m *Migrate) Diff(ctx context.Context, tables ...*Table) error + func (m *Migrate) NamedDiff(ctx context.Context, name string, tables ...*Table) error + type MigrateOption func(*Migrate) + func WithApplyHook(hooks ...ApplyHook) MigrateOption + func WithAtlas(b bool) MigrateOption + func WithDiffHook(hooks ...DiffHook) MigrateOption + func WithDir(dir migrate.Dir) MigrateOption + func WithDropColumn(b bool) MigrateOption + func WithDropIndex(b bool) MigrateOption + func WithFixture(b bool) MigrateOption + func WithForeignKeys(b bool) MigrateOption + func WithFormatter(fmt migrate.Formatter) MigrateOption + func WithGlobalUniqueID(b bool) MigrateOption + func WithHooks(hooks ...Hook) MigrateOption + func WithSkipChanges(skip ChangeKind) MigrateOption + type MySQL struct + type Postgres struct + type ReferenceOption string + const Cascade + const NoAction + const Restrict + const SetDefault + const SetNull + func (r ReferenceOption) ConstName() string + type SQLite struct + WithForeignKeys bool + type Table struct + Annotation *entsql.Annotation + Columns []*Column + ForeignKeys []*ForeignKey + Indexes []*Index + Name string + PrimaryKey []*Column + func NewTable(name string) *Table + func (t *Table) AddColumn(c *Column) *Table + func (t *Table) AddForeignKey(fk *ForeignKey) *Table + func (t *Table) AddIndex(name string, unique bool, columns []string) *Table + func (t *Table) AddPrimary(c *Column) *Table + func (t *Table) HasColumn(name string) bool + func (t *Table) Index(name string) (*Index, bool) + func (t *Table) SetAnnotation(ant *entsql.Annotation) *Table + type WriteDriver struct + func (w *WriteDriver) Commit() error + func (w *WriteDriver) Exec(_ context.Context, query string, _, _ interface{}) error + func (w *WriteDriver) Rollback() error + func (w *WriteDriver) Tx(context.Context) (dialect.Tx, error)