controller

package
v0.0.0-...-eca6f23 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller struct {
	// Container provides route handlers with access to all services.
	Container *services.Container
}

Controller stores the Container, providing the route handlers with access to all necessary dependencies.

func NewController

func NewController(c *services.Container) Controller

NewController creates a new Controller.

func (*Controller) Redirect

func (c *Controller) Redirect(ctx echo.Context, route string, routeParams ...interface{}) error

func (*Controller) RenderErrorResponse

func (c *Controller) RenderErrorResponse(ctx echo.Context, status int, err error, msg string) error

func (*Controller) RenderJSONResponse

func (c *Controller) RenderJSONResponse(ctx echo.Context, resp JSONResponse) error

type JSONResponse

type JSONResponse struct {
	StatusCode int
	Headers    map[string]string
	RequestID  string
	Path       string
	URL        string
	Context    echo.Context
	ToURL      func(name string, params ...interface{}) string
	Body       interface{}
}

JSONResponse defines the information required to construct a JSON HTTP response.

func NewJSONResponse

func NewJSONResponse(ctx echo.Context) JSONResponse

NewJSONResponse creates a new instance of a JSONResponse struct given an echo context.

Jump to

Keyboard shortcuts

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