github.com/Unity-Technologies/migrate@v3.5.4+incompatible/source/go_bindata/examples/migrations/bindata.go (about)

     1  // Code generated by go-bindata.
     2  // sources:
     3  // 1085649617_create_users_table.down.sql
     4  // 1085649617_create_users_table.up.sql
     5  // 1185749658_add_city_to_users.down.sql
     6  // 1185749658_add_city_to_users.up.sql
     7  // DO NOT EDIT!
     8  
     9  package testdata
    10  
    11  import (
    12  	"bytes"
    13  	"compress/gzip"
    14  	"fmt"
    15  	"io"
    16  	"io/ioutil"
    17  	"os"
    18  	"path/filepath"
    19  	"strings"
    20  	"time"
    21  )
    22  
    23  func bindataRead(data []byte, name string) ([]byte, error) {
    24  	gz, err := gzip.NewReader(bytes.NewBuffer(data))
    25  	if err != nil {
    26  		return nil, fmt.Errorf("Read %q: %v", name, err)
    27  	}
    28  
    29  	var buf bytes.Buffer
    30  	_, err = io.Copy(&buf, gz)
    31  	clErr := gz.Close()
    32  
    33  	if err != nil {
    34  		return nil, fmt.Errorf("Read %q: %v", name, err)
    35  	}
    36  	if clErr != nil {
    37  		return nil, err
    38  	}
    39  
    40  	return buf.Bytes(), nil
    41  }
    42  
    43  type asset struct {
    44  	bytes []byte
    45  	info  os.FileInfo
    46  }
    47  
    48  type bindataFileInfo struct {
    49  	name    string
    50  	size    int64
    51  	mode    os.FileMode
    52  	modTime time.Time
    53  }
    54  
    55  func (fi bindataFileInfo) Name() string {
    56  	return fi.name
    57  }
    58  func (fi bindataFileInfo) Size() int64 {
    59  	return fi.size
    60  }
    61  func (fi bindataFileInfo) Mode() os.FileMode {
    62  	return fi.mode
    63  }
    64  func (fi bindataFileInfo) ModTime() time.Time {
    65  	return fi.modTime
    66  }
    67  func (fi bindataFileInfo) IsDir() bool {
    68  	return false
    69  }
    70  func (fi bindataFileInfo) Sys() interface{} {
    71  	return nil
    72  }
    73  
    74  var __1085649617_create_users_tableDownSql = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x72\x09\xf2\x0f\x50\x08\x71\x74\xf2\x71\x55\xf0\x74\x53\x70\x8d\xf0\x0c\x0e\x09\x56\x28\x2d\x4e\x2d\x2a\xb6\xe6\x02\x04\x00\x00\xff\xff\x2c\x02\x3d\xa7\x1c\x00\x00\x00")
    75  
    76  func _1085649617_create_users_tableDownSqlBytes() ([]byte, error) {
    77  	return bindataRead(
    78  		__1085649617_create_users_tableDownSql,
    79  		"1085649617_create_users_table.down.sql",
    80  	)
    81  }
    82  
    83  func _1085649617_create_users_tableDownSql() (*asset, error) {
    84  	bytes, err := _1085649617_create_users_tableDownSqlBytes()
    85  	if err != nil {
    86  		return nil, err
    87  	}
    88  
    89  	info := bindataFileInfo{name: "1085649617_create_users_table.down.sql", size: 28, mode: os.FileMode(420), modTime: time.Unix(1485750305, 0)}
    90  	a := &asset{bytes: bytes, info: info}
    91  	return a, nil
    92  }
    93  
    94  var __1085649617_create_users_tableUpSql = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x72\x0e\x72\x75\x0c\x71\x55\x08\x71\x74\xf2\x71\x55\x28\x2d\x4e\x2d\x2a\x56\xd0\xe0\x52\x00\xb3\xe2\x33\x53\x14\x32\xf3\x4a\x52\xd3\x53\x8b\x14\x4a\xf3\x32\x0b\x4b\x53\x75\xb8\x14\x14\xf2\x12\x73\x53\x15\x14\x14\x14\xca\x12\x8b\x92\x33\x12\x8b\x34\x4c\x0c\x34\x41\xc2\xa9\xb9\x89\x99\x39\xa8\xc2\x5c\x9a\xd6\x5c\x80\x00\x00\x00\xff\xff\xa3\x57\xbc\x0b\x5f\x00\x00\x00")
    95  
    96  func _1085649617_create_users_tableUpSqlBytes() ([]byte, error) {
    97  	return bindataRead(
    98  		__1085649617_create_users_tableUpSql,
    99  		"1085649617_create_users_table.up.sql",
   100  	)
   101  }
   102  
   103  func _1085649617_create_users_tableUpSql() (*asset, error) {
   104  	bytes, err := _1085649617_create_users_tableUpSqlBytes()
   105  	if err != nil {
   106  		return nil, err
   107  	}
   108  
   109  	info := bindataFileInfo{name: "1085649617_create_users_table.up.sql", size: 95, mode: os.FileMode(420), modTime: time.Unix(1485803085, 0)}
   110  	a := &asset{bytes: bytes, info: info}
   111  	return a, nil
   112  }
   113  
   114  var __1185749658_add_city_to_usersDownSql = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x72\xf4\x09\x71\x0d\x52\x08\x71\x74\xf2\x71\x55\x28\x2d\x4e\x2d\x2a\x56\x70\x09\xf2\x0f\x50\x70\xf6\xf7\x09\xf5\xf5\x53\xf0\x74\x53\x70\x8d\xf0\x0c\x0e\x09\x56\x48\xce\x2c\xa9\xb4\xe6\x02\x04\x00\x00\xff\xff\xb7\x52\x88\xd7\x2e\x00\x00\x00")
   115  
   116  func _1185749658_add_city_to_usersDownSqlBytes() ([]byte, error) {
   117  	return bindataRead(
   118  		__1185749658_add_city_to_usersDownSql,
   119  		"1185749658_add_city_to_users.down.sql",
   120  	)
   121  }
   122  
   123  func _1185749658_add_city_to_usersDownSql() (*asset, error) {
   124  	bytes, err := _1185749658_add_city_to_usersDownSqlBytes()
   125  	if err != nil {
   126  		return nil, err
   127  	}
   128  
   129  	info := bindataFileInfo{name: "1185749658_add_city_to_users.down.sql", size: 46, mode: os.FileMode(420), modTime: time.Unix(1485750443, 0)}
   130  	a := &asset{bytes: bytes, info: info}
   131  	return a, nil
   132  }
   133  
   134  var __1185749658_add_city_to_usersUpSql = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x72\xf4\x09\x71\x0d\x52\x08\x71\x74\xf2\x71\x55\x28\x2d\x4e\x2d\x2a\x56\x70\x74\x71\x51\x70\xf6\xf7\x09\xf5\xf5\x53\x48\xce\x2c\xa9\x54\x28\x4b\x2c\x4a\xce\x48\x2c\xd2\x30\x34\x30\xd0\xb4\xe6\xe2\xe2\x02\x04\x00\x00\xff\xff\xa8\x0f\x49\xc6\x32\x00\x00\x00")
   135  
   136  func _1185749658_add_city_to_usersUpSqlBytes() ([]byte, error) {
   137  	return bindataRead(
   138  		__1185749658_add_city_to_usersUpSql,
   139  		"1185749658_add_city_to_users.up.sql",
   140  	)
   141  }
   142  
   143  func _1185749658_add_city_to_usersUpSql() (*asset, error) {
   144  	bytes, err := _1185749658_add_city_to_usersUpSqlBytes()
   145  	if err != nil {
   146  		return nil, err
   147  	}
   148  
   149  	info := bindataFileInfo{name: "1185749658_add_city_to_users.up.sql", size: 50, mode: os.FileMode(420), modTime: time.Unix(1485843733, 0)}
   150  	a := &asset{bytes: bytes, info: info}
   151  	return a, nil
   152  }
   153  
   154  // Asset loads and returns the asset for the given name.
   155  // It returns an error if the asset could not be found or
   156  // could not be loaded.
   157  func Asset(name string) ([]byte, error) {
   158  	cannonicalName := strings.Replace(name, "\\", "/", -1)
   159  	if f, ok := _bindata[cannonicalName]; ok {
   160  		a, err := f()
   161  		if err != nil {
   162  			return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err)
   163  		}
   164  		return a.bytes, nil
   165  	}
   166  	return nil, fmt.Errorf("Asset %s not found", name)
   167  }
   168  
   169  // MustAsset is like Asset but panics when Asset would return an error.
   170  // It simplifies safe initialization of global variables.
   171  func MustAsset(name string) []byte {
   172  	a, err := Asset(name)
   173  	if err != nil {
   174  		panic("asset: Asset(" + name + "): " + err.Error())
   175  	}
   176  
   177  	return a
   178  }
   179  
   180  // AssetInfo loads and returns the asset info for the given name.
   181  // It returns an error if the asset could not be found or
   182  // could not be loaded.
   183  func AssetInfo(name string) (os.FileInfo, error) {
   184  	cannonicalName := strings.Replace(name, "\\", "/", -1)
   185  	if f, ok := _bindata[cannonicalName]; ok {
   186  		a, err := f()
   187  		if err != nil {
   188  			return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err)
   189  		}
   190  		return a.info, nil
   191  	}
   192  	return nil, fmt.Errorf("AssetInfo %s not found", name)
   193  }
   194  
   195  // AssetNames returns the names of the assets.
   196  func AssetNames() []string {
   197  	names := make([]string, 0, len(_bindata))
   198  	for name := range _bindata {
   199  		names = append(names, name)
   200  	}
   201  	return names
   202  }
   203  
   204  // _bindata is a table, holding each asset generator, mapped to its name.
   205  var _bindata = map[string]func() (*asset, error){
   206  	"1085649617_create_users_table.down.sql": _1085649617_create_users_tableDownSql,
   207  	"1085649617_create_users_table.up.sql": _1085649617_create_users_tableUpSql,
   208  	"1185749658_add_city_to_users.down.sql": _1185749658_add_city_to_usersDownSql,
   209  	"1185749658_add_city_to_users.up.sql": _1185749658_add_city_to_usersUpSql,
   210  }
   211  
   212  // AssetDir returns the file names below a certain
   213  // directory embedded in the file by go-bindata.
   214  // For example if you run go-bindata on data/... and data contains the
   215  // following hierarchy:
   216  //     data/
   217  //       foo.txt
   218  //       img/
   219  //         a.png
   220  //         b.png
   221  // then AssetDir("data") would return []string{"foo.txt", "img"}
   222  // AssetDir("data/img") would return []string{"a.png", "b.png"}
   223  // AssetDir("foo.txt") and AssetDir("notexist") would return an error
   224  // AssetDir("") will return []string{"data"}.
   225  func AssetDir(name string) ([]string, error) {
   226  	node := _bintree
   227  	if len(name) != 0 {
   228  		cannonicalName := strings.Replace(name, "\\", "/", -1)
   229  		pathList := strings.Split(cannonicalName, "/")
   230  		for _, p := range pathList {
   231  			node = node.Children[p]
   232  			if node == nil {
   233  				return nil, fmt.Errorf("Asset %s not found", name)
   234  			}
   235  		}
   236  	}
   237  	if node.Func != nil {
   238  		return nil, fmt.Errorf("Asset %s not found", name)
   239  	}
   240  	rv := make([]string, 0, len(node.Children))
   241  	for childName := range node.Children {
   242  		rv = append(rv, childName)
   243  	}
   244  	return rv, nil
   245  }
   246  
   247  type bintree struct {
   248  	Func     func() (*asset, error)
   249  	Children map[string]*bintree
   250  }
   251  var _bintree = &bintree{nil, map[string]*bintree{
   252  	"1085649617_create_users_table.down.sql": &bintree{_1085649617_create_users_tableDownSql, map[string]*bintree{}},
   253  	"1085649617_create_users_table.up.sql": &bintree{_1085649617_create_users_tableUpSql, map[string]*bintree{}},
   254  	"1185749658_add_city_to_users.down.sql": &bintree{_1185749658_add_city_to_usersDownSql, map[string]*bintree{}},
   255  	"1185749658_add_city_to_users.up.sql": &bintree{_1185749658_add_city_to_usersUpSql, map[string]*bintree{}},
   256  }}
   257  
   258  // RestoreAsset restores an asset under the given directory
   259  func RestoreAsset(dir, name string) error {
   260  	data, err := Asset(name)
   261  	if err != nil {
   262  		return err
   263  	}
   264  	info, err := AssetInfo(name)
   265  	if err != nil {
   266  		return err
   267  	}
   268  	err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755))
   269  	if err != nil {
   270  		return err
   271  	}
   272  	err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode())
   273  	if err != nil {
   274  		return err
   275  	}
   276  	err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime())
   277  	if err != nil {
   278  		return err
   279  	}
   280  	return nil
   281  }
   282  
   283  // RestoreAssets restores an asset under the given directory recursively
   284  func RestoreAssets(dir, name string) error {
   285  	children, err := AssetDir(name)
   286  	// File
   287  	if err != nil {
   288  		return RestoreAsset(dir, name)
   289  	}
   290  	// Dir
   291  	for _, child := range children {
   292  		err = RestoreAssets(dir, filepath.Join(name, child))
   293  		if err != nil {
   294  			return err
   295  		}
   296  	}
   297  	return nil
   298  }
   299  
   300  func _filePath(dir, name string) string {
   301  	cannonicalName := strings.Replace(name, "\\", "/", -1)
   302  	return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...)
   303  }
   304