README
¶
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/golang-migrate/migrate"
"github.com/golang-migrate/migrate/source/go_bindata"
"github.com/golang-migrate/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)
})
d, err := bindata.WithInstance(s)
m, err := migrate.NewWithSourceInstance("go-bindata", d, "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
Documentation
¶
Index ¶
- Variables
- func WithInstance(instance interface{}) (source.Driver, error)
- type AssetFunc
- type AssetSource
- type Bindata
- func (b *Bindata) Close() error
- func (b *Bindata) First() (version uint, err error)
- func (b *Bindata) Next(version uint) (nextVersion uint, err error)
- func (b *Bindata) Open(url string) (source.Driver, error)
- func (b *Bindata) Prev(version uint) (prevVersion uint, err error)
- func (b *Bindata) ReadDown(version uint) (r io.ReadCloser, identifier string, err error)
- func (b *Bindata) ReadUp(version uint) (r io.ReadCloser, identifier string, err error)
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrNoAssetSource = fmt.Errorf("expects *AssetSource")
)
Functions ¶
func WithInstance ¶
Types ¶
type AssetSource ¶
func Resource ¶
func Resource(names []string, afn AssetFunc) *AssetSource
Click to show internal directories.
Click to hide internal directories.