Documentation
¶
Overview ¶
Package gomig TODO: add documentation
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNoBackend returned by runners if no BackendAdapter set ErrNoBackend = errors.New("NO_BACKEND") // ErrNoMigrations returns by NewRunner if no migrations provided ErrNoMigrations = errors.New("NO_MIGRATIONS") // ErrMigrationFailed returned by runners if migration was failed ErrMigrationFailed = errors.New("MIGRATION_FAILED") )
Functions ¶
This section is empty.
Types ¶
type BackendAdapter ¶
type BackendAdapter interface {
GetVersion(ctx context.Context) (uint, error)
SaveVersion(ctx context.Context, ver uint, name string, messages []string) error
Reset(ctx context.Context) error
}
BackendAdapter TODO: Add documentation
type Migration ¶
type Migration interface {
Up(ctx context.Context) (messages []string, err error)
Down(ctx context.Context) (messages []string, err error)
Name() string
}
Migration TODO: Add documentation
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
Runner the runner of migrations
func NewRunner ¶
func NewRunner(migs []Migration, storage BackendAdapter) *Runner
NewRunner creates the runner
func (*Runner) Reset ¶
Reset runs all migrations down to the clean state and calls to Reset of storage
Click to show internal directories.
Click to hide internal directories.