github.com/SigNoz/golang-migrate/v4@v4.0.0-20231005133642-7493dbaf5f5b/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  	"os"
    17  	"path/filepath"
    18  	"strings"
    19  	"time"
    20  )
    21  
    22  func bindataRead(data []byte, name string) ([]byte, error) {
    23  	gz, err := gzip.NewReader(bytes.NewBuffer(data))
    24  	if err != nil {
    25  		return nil, fmt.Errorf("Read %q: %v", name, err)
    26  	}
    27  
    28  	var buf bytes.Buffer
    29  	_, err = io.Copy(&buf, gz)
    30  	clErr := gz.Close()
    31  
    32  	if err != nil {
    33  		return nil, fmt.Errorf("Read %q: %v", name, err)
    34  	}
    35  	if clErr != nil {
    36  		return nil, err
    37  	}
    38  
    39  	return buf.Bytes(), nil
    40  }
    41  
    42  type asset struct {
    43  	bytes []byte
    44  	info  os.FileInfo
    45  }
    46  
    47  type bindataFileInfo struct {
    48  	name    string
    49  	size    int64
    50  	mode    os.FileMode
    51  	modTime time.Time
    52  }
    53  
    54  func (fi bindataFileInfo) Name() string {
    55  	return fi.name
    56  }
    57  func (fi bindataFileInfo) Size() int64 {
    58  	return fi.size
    59  }
    60  func (fi bindataFileInfo) Mode() os.FileMode {
    61  	return fi.mode
    62  }
    63  func (fi bindataFileInfo) ModTime() time.Time {
    64  	return fi.modTime
    65  }
    66  func (fi bindataFileInfo) IsDir() bool {
    67  	return false
    68  }
    69  func (fi bindataFileInfo) Sys() interface{} {
    70  	return nil
    71  }
    72  
    73  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")
    74  
    75  func _1085649617_create_users_tableDownSqlBytes() ([]byte, error) {
    76  	return bindataRead(
    77  		__1085649617_create_users_tableDownSql,
    78  		"1085649617_create_users_table.down.sql",
    79  	)
    80  }
    81  
    82  func _1085649617_create_users_tableDownSql() (*asset, error) {
    83  	bytes, err := _1085649617_create_users_tableDownSqlBytes()
    84  	if err != nil {
    85  		return nil, err
    86  	}
    87  
    88  	info := bindataFileInfo{name: "1085649617_create_users_table.down.sql", size: 28, mode: os.FileMode(420), modTime: time.Unix(1485750305, 0)}
    89  	a := &asset{bytes: bytes, info: info}
    90  	return a, nil
    91  }
    92  
    93  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")
    94  
    95  func _1085649617_create_users_tableUpSqlBytes() ([]byte, error) {
    96  	return bindataRead(
    97  		__1085649617_create_users_tableUpSql,
    98  		"1085649617_create_users_table.up.sql",
    99  	)
   100  }
   101  
   102  func _1085649617_create_users_tableUpSql() (*asset, error) {
   103  	bytes, err := _1085649617_create_users_tableUpSqlBytes()
   104  	if err != nil {
   105  		return nil, err
   106  	}
   107  
   108  	info := bindataFileInfo{name: "1085649617_create_users_table.up.sql", size: 95, mode: os.FileMode(420), modTime: time.Unix(1485803085, 0)}
   109  	a := &asset{bytes: bytes, info: info}
   110  	return a, nil
   111  }
   112  
   113  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")
   114  
   115  func _1185749658_add_city_to_usersDownSqlBytes() ([]byte, error) {
   116  	return bindataRead(
   117  		__1185749658_add_city_to_usersDownSql,
   118  		"1185749658_add_city_to_users.down.sql",
   119  	)
   120  }
   121  
   122  func _1185749658_add_city_to_usersDownSql() (*asset, error) {
   123  	bytes, err := _1185749658_add_city_to_usersDownSqlBytes()
   124  	if err != nil {
   125  		return nil, err
   126  	}
   127  
   128  	info := bindataFileInfo{name: "1185749658_add_city_to_users.down.sql", size: 46, mode: os.FileMode(420), modTime: time.Unix(1485750443, 0)}
   129  	a := &asset{bytes: bytes, info: info}
   130  	return a, nil
   131  }
   132  
   133  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")
   134  
   135  func _1185749658_add_city_to_usersUpSqlBytes() ([]byte, error) {
   136  	return bindataRead(
   137  		__1185749658_add_city_to_usersUpSql,
   138  		"1185749658_add_city_to_users.up.sql",
   139  	)
   140  }
   141  
   142  func _1185749658_add_city_to_usersUpSql() (*asset, error) {
   143  	bytes, err := _1185749658_add_city_to_usersUpSqlBytes()
   144  	if err != nil {
   145  		return nil, err
   146  	}
   147  
   148  	info := bindataFileInfo{name: "1185749658_add_city_to_users.up.sql", size: 50, mode: os.FileMode(420), modTime: time.Unix(1485843733, 0)}
   149  	a := &asset{bytes: bytes, info: info}
   150  	return a, nil
   151  }
   152  
   153  // Asset loads and returns the asset for the given name.
   154  // It returns an error if the asset could not be found or
   155  // could not be loaded.
   156  func Asset(name string) ([]byte, error) {
   157  	cannonicalName := strings.Replace(name, "\\", "/", -1)
   158  	if f, ok := _bindata[cannonicalName]; ok {
   159  		a, err := f()
   160  		if err != nil {
   161  			return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err)
   162  		}
   163  		return a.bytes, nil
   164  	}
   165  	return nil, fmt.Errorf("Asset %s not found", name)
   166  }
   167  
   168  // MustAsset is like Asset but panics when Asset would return an error.
   169  // It simplifies safe initialization of global variables.
   170  func MustAsset(name string) []byte {
   171  	a, err := Asset(name)
   172  	if err != nil {
   173  		panic("asset: Asset(" + name + "): " + err.Error())
   174  	}
   175  
   176  	return a
   177  }
   178  
   179  // AssetInfo loads and returns the asset info for the given name.
   180  // It returns an error if the asset could not be found or
   181  // could not be loaded.
   182  func AssetInfo(name string) (os.FileInfo, error) {
   183  	cannonicalName := strings.Replace(name, "\\", "/", -1)
   184  	if f, ok := _bindata[cannonicalName]; ok {
   185  		a, err := f()
   186  		if err != nil {
   187  			return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err)
   188  		}
   189  		return a.info, nil
   190  	}
   191  	return nil, fmt.Errorf("AssetInfo %s not found", name)
   192  }
   193  
   194  // AssetNames returns the names of the assets.
   195  func AssetNames() []string {
   196  	names := make([]string, 0, len(_bindata))
   197  	for name := range _bindata {
   198  		names = append(names, name)
   199  	}
   200  	return names
   201  }
   202  
   203  // _bindata is a table, holding each asset generator, mapped to its name.
   204  var _bindata = map[string]func() (*asset, error){
   205  	"1085649617_create_users_table.down.sql": _1085649617_create_users_tableDownSql,
   206  	"1085649617_create_users_table.up.sql":   _1085649617_create_users_tableUpSql,
   207  	"1185749658_add_city_to_users.down.sql":  _1185749658_add_city_to_usersDownSql,
   208  	"1185749658_add_city_to_users.up.sql":    _1185749658_add_city_to_usersUpSql,
   209  }
   210  
   211  // AssetDir returns the file names below a certain
   212  // directory embedded in the file by go-bindata.
   213  // For example if you run go-bindata on data/... and data contains the
   214  // following hierarchy:
   215  //     data/
   216  //       foo.txt
   217  //       img/
   218  //         a.png
   219  //         b.png
   220  // then AssetDir("data") would return []string{"foo.txt", "img"}
   221  // AssetDir("data/img") would return []string{"a.png", "b.png"}
   222  // AssetDir("foo.txt") and AssetDir("notexist") would return an error
   223  // AssetDir("") will return []string{"data"}.
   224  func AssetDir(name string) ([]string, error) {
   225  	node := _bintree
   226  	if len(name) != 0 {
   227  		cannonicalName := strings.Replace(name, "\\", "/", -1)
   228  		pathList := strings.Split(cannonicalName, "/")
   229  		for _, p := range pathList {
   230  			node = node.Children[p]
   231  			if node == nil {
   232  				return nil, fmt.Errorf("Asset %s not found", name)
   233  			}
   234  		}
   235  	}
   236  	if node.Func != nil {
   237  		return nil, fmt.Errorf("Asset %s not found", name)
   238  	}
   239  	rv := make([]string, 0, len(node.Children))
   240  	for childName := range node.Children {
   241  		rv = append(rv, childName)
   242  	}
   243  	return rv, nil
   244  }
   245  
   246  type bintree struct {
   247  	Func     func() (*asset, error)
   248  	Children map[string]*bintree
   249  }
   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 = os.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  }