Documentation
¶
Index ¶
- func Exec(db *bun.DB, sql string, isTx bool, splitter string) (err error)
- func GenerateDown(upSql string) string
- func GenerateDownLine(up string) (down string)
- 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 DownGenerator
- type Migration
- func (o *Migration) AutoGenerateDown()
- func (o *Migration) DownHashIsValid() bool
- func (o Migration) Error() error
- func (o *Migration) GenerateDown()
- func (o *Migration) IsApplied() bool
- func (o *Migration) Lost() bool
- func (o *Migration) PreviewDown() string
- 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()
- 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) 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) 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) Reset() (err error)
- func (o *Migrator) Rollback() (err error)
- func (o *Migrator) RollbackLast() (err error)
- 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) 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
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateDown ¶
func GenerateDownLine ¶
Types ¶
type DownGenerator ¶
type DownGenerator struct {
Process func(string) bool
Command string
// contains filtered or unexported fields
}
func NewDownGenerator ¶
func NewDownGenerator() *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 (o *Migration) AutoGenerateDown()
func (*Migration) DownHashIsValid ¶
func (*Migration) GenerateDown ¶
func (o *Migration) GenerateDown()
func (*Migration) PreviewDown ¶
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()
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) 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) Migrations ¶
func (o *Migrator) Migrations() Migrations
func (*Migrator) MigrationsCount ¶
func (*Migrator) RollbackLast ¶
func (*Migrator) UnappliedMigrations ¶
func (o *Migrator) UnappliedMigrations() (l Migrations)
func (*Migrator) UnappliedMigrationsCount ¶
func (*Migrator) WithAutoDownSql ¶
func (*Migrator) WithMarkAppliedOnSuccess ¶
func (*Migrator) WithRollbackLost ¶
func (*Migrator) WithSaveDownSql ¶
func (*Migrator) WithSplitter ¶
func (*Migrator) WithTableName ¶
Click to show internal directories.
Click to hide internal directories.