Documentation
¶
Index ¶
- func CreateFilesMap(files []config.File) map[string]File
- func CreateTemplatesMap(filenameTemplatesList []config.FilenameTemplateMap) map[string]string
- func FilterTemplatesMap(filter string, templatesMap map[string]string) map[string]string
- func MustGenerateFile(tg *templategenerators.TemplateGenerator, templatesMap map[string]string, ...)
- func MustGenerateFiles(tg *templategenerators.TemplateGenerator, ...)
- func NewGenerator() *templategenerators.TemplateGenerator
- type File
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateFilesMap ¶
CreateFilesMap creates a map of file configurations from a slice of config.File structs. Each element in the slice corresponds to a key-value pair in the map, where the key is the file name and the value is a File struct containing template and import information.
func CreateTemplatesMap ¶ added in v0.6.2
func CreateTemplatesMap(filenameTemplatesList []config.FilenameTemplateMap) map[string]string
CreateTemplatesMap creates a map of templates from a slice of config.FilenameTemplateMap structs. Each struct represents a map where keys are file names and values are corresponding templates. It merges these maps into a single map.
func FilterTemplatesMap ¶ added in v0.6.2
FilterTemplatesMap filters a map of filenames to templates based on a given filter string. It iterates over each key-value pair in the input map and adds pairs to a new map if the filename contains the filter string.
func MustGenerateFile ¶ added in v0.11.0
func MustGenerateFile(tg *templategenerators.TemplateGenerator, templatesMap map[string]string, fileName, fileTmpl, outputFile string, data any, )
MustGenerateFile generates a single file using the provided template. It logs any errors encountered during the generation process, except for the ErrUnsupportedFileType error, which is ignored.
func MustGenerateFiles ¶ added in v0.11.0
func MustGenerateFiles(tg *templategenerators.TemplateGenerator, defaultTemplatesMap map[string]string, filesMap map[string]File, data any, output string, )
MustGenerateFiles generates multiple files at once using the provided templates. It logs any errors encountered during the generation process.
func NewGenerator ¶ added in v0.11.0
func NewGenerator() *templategenerators.TemplateGenerator
NewGenerator initialises a new instance of templategenerators.TemplateGenerator with additional template functions provided as a template.FuncMap.