Documentation ¶
Overview ¶
Package pack 用于将数据资源打包为 Go 文件
Index ¶
- func Bytes(v interface{}) ([]byte, error)
- func DirBytes(root string) ([]byte, error)
- func DirFile(root string, pkgName, varName, fileHeader, tag, path string) error
- func DirString(root string) (string, error)
- func File(v interface{}, pkgName, varName, fileHeader, tag, path string) error
- func NewFileSystem(data string) (http.FileSystem, error)
- func String(v interface{}) (string, error)
- func Unpack(data string, v interface{}) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func File ¶
File 将对象 v 打包成一个 Go 文件内容中
pkgName 和 varName 分别指定包名和变量名; fileHeader 指定了文件头,如果为空,则不会输出文件内容; tag 指定了 // +build 指令下的标签,如果为空则不生成该指令;
func NewFileSystem ¶ added in v0.2.0
func NewFileSystem(data string) (http.FileSystem, error)
NewFileSystem 将 data 解包并生成符合 http.FileSystem 接口的实例
data 必须是由 DirBytes 或是 DirString 打包后的数据。
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.