echox

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2018 License: Apache-2.0 Imports: 14 Imported by: 0

README

extensions of echo web framework

Documentation

Overview

*

  • Copyright 2015 @ z3q.net.
  • name : echo
  • author : jarryliu
  • date : 2015-12-04 10:51
  • description :
  • history :

*

  • Copyright 2015 @ at3.net.
  • name : middleware.go
  • author : jarryliu
  • date : 2016-11-20 22:42
  • description :
  • history :

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRenderer

func NewRenderer(t *gof.CacheTemplate) echo.Renderer

func StopAttackMiddleware

func StopAttackMiddleware(h echo.HandlerFunc) echo.HandlerFunc

防SQL注入

Types

type Context

type Context struct {
	echo.Context

	App     gof.App
	Session *session.Session
	Storage storage.Interface
	// contains filtered or unexported fields
}

func (*Context) Debug

func (c *Context) Debug(err error) error

func (*Context) Error

func (c *Context) Error(err error)

func (*Context) IsPost

func (c *Context) IsPost() bool

func (*Context) NewData

func (c *Context) NewData() *TemplateData

func (*Context) RealIp

func (c *Context) RealIp() string

返回真实IP

func (*Context) Render

func (c *Context) Render(code int, name string, data interface{}) error

覆写Render方法

func (*Context) RenderOK

func (c *Context) RenderOK(name string, data interface{}) error

func (*Context) RequestRawURI

func (c *Context) RequestRawURI(r *http.Request) string

获取请求完整的地址

func (*Context) StringOK

func (c *Context) StringOK(s string) error

type Echo

type Echo struct {
	*echo.Echo
	// contains filtered or unexported fields
}

func New

func New() *Echo

new echo instance

func (*Echo) Any

func (e *Echo) Any(path string, h Handler)

注册自定义的GET/POST处理程序

func (*Echo) Auto

func (e *Echo) Auto(prefix string, i interface{})

将控制器下所有的动作映射到路由,如果动作名只有首字母为大写, 那么URL中动作名小写,反之与动作名一致

func (*Echo) AutoGET

func (e *Echo) AutoGET(prefix string, i interface{})

func (*Echo) AutoPOST

func (e *Echo) AutoPOST(prefix string, i interface{})

func (*Echo) Classic

func (e *Echo) Classic() *echo.Echo

获取Echo原始对象

func (*Echo) GET

func (e *Echo) GET(path string, h Handler)

注册自定义的GET处理程序

func (*Echo) GetVariable

func (e *Echo) GetVariable(key string) interface{}

获取变量

func (*Echo) Group

func (e *Echo) Group(prefix string, m ...echo.MiddlewareFunc) *Group

分组

func (*Echo) Original

func (e *Echo) Original() *echo.Echo

获取原始的Echo对象

func (*Echo) POST

func (e *Echo) POST(path string, h Handler)

注册自定义的POST处理程序

func (*Echo) SetApp

func (e *Echo) SetApp(app gof.App)

func (*Echo) SetRenderer

func (e *Echo) SetRenderer(r echo.Renderer)

设置模板

func (*Echo) SetVariable

func (e *Echo) SetVariable(key string, v interface{})

设置变量

func (*Echo) Static

func (e *Echo) Static(prefix, root string)

静态文件路由

type Group

type Group struct {
	*echo.Group
	// contains filtered or unexported fields
}

func (*Group) Any

func (g *Group) Any(path string, h Handler)

func (*Group) Auto

func (g *Group) Auto(prefix string, i interface{})

将控制器下所有的动作映射到路由

func (*Group) AutoGET

func (g *Group) AutoGET(prefix string, i interface{})

func (*Group) AutoPOST

func (g *Group) AutoPOST(prefix string, i interface{})

func (*Group) Classic

func (g *Group) Classic() *echo.Group

获取Echo原始的Group对象

func (*Group) GET

func (g *Group) GET(path string, h Handler)

func (*Group) POST

func (g *Group) POST(path string, h Handler)

type Handler

type Handler func(*Context) error

type HandlerProvider

type HandlerProvider interface {
	FactoryHandler(path string) *Handler
}

type TemplateData

type TemplateData struct {
	Var  map[string]interface{}
	Map  map[string]interface{}
	Data interface{}
}

Jump to

Keyboard shortcuts

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