Update README.md

This commit is contained in:
Matthias Kadenbach 2017-04-21 13:29:13 -07:00 committed by GitHub
parent 365b0565de
commit 4a2a810c20
1 changed files with 14 additions and 16 deletions

View File

@ -1,25 +1,17 @@
# go-bindata # go-bindata
## Usage ## Usage
```
### Read bindata with NewWithSourceInstance
```shell
go get -u github.com/jteeuwen/go-bindata/... go get -u github.com/jteeuwen/go-bindata/...
cd examples/migrations && go-bindata -pkg migrations . cd examples/migrations && go-bindata -pkg migrations .
``` ```
```go
```
// 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
```
```
import ( import (
"github.com/mattes/migrate" "github.com/mattes/migrate"
"github.com/mattes/migrate/source/go-bindata" "github.com/mattes/migrate/source/go-bindata"
@ -27,7 +19,7 @@ import (
) )
func main() { func main() {
// wrap assets into Resource // wrap assets into Resource
s := bindata.Resource(migrations.AssetNames(), s := bindata.Resource(migrations.AssetNames(),
func(name string) ([]byte, error) { func(name string) ([]byte, error) {
return migrations.Asset(name) return migrations.Asset(name)
@ -38,7 +30,13 @@ func main() {
} }
``` ```
### 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
```