controller

package
v0.0.0-...-699b668 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2018 License: MIT Imports: 3 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCtrlFunc

func GetCtrlFunc(ctrl Controller) func() Controller

GetCtrlFunc returns a new copy of the contoller everytime the function is called

Types

type BaseController

type BaseController struct {
	Ctx    *base.Context
	Routes []string
}

BaseController implements the Controller interface, It is recommended all user defined Controllers should embed *BaseController.

func (*BaseController) HTML

func (b *BaseController) HTML(code int)

HTML renders text/html with the given code as status code

func (*BaseController) JSON

func (b *BaseController) JSON(code int)

JSON renders application/json with the given code

func (*BaseController) New

func (b *BaseController) New(ctx *base.Context)

New sets ctx as the active context

func (*BaseController) Render

func (b *BaseController) Render() error

Render commits the changes made in the active context.

func (*BaseController) RenderJSON

func (b *BaseController) RenderJSON(value interface{}, code int)

RenderJSON encodes value into json and renders the response as JSON

func (*BaseController) String

func (b *BaseController) String(code int)

String renders text/plain with given code as status code

type Controller

type Controller interface {
	New(*base.Context)
	Render() error
}

Controller is an interface for utron controllers

Jump to

Keyboard shortcuts

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