Documentation ¶
Index ¶
- Variables
- func FindMigrationsEx(path string, fs MigratorFS) ([]string, error)
- type BadVersionError
- type IrreversibleMigrationError
- type Migration
- type Migrator
- func (m *Migrator) AppendMigration(name, upSQL, downSQL string)
- func (m *Migrator) GetCurrentVersion() (v int32, err error)
- func (m *Migrator) LoadMigrations(path string) error
- func (m *Migrator) Migrate(onCommitFailed func(err error) (retry bool)) error
- func (m *Migrator) MigrateTo(targetVersion int32, onCommitFailed func(err error) (retry bool)) (err error)
- type MigratorFS
- type MigratorOptions
- type NoMigrationsFoundError
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoFwMigration = errors.Errorf("no sql in forward migration step")
Functions ¶
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 Migrator ¶
type Migrator struct { Migrations []*Migration OnStart func(int32, string, string, string) // OnStart is called when a migration is run with the sequence, name, direction, and SQL Data map[string]interface{} // Data available to use in migrations // contains filtered or unexported fields }
func NewMigrator ¶
func NewMigratorEx ¶
func NewMigratorEx(conn *pgx.Conn, versionTable string, opts *MigratorOptions) (m *Migrator, err error)
func (*Migrator) AppendMigration ¶
func (*Migrator) GetCurrentVersion ¶
func (*Migrator) LoadMigrations ¶
type MigratorFS ¶
type MigratorOptions ¶
type MigratorOptions struct { // 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.