Documentation
¶
Overview ¶
Package codegen provides interfaces to generate source files from templates and raw data. These tools can be used to automate the creation of source files that contain a lot of similar block of codes, with only small details (names, labels, values) changing.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CodeGenerator ¶
type CodeGenerator struct {
OutputFiles []string
// contains filtered or unexported fields
}
CodeGenerator is a struct containing references to the names and contents of the files used in the template substitution process.
func (*CodeGenerator) Generate ¶
func (gen *CodeGenerator) Generate(upTo uint) error
Generate creates the files with respect to the passed templates and csv data.
func (*CodeGenerator) LoadGenerator ¶
func (gen *CodeGenerator) LoadGenerator(templateFiles []string, dataFile string, separator rune) error
LoadGenerator initializes a CodeGenerator, parsing the tokens contained in the template files. The data file is a csv file, where each row contains one tuple of data to be generated following the template.