Documentation ¶
Index ¶
- Variables
- func Errorf(code int, format string, args ...interface{}) error
- func LoadTemplates(files FileSystem, helpers TemplateHelpers)
- func Redirect(code int, url string) http.HandlerFunc
- func RenderTemplate(c *Context, path string, params interface{}) error
- func RenderTemplatePart(c *Context, path, part string, params interface{}) error
- func TemplateExists(path string) bool
- func UnmarshalOptions(r *http.Request, opts interface{}) error
- type Context
- func (c *Context) Ajax() bool
- func (c *Context) Body() io.ReadCloser
- func (c *Context) BodyJSON(v interface{}) error
- func (c *Context) Context() context.Context
- func (c *Context) Flash(kind, message string) error
- func (c *Context) Flashes() ([]Flash, error)
- func (c *Context) Form(name string) string
- func (c *Context) Get(name string) interface{}
- func (c *Context) Header(name string) string
- func (c *Context) IP() string
- func (c *Context) Logf(format string, args ...interface{})
- func (c *Context) Logger() *logger.Logger
- func (c *Context) Name() string
- func (c *Context) Protocol() string
- func (c *Context) Query(name string) string
- func (c *Context) Read(data []byte) (int, error)
- func (c *Context) Redirect(code int, target string) error
- func (c *Context) RenderJSON(v interface{}) error
- func (c *Context) RenderOK() error
- func (c *Context) RenderTemplate(path string, params interface{}) error
- func (c *Context) RenderTemplatePart(path, part string, params interface{}) error
- func (c *Context) RenderText(t string) error
- func (c *Context) Request() *http.Request
- func (c *Context) Required(names ...string) error
- func (c *Context) Response() *Response
- func (c *Context) SessionGet(name string) (string, error)
- func (c *Context) SessionSet(name, value string) error
- func (c *Context) Set(name string, value interface{})
- func (c *Context) SetVar(name, value string)
- func (c *Context) Tag(format string, args ...interface{})
- func (c *Context) Value(name string) string
- func (c *Context) Var(name string) string
- func (c *Context) Websocket() *websocket.Conn
- func (c *Context) Write(data []byte) (int, error)
- type Error
- type FileSystem
- type Flash
- type HandlerFunc
- type Middleware
- type RecoverFunc
- type Response
- type Route
- type Router
- func (rt *Router) HandleNotFound(fn HandlerFunc)
- func (rt *Router) MatcherFunc(fn mux.MatcherFunc) *Router
- func (rt *Router) Redirect(method, path string, code int, target string)
- func (rt *Router) Route(method, path string, fn HandlerFunc) Route
- func (rt *Router) Static(path string, files FileSystem) Route
- func (rt *Router) Subrouter(prefix string) *Router
- func (rt *Router) SubrouterFunc(prefix string, fn func(*Router))
- func (rt *Router) Use(mw Middleware)
- func (rt *Router) UseHandlerFunc(fn http.HandlerFunc)
- type Server
- type TemplateHelpers
Constants ¶
This section is empty.
Variables ¶
View Source
var ( SessionExpiration = 86400 * 30 SessionName = "" SessionSecret = "" )
Functions ¶
func LoadTemplates ¶
func LoadTemplates(files FileSystem, helpers TemplateHelpers)
func RenderTemplate ¶
func RenderTemplatePart ¶
func TemplateExists ¶
func UnmarshalOptions ¶
Types ¶
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
func NewContext ¶
func NewContext(w http.ResponseWriter, r *http.Request) *Context
func (*Context) Body ¶
func (c *Context) Body() io.ReadCloser
func (*Context) RenderJSON ¶
func (*Context) RenderTemplate ¶
func (*Context) RenderTemplatePart ¶
func (*Context) RenderText ¶
func (*Context) SessionSet ¶
type FileSystem ¶
type FileSystem http.FileSystem
type HandlerFunc ¶
func EnsureHTTPS ¶
func EnsureHTTPS(fn HandlerFunc) HandlerFunc
type Middleware ¶
type Middleware func(fn HandlerFunc) HandlerFunc
type RecoverFunc ¶
type RecoverFunc func(error)
type Response ¶
type Response struct { http.ResponseWriter // contains filtered or unexported fields }
func (*Response) WriteHeader ¶
type Router ¶
type Router struct { *mux.Router Middleware []Middleware Parent *Router Server *Server }
func (*Router) HandleNotFound ¶
func (rt *Router) HandleNotFound(fn HandlerFunc)
func (*Router) MatcherFunc ¶
func (rt *Router) MatcherFunc(fn mux.MatcherFunc) *Router
func (*Router) SubrouterFunc ¶ added in v1.1.0
func (*Router) Use ¶
func (rt *Router) Use(mw Middleware)
func (*Router) UseHandlerFunc ¶
func (rt *Router) UseHandlerFunc(fn http.HandlerFunc)
type Server ¶
type Server struct { *Router Check HandlerFunc Hostname string Logger *logger.Logger Recover RecoverFunc Wrapper func(h http.Handler) http.Handler // contains filtered or unexported fields }
func (*Server) HandleNotFound ¶
func (s *Server) HandleNotFound(fn HandlerFunc)
type TemplateHelpers ¶
Click to show internal directories.
Click to hide internal directories.