1package migrate 2 3import ( 4 "bytes" 5 "compress/gzip" 6 "fmt" 7 "io" 8 "strings" 9) 10 11func bindata_read(data []byte, name string) ([]byte, error) { 12 gz, err := gzip.NewReader(bytes.NewBuffer(data)) 13 if err != nil { 14 return nil, fmt.Errorf("Read %q: %v", name, err) 15 } 16 17 var buf bytes.Buffer 18 _, err = io.Copy(&buf, gz) 19 if err := gz.Close(); err != nil { 20 return nil, err 21 } 22 23 if err != nil { 24 return nil, fmt.Errorf("Read %q: %v", name, err) 25 } 26 27 return buf.Bytes(), nil 28} 29 30func test_migrations_1_initial_sql() ([]byte, error) { 31 return bindata_read([]byte{ 32 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x00, 0xff, 0x8c, 0xcd, 33 0x3d, 0x0e, 0x82, 0x40, 0x10, 0x05, 0xe0, 0x7e, 0x4e, 0xf1, 0x3a, 0x34, 34 0x86, 0x13, 0x50, 0xa1, 0xd0, 0x91, 0xa8, 0x08, 0x07, 0x40, 0x76, 0x22, 35 0x13, 0xd7, 0xdd, 0x09, 0xac, 0xc1, 0xe3, 0xbb, 0xc4, 0x68, 0xb4, 0xb3, 36 0x7c, 0x6f, 0x7e, 0xbe, 0x34, 0xc5, 0xe6, 0x26, 0x97, 0xb1, 0x0b, 0x8c, 37 0x56, 0x29, 0xc6, 0xd3, 0xb1, 0x82, 0x38, 0x4c, 0xdc, 0x07, 0xf1, 0x0e, 38 0x49, 0xab, 0x09, 0x64, 0x02, 0x3f, 0xb8, 0xbf, 0x07, 0x36, 0x98, 0x07, 39 0x76, 0x08, 0x43, 0xac, 0x5e, 0x77, 0xcb, 0x52, 0x0c, 0x9d, 0xaa, 0x15, 40 0x36, 0xb4, 0xab, 0xcb, 0xbc, 0x29, 0xd1, 0xe4, 0xdb, 0xaa, 0x84, 0xb2, 41 0x57, 0xcb, 0x58, 0x89, 0x89, 0x2f, 0xc3, 0x3a, 0x23, 0xa2, 0x6f, 0xb0, 42 0xf0, 0xb3, 0x7b, 0x93, 0x1f, 0x6f, 0x29, 0xff, 0x12, 0x47, 0x6f, 0x6d, 43 0x9c, 0x9e, 0xbb, 0xfe, 0x4a, 0x45, 0xbd, 0x3f, 0xfc, 0x98, 0x19, 0x3d, 44 0x03, 0x00, 0x00, 0xff, 0xff, 0x0d, 0x70, 0x5e, 0xf9, 0xda, 0x00, 0x00, 45 0x00, 46 }, 47 "test-migrations/1_initial.sql", 48 ) 49} 50 51func test_migrations_2_record_sql() ([]byte, error) { 52 return bindata_read([]byte{ 53 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x00, 0xff, 0xd2, 0xd5, 54 0x55, 0xd0, 0xce, 0xcd, 0x4c, 0x2f, 0x4a, 0x2c, 0x49, 0x55, 0x08, 0x2d, 55 0xe0, 0xf2, 0xf4, 0x0b, 0x76, 0x0d, 0x0a, 0x51, 0xf0, 0xf4, 0x0b, 0xf1, 56 0x57, 0x28, 0x48, 0xcd, 0x2f, 0xc8, 0x49, 0x55, 0xd0, 0xc8, 0x4c, 0xd1, 57 0x54, 0x08, 0x73, 0xf4, 0x09, 0x75, 0x0d, 0x56, 0xd0, 0x30, 0xd4, 0xb4, 58 0xe6, 0xe2, 0x42, 0xd6, 0xe3, 0x92, 0x5f, 0x9e, 0xc7, 0xe5, 0xe2, 0xea, 59 0xe3, 0x1a, 0xe2, 0xaa, 0xe0, 0x16, 0xe4, 0xef, 0x0b, 0xd3, 0x15, 0xee, 60 0xe1, 0x1a, 0xe4, 0xaa, 0x90, 0x99, 0x62, 0x6b, 0x68, 0xcd, 0x05, 0x08, 61 0x00, 0x00, 0xff, 0xff, 0xf4, 0x3a, 0x7b, 0xae, 0x64, 0x00, 0x00, 0x00, 62 }, 63 "test-migrations/2_record.sql", 64 ) 65} 66 67// Asset loads and returns the asset for the given name. 68// It returns an error if the asset could not be found or 69// could not be loaded. 70func Asset(name string) ([]byte, error) { 71 canonicalName := strings.Replace(name, "\\", "/", -1) 72 if f, ok := _bindata[canonicalName]; ok { 73 return f() 74 } 75 return nil, fmt.Errorf("Asset %s not found", name) 76} 77 78// AssetNames returns the names of the assets. 79func AssetNames() []string { 80 names := make([]string, 0, len(_bindata)) 81 for name := range _bindata { 82 names = append(names, name) 83 } 84 return names 85} 86 87// _bindata is a table, holding each asset generator, mapped to its name. 88var _bindata = map[string]func() ([]byte, error){ 89 "test-migrations/1_initial.sql": test_migrations_1_initial_sql, 90 "test-migrations/2_record.sql": test_migrations_2_record_sql, 91} 92// AssetDir returns the file names below a certain 93// directory embedded in the file by go-bindata. 94// For example if you run go-bindata on data/... and data contains the 95// following hierarchy: 96// data/ 97// foo.txt 98// img/ 99// a.png 100// b.png 101// then AssetDir("data") would return []string{"foo.txt", "img"} 102// AssetDir("data/img") would return []string{"a.png", "b.png"} 103// AssetDir("foo.txt") and AssetDir("notexist") would return an error 104// AssetDir("") will return []string{"data"}. 105func AssetDir(name string) ([]string, error) { 106 node := _bintree 107 if len(name) != 0 { 108 canonicalName := strings.Replace(name, "\\", "/", -1) 109 pathList := strings.Split(canonicalName, "/") 110 for _, p := range pathList { 111 node = node.Children[p] 112 if node == nil { 113 return nil, fmt.Errorf("Asset %s not found", name) 114 } 115 } 116 } 117 if node.Func != nil { 118 return nil, fmt.Errorf("Asset %s not found", name) 119 } 120 rv := make([]string, 0, len(node.Children)) 121 for name := range node.Children { 122 rv = append(rv, name) 123 } 124 return rv, nil 125} 126 127type _bintree_t struct { 128 Func func() ([]byte, error) 129 Children map[string]*_bintree_t 130} 131var _bintree = &_bintree_t{nil, map[string]*_bintree_t{ 132 "test-migrations": &_bintree_t{nil, map[string]*_bintree_t{ 133 "1_initial.sql": &_bintree_t{test_migrations_1_initial_sql, map[string]*_bintree_t{ 134 }}, 135 "2_record.sql": &_bintree_t{test_migrations_2_record_sql, map[string]*_bintree_t{ 136 }}, 137 }}, 138}} 139