gencontroller

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2018 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package gencontroller generates the controller code for a given design resource. This generator is intended for use when resources are added to the design after the initial bootstrapping.

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.

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.
	AppPkg    string                // Name of generated "app" package
	Force     bool                  // Whether to override existing files
	Regen     bool                  // Whether to regenerate scaffolding in place, retaining controller impls
	Pkg       string                // Name of the generated package
	Resource  string                // Name of the generated file
	// contains filtered or unexported fields
}

Generator is the application code generator.

func NewGenerator

func NewGenerator(options ...Option) *Generator

NewGenerator returns an initialized instance of a JavaScript Client Generator

func (*Generator) Cleanup

func (g *Generator) Cleanup()

Cleanup removes all the files generated by this generator during the last invokation of Generate.

func (*Generator) Generate

func (g *Generator) Generate() (_ []string, err error)

Generate produces the skeleton controller service factory.

type Option

type Option func(*Generator)

Option a generator option definition

func API

func API(API *design.APIDefinition) Option

API The API definition

func AppPkg

func AppPkg(pkg string) Option

AppPkg Name of generated "app" package

func DesignPkg

func DesignPkg(designPkg string) Option

DesignPkg Path to design package, only used to mark generated files.

func Force

func Force(force bool) Option

Force Whether to override existing files

func OutDir

func OutDir(outDir string) Option

OutDir Path to output directory

func Pkg

func Pkg(name string) Option

Pkg sets the name of generated package

func Regen added in v1.3.0

func Regen(regen bool) Option

Regen Whether to regenerate scaffolding while maintaining controller impls

func Resource

func Resource(res string) Option

Resource Name of generated the generated file

Jump to

Keyboard shortcuts

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