Documentation ¶
Index ¶
- Variables
- func Dir(s string) func(t TemplatePathFormat) string
- type FileTemplate
- type FuncMap
- type Template
- func (t *Template) AddParseTree(name string, tree *parse.Tree) (*Template, error)
- func (t *Template) Funcs(funcMap FuncMap) *Template
- func (t *Template) ParseDir(path string) (*Template, error)
- func (t *Template) ParseFS(fsys fs.FS, patterns ...string) (*Template, error)
- func (t *Template) ParseFiles(filenames ...string) (*Template, error)
- func (t *Template) ParseGlob(pattern string) (*Template, error)
- type TemplatePathFormat
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Funcs are the predefined template // functions used by the codegen. Funcs = template.FuncMap{ "base": filepath.Base, "dict": dict, "toLower": toLower, "toFirstCap": toFirstCap, "toFirstLower": toFirstLower, "toSnakeCase": stringutil.ToSnakeCase, "stringReplace": strings.Replace, "stringHasPrefix": strings.HasPrefix, "stringReplaceAll": strings.ReplaceAll, "sub": sub, "joinStrings": joinStrings, } )
Functions ¶
Types ¶
type FileTemplate ¶
type Template ¶
func NewTemplate ¶
func (*Template) AddParseTree ¶
AddParseTree adds the given parse tree to the template.
func (*Template) ParseFiles ¶
ParseFiles 解析文件
type TemplatePathFormat ¶
type TemplatePathFormat interface {
Dir() string
}
Click to show internal directories.
Click to hide internal directories.