handlers

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package handlers manages the exported methods in the service handler code adding/removing exported methods to match the service definition.

Index

Constants

View Source
const HookPath = "handlers/hooks.gotemplate"
View Source
const MiddlewaresPath = "handlers/middlewares.gotemplate"

MiddlewaresPath is the path to the middleware gotemplate file.

View Source
const ServerHandlerPath = "handlers/handlers.gotemplate"

ServerHadlerPath is the relative path to the server handler template file

Variables

This section is empty.

Functions

func New

func New(svc *svcdef.Service, prev io.Reader) (gengokit.Renderable, error)

New returns a truss.Renderable capable of updating server handlers. New should be passed the previous version of the server handler to parse.

func NewHook

func NewHook(prev io.Reader) gengokit.Renderable

NewHook returns a new HookRender

Types

type HookRender

type HookRender struct {
	// contains filtered or unexported fields
}

func (*HookRender) Render

func (h *HookRender) Render(_ string, _ *gengokit.Data) (io.Reader, error)

Render will return the existing file if it exists, otherwise it will return a brand new copy from the template.

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.

func (*Middlewares) Render

func (m *Middlewares) Render(path string, data *gengokit.Data) (io.Reader, error)

Render creates the middlewares.go file. With no previous version it renders the templates, if there was a previous version loaded in, it passes that through.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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