github.com/ijc/docker-app@v0.6.1-0.20181012090447-c7ca8bc483fb/specification/bindata.go (about)

     1  // Code generated by "esc -o bindata.go -pkg specification -ignore .*\.go -private -modtime=1518458244 schemas"; DO NOT EDIT.
     2  
     3  package specification
     4  
     5  import (
     6  	"bytes"
     7  	"compress/gzip"
     8  	"encoding/base64"
     9  	"io/ioutil"
    10  	"net/http"
    11  	"os"
    12  	"path"
    13  	"sync"
    14  	"time"
    15  )
    16  
    17  type _escLocalFS struct{}
    18  
    19  var _escLocal _escLocalFS
    20  
    21  type _escStaticFS struct{}
    22  
    23  var _escStatic _escStaticFS
    24  
    25  type _escDirectory struct {
    26  	fs   http.FileSystem
    27  	name string
    28  }
    29  
    30  type _escFile struct {
    31  	compressed string
    32  	size       int64
    33  	modtime    int64
    34  	local      string
    35  	isDir      bool
    36  
    37  	once sync.Once
    38  	data []byte
    39  	name string
    40  }
    41  
    42  func (_escLocalFS) Open(name string) (http.File, error) {
    43  	f, present := _escData[path.Clean(name)]
    44  	if !present {
    45  		return nil, os.ErrNotExist
    46  	}
    47  	return os.Open(f.local)
    48  }
    49  
    50  func (_escStaticFS) prepare(name string) (*_escFile, error) {
    51  	f, present := _escData[path.Clean(name)]
    52  	if !present {
    53  		return nil, os.ErrNotExist
    54  	}
    55  	var err error
    56  	f.once.Do(func() {
    57  		f.name = path.Base(name)
    58  		if f.size == 0 {
    59  			return
    60  		}
    61  		var gr *gzip.Reader
    62  		b64 := base64.NewDecoder(base64.StdEncoding, bytes.NewBufferString(f.compressed))
    63  		gr, err = gzip.NewReader(b64)
    64  		if err != nil {
    65  			return
    66  		}
    67  		f.data, err = ioutil.ReadAll(gr)
    68  	})
    69  	if err != nil {
    70  		return nil, err
    71  	}
    72  	return f, nil
    73  }
    74  
    75  func (fs _escStaticFS) Open(name string) (http.File, error) {
    76  	f, err := fs.prepare(name)
    77  	if err != nil {
    78  		return nil, err
    79  	}
    80  	return f.File()
    81  }
    82  
    83  func (dir _escDirectory) Open(name string) (http.File, error) {
    84  	return dir.fs.Open(dir.name + name)
    85  }
    86  
    87  func (f *_escFile) File() (http.File, error) {
    88  	type httpFile struct {
    89  		*bytes.Reader
    90  		*_escFile
    91  	}
    92  	return &httpFile{
    93  		Reader:   bytes.NewReader(f.data),
    94  		_escFile: f,
    95  	}, nil
    96  }
    97  
    98  func (f *_escFile) Close() error {
    99  	return nil
   100  }
   101  
   102  func (f *_escFile) Readdir(count int) ([]os.FileInfo, error) {
   103  	return nil, nil
   104  }
   105  
   106  func (f *_escFile) Stat() (os.FileInfo, error) {
   107  	return f, nil
   108  }
   109  
   110  func (f *_escFile) Name() string {
   111  	return f.name
   112  }
   113  
   114  func (f *_escFile) Size() int64 {
   115  	return f.size
   116  }
   117  
   118  func (f *_escFile) Mode() os.FileMode {
   119  	return 0
   120  }
   121  
   122  func (f *_escFile) ModTime() time.Time {
   123  	return time.Unix(f.modtime, 0)
   124  }
   125  
   126  func (f *_escFile) IsDir() bool {
   127  	return f.isDir
   128  }
   129  
   130  func (f *_escFile) Sys() interface{} {
   131  	return f
   132  }
   133  
   134  // _escFS returns a http.Filesystem for the embedded assets. If useLocal is true,
   135  // the filesystem's contents are instead used.
   136  func _escFS(useLocal bool) http.FileSystem {
   137  	if useLocal {
   138  		return _escLocal
   139  	}
   140  	return _escStatic
   141  }
   142  
   143  // _escDir returns a http.Filesystem for the embedded assets on a given prefix dir.
   144  // If useLocal is true, the filesystem's contents are instead used.
   145  func _escDir(useLocal bool, name string) http.FileSystem {
   146  	if useLocal {
   147  		return _escDirectory{fs: _escLocal, name: name}
   148  	}
   149  	return _escDirectory{fs: _escStatic, name: name}
   150  }
   151  
   152  // _escFSByte returns the named file from the embedded assets. If useLocal is
   153  // true, the filesystem's contents are instead used.
   154  func _escFSByte(useLocal bool, name string) ([]byte, error) {
   155  	if useLocal {
   156  		f, err := _escLocal.Open(name)
   157  		if err != nil {
   158  			return nil, err
   159  		}
   160  		b, err := ioutil.ReadAll(f)
   161  		_ = f.Close()
   162  		return b, err
   163  	}
   164  	f, err := _escStatic.prepare(name)
   165  	if err != nil {
   166  		return nil, err
   167  	}
   168  	return f.data, nil
   169  }
   170  
   171  // _escFSMustByte is the same as _escFSByte, but panics if name is not present.
   172  func _escFSMustByte(useLocal bool, name string) []byte {
   173  	b, err := _escFSByte(useLocal, name)
   174  	if err != nil {
   175  		panic(err)
   176  	}
   177  	return b
   178  }
   179  
   180  // _escFSString is the string version of _escFSByte.
   181  func _escFSString(useLocal bool, name string) (string, error) {
   182  	b, err := _escFSByte(useLocal, name)
   183  	return string(b), err
   184  }
   185  
   186  // _escFSMustString is the string version of _escFSMustByte.
   187  func _escFSMustString(useLocal bool, name string) string {
   188  	return string(_escFSMustByte(useLocal, name))
   189  }
   190  
   191  var _escData = map[string]*_escFile{
   192  
   193  	"/schemas/metadata_schema_v0.1.json": {
   194  		local:   "schemas/metadata_schema_v0.1.json",
   195  		size:    1019,
   196  		modtime: 1518458244,
   197  		compressed: `
   198  H4sIAAAAAAAC/5xSy27CQAy85ytW2x6BUKmn/AqqkJsYWJR91GuQUJV/rxLz2nYTUHNKxvZkxuPvQiml
   199  9Gusd2hBV0rvmENVlvvo3VzQhadt2RBseL58LwV70TOZNE0/ZJGhAYa1VNfH5eJt0VNc2vgUsG/0n3us
   200  +YIG8gGJDUZdKZEy4A4sJkjCEZmM2545rtWNJws8OPCRB4ZrQ3fr1UekaLx7SJ8dbjDWZAJPEawSdKhk
   201  FYvTQ9vqBP7I/rj3EwPU+D/dFoxjMA4pjhMAEZx+r9Uw2r8zU+ml/nJJPiX//ulmeXa0YNqn6FejHdMB
   202  PQgrCW58+u44RXLeZTGN3L7k7bwVTfh1MIRNYlM2n7n7Qo6sK34CAAD//7xaWqb7AwAA
   203  `,
   204  	},
   205  
   206  	"/": {
   207  		isDir: true,
   208  		local: "",
   209  	},
   210  
   211  	"/schemas": {
   212  		isDir: true,
   213  		local: "schemas",
   214  	},
   215  }