migrate/source/go-bindata
Parker McGee a7e1cacd36 Fix a typo
I was browsing this and noticed the typo that is causing syntax highlighting to be off.
2017-05-04 07:44:37 -04:00
..
examples/migrations initial version 3.0.0 preview 2017-02-07 22:01:29 -08:00
testdata initial version 3.0.0 preview 2017-02-07 22:01:29 -08:00
README.md Fix a typo 2017-05-04 07:44:37 -04:00
go-bindata.go update go-bindata with latest source.Migration helper 2017-02-07 22:59:12 -08:00
go-bindata_test.go update go-bindata with latest source.Migration helper 2017-02-07 22:59:12 -08:00

README.md

go-bindata

Usage

Read bindata with NewWithSourceInstance

go get -u github.com/jteeuwen/go-bindata/...
cd examples/migrations && go-bindata -pkg migrations .
import (
  "github.com/mattes/migrate"
  "github.com/mattes/migrate/source/go-bindata"
  "github.com/mattes/migrate/source/go-bindata/examples/migrations"
)

func main() {
  // wrap assets into Resource
  s := bindata.Resource(migrations.AssetNames(),
    func(name string) ([]byte, error) {
      return migrations.Asset(name)
    })

  m, err := migrate.NewWithSourceInstance("go-bindata", s, "database://foobar")
  m.Up() // run your migrations and handle the errors above of course
}

Read bindata with URL (todo)

This will restore the assets in a tmp directory and then proxy to source/file. go-bindata must be in your $PATH.

migrate -source go-bindata://examples/migrations/bindata.go