Help us shape the future of Go! Take the 2026 Go Developer Survey

gomig

package module
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2019 License: MIT Imports: 2 Imported by: 0

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() (uint, error)
	SaveVersion(ver uint, messages []string) error
	Reset() error
}

BackendAdapter TODO: Add documentation

type Migration

type Migration interface {
	Up() (messages []string, err error)
	Down() (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) Auto

func (r *Runner) Auto() error

Auto runs the migrations from the current version up to the latest

func (*Runner) ForceVer

func (r *Runner) ForceVer(ver uint) error

ForceVer calls Reset then runs migrations up to the ver number

func (*Runner) Reset

func (r *Runner) Reset() error

Reset runs all migrations down to the clean state and calls to Reset of storage

func (*Runner) SetVer

func (r *Runner) SetVer(ver uint) error

SetVer runs migrations up or down to the ver number

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL