render

package
v0.0.0-...-f9573de Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2017 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultVars

func DefaultVars(req *http.Request, m Vars) map[string]interface{}

DefaultVars adds the default vars (User and Session) to the data map using the global renderer instance

func Form

func Form(req *http.Request, model interface{}, errs *validator.StructErrors) htmlform.Form

Form creates a htmlform.Form from a model and http.Request

func Ftos

func Ftos(req *http.Request, model interface{}) error

Ftos converts form data into a model

func HTML

func HTML(w http.ResponseWriter, status int, name string, binding interface{}, htmlOpt ...render.HTMLOptions)

HTML is an alias to github.com/unrolled/render.Render.HTML

func Vtom

func Vtom(req *http.Request, errs *validator.StructErrors) func(field string) map[string]interface{}

Vtom converts validator.v5 errors to a map[string]interface{}

func WithCsrfHandler

func WithCsrfHandler(h http.Handler) http.Handler

WithCsrfHandler is a middleware wrapper providing CSRF validation

Types

type Config

type Config interface {
	Asset() func(string) ([]byte, error)
	AssetNames() func() []string
	// Config is any config struct to make available as `Config` in the template
	Config() interface{}
}

Config is the renderer configuration

type Renderer

type Renderer struct {
	*render.Render
	// contains filtered or unexported fields
}

Renderer encapsulates unrolled/render and the renderer config

var Render Renderer

Render is a global instance of github.com/unrolled/render.Render

func New

func New(config Config) Renderer

New creates a new instance of github.com/unrolled/render.Render

func NewFromRender

func NewFromRender(r *render.Render, config Config) Renderer

NewFromRender returns a new Renderer using the supplied unrolled.Render

func (Renderer) DefaultVars

func (r Renderer) DefaultVars(req *http.Request, m Vars) map[string]interface{}

DefaultVars adds the default vars (User and Session) to the data map

type Vars

type Vars map[string]interface{}

Vars is a map of variables

Jump to

Keyboard shortcuts

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