github.com/anovateam/migrate@v3.5.4+incompatible/source/go_bindata/testdata/bindata.go (about)

     1  // Code generated by go-bindata.
     2  // sources:
     3  // 1_test.down.sql
     4  // 1_test.up.sql
     5  // 3_test.up.sql
     6  // 4_test.down.sql
     7  // 4_test.up.sql
     8  // 5_test.down.sql
     9  // 7_test.down.sql
    10  // 7_test.up.sql
    11  // DO NOT EDIT!
    12  
    13  package testdata
    14  
    15  import (
    16  	"bytes"
    17  	"compress/gzip"
    18  	"fmt"
    19  	"io"
    20  	"io/ioutil"
    21  	"os"
    22  	"path/filepath"
    23  	"strings"
    24  	"time"
    25  )
    26  
    27  func bindataRead(data []byte, name string) ([]byte, error) {
    28  	gz, err := gzip.NewReader(bytes.NewBuffer(data))
    29  	if err != nil {
    30  		return nil, fmt.Errorf("Read %q: %v", name, err)
    31  	}
    32  
    33  	var buf bytes.Buffer
    34  	_, err = io.Copy(&buf, gz)
    35  	clErr := gz.Close()
    36  
    37  	if err != nil {
    38  		return nil, fmt.Errorf("Read %q: %v", name, err)
    39  	}
    40  	if clErr != nil {
    41  		return nil, err
    42  	}
    43  
    44  	return buf.Bytes(), nil
    45  }
    46  
    47  type asset struct {
    48  	bytes []byte
    49  	info  os.FileInfo
    50  }
    51  
    52  type bindataFileInfo struct {
    53  	name    string
    54  	size    int64
    55  	mode    os.FileMode
    56  	modTime time.Time
    57  }
    58  
    59  func (fi bindataFileInfo) Name() string {
    60  	return fi.name
    61  }
    62  func (fi bindataFileInfo) Size() int64 {
    63  	return fi.size
    64  }
    65  func (fi bindataFileInfo) Mode() os.FileMode {
    66  	return fi.mode
    67  }
    68  func (fi bindataFileInfo) ModTime() time.Time {
    69  	return fi.modTime
    70  }
    71  func (fi bindataFileInfo) IsDir() bool {
    72  	return false
    73  }
    74  func (fi bindataFileInfo) Sys() interface{} {
    75  	return nil
    76  }
    77  
    78  var __1_testDownSql = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x01\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00")
    79  
    80  func _1_testDownSqlBytes() ([]byte, error) {
    81  	return bindataRead(
    82  		__1_testDownSql,
    83  		"1_test.down.sql",
    84  	)
    85  }
    86  
    87  func _1_testDownSql() (*asset, error) {
    88  	bytes, err := _1_testDownSqlBytes()
    89  	if err != nil {
    90  		return nil, err
    91  	}
    92  
    93  	info := bindataFileInfo{name: "1_test.down.sql", size: 0, mode: os.FileMode(420), modTime: time.Unix(1486440324, 0)}
    94  	a := &asset{bytes: bytes, info: info}
    95  	return a, nil
    96  }
    97  
    98  var __1_testUpSql = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x01\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00")
    99  
   100  func _1_testUpSqlBytes() ([]byte, error) {
   101  	return bindataRead(
   102  		__1_testUpSql,
   103  		"1_test.up.sql",
   104  	)
   105  }
   106  
   107  func _1_testUpSql() (*asset, error) {
   108  	bytes, err := _1_testUpSqlBytes()
   109  	if err != nil {
   110  		return nil, err
   111  	}
   112  
   113  	info := bindataFileInfo{name: "1_test.up.sql", size: 0, mode: os.FileMode(420), modTime: time.Unix(1486440319, 0)}
   114  	a := &asset{bytes: bytes, info: info}
   115  	return a, nil
   116  }
   117  
   118  var __3_testUpSql = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x01\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00")
   119  
   120  func _3_testUpSqlBytes() ([]byte, error) {
   121  	return bindataRead(
   122  		__3_testUpSql,
   123  		"3_test.up.sql",
   124  	)
   125  }
   126  
   127  func _3_testUpSql() (*asset, error) {
   128  	bytes, err := _3_testUpSqlBytes()
   129  	if err != nil {
   130  		return nil, err
   131  	}
   132  
   133  	info := bindataFileInfo{name: "3_test.up.sql", size: 0, mode: os.FileMode(420), modTime: time.Unix(1486440331, 0)}
   134  	a := &asset{bytes: bytes, info: info}
   135  	return a, nil
   136  }
   137  
   138  var __4_testDownSql = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x01\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00")
   139  
   140  func _4_testDownSqlBytes() ([]byte, error) {
   141  	return bindataRead(
   142  		__4_testDownSql,
   143  		"4_test.down.sql",
   144  	)
   145  }
   146  
   147  func _4_testDownSql() (*asset, error) {
   148  	bytes, err := _4_testDownSqlBytes()
   149  	if err != nil {
   150  		return nil, err
   151  	}
   152  
   153  	info := bindataFileInfo{name: "4_test.down.sql", size: 0, mode: os.FileMode(420), modTime: time.Unix(1486440337, 0)}
   154  	a := &asset{bytes: bytes, info: info}
   155  	return a, nil
   156  }
   157  
   158  var __4_testUpSql = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x01\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00")
   159  
   160  func _4_testUpSqlBytes() ([]byte, error) {
   161  	return bindataRead(
   162  		__4_testUpSql,
   163  		"4_test.up.sql",
   164  	)
   165  }
   166  
   167  func _4_testUpSql() (*asset, error) {
   168  	bytes, err := _4_testUpSqlBytes()
   169  	if err != nil {
   170  		return nil, err
   171  	}
   172  
   173  	info := bindataFileInfo{name: "4_test.up.sql", size: 0, mode: os.FileMode(420), modTime: time.Unix(1486440335, 0)}
   174  	a := &asset{bytes: bytes, info: info}
   175  	return a, nil
   176  }
   177  
   178  var __5_testDownSql = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x01\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00")
   179  
   180  func _5_testDownSqlBytes() ([]byte, error) {
   181  	return bindataRead(
   182  		__5_testDownSql,
   183  		"5_test.down.sql",
   184  	)
   185  }
   186  
   187  func _5_testDownSql() (*asset, error) {
   188  	bytes, err := _5_testDownSqlBytes()
   189  	if err != nil {
   190  		return nil, err
   191  	}
   192  
   193  	info := bindataFileInfo{name: "5_test.down.sql", size: 0, mode: os.FileMode(420), modTime: time.Unix(1486440340, 0)}
   194  	a := &asset{bytes: bytes, info: info}
   195  	return a, nil
   196  }
   197  
   198  var __7_testDownSql = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x01\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00")
   199  
   200  func _7_testDownSqlBytes() ([]byte, error) {
   201  	return bindataRead(
   202  		__7_testDownSql,
   203  		"7_test.down.sql",
   204  	)
   205  }
   206  
   207  func _7_testDownSql() (*asset, error) {
   208  	bytes, err := _7_testDownSqlBytes()
   209  	if err != nil {
   210  		return nil, err
   211  	}
   212  
   213  	info := bindataFileInfo{name: "7_test.down.sql", size: 0, mode: os.FileMode(420), modTime: time.Unix(1486440343, 0)}
   214  	a := &asset{bytes: bytes, info: info}
   215  	return a, nil
   216  }
   217  
   218  var __7_testUpSql = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x01\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00")
   219  
   220  func _7_testUpSqlBytes() ([]byte, error) {
   221  	return bindataRead(
   222  		__7_testUpSql,
   223  		"7_test.up.sql",
   224  	)
   225  }
   226  
   227  func _7_testUpSql() (*asset, error) {
   228  	bytes, err := _7_testUpSqlBytes()
   229  	if err != nil {
   230  		return nil, err
   231  	}
   232  
   233  	info := bindataFileInfo{name: "7_test.up.sql", size: 0, mode: os.FileMode(420), modTime: time.Unix(1486440347, 0)}
   234  	a := &asset{bytes: bytes, info: info}
   235  	return a, nil
   236  }
   237  
   238  // Asset loads and returns the asset for the given name.
   239  // It returns an error if the asset could not be found or
   240  // could not be loaded.
   241  func Asset(name string) ([]byte, error) {
   242  	cannonicalName := strings.Replace(name, "\\", "/", -1)
   243  	if f, ok := _bindata[cannonicalName]; ok {
   244  		a, err := f()
   245  		if err != nil {
   246  			return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err)
   247  		}
   248  		return a.bytes, nil
   249  	}
   250  	return nil, fmt.Errorf("Asset %s not found", name)
   251  }
   252  
   253  // MustAsset is like Asset but panics when Asset would return an error.
   254  // It simplifies safe initialization of global variables.
   255  func MustAsset(name string) []byte {
   256  	a, err := Asset(name)
   257  	if err != nil {
   258  		panic("asset: Asset(" + name + "): " + err.Error())
   259  	}
   260  
   261  	return a
   262  }
   263  
   264  // AssetInfo loads and returns the asset info for the given name.
   265  // It returns an error if the asset could not be found or
   266  // could not be loaded.
   267  func AssetInfo(name string) (os.FileInfo, error) {
   268  	cannonicalName := strings.Replace(name, "\\", "/", -1)
   269  	if f, ok := _bindata[cannonicalName]; ok {
   270  		a, err := f()
   271  		if err != nil {
   272  			return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err)
   273  		}
   274  		return a.info, nil
   275  	}
   276  	return nil, fmt.Errorf("AssetInfo %s not found", name)
   277  }
   278  
   279  // AssetNames returns the names of the assets.
   280  func AssetNames() []string {
   281  	names := make([]string, 0, len(_bindata))
   282  	for name := range _bindata {
   283  		names = append(names, name)
   284  	}
   285  	return names
   286  }
   287  
   288  // _bindata is a table, holding each asset generator, mapped to its name.
   289  var _bindata = map[string]func() (*asset, error){
   290  	"1_test.down.sql": _1_testDownSql,
   291  	"1_test.up.sql": _1_testUpSql,
   292  	"3_test.up.sql": _3_testUpSql,
   293  	"4_test.down.sql": _4_testDownSql,
   294  	"4_test.up.sql": _4_testUpSql,
   295  	"5_test.down.sql": _5_testDownSql,
   296  	"7_test.down.sql": _7_testDownSql,
   297  	"7_test.up.sql": _7_testUpSql,
   298  }
   299  
   300  // AssetDir returns the file names below a certain
   301  // directory embedded in the file by go-bindata.
   302  // For example if you run go-bindata on data/... and data contains the
   303  // following hierarchy:
   304  //     data/
   305  //       foo.txt
   306  //       img/
   307  //         a.png
   308  //         b.png
   309  // then AssetDir("data") would return []string{"foo.txt", "img"}
   310  // AssetDir("data/img") would return []string{"a.png", "b.png"}
   311  // AssetDir("foo.txt") and AssetDir("notexist") would return an error
   312  // AssetDir("") will return []string{"data"}.
   313  func AssetDir(name string) ([]string, error) {
   314  	node := _bintree
   315  	if len(name) != 0 {
   316  		cannonicalName := strings.Replace(name, "\\", "/", -1)
   317  		pathList := strings.Split(cannonicalName, "/")
   318  		for _, p := range pathList {
   319  			node = node.Children[p]
   320  			if node == nil {
   321  				return nil, fmt.Errorf("Asset %s not found", name)
   322  			}
   323  		}
   324  	}
   325  	if node.Func != nil {
   326  		return nil, fmt.Errorf("Asset %s not found", name)
   327  	}
   328  	rv := make([]string, 0, len(node.Children))
   329  	for childName := range node.Children {
   330  		rv = append(rv, childName)
   331  	}
   332  	return rv, nil
   333  }
   334  
   335  type bintree struct {
   336  	Func     func() (*asset, error)
   337  	Children map[string]*bintree
   338  }
   339  var _bintree = &bintree{nil, map[string]*bintree{
   340  	"1_test.down.sql": &bintree{_1_testDownSql, map[string]*bintree{}},
   341  	"1_test.up.sql": &bintree{_1_testUpSql, map[string]*bintree{}},
   342  	"3_test.up.sql": &bintree{_3_testUpSql, map[string]*bintree{}},
   343  	"4_test.down.sql": &bintree{_4_testDownSql, map[string]*bintree{}},
   344  	"4_test.up.sql": &bintree{_4_testUpSql, map[string]*bintree{}},
   345  	"5_test.down.sql": &bintree{_5_testDownSql, map[string]*bintree{}},
   346  	"7_test.down.sql": &bintree{_7_testDownSql, map[string]*bintree{}},
   347  	"7_test.up.sql": &bintree{_7_testUpSql, map[string]*bintree{}},
   348  }}
   349  
   350  // RestoreAsset restores an asset under the given directory
   351  func RestoreAsset(dir, name string) error {
   352  	data, err := Asset(name)
   353  	if err != nil {
   354  		return err
   355  	}
   356  	info, err := AssetInfo(name)
   357  	if err != nil {
   358  		return err
   359  	}
   360  	err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755))
   361  	if err != nil {
   362  		return err
   363  	}
   364  	err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode())
   365  	if err != nil {
   366  		return err
   367  	}
   368  	err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime())
   369  	if err != nil {
   370  		return err
   371  	}
   372  	return nil
   373  }
   374  
   375  // RestoreAssets restores an asset under the given directory recursively
   376  func RestoreAssets(dir, name string) error {
   377  	children, err := AssetDir(name)
   378  	// File
   379  	if err != nil {
   380  		return RestoreAsset(dir, name)
   381  	}
   382  	// Dir
   383  	for _, child := range children {
   384  		err = RestoreAssets(dir, filepath.Join(name, child))
   385  		if err != nil {
   386  			return err
   387  		}
   388  	}
   389  	return nil
   390  }
   391  
   392  func _filePath(dir, name string) string {
   393  	cannonicalName := strings.Replace(name, "\\", "/", -1)
   394  	return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...)
   395  }
   396