Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoFwMigration = errors.Errorf("no sql in forward migration step")
Functions ¶
func FindMigrations ¶
func FindMigrationsEx ¶
func FindMigrationsEx(path string, fs MigratorFS) ([]string, error)
Types ¶
type BadVersionError ¶
type BadVersionError string
func (BadVersionError) Error ¶
func (e BadVersionError) Error() string
type IrreversibleMigrationError ¶
type IrreversibleMigrationError struct {
// contains filtered or unexported fields
}
func (IrreversibleMigrationError) Error ¶
func (e IrreversibleMigrationError) Error() string
type MigrationPgError ¶
type Migrator ¶
type Migrator struct {
Migrations []*Migration
OnStart func(name string, direction string, sql string) // OnStart is called when a migration is being run
OnFinish func(name string, direction string, durationMs int64)
OnError func(name string, err error, sql string)
Data map[string]interface{} // Data available to use in migrations
// contains filtered or unexported fields
}
func NewMigratorEx ¶
func NewMigratorEx(db *sql.DB, opts *MigratorOptions) (m *Migrator, err error)
func (*Migrator) AppendMigration ¶
func (*Migrator) GetCurrentVersion ¶
func (*Migrator) LoadMigrations ¶
type MigratorFS ¶
type MigratorOptions ¶
type MigratorOptions struct {
// DisableTx causes the Migrator not to run migrations in a transaction.
DisableTx bool
// MigratorFS is the interface used for collecting the migrations.
MigratorFS MigratorFS
}
type NoMigrationsFoundError ¶
type NoMigrationsFoundError struct {
Path string
}
func (NoMigrationsFoundError) Error ¶
func (e NoMigrationsFoundError) Error() string
Click to show internal directories.
Click to hide internal directories.