Documentation
¶
Index ¶
Constants ¶
View Source
const ( MethodGet = "Get" MethodHead = "Head" MethodPost = "Post" MethodPut = "Put" MethodPatch = "Patch" // RFC 5789 MethodDelete = "Delete" MethodConnect = "Connect" MethodOptions = "Options" MethodTrace = "Trace" )
Variables ¶
View Source
var DefaultConvertor = Convertor
默认转换函数
View Source
var MethodAny = []string{ MethodGet, MethodHead, MethodPost, MethodPut, MethodPatch, MethodDelete, MethodConnect, MethodOptions, MethodTrace, }
View Source
var MethodExpr = regexp.MustCompile(`\.(Any|` + strings.Join(MethodAny, "|") + `)(\w*)`)
请求方法的正则表达式
View Source
var ParsePath = func(path string) string {
if path == "" {
return ""
}
new := relativePath.Replace(path)
if 'A' <= path[0] && path[0] <= 'Z' {
new = new[2:]
}
return "/" + new
}
路径解析
Functions ¶
Types ¶
type Group ¶
type Group struct { // 相对路径 (r.Group) Path string // 中间件 (r.Use) Middlewares []gin.HandlerFunc // 自定义函数 // 用户可以自行绑定内容 CustomFunc func(r gin.IRouter) // 自动接口绑定 (r.Handle) Handlers []HandlerFunc // 自定义路径绑定 (r.Handle) HandlerMap map[string]HandlerFunc // 转换器 // 为空则使用默认转换函数 Convertor func(HandlerFunc) gin.HandlerFunc // 子接口组 Groups []Group }
接口组 (r = gin.IRouter)
type H ¶
type H = []HandlerFunc
type M ¶
type M = []gin.HandlerFunc
Click to show internal directories.
Click to hide internal directories.