Files
ent/entc/load/internal/bindata.go
Ariel Mashraki c3955a08f1 schema/field: json type support (#38)
Summary:
Pull Request resolved: https://github.com/facebookincubator/ent/pull/38

Only `IsNil` and `NotNil` predicates are supported this moment

Reviewed By: alexsn

Differential Revision: D17444976

fbshipit-source-id: 37336fa0bc7749af995933baee2e23bb7366dd78
2019-09-19 05:00:11 -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(1567330508, 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\xdd\x6f\xdb\x46\x12\x7f\x26\xff\x8a\xa9\x80\x04\xa4\xe1\xa3\x72\x7d\x3b\x16\x7a\x28\x52\x17\xf0\xf5\xce\x09\x9a\xdc\xbd\x18\x86\xbb\x22\x67\xa5\xad\xc9\x5d\x66\x77\xa5\x44\x35\xfc\xbf\x1f\x66\x3f\xf8\x25\xc9\xc8\xa5\xb5\x01\x43\xda\xf9\xda\x99\xdf\x7c\xec\x68\xb9\x84\xb7\xaa\x3b\x68\xb1\xd9\x5a\xf8\xfe\xcd\xdf\xff\xf1\xb7\x4e\xa3\x41\x69\xe1\x67\x56\xe1\x5a\xa9\x07\xb8\x96\x55\x01\x3f\x36\x0d\x38\x21\x03\xc4\xd7\x7b\xac\x8b\x74\xb9\x84\x8f\x5b\x61\xc0\xa8\x9d\xae\x10\x2a\x55\x23\x08\x03\x8d\xa8\x50\x1a\xac\x61\x27\x6b\xd4\x60\xb7\x08\x3f\x76\xac\xda\x22\x7c\x5f\xbc\x89\x5c\xe0\x6a\x27\x6b\x32\x21\xa4\x13\xf9\xd7\xf5\xdb\xab\x9b\x0f\x57\xc0\x45\x83\x91\xa6\x95\xb2\x50\x0b\x8d\x95\x55\xfa\x00\x8a\x83\x1d\xdd\x67\x35\x62\x91\xa6\x1d\xab\x1e\xd8\x06\xa1\x51\xac\x4e\x53\xd1\x76\x4a\x5b\xc8\xd2\x64\x81\xb2\x52\xb5\x90\x9b\xe5\xef\x46\xc9\x45\x9a\x2c\x78\x6b\xe9\x43\x23\x6f\xb0\xb2\x8b\x34\x4d\x16\x1b\x61\xb7\xbb\x75\x51\xa9\x76\xc9\x43\xc0\x42\x56\xbb\x35\xb3\x4a\x2f\x51\xda\xa5\xa9\xb6\xd8\xb2\x25\xd6\x1b\xfc\x2a\x85\xc5\xff\x61\x94\x0b\x6c\xea\x45\x9a\xa7\x04\xc3\x07\x47\x03\x8d\x21\x01\x06\x98\x04\x94\xb6\x08\x0c\xbb\x65\x16\x3e\x33\xe3\xe2\xc4\x1a\xb8\x56\x2d\x30\xa8\x54\xdb\x35\x82\xc0\x36\xa8\x21\x60\x51\xa4\xf6\xd0\x61\x34\x69\xac\xde\x55\x16\x1e\xd3\xe4\x86\xb5\x08\xf1\xcf\x58\x2d\xe4\xa6\x3f\xfe\x46\x28\x95\x0b\xc9\x5a\xbc\x54\xad\xb0\xd8\x76\xf6\xb0\xf8\x2d\x4d\xae\xea\x0d\x9a\x28\x75\x7b\x77\x41\xe7\x99\x12\xa1\x63\xa6\x5a\x3f\x53\x6c\x66\xd0\x72\xe7\xa9\x96\x0b\x7f\xa6\x76\x2d\x6b\xfc\x12\xaf\xbb\xbd\xbb\x70\xe7\xa9\x9a\xf0\x22\x53\xbd\x0f\x2e\xc6\x70\xe9\xed\xdd\xc5\xe8\x1c\xf5\x3c\x0c\xf7\x27\x6e\x7d\x72\x09\xf0\xc2\xc7\xf8\x7b\xfa\x37\xc0\xef\x15\xcf\xa0\x3f\x87\xff\x3c\xfe\xd7\x92\xab\x41\xec\xc2\xf9\x5f\x7c\x3c\x74\xe8\x18\x41\x8d\x2e\x9c\xaa\x7d\x64\x23\xe3\xe7\x6e\xb3\x6c\x33\xc3\x51\xfc\x31\xf2\xf1\x42\x48\x3b\x32\xd2\x23\x29\xfe\x98\x5d\xf6\x1f\x29\x3e\xed\x7a\xc5\xb5\x52\xcd\x09\xb5\x9d\x13\x9a\x2a\xde\x88\xa6\x61\xeb\x06\x9f\x55\x94\x41\x68\xaa\xfa\xae\xb3\x42\x49\xd6\x3c\xab\xaa\x82\xd0\x54\xf5\x27\xe4\x6c\xd7\xd8\xe7\xdd\xad\xbd\xd0\x2c\xd0\xae\x66\x16\xa3\xfe\xb9\x40\x9d\xd0\xfd\x49\x03\xd7\x6d\xbb\xb3\x7d\xc4\x67\x0c\x88\x28\x34\xd5\xfd\x2f\x6b\x44\x4d\x43\xc4\xf5\xc7\x2c\x37\x51\x77\xdf\x0b\xcd\x3b\x44\x69\xb6\xc1\x5f\xf0\xf0\x4c\x3d\x18\x2f\x74\xff\x80\x87\x13\x1d\x32\x6e\xaa\x59\x9f\x7c\xb1\xa8\x29\x17\xa1\xda\x5d\x91\x42\x8d\x5c\x48\xac\xe3\x34\xf7\x53\x2f\xce\xa6\x91\xad\xa1\x45\xfa\xa2\x0d\xfe\x9d\x2b\xd3\xbe\x95\xa6\x72\xc7\xcd\x43\x7d\x72\xca\xe0\x51\xbb\xbc\x55\x6d\x4b\xcf\xde\x4c\xb0\xf2\xe4\xa9\xec\xfb\x87\xcd\x7b\x66\xb7\x73\xd9\xee\x61\x73\xdf\x31\xbb\x9d\x8d\xcf\x76\x8d\x35\x4d\x8c\x90\xeb\x38\x32\x03\xf9\x04\xcc\x6e\xc0\x1e\xcf\x21\x47\xfe\x86\x31\xe4\xf4\x4e\x4c\xa1\xbf\x0c\xba\xaf\x4d\xda\xaf\xc8\xfd\xe5\x53\x39\x8d\xfc\xfe\xf8\xf6\x5f\x91\x87\x19\xe4\xdf\x9b\x41\xf8\xcc\xe4\x99\xc2\x7b\x6a\xd6\x5c\xcb\x3d\x6a\x83\x73\x51\xe1\xc9\xf3\xeb\x3f\xed\x84\x3e\xca\x9a\x0e\xe4\x13\x59\xf3\x2f\xd5\x71\xda\x3c\xfd\x1b\xf2\xe6\x15\x87\xc4\x85\x48\xfb\x91\xf1\x4c\xa4\xe1\xc9\xbe\xbd\x9b\x22\x7d\xfe\x99\x9e\x4b\x9e\x7d\x24\x6f\xf0\xb3\xcb\x47\xa5\x91\x59\x74\x41\x86\x88\xc8\xb8\x0f\xcb\x7d\xab\xd1\x54\x5a\x74\x56\xe9\x22\xe5\x3b\x59\x45\xcd\x0c\x6b\xb8\x20\x89\xe2\xa7\x5e\x22\x0f\x49\x7e\x4c\x13\x89\x50\xae\xe0\x35\x1d\x1f\xd3\x84\x4a\xab\xf4\x65\x80\x75\xf1\x91\x6d\x2e\x89\x76\xe8\xb0\xec\x69\x54\x8d\x69\xe2\xaa\xba\x27\xd2\x81\x88\x1e\xb1\xd2\x13\xfd\x81\xc8\xa1\x0e\x4a\x47\x0e\x07\xa2\xc7\x9c\x97\x44\x8f\x07\xcf\xe0\xc1\xbe\x63\xf0\x60\xff\x29\x4d\x04\x07\x8d\x9c\x5c\xf6\x9c\x1f\xdc\xf1\xbb\x15\x48\xd1\x50\x38\x89\x44\x22\xc3\xaa\x0f\x5f\x23\xcf\x9d\xaa\x46\xbb\xd3\x12\x24\x06\x64\xff\xcd\xb4\xd9\xb2\x26\xec\x6c\x6e\x77\x45\x37\x36\x47\x3b\xa0\x90\x16\x35\xad\x94\xf4\x4d\x01\x83\x7f\x7e\x78\x77\x43\xca\xae\xbc\x2a\x26\x61\x4d\xc8\x93\x6a\xed\x45\xc8\x40\x50\x56\xeb\xdf\xb1\xb2\xe1\x23\x24\x65\x72\x69\x66\xe2\xdd\x54\xb5\xe1\xa6\x1c\xb2\x35\xdc\xde\xad\x0f\x16\x2f\x01\xb5\xa6\x7f\xca\xd8\x63\x9a\x18\x97\x2a\xaf\xfb\xe8\x01\x12\xd2\x6f\xeb\x59\xd8\xb1\x5d\x7e\xde\xf1\x60\x39\xcf\x5d\x6a\xb2\xfc\x29\x4d\x42\x85\x39\x93\xe5\x0a\x0c\xe3\xe8\x6b\x31\xca\x3a\x70\x89\x3b\x42\x33\x62\x26\x9a\x4b\xe0\xad\x2d\xae\xc8\x17\x9e\x2d\x82\xe3\xaf\x3e\x95\xf0\x6a\xbf\xb8\x04\xe3\x4b\x80\xd4\x3d\xd8\x5c\x69\xb8\xbf\x04\x97\x29\xcd\x24\x55\xaa\x2f\x7c\xb2\xca\x6b\x22\xf3\x51\x41\x66\x79\x9a\x24\xc6\x49\xbf\x76\x5e\x91\xd8\xa8\xc6\xdc\x1f\x1f\x0a\xcd\xed\x68\x53\x16\x51\x1c\x6b\x28\xe1\xc8\x0a\x75\x3c\x2a\xcf\xc8\x19\x6a\xb4\x5f\x8c\xca\xe1\xb2\xb8\x05\x11\x3b\x2e\x3f\x03\x3b\x52\xbc\x3f\x71\x81\x28\x7b\x7f\xfa\x95\x82\xf8\xc3\x32\x50\x06\xfe\x40\x71\x02\xc3\xaa\xe1\x04\x1a\x94\x19\xaf\x8b\x81\x9a\x3b\xa9\xb0\x07\x95\x43\x04\x71\x33\xf2\x49\xf3\x61\x8e\x57\xa6\xd2\x85\x39\x59\xa2\x06\xd1\xa7\x34\xa1\xa4\x1b\xee\xd0\x83\xd5\x90\xf8\xaf\xc9\x7c\x2b\x8c\xa1\x11\xe6\x86\xa7\x20\x03\x94\x75\xbf\x89\xbc\xfa\x34\xaa\x0a\xc3\xdd\x97\x7c\xb8\x91\xe2\xa7\xc5\xf7\xbb\x15\xbc\xf1\xf7\x19\xee\x29\x2b\x78\x1d\x98\x41\xda\x14\x61\x64\xae\x80\x75\x1d\xca\x3a\x8b\x14\x32\xec\xab\xcd\xcf\xd9\x71\x69\xbb\x81\xfc\x92\x95\x8d\x43\x65\xbb\xdb\x9d\x51\x53\xf8\x87\x60\xe4\xea\x95\x77\xad\x1f\xc6\x93\xa2\xcf\xbd\xc9\xf8\x03\x6b\x1c\x40\xf8\x5d\xf6\x92\x21\x88\xfa\xcb\x10\x44\xf0\xc1\x19\x0e\x0c\x51\x7f\x39\x6a\xd1\x22\xfe\x5e\x1c\x85\x78\x1d\xdd\x7f\xed\xbe\xb9\x74\xba\xb0\x4b\x70\x36\x3c\x04\x44\xf5\x79\x2b\x1d\x35\xe4\x70\xdc\x97\x44\x1e\x3a\xf2\x69\x32\xb6\xe9\x99\x2c\xc2\xf4\xcc\x4c\x1e\x66\xf8\x30\xc5\xe0\xb3\x66\x9d\x19\xaf\xbd\x81\xde\xa2\xdd\xaa\x1a\x3e\x0b\xbb\x05\x8d\x95\xda\xa3\x06\xab\x00\xa5\xd9\x69\x04\xa9\xa0\x63\x52\x54\x86\x76\xe6\xd6\x9b\x17\x72\x13\xa6\xf5\xd1\x90\x3c\x1a\xd5\x3c\x3e\xe7\xfd\x0f\xd7\xf9\xd0\xae\x91\xa3\x06\x32\x97\xe5\x1e\x5d\x0e\x7b\x87\xbb\x77\x26\xcb\x7f\x80\xfd\x38\xad\x09\xe9\xaf\x4e\x64\x34\x46\xe4\x1d\x0e\xc9\xdd\x53\x5a\xc2\x70\x07\x67\xc4\xf7\xcd\x13\xe5\x2b\x60\x37\x51\xcf\xf2\x4b\x27\x35\x00\xe8\x6b\xf6\x08\x3f\x4f\xfe\xb3\xf0\x8d\x1b\xf1\x08\x3d\xdf\x39\x1e\x3c\x12\x7c\x41\xec\x7c\x34\x27\xa0\xc3\xd0\xb1\xcf\x21\xe7\x83\x38\x02\x2e\xf6\xc2\x11\x74\x91\xf1\x67\xc1\x9b\x0e\x81\x23\xf8\x62\xcf\x7a\x00\x9d\xf0\x0b\x22\x18\x83\x3a\x81\xa1\xe8\x87\xc2\x73\x28\xc6\x68\x06\x1c\x5d\xa0\xfd\x0a\x63\x61\xbc\xc4\xe4\x93\x13\xf9\x46\x63\xcb\x16\xbf\x08\x59\x67\x39\xbd\x55\x91\xff\xde\x6a\xe7\xba\x85\x15\xd8\xe2\xaa\xc1\x36\x9b\x8c\x0e\x9b\x3e\xa5\xff\x0b\x00\x00\xff\xff\x9d\x2e\x42\x92\x77\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: 5495, mode: os.FileMode(420), modTime: time.Unix(1568742782, 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, "/")...)...)
}