bindata

package
v3.0.0-rc1+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2017 License: MIT Imports: 6 Imported by: 0

README

go-bindata

Usage

go get -u github.com/jteeuwen/go-bindata/...
cd examples/migrations && go-bindata -pkg migrations .
// 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 (
  "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
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoAssetSource = fmt.Errorf("expects *AssetSource")
)

Functions

func WithInstance

func WithInstance(instance interface{}) (source.Driver, error)

Types

type AssetFunc

type AssetFunc func(name string) ([]byte, error)

type AssetSource

type AssetSource struct {
	Names     []string
	AssetFunc AssetFunc
}

func Resource

func Resource(names []string, afn AssetFunc) *AssetSource

type Bindata

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

func (*Bindata) Close

func (b *Bindata) Close() error

func (*Bindata) First

func (b *Bindata) First() (version uint, err error)

func (*Bindata) Next

func (b *Bindata) Next(version uint) (nextVersion uint, err error)

func (*Bindata) Open

func (b *Bindata) Open(url string) (source.Driver, error)

func (*Bindata) Prev

func (b *Bindata) Prev(version uint) (prevVersion uint, err error)

func (*Bindata) ReadDown

func (b *Bindata) ReadDown(version uint) (r io.ReadCloser, identifier string, err error)

func (*Bindata) ReadUp

func (b *Bindata) ReadUp(version uint) (r io.ReadCloser, identifier string, err error)

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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