...

Source file src/github.com/gin-gonic/contrib/static/example/bindata/bindata.go

Documentation: github.com/gin-gonic/contrib/static/example/bindata

     1  package main
     2  
     3  import (
     4  	"bytes"
     5  	"compress/gzip"
     6  	"fmt"
     7  	"io"
     8  	"os"
     9  	"strings"
    10  )
    11  
    12  func bindata_read(data []byte, name string) ([]byte, error) {
    13  	gz, err := gzip.NewReader(bytes.NewBuffer(data))
    14  	if err != nil {
    15  		return nil, fmt.Errorf("Read %q: %v", name, err)
    16  	}
    17  
    18  	var buf bytes.Buffer
    19  	_, err = io.Copy(&buf, gz)
    20  	gz.Close()
    21  
    22  	if err != nil {
    23  		return nil, fmt.Errorf("Read %q: %v", name, err)
    24  	}
    25  
    26  	return buf.Bytes(), nil
    27  }
    28  
    29  func data_index_html() ([]byte, error) {
    30  	return bindata_read([]byte{
    31  		0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x00, 0xff, 0x44, 0xce,
    32  		0xbd, 0xae, 0xc2, 0x30, 0x0c, 0x05, 0xe0, 0xbd, 0x4f, 0xe1, 0x9b, 0xbd,
    33  		0xaa, 0xba, 0xdd, 0x21, 0xcd, 0xc2, 0xef, 0x06, 0x43, 0x19, 0x18, 0x5d,
    34  		0x62, 0x35, 0x41, 0x4e, 0x22, 0x15, 0x4b, 0x88, 0xb7, 0x27, 0x21, 0x45,
    35  		0x4c, 0x39, 0xb1, 0xf5, 0x1d, 0x59, 0xff, 0x6d, 0x4f, 0x9b, 0xf1, 0x7a,
    36  		0xde, 0x81, 0x93, 0xc0, 0xa6, 0xd1, 0xe5, 0x01, 0xc6, 0x38, 0x0f, 0xea,
    37  		0x8e, 0xca, 0x34, 0x00, 0xda, 0x11, 0xda, 0x12, 0x72, 0x0c, 0x24, 0x08,
    38  		0x37, 0x87, 0xcb, 0x83, 0x64, 0x50, 0x97, 0x71, 0xdf, 0xfe, 0x2b, 0xe8,
    39  		0xd6, 0xa5, 0x78, 0x61, 0x32, 0x73, 0x6a, 0x27, 0x1f, 0x2d, 0x0a, 0xea,
    40  		0xae, 0x4e, 0x4a, 0x47, 0xf7, 0x2d, 0xd1, 0x53, 0xb2, 0xaf, 0x15, 0xb8,
    41  		0xde, 0x1c, 0x89, 0x39, 0xc1, 0xc1, 0x47, 0xf8, 0x39, 0x08, 0xde, 0x5a,
    42  		0xa6, 0x27, 0x2e, 0x94, 0x5d, 0x5f, 0x7d, 0x65, 0xf9, 0xff, 0x39, 0xf3,
    43  		0x1d, 0x00, 0x00, 0xff, 0xff, 0x51, 0x69, 0x85, 0x27, 0xb7, 0x00, 0x00,
    44  		0x00,
    45  	},
    46  		"data/index.html",
    47  	)
    48  }
    49  
    50  // Asset loads and returns the asset for the given name.
    51  // It returns an error if the asset could not be found or
    52  // could not be loaded.
    53  func Asset(name string) ([]byte, error) {
    54  	canonicalName := strings.Replace(name, "\\", "/", -1)
    55  	if f, ok := _bindata[canonicalName]; ok {
    56  		return f()
    57  	}
    58  	return nil, fmt.Errorf("Asset %s not found", name)
    59  }
    60  
    61  // AssetNames returns the names of the assets.
    62  func AssetNames() []string {
    63  	names := make([]string, 0, len(_bindata))
    64  	for name := range _bindata {
    65  		names = append(names, name)
    66  	}
    67  	return names
    68  }
    69  
    70  // _bindata is a table, holding each asset generator, mapped to its name.
    71  var _bindata = map[string]func() ([]byte, error){
    72  	"data/index.html": data_index_html,
    73  }
    74  
    75  // AssetDir returns the file names below a certain
    76  // directory embedded in the file by go-bindata.
    77  // For example if you run go-bindata on data/... and data contains the
    78  // following hierarchy:
    79  //     data/
    80  //       foo.txt
    81  //       img/
    82  //         a.png
    83  //         b.png
    84  // then AssetDir("data") would return []string{"foo.txt", "img"}
    85  // AssetDir("data/img") would return []string{"a.png", "b.png"}
    86  // AssetDir("foo.txt") and AssetDir("notexist") would return an error
    87  func AssetDir(name string) ([]string, error) {
    88  	canonicalName := strings.Replace(name, "\\", "/", -1)
    89  	pathList := strings.Split(canonicalName, "/")
    90  	node := _bintree
    91  	for _, p := range pathList {
    92  		node = node.Children[p]
    93  		if node == nil {
    94  			return nil, fmt.Errorf("Asset %s not found", name)
    95  		}
    96  	}
    97  	if node.Func != nil {
    98  		return nil, fmt.Errorf("Asset %s not found", name)
    99  	}
   100  	rv := make([]string, 0, len(node.Children))
   101  	for name := range node.Children {
   102  		rv = append(rv, name)
   103  	}
   104  	return rv, nil
   105  }
   106  
   107  type _bintree_t struct {
   108  	Func     func() ([]byte, error)
   109  	Children map[string]*_bintree_t
   110  }
   111  
   112  var _bintree = &_bintree_t{nil, map[string]*_bintree_t{
   113  	"data": &_bintree_t{nil, map[string]*_bintree_t{
   114  		"index.html": &_bintree_t{data_index_html, map[string]*_bintree_t{}},
   115  	}},
   116  }}
   117  
   118  // AssetInfo returns file info of given path
   119  func AssetInfo(path string) (os.FileInfo, error) {
   120  	return os.Stat(path)
   121  }
   122  

View as plain text