web

package
v0.0.0-...-b425644 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultHandler

func DefaultHandler(h func(w http.ResponseWriter, r *http.Request, params httprouter.Params)) func(w http.ResponseWriter, r *http.Request)

Types

type Action

type Action interface {
	Template() ([]byte, error)
}

type App

type App struct {
	Layout       Layout
	DefaultTitle string
	Funcs        template.FuncMap
	// contains filtered or unexported fields
}

func New

func New(layout Layout) *App

func (*App) ActionHandler

func (t *App) ActionHandler(action Action) func(w http.ResponseWriter, r *http.Request, params httprouter.Params)

func (*App) HandleAction

func (t *App) HandleAction(w http.ResponseWriter, r *http.Request, action Action)

func (*App) HandleError

func (t *App) HandleError(w http.ResponseWriter, e error)

allow registering error pages

func (*App) Handler

func (t *App) Handler(action Action) func(w http.ResponseWriter, r *http.Request, params httprouter.Params)

func (*App) LayoutHandler

func (t *App) LayoutHandler(layout Layout, action Action) func(w http.ResponseWriter, r *http.Request, params httprouter.Params)

func (*App) Url

func (a *App) Url(name string, params ...interface{}) string

type Layout

type Layout interface {
	Load(*http.Request, Action, template.HTML) error
	Template() ([]byte, error)
}

type LoadAction

type LoadAction interface {
	Action
	Load(r *http.Request) error
}

type LoadWithParamsAction

type LoadWithParamsAction interface {
	Action
	Load(r *http.Request, params httprouter.Params) error
}

type NamedRoute

type NamedRoute struct {
	Name    string
	Handler interface{}
}

type Router

type Router map[string]map[string]func(http.ResponseWriter, *http.Request, httprouter.Params)

func (Router) Handler

func (r Router) Handler() (h http.Handler, err error)

type UrlFunc

type UrlFunc func(...interface{}) string

Jump to

Keyboard shortcuts

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