github.com/astaxie/beego@v1.12.3/testdata/bindata.go (about) 1 // Code generated by go-bindata. 2 // sources: 3 // views/blocks/block.tpl 4 // views/header.tpl 5 // views/index.tpl 6 // DO NOT EDIT! 7 8 package testdata 9 10 import ( 11 "bytes" 12 "compress/gzip" 13 "fmt" 14 "io" 15 "io/ioutil" 16 "os" 17 "path/filepath" 18 "strings" 19 "time" 20 21 "github.com/elazarl/go-bindata-assetfs" 22 ) 23 24 func bindataRead(data []byte, name string) ([]byte, error) { 25 gz, err := gzip.NewReader(bytes.NewBuffer(data)) 26 if err != nil { 27 return nil, fmt.Errorf("Read %q: %v", name, err) 28 } 29 30 var buf bytes.Buffer 31 _, err = io.Copy(&buf, gz) 32 clErr := gz.Close() 33 34 if err != nil { 35 return nil, fmt.Errorf("Read %q: %v", name, err) 36 } 37 if clErr != nil { 38 return nil, err 39 } 40 41 return buf.Bytes(), nil 42 } 43 44 type asset struct { 45 bytes []byte 46 info os.FileInfo 47 } 48 49 type bindataFileInfo struct { 50 name string 51 size int64 52 mode os.FileMode 53 modTime time.Time 54 } 55 56 func (fi bindataFileInfo) Name() string { 57 return fi.name 58 } 59 func (fi bindataFileInfo) Size() int64 { 60 return fi.size 61 } 62 func (fi bindataFileInfo) Mode() os.FileMode { 63 return fi.mode 64 } 65 func (fi bindataFileInfo) ModTime() time.Time { 66 return fi.modTime 67 } 68 func (fi bindataFileInfo) IsDir() bool { 69 return false 70 } 71 func (fi bindataFileInfo) Sys() interface{} { 72 return nil 73 } 74 75 var _viewsBlocksBlockTpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xaa\xae\x4e\x49\x4d\xcb\xcc\x4b\x55\x50\x4a\xca\xc9\x4f\xce\x56\xaa\xad\xe5\xb2\xc9\x30\xb4\xf3\x48\xcd\xc9\xc9\xd7\x51\x00\x8b\x15\x2b\xda\xe8\x67\x18\xda\x71\x55\x57\xa7\xe6\xa5\xd4\xd6\x02\x02\x00\x00\xff\xff\xfd\xa1\x7a\xf6\x32\x00\x00\x00") 76 77 func viewsBlocksBlockTplBytes() ([]byte, error) { 78 return bindataRead( 79 _viewsBlocksBlockTpl, 80 "views/blocks/block.tpl", 81 ) 82 } 83 84 func viewsBlocksBlockTpl() (*asset, error) { 85 bytes, err := viewsBlocksBlockTplBytes() 86 if err != nil { 87 return nil, err 88 } 89 90 info := bindataFileInfo{name: "views/blocks/block.tpl", size: 50, mode: os.FileMode(436), modTime: time.Unix(1541431067, 0)} 91 a := &asset{bytes: bytes, info: info} 92 return a, nil 93 } 94 95 var _viewsHeaderTpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xaa\xae\x4e\x49\x4d\xcb\xcc\x4b\x55\x50\xca\x48\x4d\x4c\x49\x2d\x52\xaa\xad\xe5\xb2\xc9\x30\xb4\xf3\x48\xcd\xc9\xc9\xd7\x51\x48\x2c\x2e\x49\xac\xc8\x4c\x55\xb4\xd1\xcf\x30\xb4\xe3\xaa\xae\x4e\xcd\x4b\xa9\xad\x05\x04\x00\x00\xff\xff\xe4\x12\x47\x01\x34\x00\x00\x00") 96 97 func viewsHeaderTplBytes() ([]byte, error) { 98 return bindataRead( 99 _viewsHeaderTpl, 100 "views/header.tpl", 101 ) 102 } 103 104 func viewsHeaderTpl() (*asset, error) { 105 bytes, err := viewsHeaderTplBytes() 106 if err != nil { 107 return nil, err 108 } 109 110 info := bindataFileInfo{name: "views/header.tpl", size: 52, mode: os.FileMode(436), modTime: time.Unix(1541431067, 0)} 111 a := &asset{bytes: bytes, info: info} 112 return a, nil 113 } 114 115 var _viewsIndexTpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x64\x8f\xbd\x8a\xc3\x30\x10\x84\x6b\xeb\x29\xe6\xfc\x00\x16\xb8\x3c\x16\x35\x77\xa9\x13\x88\x09\xa4\xf4\xcf\x12\x99\x48\x48\xd8\x82\x10\x84\xde\x3d\xc8\x8a\x8b\x90\x6a\xa4\xd9\x6f\xd8\x59\xfa\xf9\x3f\xfe\x75\xd7\xd3\x01\x3a\x58\xa3\x04\x15\x01\x48\x73\x3f\xe5\x07\x40\x61\x0e\x86\xd5\xc0\x7c\x73\x78\xb0\x19\x9d\x65\x04\xb6\xde\xf4\x81\x49\x96\x69\x8e\xc8\x3d\x43\x83\x9b\x9e\x4a\x88\x2a\xc6\x9d\x43\x3d\x18\x37\xde\xeb\x94\x3e\xdd\x1c\xe1\xe5\xcb\xde\xe0\x55\x6e\xd2\x04\x6f\x32\x20\x2a\xd2\xad\x8a\x11\x4d\x97\x57\x22\x25\x92\xba\x55\xa2\x22\xaf\xd0\xe9\x79\xc5\xbc\xe2\xec\x2c\x5f\xfa\xe5\x17\x99\x7b\x7f\x36\xd2\x97\x8a\xa5\x19\xc9\x72\xe7\x2b\x00\x00\xff\xff\xb2\x39\xca\x9f\xff\x00\x00\x00") 116 117 func viewsIndexTplBytes() ([]byte, error) { 118 return bindataRead( 119 _viewsIndexTpl, 120 "views/index.tpl", 121 ) 122 } 123 124 func viewsIndexTpl() (*asset, error) { 125 bytes, err := viewsIndexTplBytes() 126 if err != nil { 127 return nil, err 128 } 129 130 info := bindataFileInfo{name: "views/index.tpl", size: 255, mode: os.FileMode(436), modTime: time.Unix(1541434906, 0)} 131 a := &asset{bytes: bytes, info: info} 132 return a, nil 133 } 134 135 // Asset loads and returns the asset for the given name. 136 // It returns an error if the asset could not be found or 137 // could not be loaded. 138 func Asset(name string) ([]byte, error) { 139 cannonicalName := strings.Replace(name, "\\", "/", -1) 140 if f, ok := _bindata[cannonicalName]; ok { 141 a, err := f() 142 if err != nil { 143 return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err) 144 } 145 return a.bytes, nil 146 } 147 return nil, fmt.Errorf("Asset %s not found", name) 148 } 149 150 // MustAsset is like Asset but panics when Asset would return an error. 151 // It simplifies safe initialization of global variables. 152 func MustAsset(name string) []byte { 153 a, err := Asset(name) 154 if err != nil { 155 panic("asset: Asset(" + name + "): " + err.Error()) 156 } 157 158 return a 159 } 160 161 // AssetInfo loads and returns the asset info for the given name. 162 // It returns an error if the asset could not be found or 163 // could not be loaded. 164 func AssetInfo(name string) (os.FileInfo, error) { 165 cannonicalName := strings.Replace(name, "\\", "/", -1) 166 if f, ok := _bindata[cannonicalName]; ok { 167 a, err := f() 168 if err != nil { 169 return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err) 170 } 171 return a.info, nil 172 } 173 return nil, fmt.Errorf("AssetInfo %s not found", name) 174 } 175 176 // AssetNames returns the names of the assets. 177 func AssetNames() []string { 178 names := make([]string, 0, len(_bindata)) 179 for name := range _bindata { 180 names = append(names, name) 181 } 182 return names 183 } 184 185 // _bindata is a table, holding each asset generator, mapped to its name. 186 var _bindata = map[string]func() (*asset, error){ 187 "views/blocks/block.tpl": viewsBlocksBlockTpl, 188 "views/header.tpl": viewsHeaderTpl, 189 "views/index.tpl": viewsIndexTpl, 190 } 191 192 // AssetDir returns the file names below a certain 193 // directory embedded in the file by go-bindata. 194 // For example if you run go-bindata on data/... and data contains the 195 // following hierarchy: 196 // data/ 197 // foo.txt 198 // img/ 199 // a.png 200 // b.png 201 // then AssetDir("data") would return []string{"foo.txt", "img"} 202 // AssetDir("data/img") would return []string{"a.png", "b.png"} 203 // AssetDir("foo.txt") and AssetDir("notexist") would return an error 204 // AssetDir("") will return []string{"data"}. 205 func AssetDir(name string) ([]string, error) { 206 node := _bintree 207 if len(name) != 0 { 208 cannonicalName := strings.Replace(name, "\\", "/", -1) 209 pathList := strings.Split(cannonicalName, "/") 210 for _, p := range pathList { 211 node = node.Children[p] 212 if node == nil { 213 return nil, fmt.Errorf("Asset %s not found", name) 214 } 215 } 216 } 217 if node.Func != nil { 218 return nil, fmt.Errorf("Asset %s not found", name) 219 } 220 rv := make([]string, 0, len(node.Children)) 221 for childName := range node.Children { 222 rv = append(rv, childName) 223 } 224 return rv, nil 225 } 226 227 type bintree struct { 228 Func func() (*asset, error) 229 Children map[string]*bintree 230 } 231 232 var _bintree = &bintree{nil, map[string]*bintree{ 233 "views": &bintree{nil, map[string]*bintree{ 234 "blocks": &bintree{nil, map[string]*bintree{ 235 "block.tpl": &bintree{viewsBlocksBlockTpl, map[string]*bintree{}}, 236 }}, 237 "header.tpl": &bintree{viewsHeaderTpl, map[string]*bintree{}}, 238 "index.tpl": &bintree{viewsIndexTpl, map[string]*bintree{}}, 239 }}, 240 }} 241 242 // RestoreAsset restores an asset under the given directory 243 func RestoreAsset(dir, name string) error { 244 data, err := Asset(name) 245 if err != nil { 246 return err 247 } 248 info, err := AssetInfo(name) 249 if err != nil { 250 return err 251 } 252 err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755)) 253 if err != nil { 254 return err 255 } 256 err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode()) 257 if err != nil { 258 return err 259 } 260 err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) 261 if err != nil { 262 return err 263 } 264 return nil 265 } 266 267 // RestoreAssets restores an asset under the given directory recursively 268 func RestoreAssets(dir, name string) error { 269 children, err := AssetDir(name) 270 // File 271 if err != nil { 272 return RestoreAsset(dir, name) 273 } 274 // Dir 275 for _, child := range children { 276 err = RestoreAssets(dir, filepath.Join(name, child)) 277 if err != nil { 278 return err 279 } 280 } 281 return nil 282 } 283 284 func _filePath(dir, name string) string { 285 cannonicalName := strings.Replace(name, "\\", "/", -1) 286 return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...) 287 } 288 289 func assetFS() *assetfs.AssetFS { 290 assetInfo := func(path string) (os.FileInfo, error) { 291 return os.Stat(path) 292 } 293 for k := range _bintree.Children { 294 return &assetfs.AssetFS{Asset: Asset, AssetDir: AssetDir, AssetInfo: assetInfo, Prefix: k} 295 } 296 panic("unreachable") 297 }