288 строки
10 KiB
Go
288 строки
10 KiB
Go
// Code generated by go-bindata.
|
|
// sources:
|
|
// sqlite3/1.sql
|
|
// mysql/1.sql
|
|
// postgres/1.sql
|
|
// DO NOT EDIT!
|
|
|
|
package migration
|
|
|
|
import (
|
|
"bytes"
|
|
"compress/gzip"
|
|
"fmt"
|
|
"io"
|
|
"io/ioutil"
|
|
"os"
|
|
"path/filepath"
|
|
"strings"
|
|
"time"
|
|
)
|
|
|
|
func bindataRead(data []byte, name string) ([]byte, error) {
|
|
gz, err := gzip.NewReader(bytes.NewBuffer(data))
|
|
if err != nil {
|
|
return nil, fmt.Errorf("Read %q: %v", name, err)
|
|
}
|
|
|
|
var buf bytes.Buffer
|
|
_, err = io.Copy(&buf, gz)
|
|
clErr := gz.Close()
|
|
|
|
if err != nil {
|
|
return nil, fmt.Errorf("Read %q: %v", name, err)
|
|
}
|
|
if clErr != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return buf.Bytes(), nil
|
|
}
|
|
|
|
type asset struct {
|
|
bytes []byte
|
|
info os.FileInfo
|
|
}
|
|
|
|
type bindataFileInfo struct {
|
|
name string
|
|
size int64
|
|
mode os.FileMode
|
|
modTime time.Time
|
|
}
|
|
|
|
func (fi bindataFileInfo) Name() string {
|
|
return fi.name
|
|
}
|
|
func (fi bindataFileInfo) Size() int64 {
|
|
return fi.size
|
|
}
|
|
func (fi bindataFileInfo) Mode() os.FileMode {
|
|
return fi.mode
|
|
}
|
|
func (fi bindataFileInfo) ModTime() time.Time {
|
|
return fi.modTime
|
|
}
|
|
func (fi bindataFileInfo) IsDir() bool {
|
|
return false
|
|
}
|
|
func (fi bindataFileInfo) Sys() interface{} {
|
|
return nil
|
|
}
|
|
|
|
var _sqlite31SQL = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x8c\x92\x4d\x6e\xc2\x30\x10\x46\xf7\x3e\xc5\x2c\x41\x85\x13\xb0\x32\xcd\xb4\xb2\x0a\x36\x35\x8e\x14\x56\xc8\x6a\xad\xc8\x22\x7f\x72\x02\xed\xf1\x9b\x58\x4e\x20\x5e\x54\x64\x65\x3d\x79\xbe\xcc\x1b\xcf\x7a\x0d\x2f\xa5\xcd\x9d\xee\x0c\xa4\x0d\x21\xaf\x12\xa9\x42\x50\x74\xbb\x43\x60\x6f\xc0\x85\x02\xcc\xd8\x51\x1d\xe1\xda\x1a\xd7\xc2\x82\xf8\xc3\xd9\x7e\x83\xff\x18\x57\xf8\x8e\x12\x0e\x92\xed\xa9\x3c\xc1\x07\x9e\x80\xa6\x4a\x30\xde\x47\xed\x91\x2b\xb2\xf2\xf7\x8b\x3a\xb7\x55\x7f\x5f\x61\x36\xa2\xae\xbe\x98\x08\x99\x52\xdb\x62\x8e\xf4\x4d\x77\xda\xcd\x50\x6b\xbe\x9c\xe9\x02\x22\xab\x94\xb3\xcf\x14\x17\xf7\xdf\x2c\xc9\x72\xf3\xaf\x8a\x33\x4d\xed\x55\x86\xc3\xa4\xf2\x8c\x8b\x2f\x98\x06\x10\x0a\x02\xae\x7f\x2a\xe3\x60\xea\xde\xb3\x4a\x97\x06\x22\xd6\x16\xd7\x3c\x66\x85\xad\x2e\x31\x6b\x9c\xbd\x0d\xef\x02\x5b\x21\x76\x48\xf9\x58\x1e\xec\x23\xfd\x29\x7a\x66\xcf\x78\x82\x59\x64\x6f\x7f\xcf\xb3\x7e\x05\x1f\x07\x72\xc7\x7d\xc4\x13\x09\xe3\x20\xa2\x84\x80\x87\x36\x1e\xf7\x2b\xe9\x93\x09\x49\xa4\x38\x84\x47\xf1\x35\x9b\x47\xe2\x77\x6c\x43\xfe\x02\x00\x00\xff\xff\x54\x85\x0e\xca\x96\x02\x00\x00")
|
|
|
|
func sqlite31SQLBytes() ([]byte, error) {
|
|
return bindataRead(
|
|
_sqlite31SQL,
|
|
"sqlite3/1.sql",
|
|
)
|
|
}
|
|
|
|
func sqlite31SQL() (*asset, error) {
|
|
bytes, err := sqlite31SQLBytes()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
info := bindataFileInfo{name: "sqlite3/1.sql", size: 662, mode: os.FileMode(420), modTime: time.Unix(1478811055, 0)}
|
|
a := &asset{bytes: bytes, info: info}
|
|
return a, nil
|
|
}
|
|
|
|
var _mysql1SQL = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x8c\x92\x4f\x6f\xc2\x20\x18\xc6\xef\x7c\x8a\xf7\xa8\x99\x26\x9b\x99\x27\x4f\xa8\x6c\x23\x53\x70\x48\x17\x3d\x19\xb2\x91\x86\xd8\x7f\xa1\xd5\xed\xe3\xaf\x25\xb4\xb5\xce\x2e\xeb\x89\xbc\xbf\xfc\xa0\xcf\x03\xe3\x31\xdc\xc5\x26\xb4\xaa\xd0\x10\x64\x08\x2d\x04\xc1\x92\x80\xc4\xf3\x15\x01\xfa\x04\x8c\x4b\x20\x3b\xba\x95\x5b\x38\xe5\xda\xe6\x30\x40\x6e\x71\x30\x9f\xe0\x3e\xca\x24\x79\x26\x02\x36\x82\xae\xb1\xd8\xc3\x2b\xd9\x03\x0e\x24\x3f\x50\x56\xee\xb5\x26\x4c\xa2\x91\x13\xa2\x34\x34\x49\x29\xbc\x63\xb1\x78\xc1\x62\x30\x99\x4e\x87\x1e\x15\xe9\x51\xf7\x20\x1d\x2b\x13\xdd\x46\xea\xac\x0a\x65\x5b\xf4\x70\x3f\x79\xac\x59\xae\x3f\xac\x2e\xae\x34\x34\x0a\x18\x7d\x0b\xc8\xa0\xfd\x9f\x21\x1a\xce\xfe\x0c\x6d\x75\x96\xba\xd0\xd5\xa2\x09\xfd\xaf\xd4\xce\x68\xba\xf2\x86\x1f\xa7\x5f\x89\xb6\xf0\x2b\x97\x63\x89\x8a\x35\xf4\xb0\x3c\x3a\x85\x7d\x2c\x32\xc9\xb1\xc3\x7c\x21\x0e\x66\xd6\x9c\xab\x3b\x86\x39\xe7\x2b\x82\x59\xbd\x9f\xef\xa9\xa7\xa8\xe6\xcc\x4e\x4f\x94\x2d\xc9\x0e\xcc\xf7\xa1\x13\x85\xb3\xba\xac\x76\x5c\x4a\x37\x9d\xba\x95\x2b\xc7\x8f\xab\xa3\x2e\xdf\xe5\xb2\xdc\x0b\xa1\xa5\xe0\x1b\x7f\x45\xce\x99\x5d\x4e\xdc\xdb\x9c\xa1\x9f\x00\x00\x00\xff\xff\xbb\xdd\xcc\xcc\xce\x02\x00\x00")
|
|
|
|
func mysql1SQLBytes() ([]byte, error) {
|
|
return bindataRead(
|
|
_mysql1SQL,
|
|
"mysql/1.sql",
|
|
)
|
|
}
|
|
|
|
func mysql1SQL() (*asset, error) {
|
|
bytes, err := mysql1SQLBytes()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
info := bindataFileInfo{name: "mysql/1.sql", size: 718, mode: os.FileMode(420), modTime: time.Unix(1478811055, 0)}
|
|
a := &asset{bytes: bytes, info: info}
|
|
return a, nil
|
|
}
|
|
|
|
var _postgres1SQL = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x7c\x92\xcf\x4f\x83\x30\x1c\xc5\xef\xfd\x2b\xbe\xc7\x2d\x6e\x89\x2e\xee\xc4\xa9\x1b\x55\x1b\xb1\xcc\x02\x66\x3b\x2d\x8d\x36\xa4\x19\xbf\x52\xd8\xf4\xcf\x17\x9a\x02\x63\x82\x9c\x9a\xf7\xf9\xbe\x96\xf7\xda\xe5\x12\xee\x52\x15\x6b\x51\x49\x88\x0a\x84\xb6\x9c\xe0\x90\x40\x88\x37\x1e\x01\xfa\x04\xcc\x0f\x81\xec\x69\x10\x06\x70\x2e\xa5\x2e\x61\x86\xcc\xe2\xa8\xbe\xc0\x7c\x01\xe1\x14\x7b\xb0\xe3\xf4\x0d\xf3\x03\xbc\x92\x03\x5a\x98\x81\x24\x8f\x55\x56\x0f\x7c\x60\xbe\x7d\xc1\x7c\xb6\x5a\xaf\xe7\x16\x55\xf9\x49\x4e\x20\x99\x0a\x95\x8c\x23\x71\x11\x95\xd0\x3d\x7a\xb8\x5f\x3d\xb6\xac\x94\x9f\x5a\x56\x37\x36\xb4\x88\x18\x7d\x8f\xc8\xac\xff\x9f\x39\x9a\x3b\xff\x86\xd4\xb2\xc8\x4d\xc8\x66\xd1\x85\x1c\x4d\x69\x26\xba\x2e\x28\x0b\xc9\x33\xe1\x56\xce\xbf\x33\xa9\xe1\x4f\x0e\xc3\x32\x91\x4a\x98\x60\x65\x72\x8e\xa7\x58\xa2\xb2\xd3\x80\xd9\x02\x0c\x2c\xb4\xba\x34\x77\x08\x1b\xdf\xf7\x08\x66\xed\x7e\xb6\x97\x89\x62\xba\x33\x07\xbd\x50\xe6\x92\x3d\xa8\x9f\xe3\x20\x8a\xcf\xda\x72\x7a\xb9\x36\x8d\x7a\xda\x56\x6e\x3c\x56\x6e\x8e\xba\x7e\x77\x6e\xbd\x17\x42\x2e\xf7\x77\xf6\x4a\x8c\xc7\xb9\x56\xcc\xdb\x73\xd0\x6f\x00\x00\x00\xff\xff\x05\x71\xe8\xdb\xae\x02\x00\x00")
|
|
|
|
func postgres1SQLBytes() ([]byte, error) {
|
|
return bindataRead(
|
|
_postgres1SQL,
|
|
"postgres/1.sql",
|
|
)
|
|
}
|
|
|
|
func postgres1SQL() (*asset, error) {
|
|
bytes, err := postgres1SQLBytes()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
info := bindataFileInfo{name: "postgres/1.sql", size: 686, mode: os.FileMode(420), modTime: time.Unix(1479127493, 0)}
|
|
a := &asset{bytes: bytes, info: info}
|
|
return a, nil
|
|
}
|
|
|
|
// Asset loads and returns the asset for the given name.
|
|
// It returns an error if the asset could not be found or
|
|
// could not be loaded.
|
|
func Asset(name string) ([]byte, error) {
|
|
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
|
if f, ok := _bindata[cannonicalName]; ok {
|
|
a, err := f()
|
|
if err != nil {
|
|
return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err)
|
|
}
|
|
return a.bytes, nil
|
|
}
|
|
return nil, fmt.Errorf("Asset %s not found", name)
|
|
}
|
|
|
|
// MustAsset is like Asset but panics when Asset would return an error.
|
|
// It simplifies safe initialization of global variables.
|
|
func MustAsset(name string) []byte {
|
|
a, err := Asset(name)
|
|
if err != nil {
|
|
panic("asset: Asset(" + name + "): " + err.Error())
|
|
}
|
|
|
|
return a
|
|
}
|
|
|
|
// AssetInfo loads and returns the asset info for the given name.
|
|
// It returns an error if the asset could not be found or
|
|
// could not be loaded.
|
|
func AssetInfo(name string) (os.FileInfo, error) {
|
|
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
|
if f, ok := _bindata[cannonicalName]; ok {
|
|
a, err := f()
|
|
if err != nil {
|
|
return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err)
|
|
}
|
|
return a.info, nil
|
|
}
|
|
return nil, fmt.Errorf("AssetInfo %s not found", name)
|
|
}
|
|
|
|
// AssetNames returns the names of the assets.
|
|
func AssetNames() []string {
|
|
names := make([]string, 0, len(_bindata))
|
|
for name := range _bindata {
|
|
names = append(names, name)
|
|
}
|
|
return names
|
|
}
|
|
|
|
// _bindata is a table, holding each asset generator, mapped to its name.
|
|
var _bindata = map[string]func() (*asset, error){
|
|
"sqlite3/1.sql": sqlite31SQL,
|
|
"mysql/1.sql": mysql1SQL,
|
|
"postgres/1.sql": postgres1SQL,
|
|
}
|
|
|
|
// AssetDir returns the file names below a certain
|
|
// directory embedded in the file by go-bindata.
|
|
// For example if you run go-bindata on data/... and data contains the
|
|
// following hierarchy:
|
|
// data/
|
|
// foo.txt
|
|
// img/
|
|
// a.png
|
|
// b.png
|
|
// then AssetDir("data") would return []string{"foo.txt", "img"}
|
|
// AssetDir("data/img") would return []string{"a.png", "b.png"}
|
|
// AssetDir("foo.txt") and AssetDir("notexist") would return an error
|
|
// AssetDir("") will return []string{"data"}.
|
|
func AssetDir(name string) ([]string, error) {
|
|
node := _bintree
|
|
if len(name) != 0 {
|
|
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
|
pathList := strings.Split(cannonicalName, "/")
|
|
for _, p := range pathList {
|
|
node = node.Children[p]
|
|
if node == nil {
|
|
return nil, fmt.Errorf("Asset %s not found", name)
|
|
}
|
|
}
|
|
}
|
|
if node.Func != nil {
|
|
return nil, fmt.Errorf("Asset %s not found", name)
|
|
}
|
|
rv := make([]string, 0, len(node.Children))
|
|
for childName := range node.Children {
|
|
rv = append(rv, childName)
|
|
}
|
|
return rv, nil
|
|
}
|
|
|
|
type bintree struct {
|
|
Func func() (*asset, error)
|
|
Children map[string]*bintree
|
|
}
|
|
|
|
var _bintree = &bintree{nil, map[string]*bintree{
|
|
"mysql": &bintree{nil, map[string]*bintree{
|
|
"1.sql": &bintree{mysql1SQL, map[string]*bintree{}},
|
|
}},
|
|
"postgres": &bintree{nil, map[string]*bintree{
|
|
"1.sql": &bintree{postgres1SQL, map[string]*bintree{}},
|
|
}},
|
|
"sqlite3": &bintree{nil, map[string]*bintree{
|
|
"1.sql": &bintree{sqlite31SQL, map[string]*bintree{}},
|
|
}},
|
|
}}
|
|
|
|
// RestoreAsset restores an asset under the given directory
|
|
func RestoreAsset(dir, name string) error {
|
|
data, err := Asset(name)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
info, err := AssetInfo(name)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755))
|
|
if err != nil {
|
|
return err
|
|
}
|
|
err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode())
|
|
if err != nil {
|
|
return err
|
|
}
|
|
err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime())
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// RestoreAssets restores an asset under the given directory recursively
|
|
func RestoreAssets(dir, name string) error {
|
|
children, err := AssetDir(name)
|
|
// File
|
|
if err != nil {
|
|
return RestoreAsset(dir, name)
|
|
}
|
|
// Dir
|
|
for _, child := range children {
|
|
err = RestoreAssets(dir, filepath.Join(name, child))
|
|
if err != nil {
|
|
return err
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func _filePath(dir, name string) string {
|
|
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
|
return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...)
|
|
}
|