1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
package radix
import (
"regexp"
"github.com/valyala/fasthttp"
)
type nodeType uint8
type nodeWildcard struct {
path string
paramKey string
handler fasthttp.RequestHandler
}
type node struct {
nType nodeType
path string
tsr bool
handler fasthttp.RequestHandler
hasWildChild bool
children []*node
wildcard *nodeWildcard
paramKeys []string
paramRegex *regexp.Regexp
}
type wildPath struct {
path string
keys []string
start int
end int
pType nodeType
pattern string
regex *regexp.Regexp
}
// Tree is a routes storage
type Tree struct {
root *node
// If enabled, the node handler could be updated
Mutable bool
}
|