source

package
v3.0.0-prev0+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2017 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultParse = Parse
View Source
var DefaultRegex = Regex
View Source
var ErrParse = fmt.Errorf("no match")
View Source
var Regex = regexp.MustCompile(`^([0-9]+)_(.*)\.(` + string(Down) + `|` + string(Up) + `)\.(.*)$`)

filename example: `123_name.up.ext` filename example: `123_name.down.ext`

Functions

func Register

func Register(name string, driver Driver)

Types

type Direction

type Direction string
const (
	Down Direction = "down"
	Up             = "up"
)

type Driver

type Driver interface {
	Open(url string) (Driver, error)

	Close() error

	First() (version uint, err error)

	Prev(version uint) (prevVersion uint, err error)

	Next(version uint) (nextVersion uint, err error)

	ReadUp(version uint) (r io.ReadCloser, identifier string, err error)

	ReadDown(version uint) (r io.ReadCloser, identifier string, err error)
}

func Open

func Open(url string) (Driver, error)

type Migration

type Migration struct {
	Version    uint
	Identifier string
	Direction  Direction
	Raw        string
}

func Parse

func Parse(raw string) (*Migration, error)

type Migrations

type Migrations struct {
	// contains filtered or unexported fields
}

func NewMigrations

func NewMigrations() *Migrations

func (*Migrations) Append

func (i *Migrations) Append(m *Migration) (ok bool)

func (*Migrations) Down

func (i *Migrations) Down(version uint) (m *Migration, ok bool)

func (*Migrations) First

func (i *Migrations) First() (version uint, ok bool)

func (*Migrations) Next

func (i *Migrations) Next(version uint) (nextVersion uint, ok bool)

func (*Migrations) Prev

func (i *Migrations) Prev(version uint) (prevVersion uint, ok bool)

func (*Migrations) Up

func (i *Migrations) Up(version uint) (m *Migration, ok bool)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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