Documentation ¶
Overview ¶
Package tmpl provides code generation from pure Go templates.
Index ¶
- Variables
- type Environment
- type Loader
- type LoaderFunc
- type Package
- type Template
- type Transform
- func CommentReplace(old, new string) Transform
- func DefineBool(name string, value bool) Transform
- func DefineIntDecimal(name string, value int) Transform
- func DefineIntHex(name string, value int) Transform
- func DefineLiteral(name string, kind token.Token, value string) Transform
- func DefineLiteralf(name string, kind token.Token, format string, args ...interface{}) Transform
- func DefineString(name, value string) Transform
- func GeneratedBy(by string) Transform
- func Preprocessor() Transform
- func Rename(from, to string) Transform
- func SetPackageName(name string) Transform
Constants ¶
This section is empty.
Variables ¶
View Source
var ( FileSystemLoader = LoaderFunc(ioutil.ReadFile) Default = Environment{Loader: FileSystemLoader} )
Functions ¶
This section is empty.
Types ¶
type Environment ¶
type Environment struct {
Loader Loader
}
type Loader ¶
Loader is a method of loading templates.
func NewBasePath ¶
NewBasePath restricts the given loader to a given path.
type LoaderFunc ¶
LoaderFunc adapts a function to the Loader interface.
type Package ¶
type Package struct {
// contains filtered or unexported fields
}
func NewPackage ¶
func NewPackage() *Package
type Transform ¶
func CommentReplace ¶
func DefineBool ¶
func DefineIntDecimal ¶
func DefineIntHex ¶
func DefineLiteralf ¶
func DefineString ¶
func GeneratedBy ¶
GeneratedBy replaces the string "CodeGenerationWarning" in comments with a standard code generation warning. This is a special case of the CommentReplace transform.
func Preprocessor ¶
func Preprocessor() Transform
func SetPackageName ¶
Click to show internal directories.
Click to hide internal directories.