Documentation
¶
Overview ¶
Package genmain provides a generator for a skeleton goa application. This generator generates the code for a basic "main" package and is mainly intended as a way to bootstrap new applications. The generator creates a main.go file and one file per resource listed in the API metadata. If a file already exists it skips its creation unless the flag --force is provided on the command line in which case it overrides the content of existing files.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Generate ¶
func Generate() (files []string, err error)
Generate is the generator entry point called by the meta generator.
func GenerateController ¶ added in v1.2.0
func GenerateController(force, regen bool, appPkg, outDir, pkg, name string, r *design.ResourceDefinition) (filename string, err error)
GenerateController generates the controller corresponding to the given resource and returns the generated filename.
Types ¶
type Generator ¶
type Generator struct {
API *design.APIDefinition // The API definition
OutDir string // Path to output directory
DesignPkg string // Path to design package, only used to mark generated files.
Target string // Name of generated "app" package
Force bool // Whether to override existing files
Regen bool // Whether to regenerate scaffolding in place, maintaining controller implementation
// contains filtered or unexported fields
}
Generator is the application code generator.
func NewGenerator ¶ added in v1.2.0
func NewGenerator(options ...Option) *Generator
NewGenerator returns an initialized instance of a JavaScript Client Generator
type Option ¶ added in v1.2.0
type Option func(*Generator)
Option a generator option definition
func DesignPkg ¶ added in v1.2.0
func DesignPkg(designPkg string) Option
DesignPkg Path to design package, only used to mark generated files.