Documentation ¶
Index ¶
- func Exec(db *bun.DB, sql string, isTx bool, splitter string) (err error)
- func GenerateDown(upSql string) (string, error)
- func GenerateDownLine(up string) (string, error)
- func GenerateDownLineWithContext(up string, c *Context) (down string, err error)
- func GenerateDownWithContext(upSql string, c *Context) (down string, err error)
- func Name(s string) (name string, comment string, isUp bool, isTx bool, ok bool)
- func ReadSql(f fs.FS, path string) (sql string, err error)
- type Column
- type Context
- type DownGenerator
- type Migration
- func (o *Migration) AutoGenerateDown(c *Context) error
- func (o *Migration) DownHashIsValid() bool
- func (o Migration) Error() error
- func (o *Migration) GenerateDown(c *Context) (err error)
- func (o *Migration) IsApplied() bool
- func (o *Migration) Lost() bool
- func (o *Migration) PreviewDown(c *Context) (string, error)
- func (o *Migration) RepairDown(c *Context) (ok bool, err error)
- func (o *Migration) SetApplied(groupId int64)
- func (o *Migration) SetFuncs(db *bun.DB, splitter string)
- func (o *Migration) SetUnapplied()
- func (o Migration) String() string
- func (o *Migration) UpHashIsValid() bool
- type Migrations
- func (o Migrations) Applied() (applied Migrations)
- func (o *Migrations) AutoGenerateDown() (err error)
- func (o Migrations) Count() int
- func (o Migrations) Last() *Migration
- func (o Migrations) LastGroup() (l Migrations)
- func (o Migrations) LastGroupId() (lastGroupId int64)
- func (o *Migrations) Load(f fs.FS) error
- func (o Migrations) PreviewDown() (name string, down string, err error)
- func (o *Migrations) RepairDown(update func(*Migration) error) (names []string, err error)
- func (o Migrations) SetFuncs(db *bun.DB, splitter string)
- func (o Migrations) SortAsc()
- func (o Migrations) SortDesc()
- func (o Migrations) Unapplied() (unapplied Migrations)
- type Migrator
- func (o *Migrator) AppliedMigrations() (l Migrations)
- func (o *Migrator) AppliedMigrationsCount() int
- func (o *Migrator) Forget() (err error)
- func (o *Migrator) HasIncompleteMigrations() bool
- func (o *Migrator) Init() (err error)
- func (o *Migrator) Load(fs fs.FS) (err error)
- func (o *Migrator) Migrate() (err error)
- func (o *Migrator) Migrations() Migrations
- func (o *Migrator) MigrationsCount() int
- func (o *Migrator) RepairDown() ([]string, error)
- func (o *Migrator) Reset() (err error)
- func (o *Migrator) Rollback() error
- func (o *Migrator) RollbackLast() (err error)
- func (o *Migrator) RolledbackMigrations() (l Migrations)
- func (o *Migrator) RolledbackMigrationsCount() int
- func (o *Migrator) Status() string
- func (o *Migrator) UnappliedMigrations() (l Migrations)
- func (o *Migrator) UnappliedMigrationsCount() int
- func (o *Migrator) WithAutoDownSql(v bool) *Migrator
- func (o *Migrator) WithMarkAppliedOnSuccess(v bool) *Migrator
- func (o *Migrator) WithReadonly(ro bool) *Migrator
- func (o *Migrator) WithRollbackLost(v bool) *Migrator
- func (o *Migrator) WithSaveDownSql(v bool) *Migrator
- func (o *Migrator) WithSplitter(v string) *Migrator
- func (o *Migrator) WithTableName(v string) *Migrator
- type Schema
- func (o *Schema) AddColumn(tableName, columnName, columnType, columnConstraints string) error
- func (o *Schema) AddTable(name string) error
- func (o *Schema) AlterColumnType(tableName, columnName, columnType string) error
- func (o *Schema) Column(tableName, columnName string) (r *Column, err error)
- func (o *Schema) ColumnType(tableName, columnName string) (columnType string, columnConstraints string, err error)
- func (o *Schema) DromColumn(tableName, columnName string) error
- func (o *Schema) DromTable(name string) error
- func (o *Schema) Table(name string) (r *Table, err error)
- type Table
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateDown ¶
func GenerateDownLine ¶
func GenerateDownLineWithContext ¶ added in v0.6.14
func GenerateDownWithContext ¶ added in v0.6.14
Types ¶
type Context ¶ added in v0.6.14
type Context struct {
// contains filtered or unexported fields
}
func NewContext ¶ added in v0.6.14
func NewContext() *Context
type DownGenerator ¶
type DownGenerator struct { Process func(string) bool Command string Error error // contains filtered or unexported fields }
func NewDownGenerator ¶
func NewDownGenerator(c *Context) *DownGenerator
type Migration ¶
type Migration struct { bun.BaseModel Id int64 `bun:",pk,autoincrement"` Name string `bun:",notnull"` Comment string `bun:",notnull"` IsTx bool `bun:",notnull"` UpHash string `bun:",notnull"` DownHash string `bun:",notnull"` UpSql string `bun:"-"` DownSql string `bun:",notnull"` GroupId int64 `bun:",notnull"` MigratedAt time.Time `bun:",notnull"` Up func() error `bun:"-"` Down func() error `bun:"-"` // contains filtered or unexported fields }
func (*Migration) AutoGenerateDown ¶
func (*Migration) DownHashIsValid ¶
func (*Migration) GenerateDown ¶
func (*Migration) RepairDown ¶ added in v0.6.14
func (*Migration) SetApplied ¶
func (*Migration) SetUnapplied ¶
func (o *Migration) SetUnapplied()
func (*Migration) UpHashIsValid ¶
type Migrations ¶
type Migrations []*Migration
func (Migrations) Applied ¶
func (o Migrations) Applied() (applied Migrations)
func (*Migrations) AutoGenerateDown ¶
func (o *Migrations) AutoGenerateDown() (err error)
func (Migrations) Count ¶
func (o Migrations) Count() int
func (Migrations) Last ¶
func (o Migrations) Last() *Migration
func (Migrations) LastGroup ¶
func (o Migrations) LastGroup() (l Migrations)
func (Migrations) LastGroupId ¶
func (o Migrations) LastGroupId() (lastGroupId int64)
func (Migrations) PreviewDown ¶ added in v0.6.14
func (o Migrations) PreviewDown() (name string, down string, err error)
func (*Migrations) RepairDown ¶ added in v0.6.14
func (o *Migrations) RepairDown(update func(*Migration) error) (names []string, err error)
func (Migrations) SortAsc ¶
func (o Migrations) SortAsc()
func (Migrations) SortDesc ¶
func (o Migrations) SortDesc()
func (Migrations) Unapplied ¶
func (o Migrations) Unapplied() (unapplied Migrations)
type Migrator ¶
type Migrator struct {
// contains filtered or unexported fields
}
func NewMigrator ¶
func (*Migrator) AppliedMigrations ¶
func (o *Migrator) AppliedMigrations() (l Migrations)
func (*Migrator) AppliedMigrationsCount ¶
func (*Migrator) HasIncompleteMigrations ¶ added in v0.4.13
func (*Migrator) Migrations ¶
func (o *Migrator) Migrations() Migrations
func (*Migrator) MigrationsCount ¶
func (*Migrator) RepairDown ¶ added in v0.6.14
func (*Migrator) RollbackLast ¶
func (*Migrator) RolledbackMigrations ¶ added in v0.4.13
func (o *Migrator) RolledbackMigrations() (l Migrations)
func (*Migrator) RolledbackMigrationsCount ¶ added in v0.4.13
func (*Migrator) UnappliedMigrations ¶
func (o *Migrator) UnappliedMigrations() (l Migrations)
func (*Migrator) UnappliedMigrationsCount ¶
func (*Migrator) WithAutoDownSql ¶
func (*Migrator) WithMarkAppliedOnSuccess ¶
func (*Migrator) WithReadonly ¶ added in v0.6.14
func (*Migrator) WithRollbackLost ¶
func (*Migrator) WithSaveDownSql ¶
func (*Migrator) WithSplitter ¶
func (*Migrator) WithTableName ¶
type Schema ¶ added in v0.6.14
type Schema struct {
Tables []Table
}
func (*Schema) AlterColumnType ¶ added in v0.6.14
func (*Schema) ColumnType ¶ added in v0.6.14
func (*Schema) DromColumn ¶ added in v0.6.14
Click to show internal directories.
Click to hide internal directories.