Documentation
¶
Overview ¶
Package templating assists in template based code generation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateFile ¶
CreateFile creates path, executes tmpl with dot ctx, and handles closing.
Types ¶
type File ¶
type File struct { Dir string // Dir is the destination directory of this file, within the test directory. Name string // Name is the filename of this file. Desc string // Desc is a human-readable description for this file. Glob string // Glob is the slash-delimited glob of source templates for this file. }
File holds information about a templated file.
type Generator ¶
type Generator struct { Files []File // Files is the list of files this generator will make. Templates Set // Templates is the map of templates to use for files in testFiles. }
Generator is a mixin struct for dealing with templated parts of generators.
func NewGenerator ¶
func NewGenerator(files []File, builder SetBuilder) (*Generator, error)
NewGenerator creates a Generator using files and builder.
type SetBuilder ¶
type SetBuilder struct { Srcs []Source // Srcs is an ordered set of template sources. Funcs template.FuncMap // Funcs is the custom function map to apply to the templates. }
SetBuilder is a builder for Set.
func (*SetBuilder) BuildFiles ¶
func (b *SetBuilder) BuildFiles(files []File) (Set, error)
BuildFiles uses the builder's source set to parse templates for files.
Click to show internal directories.
Click to hide internal directories.