template

package
v0.0.0-...-8049e74 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 11, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Generator

type Generator struct {
	// A map of object types to sets of input and output files. It OK for an
	// object type name to not exist in a generator,
	// that file will simply not be output. The content of this object may be
	// used in a different template, usually that of a parent, or a child
	// collection.
	ObjectTypeTemplates map[schema.ObjectTypeName][]InputOutputFilePair
}

func (*Generator) ExpandTemplate

func (this *Generator) ExpandTemplate(schemaObject schema.ObjectInterface, templateFileName string) (string, error)

func (*Generator) Output

func (this *Generator) Output(schemaObject schema.ObjectInterface, outputDirectory string) error

Output file(s) for the supplied schema object and its children

func (*Generator) OutputFile

func (this *Generator) OutputFile(schemaObject schema.ObjectInterface, outputDirectory string, ioFilePair InputOutputFilePair) error

Output a file for the supplied schema object

type InputOutputFilePair

type InputOutputFilePair struct {
	// The template filename (without the path) that this object can use to
	// create some output.
	TemplateFileName string

	// If a TemplateFileName() is available, this can be provided to specify
	// the output filename. If no value is returned, no separate file will be
	// output.
	OutputFileNameFn func(schema.ObjectInterface) (string, error)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL