mirror of
https://github.com/gin-gonic/gin.git
synced 2026-06-13 00:59:29 +08:00
Merge ad38d93dbc3713abbff8db692350a838d64ef3e5 into 5f4f9643258dc2a65e684b63f12c8d543c936c67
This commit is contained in:
commit
4ec4217758
22
tree.go
22
tree.go
@ -130,18 +130,28 @@ func (n *node) incrementChildPrio(pos int) int {
|
|||||||
return newPos
|
return newPos
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (n *node) compareEmptyTree(path string, fullPath string, handlers HandlersChain) {
|
||||||
|
if len(n.path) == 0 && len(n.children) == 0 {
|
||||||
|
n.insertChild(path, fullPath, handlers)
|
||||||
|
n.nType = root
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// addRoute adds a node with the given handle to the path.
|
// addRoute adds a node with the given handle to the path.
|
||||||
// Not concurrency-safe!
|
// Not concurrency-safe!
|
||||||
func (n *node) addRoute(path string, handlers HandlersChain) {
|
func (n *node) addRoute(path string, handlers HandlersChain) {
|
||||||
fullPath := path
|
fullPath := path
|
||||||
n.priority++
|
n.priority++
|
||||||
|
|
||||||
// Empty tree
|
// // Empty tree
|
||||||
if len(n.path) == 0 && len(n.children) == 0 {
|
// if len(n.path) == 0 && len(n.children) == 0 {
|
||||||
n.insertChild(path, fullPath, handlers)
|
// n.insertChild(path, fullPath, handlers)
|
||||||
n.nType = root
|
// n.nType = root
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
n.compareEmptyTree(path, fullPath, handlers)
|
||||||
|
|
||||||
parentFullPathIndex := 0
|
parentFullPathIndex := 0
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user