Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Template ¶
type Template struct {
// contains filtered or unexported fields
}
Template is a wrapper around the text/template package that provides a generic way for generating files according to the "go generate" pattern.
In addition to the standard template delimiters (https://pkg.go.dev/text/template), it supports /*{{ ... }}*/, which allows to "hide" template code in go comments. Data is provided to the template as function pipelines.
func NewTemplate ¶
NewTemplate creates a new Template with the given pipeline mappings.
func (*Template) Generate ¶
Generate generates the file with the given fileName (it can receive an optional generator function that overrides the way the content is generated).
func (*Template) GenerateContent ¶
GenerateContent generates the dynamic content of the file by processing the template.