Documentation ¶
Overview ¶
Package handlers renders the Go source files found in <svcname>/handlers/. Most importantly, it handles rendering and modifying the <svcname>/handlers/handlers.go file, while making sure that existing code in that handlers.go file is not deleted.
Index ¶
Constants ¶
const HookPath = "handlers/hooks.gotemplate"
const MiddlewaresPath = "handlers/middlewares.gotemplate"
MiddlewaresPath is the path to the middleware gotemplate file.
const ServerHandlerPath = "handlers/handlers.gotemplate"
ServerHadlerPath is the relative path to the server handler template file
Variables ¶
This section is empty.
Functions ¶
Types ¶
type HookRender ¶
type HookRender struct {
// contains filtered or unexported fields
}
func (*HookRender) Render ¶
Render returns an io.Reader with the contents of <svcname>/handlers/hooks.go. If hooks.go does not already exist, then it's rendered anew from the templates defined in 'gengokit/handlers/templates/hook.go'. If hooks.go does exist already, then:
- Modify the new code so that it will import "{{.ImportPath}}/svc/server" if it doesn't already.
- Add the InterruptHandler if it doesn't exist already
- Add the SetConfig function if it doesn't exist already
type Middlewares ¶
type Middlewares struct {
// contains filtered or unexported fields
}
Middlewares satisfies the gengokit.Renderable interface to render middlewares.
func NewMiddlewares ¶
func NewMiddlewares() *Middlewares
NewMiddlewares returns a Renderable that renders the middlewares.go file.
func (*Middlewares) Load ¶
func (m *Middlewares) Load(prev io.Reader)
Load loads the previous version of the middleware file.