Documentation
¶
Index ¶
Constants ¶
View Source
const ( // DynamicCharacter 动态路由符号,比如 /user/:name DynamicCharacter = ':' // WildcardCharacter 通配符,比如 /blog/hi/* WildcardCharacter = '*' )
View Source
const ( // STATIC 静态路由 STATIC = 0 // DYNAMIC 含有动态参数标记 : DYNAMIC = 2 // WILDCARD 含有通配符 * WILDCARD = 2 << 1 // REGEXP 含有正则表达式 REGEXP = 2 << 2 // VALIDATOR 是否含有验证函数 VALIDATOR = 2 << 3 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Route ¶
type Route interface { // Insert 添加路由,路由不可重复 Insert(path string, handlers ...zeroapi.Handler) // Build 解析路由,包括动态参数,正则表达式,验证函数。路由优化 Build(router zeroapi.Router) bool // Lookup 查找路由 Lookup(path string) ([]zeroapi.Handler, map[string]string) // Child 查找节点信息 Child(path string) zeroapi.RouteNode // Children 获取节点列表 Children() []zeroapi.RouteNode // Reset 重置,清理所有数据 Reset() }
Route 路由,每一个 Route 表示一颗基数树,每种 HTTP Method 一个实例
Click to show internal directories.
Click to hide internal directories.