github.com/goadesign/goa/goagen/gen_controller


gencontroller

import "github.com/goadesign/goa/goagen/gen_controller"

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

Package files

doc.go generator.go options.go

func Generate

func Generate() (files []string, err error)

Generate is the generator entry point called by the meta generator.

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

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


Generated by godoc2md