Versions in this module Expand all Collapse all v1 v1.0.0 Jan 13, 2022 Changes in this version + const NoMigrationVersion + var ErrDatabaseDirty = fmt.Errorf("database contains unsuccessful migration") + var ErrNoChange = fmt.Errorf("no change") + var ErrParse = fmt.Errorf("no match") + var ErrVersionNotAllowed = fmt.Errorf("version 0 is not allowed") + var Regex = regexp.MustCompile(`^([0-9]+)_(.*)\.(` + string(Down) + `|` + string(Up) + `)\.(.*)$`) + type Direction string + const Down + const Up + type DriverError struct + Line uint + Msg string + OrigErr error + Query []byte + func (e DriverError) Error() string + func (e DriverError) Unwrap() error + type ErrDuplicateMigration struct + func (e ErrDuplicateMigration) Error() string + type Logger interface + Printf func(format string, v ...interface{}) + type MigrationDriver interface + GetVersion func() (version uint64, dirty bool, err error) + Lock func() error + Reset func() error + RunMigration func(migration io.Reader) error + SetVersion func(version uint64, dirty bool) error + Unlock func() error + type MigrationSource interface + First func() (version uint64, err error) + Next func(version uint64) (nextVersion uint64, err error) + Prev func(version uint64) (prevVersion uint64, err error) + ReadDown func(version uint64) (r io.ReadCloser, identifier string, err error) + ReadUp func(version uint64) (r io.ReadCloser, identifier string, err error) + func NewFsSource(fsys fs.FS, basePath string) (MigrationSource, error) + type Migrator interface + Migrate func(version uint64) error + func NewMigrator(source MigrationSource, driver MigrationDriver, opts ...MigratorOption) (Migrator, error) + type MigratorOption func(svc *migrator) + func WithLogger(logger Logger) MigratorOption + func WithVerboseLogging(verbose bool) MigratorOption