代码拉取完成,页面将自动刷新
package baa
const (
GET int = iota
POST
PUT
DELETE
PATCH
OPTIONS
HEAD
// RouteLength route table length
RouteLength
)
// RouterMethods declare method key in route table
var RouterMethods = map[string]int{
"GET": GET,
"POST": POST,
"PUT": PUT,
"DELETE": DELETE,
"PATCH": PATCH,
"OPTIONS": OPTIONS,
"HEAD": HEAD,
}
// RouterMethodName declare method name with route table key
var RouterMethodName = map[int]string{
GET: "GET",
POST: "POST",
PUT: "PUT",
DELETE: "DELETE",
PATCH: "PATCH",
OPTIONS: "OPTIONS",
HEAD: "HEAD",
}
// Router is an router interface for baa
type Router interface {
// SetAutoHead sets the value who determines whether add HEAD method automatically
// when GET method is added. Combo router will not be affected by this value.
SetAutoHead(v bool)
// SetAutoTrailingSlash optional trailing slash.
SetAutoTrailingSlash(v bool)
// Match find matched route then returns handlers and name
Match(method, uri string, c *Context) ([]HandlerFunc, string)
// URLFor use named route return format url
URLFor(name string, args ...interface{}) string
// Add registers a new handle with the given method, pattern and handlers.
Add(method, pattern string, handlers []HandlerFunc) RouteNode
// GroupAdd registers a list of same prefix route
GroupAdd(pattern string, f func(), handlers []HandlerFunc)
// Routes returns registered route uri in a string slice
Routes() map[string][]string
// NamedRoutes returns named route uri in a string slice
NamedRoutes() map[string]string
}
// RouteNode is an router node
type RouteNode interface {
Name(name string)
}
// IsParamChar check the char can used for route params
// a-z->65:90, A-Z->97:122, 0-9->48->57, _->95
func IsParamChar(c byte) bool {
if (c >= 65 && c <= 90) || (c >= 97 && c <= 122) || (c >= 48 && c <= 57) || c == 95 {
return true
}
return false
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。