Files
ent/entc/load/internal/bindata.go
Alex Snast 6cf5b918c3 ent/entc: keep struct tags sorted
Summary: keeping tags sorted will prevent codegen changes due to random map key ordering

Reviewed By: a8m

Differential Revision: D17571598

fbshipit-source-id: 12afc4aa0d030aa178e6568eb7c768ccc159f726
2019-09-25 06:48:01 -07:00

270 lines
15 KiB
Go

// Package internal Code generated by go-bindata. (@generated) DO NOT EDIT.
// sources:
// template/main.tmpl
// schema.go
package internal
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
}
// Name return file name
func (fi bindataFileInfo) Name() string {
return fi.name
}
// Size return file size
func (fi bindataFileInfo) Size() int64 {
return fi.size
}
// Mode return file mode
func (fi bindataFileInfo) Mode() os.FileMode {
return fi.mode
}
// ModTime return file modify time
func (fi bindataFileInfo) ModTime() time.Time {
return fi.modTime
}
// IsDir return file whether a directory
func (fi bindataFileInfo) IsDir() bool {
return fi.mode&os.ModeDir != 0
}
// Sys return file is sys mode
func (fi bindataFileInfo) Sys() interface{} {
return nil
}
var _templateMainTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x54\x51\x5d\x6b\xdb\x30\x14\x7d\xb6\x7e\xc5\x99\xe9\xa8\x5d\x52\xa5\xed\xdb\x06\x79\x28\x6d\x06\x19\x5b\x3b\x48\x61\x0f\x5d\x29\x8a\x7d\x9d\x88\x3a\x92\x77\xa5\x94\x05\xa1\xff\x3e\x24\x27\x61\x7b\xb2\xa5\x73\xee\xf9\xd0\x0d\x61\x7a\x21\xee\xec\xb0\x67\xbd\xde\x78\xdc\x5c\x5d\x7f\xba\x1c\x98\x1c\x19\x8f\x2f\xaa\xa1\x95\xb5\x6f\x58\x98\x46\xe2\xb6\xef\x91\x49\x0e\x09\xe7\x77\x6a\xa5\x78\xda\x68\x07\x67\x77\xdc\x10\x1a\xdb\x12\xb4\x43\xaf\x1b\x32\x8e\x5a\xec\x4c\x4b\x0c\xbf\x21\xdc\x0e\xaa\xd9\x10\x6e\xe4\xd5\x11\x45\x67\x77\xa6\x15\xda\x64\xfc\xdb\xe2\x6e\xfe\xb0\x9c\xa3\xd3\x3d\xe1\x70\xc7\xd6\x7a\xb4\x9a\xa9\xf1\x96\xf7\xb0\x1d\xfc\x3f\x66\x9e\x89\xa4\xb8\x98\xc6\x28\x44\x08\x68\xa9\xd3\x86\x50\x6e\x95\x36\x25\x62\x14\xd3\x29\xee\x52\x9e\x35\x19\x62\xe5\xa9\xc5\x6a\x8f\x73\x32\xbe\x39\x5d\x9d\x4b\xdc\x3f\xe2\xe1\xf1\x09\xf3\xfb\xc5\x93\x14\x83\x6a\xde\xd4\x9a\x90\x34\x84\xd0\xdb\xc1\xb2\x47\x25\x8a\xd2\xba\x52\x14\xe5\x6a\xef\x29\xfd\x84\x00\x4f\xdb\xa1\x57\x9e\x50\x8e\x2c\x97\x2d\x33\x34\xb0\x36\xbe\x43\xf9\xf1\x77\x09\xf9\xe3\xa0\x18\xa3\xa8\x73\xcc\xb3\x95\x72\x84\xcf\x33\xe4\xef\x11\x4f\xb3\xef\x8a\xe1\x9a\x0d\x6d\x95\xc3\x0c\xcf\x2f\x64\xbc\x5c\x18\x4f\xdc\xa9\x86\x42\x96\x66\x65\xd6\x84\xb3\xd7\x09\xce\x8c\xda\x66\x19\xf9\xa0\xb6\xe4\x92\x7e\x51\x84\x70\x79\xd0\x8f\x51\xa6\xc3\x29\x8a\x0b\xb1\x3c\xcc\xc4\x38\xc9\x5a\x64\x5a\x5c\xc6\x28\xa2\x10\xdd\xce\x34\xb9\x73\x55\x23\x88\x22\x05\xe9\xb5\x21\x87\xe7\x97\xe7\x97\x54\x5a\x14\x9d\x65\xbc\x4e\x0e\xf9\x92\xef\x18\xe5\x98\x37\x88\xa2\x58\x4d\x40\xcc\x09\xfb\xae\xd8\x6d\x54\xbf\xcc\x60\x35\x72\x6a\x51\x14\xba\xcb\x8c\x0f\x33\x18\xdd\xe7\x99\xa2\x53\xba\xaf\x88\x39\xc1\xa9\xc2\xe8\x3b\x83\x1a\x06\x32\x6d\x95\x8f\x13\xac\x6a\x91\x50\xeb\xe4\xd2\xb7\x76\xe7\xe5\x4f\xd6\x9e\xaa\xbc\x0f\xf9\xd5\x6a\x73\x24\x8e\x71\xab\xf2\x97\x29\xeb\xba\x3e\x75\x3b\xba\x24\x7b\xcb\xb9\xe4\xa8\x45\xcc\xa3\xd6\xd2\xb3\x36\xeb\xc4\x91\xf3\xc4\xa9\xea\x3a\x73\xe6\x7f\xb4\xaf\xae\xb3\xd2\x7f\x5b\x1f\x4b\x8d\x4b\x3f\x3c\x66\x8c\xe2\x6f\x00\x00\x00\xff\xff\xe4\x6e\x0c\x4d\x4b\x03\x00\x00")
func templateMainTmplBytes() ([]byte, error) {
return bindataRead(
_templateMainTmpl,
"template/main.tmpl",
)
}
func templateMainTmpl() (*asset, error) {
bytes, err := templateMainTmplBytes()
if err != nil {
return nil, err
}
info := bindataFileInfo{name: "template/main.tmpl", size: 843, mode: os.FileMode(420), modTime: time.Unix(1567360769, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _schemaGo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xb4\x57\x5f\x6f\x1b\x37\x12\x7f\xd6\x7e\x8a\xa9\x80\x04\x92\xe1\x5b\xe5\xfa\x76\x5b\xe8\xa1\x48\x5d\xc0\xd7\x3b\x27\xa8\x73\xf7\x62\x18\x2e\xb5\x3b\x94\x58\xef\x92\x1b\x92\x52\xa2\x06\xfe\xee\x87\x19\x92\xfb\x47\x7f\x8c\x5c\x5a\x07\x08\x2c\x0e\x67\x86\x9c\xdf\x6f\x66\x38\xbb\x58\xc0\x5b\xd3\xee\xad\x5a\x6f\x3c\x7c\xff\xe6\xef\xff\xf8\x5b\x6b\xd1\xa1\xf6\xf0\xb3\x28\x71\x65\xcc\x23\x5c\xeb\x32\x87\x1f\xeb\x1a\x58\xc9\x01\xed\xdb\x1d\x56\x79\xb6\x58\xc0\x87\x8d\x72\xe0\xcc\xd6\x96\x08\xa5\xa9\x10\x94\x83\x5a\x95\xa8\x1d\x56\xb0\xd5\x15\x5a\xf0\x1b\x84\x1f\x5b\x51\x6e\x10\xbe\xcf\xdf\xa4\x5d\x90\x66\xab\x2b\x72\xa1\x34\xab\xfc\xeb\xfa\xed\xd5\xcd\xed\x15\x48\x55\x63\x92\x59\x63\x3c\x54\xca\x62\xe9\x8d\xdd\x83\x91\xe0\x07\xe7\x79\x8b\x98\x67\x59\x2b\xca\x47\xb1\x46\xa8\x8d\xa8\xb2\x4c\x35\xad\xb1\x1e\x66\xd9\x64\x8a\xba\x34\x95\xd2\xeb\xc5\xef\xce\xe8\x69\x36\x99\xca\xc6\xd3\x1f\x8b\xb2\xc6\xd2\x4f\xb3\x6c\x32\x5d\x2b\xbf\xd9\xae\xf2\xd2\x34\x0b\x19\x03\x56\xba\xdc\xae\x84\x37\x76\x81\xda\x2f\x5c\xb9\xc1\x46\x2c\xb0\x5a\xe3\x57\x19\x4c\xff\x0f\xa7\x52\x61\x5d\x4d\xb3\x79\x46\x30\xdc\xb2\x0c\x2c\x46\x02\x1c\x08\x0d\xa8\x7d\x1e\x37\xfc\x46\x78\xf8\x24\x1c\xc7\x89\x15\x48\x6b\x1a\x10\x50\x9a\xa6\xad\x15\x81\xed\xd0\x42\xc4\x22\xcf\xfc\xbe\xc5\xe4\xd2\x79\xbb\x2d\x3d\x7c\xc9\x26\x37\xa2\x41\x48\xff\x9c\xb7\x4a\xaf\xbb\xe5\x6f\x84\x52\x31\xd5\xa2\xc1\x4b\xd3\x28\x8f\x4d\xeb\xf7\xd3\xdf\xb2\xc9\x5b\xa3\xa5\x4a\x7a\x74\xa1\x81\x20\x1a\x95\x2c\x19\x9b\x5d\x55\x6b\x74\xc9\xf9\xdd\xfd\x05\xad\x0f\xce\x22\x50\xdd\xd8\xea\x67\x82\xc4\xf5\x56\xbc\x1e\x5b\x31\x6a\x07\x66\xd7\xba\xc2\xcf\xe9\xb8\xbb\xfb\x0b\x5e\x8f\xcd\x54\x50\x19\xdb\xdd\x32\x34\xf1\xd0\xbb\xfb\x8b\xc1\x3a\xd9\x05\xf4\x1e\x4e\x9c\xfa\xc4\xbc\x05\xe5\x63\xda\x82\xfc\x1b\x58\x0b\x86\x67\x48\x3b\x64\xed\x3c\x6d\xd7\x5a\x9a\x5e\xed\x82\xef\x9f\x7f\xd8\xb7\xc8\x1b\xd1\x8c\x0e\x1c\x9b\x7d\x10\x03\xe7\xe7\x4e\xf3\xe2\x80\xec\x5b\xf5\xc7\xe0\x8e\x17\x4a\xfb\x81\x93\x0e\x49\xf5\xc7\xc1\x61\xff\xd1\xea\xe3\xb6\x33\x5c\x19\x53\x9f\x30\xdb\xb2\xd2\xd8\xf0\x46\xd5\xb5\x58\xd5\xf8\xac\xa1\x8e\x4a\x63\xd3\x77\xad\x57\x46\x8b\xfa\x59\x53\x13\x95\xc6\xa6\x3f\xa1\x14\xdb\xda\x3f\x7f\xdd\x2a\x28\x1d\x04\xda\x56\xc2\x63\xb2\x3f\x17\x28\x2b\x3d\x9c\x74\x70\xdd\x34\x5b\xdf\x45\x7c\xc6\x81\x4a\x4a\x63\xdb\xff\x8a\x5a\x55\xd4\x7b\xb8\x3e\x0e\xb8\x49\xb6\xbb\x4e\xe9\xb0\x42\x8c\x15\x6b\xfc\x05\xf7\xcf\xe4\x83\x0b\x4a\x0f\x8f\xb8\x3f\x51\x21\xc3\xa2\x3a\xa8\x93\xcf\x1e\x2d\x71\x11\xb3\x9d\x93\x14\x2a\x94\x4a\x63\x95\x1e\x81\xd0\x2c\x53\x4b\x1b\xf8\xea\x4b\xa4\x4b\xda\x78\xbf\x73\x69\xda\x95\xd2\x58\xef\xb8\x78\xa8\x4e\x4e\x39\x3c\x2a\x97\xb7\xa6\x69\xe8\xb5\x3c\x50\x2c\x83\x78\xac\xfb\xfe\x71\xfd\x5e\xf8\xcd\xa1\x6e\xfb\xb8\x7e\x68\x85\xdf\x1c\xb4\xcf\x66\x85\x15\x75\x8c\xc8\x75\x6a\x99\x51\x7c\x02\x66\x6e\xb0\xc7\x7d\x88\xc5\xdf\xd0\x86\xd8\xee\x44\x17\xfa\xcb\xa0\xfb\x5a\xd2\x7e\x45\x19\x0e\x1f\xeb\x59\x94\x0f\xc7\xa7\xff\x8a\x32\xf6\xa0\xf0\xde\xf4\xca\x67\x3a\xcf\x18\xde\x53\xbd\xe6\x5a\xef\xd0\x3a\x3c\x54\x55\x41\x7c\x78\xfc\xc7\xad\xb2\x47\xac\xd9\x28\x3e\xc1\x5a\x78\xa9\x8e\x69\x0b\xf2\x6f\xe0\x2d\x18\xf6\xc4\xc5\x48\xbb\x96\xf1\x4c\xa4\xf1\xc9\xbe\xbb\x1f\x23\x7d\xfe\x99\x3e\xd4\x3c\xfb\x48\xde\xe0\x27\xe6\xa3\xb4\x28\x3c\x72\x90\x31\x22\x72\x1e\xc2\xe2\x5f\x15\xba\xd2\xaa\xd6\x1b\x9b\x67\x72\xab\xcb\x64\x39\xc3\x0a\x2e\x48\x23\xff\xa9\xd3\x98\x47\x92\xbf\x64\x13\x8d\x50\x2c\xe1\x35\x2d\xbf\x64\x13\x4a\xad\x22\xa4\x01\x56\xf9\x07\xb1\xbe\x24\xd9\xbe\xc5\xa2\x93\x51\x36\x66\x13\xce\xea\x4e\x48\x0b\x12\x06\xc4\x8a\x20\x0c\x0b\x12\xc7\x3c\x28\x58\x1c\x17\x24\x4f\x9c\x17\x24\x4f\x8b\xb0\x21\xa3\x7f\xde\x90\xd1\xff\x53\x36\x51\x12\x2c\x4a\xba\x72\xd8\xf9\x81\x97\xdf\x2d\x41\xab\x9a\xc2\x99\x68\x24\x31\x2c\xbb\xf0\x2d\xca\x39\x9b\x5a\xf4\x5b\xab\x41\x63\x44\xf6\xdf\xc2\xba\x8d\xa8\xe3\xa8\xc7\x23\x2f\x72\xdb\x1c\x8c\x8e\x4a\x7b\xb4\x34\x89\xd2\x2f\x03\x02\xfe\x79\xfb\xee\x86\x8c\x39\xbd\x4a\xa1\x61\x45\xc8\x93\x69\x15\x54\xc8\x41\x34\x36\xab\xdf\xb1\xf4\xf1\x4f\x24\x65\x74\xe8\xcc\xa5\xb3\x29\x6b\xe3\x49\x73\x98\xad\xe0\xee\x7e\xb5\xf7\x78\x09\x68\x2d\xfd\x27\xc6\xbe\x64\x13\xc7\x54\x05\x5b\x8a\x35\x8c\x93\x45\xea\xf3\x61\x39\x9b\x0f\xe9\x51\x3a\x7c\x04\xcc\xe2\xe8\xce\xfc\xbd\x93\xf1\xe4\xf9\x9c\xa9\x63\x93\xa7\x6c\x12\x93\x90\x4f\x2d\x96\xe0\x84\xc4\x90\xae\x49\x9d\xf1\xa7\xdd\x01\xe0\x09\x56\x55\x5f\x82\x6c\x7c\x7e\x45\xd7\x95\xb3\x69\x8c\xed\xd5\xc7\x02\x5e\xed\xa6\x97\xe0\x42\x96\x90\x79\xe0\x43\x1a\x0b\x0f\x97\xc0\x64\x5a\xa1\x29\x99\x43\x6d\x90\x57\x59\x91\x58\x0e\x72\x76\x36\xcf\x26\x13\xc7\xda\xaf\xf9\x56\xa4\x36\x48\x43\xfe\x27\xfb\x5c\xe4\x31\x6e\xbc\x45\x12\xde\xea\xb3\x3c\x6d\xc5\x54\x1f\x64\x70\xda\xe9\xd3\xb8\x9b\x9d\x8a\xfe\xb0\x34\x28\xd1\x76\x9a\x8f\xfa\xed\x24\x09\xf7\x49\x33\x46\xd1\xdd\xa7\x9b\x3a\x68\xbf\x9f\x17\x8a\xb8\xdf\x4b\x58\xa1\x9f\x46\x58\xa1\x46\x3d\x93\x55\xde\x4b\x99\xf8\x34\x6a\x15\x7d\x04\x69\x78\x0a\xa4\x85\x30\x87\x53\x55\xc1\x61\x8e\xe6\xac\x5e\xf5\x29\x9b\x10\xe9\x4e\x32\x7a\xb0\xec\x89\xff\x1a\xe6\x1b\xe5\x1c\x75\x39\xee\xaf\x8a\x1c\x10\xeb\x61\x58\x79\xf5\x71\x90\x15\x4e\xf2\x8f\x79\x7f\x22\xc5\x4f\xb3\xf1\x77\x4b\x78\x13\xce\x73\x32\x48\x96\xf0\x3a\x6e\x46\x6d\x97\xc7\xae\xba\x04\xd1\xb6\xa8\xab\x59\x92\x90\xe3\x90\x6d\xa1\x15\x0f\x53\x9b\x7b\xf6\x4b\x66\x36\xf6\x99\xcd\xa7\xb3\x53\x97\x87\xb7\x62\x70\xd5\xab\x70\xb5\xae\x5f\x8f\x92\x7e\x1e\x5c\xa6\x6f\xb0\x61\x00\xf1\xd3\xed\x25\x43\x50\xd5\xe7\x3e\x88\x78\x07\x76\x1c\x37\x54\xf5\xf9\xa8\x44\xf3\xf4\x49\x39\x08\xf1\x3a\x5d\xff\x35\xff\x62\x3a\x39\xec\x02\xd8\x47\x80\x80\xa4\x81\xb7\x82\xa5\x91\xc3\x61\x5d\x92\xb8\xaf\xc8\xa7\x51\x67\xa7\x97\x34\x8f\x0d\x76\xe6\xe6\xb1\xcd\xf7\x5d\x0c\x3e\x59\xd1\xba\xe1\x64\x1c\xe5\x0d\xfa\x8d\xa9\xe0\x93\xf2\x1b\xb0\x58\x9a\x1d\x5a\xf0\x06\x50\xbb\xad\x45\xd0\x06\x5a\xa1\x55\xe9\x68\xac\x6e\x82\x7b\xa5\xd7\xb1\xa1\x1f\x35\xc9\xa3\x6e\x2e\xd3\x8b\xdf\x7d\xdb\x1e\xf6\xf5\x0a\x25\x5a\x20\x77\xb3\x79\x40\x57\xc2\x8e\x71\x0f\x97\x99\xcd\x7f\x80\xdd\x90\xd6\x09\xd9\x2f\x4f\x30\x9a\x22\x0a\x17\x8e\xe4\xee\x88\x96\xd8\xdc\x81\x9d\x84\xba\x79\x22\xbe\x22\x76\x23\xf3\xd9\xfc\x92\xb5\x7a\x00\x43\xce\x1e\xe1\x17\xc4\x7f\x16\xbe\x61\x21\x1e\xa1\x17\x2a\x27\x80\x47\x8a\x2f\x88\x5d\x88\xe6\x04\x74\x18\x2b\xf6\x39\xe4\x42\x10\x47\xc0\xa5\x5a\x38\x82\x2e\x6d\xfc\x59\xf0\xc6\x4d\xe0\x08\xbe\x54\xb3\x01\x40\x56\x7e\x41\x04\x53\x50\x27\x30\x54\x5d\x53\x78\x0e\xc5\x14\x4d\x8f\x23\x07\xda\x4d\x31\x1e\x86\x73\xcc\x7c\xb4\xa2\xbb\x51\xdb\xf2\xf9\x2f\x4a\x57\xb3\x39\xbd\x55\x69\xff\xbd\xb7\x7c\x75\x0f\x4b\xf0\xf9\x55\x8d\xcd\x6c\xd4\x3a\x7c\xf6\x94\xfd\x2f\x00\x00\xff\xff\x9b\x17\xf6\x2e\xd1\x15\x00\x00")
func schemaGoBytes() ([]byte, error) {
return bindataRead(
_schemaGo,
"schema.go",
)
}
func schemaGo() (*asset, error) {
bytes, err := schemaGoBytes()
if err != nil {
return nil, err
}
info := bindataFileInfo{name: "schema.go", size: 5585, mode: os.FileMode(420), modTime: time.Unix(1569187201, 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){
"template/main.tmpl": templateMainTmpl,
"schema.go": schemaGo,
}
// 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{
"schema.go": &bintree{schemaGo, map[string]*bintree{}},
"template": &bintree{nil, map[string]*bintree{
"main.tmpl": &bintree{templateMainTmpl, 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, "/")...)...)
}