Documentation ¶
Index ¶
- type App
- type AppConfig
- type Context
- func (ctx *Context) GetValue(key string) interface{}
- func (ctx *Context) Next()
- func (ctx *Context) Param(key string) (string, bool)
- func (ctx *Context) ParamValue(key string) string
- func (ctx *Context) Post(key string) (string, bool)
- func (ctx *Context) PostValue(key string) string
- func (ctx *Context) Posts() url.Values
- func (ctx *Context) Query(key string) (string, bool)
- func (ctx *Context) QueryValue(key string) string
- func (ctx *Context) Querys() url.Values
- func (ctx *Context) Redirect(code int, url string) error
- func (ctx *Context) RemoteIP() string
- func (ctx *Context) RouteValues() []httprouter.Param
- func (ctx *Context) SetValue(key string, value interface{})
- type Event
- type EventHandler
- type Handler
- type RouterGroup
- func (r *RouterGroup) DELETE(path string, handler Handler, middlewareHandlers ...Handler)
- func (r *RouterGroup) FILE(url string, local string)
- func (r *RouterGroup) GET(path string, handler Handler, middlewareHandlers ...Handler)
- func (r *RouterGroup) GROUP(path string, handlers ...Handler) *RouterGroup
- func (r *RouterGroup) HEAD(path string, handler Handler, middlewareHandlers ...Handler)
- func (r *RouterGroup) Handle(method string, path string, handler Handler, middlewareHandlers ...Handler)
- func (r *RouterGroup) OPTIONS(path string, handler Handler, middlewareHandlers ...Handler)
- func (r *RouterGroup) PATCH(path string, handler Handler, middlewareHandlers ...Handler)
- func (r *RouterGroup) PATH(url string, local string, list bool)
- func (r *RouterGroup) POST(path string, handler Handler, middlewareHandlers ...Handler)
- func (r *RouterGroup) PUT(path string, handler Handler, middlewareHandlers ...Handler)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct { Config AppConfig // 配置 Router *RouterGroup // 路由器 // contains filtered or unexported fields }
框架实例
type AppConfig ¶ added in v0.7.0
type AppConfig struct { // Recovery bool // 启用自动恢复 RedirectTrailingSlash bool // 自动重定向到结尾带有或不带有斜杠的URL FixPath bool // 清理URL中的不规范路径分隔符,例如//和../ HandleOPTIONS bool // 自定响应OPTIONS请求 EventHandler EventHandler // 事件处理器,如果未传值则认为不记录事件 EventTrigger bool // 记录事件的触发信息(影响性能) EventTrace bool // 启用事件的跟踪信息(影响性能) EventShortPath bool // 使用事件触发信息的短文件名 }
框架配置
type Context ¶
type Context struct { Request *http.Request // responseWriter customResponseWriter // 自定义response // ResponseWriter _CustomResponseWriter // 用自定义resp替代http.resp ResponseWriter http.ResponseWriter // contains filtered or unexported fields }
连接上下文
func (*Context) ParamValue ¶ added in v0.7.0
获取某个路由参数值的string类型
func (*Context) RouteValues ¶ added in v0.4.1
func (ctx *Context) RouteValues() []httprouter.Param
获取所有路由参数值
type Event ¶
type Event struct { Status int // HTTP状态码 Message error // 消息文本 Trigger _Trigger // 触发信息 Trace []string // 跟踪信息 ResponseWriter http.ResponseWriter Request *http.Request }
事件结构
type RouterGroup ¶
type RouterGroup struct {
// contains filtered or unexported fields
}
路由组
func (*RouterGroup) DELETE ¶
func (r *RouterGroup) DELETE(path string, handler Handler, middlewareHandlers ...Handler)
DELETE 路由
func (*RouterGroup) FILE ¶
func (r *RouterGroup) FILE(url string, local string)
FILE 定义路由到文件,不支持路由组和中间件
func (*RouterGroup) GET ¶
func (r *RouterGroup) GET(path string, handler Handler, middlewareHandlers ...Handler)
GET 路由
func (*RouterGroup) GROUP ¶
func (r *RouterGroup) GROUP(path string, handlers ...Handler) *RouterGroup
GROUP 路由组
func (*RouterGroup) HEAD ¶
func (r *RouterGroup) HEAD(path string, handler Handler, middlewareHandlers ...Handler)
HEAD 路由
func (*RouterGroup) Handle ¶
func (r *RouterGroup) Handle(method string, path string, handler Handler, middlewareHandlers ...Handler)
Handle 路由
func (*RouterGroup) OPTIONS ¶
func (r *RouterGroup) OPTIONS(path string, handler Handler, middlewareHandlers ...Handler)
OPTIONS 路由
func (*RouterGroup) PATCH ¶
func (r *RouterGroup) PATCH(path string, handler Handler, middlewareHandlers ...Handler)
PATCH 路由
func (*RouterGroup) PATH ¶
func (r *RouterGroup) PATH(url string, local string, list bool)
PATH 定义路由到目录,不支持路由组和中间件
Click to show internal directories.
Click to hide internal directories.