generator

package
v0.0.0-...-8e53b5f Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2020 License: Apache-2.0 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 interface {
	// this ID must be a snake case string and must be unique.
	ID() string

	// CLIFlags is called by the executable in order to
	// inject the flags into the CLI framework. All the CLI flags
	// will have their Name and EnvVars values modified to be prefixed.
	// For example, a Generator who's ID() value is "basic" and has
	// a cli.StringFlag with a name of "package-name" and EnvVars of "PACKAGE_NAME"
	// will have the resulting cli access:
	// --opt-basic-package-name (cli flag)
	// ECSGEN_OPT_BASIC_PACKAGE_NAME (env var)
	CLIFlags() []cli.Flag

	// Validate ensures that configuration is valid
	// for the the given code generator.
	Validate() error

	// Execute will be called by the application when the loader has
	// successfully loaded the package.
	Execute(r *ecsgen.Root) error
}

The Generator interface is used to define a way to create multiple output plugins that allow ecsgen to create various code off of a single loaded schema.

type Registry

type Registry interface {
	// Register is used to add a Generator to the Registry.
	Register(Generator) error

	// Get is used to retrieve a Generator from the Registry.
	Get(string) (Generator, error)

	// All is used to retrieve all of the generators in the registry.
	All() []Generator

	// CLIFlags returns a flat set of CLI flags for all plugins registered.
	CLIFlags() []cli.Flag
}

Registry is a type that is used to hold all the output generators. This is similar to common plugin registry patterns in other go code.

func NewRegistry

func NewRegistry() Registry

NewRegistry is used to initialize a new registry.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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