Documentation ¶
Index ¶
- type CodeGenerator
- func NewCodeGeneratorFromConfig(configuration *config.Configuration, idFactory astmodel.IdentifierFactory, ...) (*CodeGenerator, error)
- func NewCodeGeneratorFromConfigFile(configurationFile string, log logr.Logger) (*CodeGenerator, error)
- func NewTargetedCodeGeneratorFromConfig(configuration *config.Configuration, idFactory astmodel.IdentifierFactory, ...) (*CodeGenerator, error)
- func (generator *CodeGenerator) Generate(ctx context.Context, log logr.Logger) error
- func (generator *CodeGenerator) HasStage(id string) bool
- func (generator *CodeGenerator) IndexOfStage(id string) int
- func (generator *CodeGenerator) InjectStageAfter(existingStage string, stage *pipeline.Stage)
- func (generator *CodeGenerator) RemoveStages(stageIds ...string)
- func (generator *CodeGenerator) ReplaceStage(existingStage string, stage *pipeline.Stage)
- func (generator *CodeGenerator) UseDebugMode(groupSpecifier string, outputFolder string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CodeGenerator ¶
type CodeGenerator struct {
// contains filtered or unexported fields
}
CodeGenerator is a generator of code
func NewCodeGeneratorFromConfig ¶
func NewCodeGeneratorFromConfig( configuration *config.Configuration, idFactory astmodel.IdentifierFactory, log logr.Logger, ) (*CodeGenerator, error)
NewCodeGeneratorFromConfig produces a new code generator with the given configuration all available stages configuration is used to configure the pipeline. idFactory is used to create identifiers for types. log is captured by stages to log messages.
func NewCodeGeneratorFromConfigFile ¶
func NewCodeGeneratorFromConfigFile( configurationFile string, log logr.Logger, ) (*CodeGenerator, error)
NewCodeGeneratorFromConfigFile produces a new Generator with the given configuration file configurationFile is the path to the configuration file. log is captured by stages to log messages.
func NewTargetedCodeGeneratorFromConfig ¶
func NewTargetedCodeGeneratorFromConfig( configuration *config.Configuration, idFactory astmodel.IdentifierFactory, target pipeline.Target, log logr.Logger, ) (*CodeGenerator, error)
NewTargetedCodeGeneratorFromConfig produces a new code generator with the given configuration and only the stages appropriate for the specified target. configuration is used to configure the pipeline. idFactory is used to create identifiers for types. target is the target for which code is being generated. log is captured by stages to log messages.
func (*CodeGenerator) Generate ¶
Generate produces the Go code corresponding to the configured JSON schema in the given output folder ctx is used to cancel the generation process. log is used to log progress.
func (*CodeGenerator) HasStage ¶
func (generator *CodeGenerator) HasStage(id string) bool
HasStage tests whether the pipeline has a stage with the given id Only available for test builds.
func (*CodeGenerator) IndexOfStage ¶
func (generator *CodeGenerator) IndexOfStage(id string) int
IndexOfStage returns the index of the stage, if present, or -1 if not Only available for test builds.
func (*CodeGenerator) InjectStageAfter ¶
func (generator *CodeGenerator) InjectStageAfter(existingStage string, stage *pipeline.Stage)
InjectStageAfter injects a new stage immediately after the first occurrence of an existing stage Only available for test builds. Will panic if the existing stage is not found.
func (*CodeGenerator) RemoveStages ¶
func (generator *CodeGenerator) RemoveStages(stageIds ...string)
RemoveStages will remove all stages from the pipeline with the given ids. Only available for test builds. Will panic if you specify an unknown id.
func (*CodeGenerator) ReplaceStage ¶
func (generator *CodeGenerator) ReplaceStage(existingStage string, stage *pipeline.Stage)
ReplaceStage replaces all uses of an existing stage with another one. Will panic if the existing stage is not found.
func (*CodeGenerator) UseDebugMode ¶
func (generator *CodeGenerator) UseDebugMode(groupSpecifier string, outputFolder string)
UseDebugMode configures the generator to use debug mode. groupSpecifier indicates which groups to include (may include wildcards). outputFolder specifies where to write the debug output.