From a8008a9418dd20cfaaeb5ae440b26468f79e4117 Mon Sep 17 00:00:00 2001 From: alick-liming Date: Tue, 5 Jan 2021 14:31:18 +0800 Subject: [PATCH] Nodename search (#484) * node name search * node name search * node name search * node name search Co-authored-by: alickliming --- src/modules/rdb/http/router_tree.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/modules/rdb/http/router_tree.go b/src/modules/rdb/http/router_tree.go index a2b9aca9..aa7b67f8 100644 --- a/src/modules/rdb/http/router_tree.go +++ b/src/modules/rdb/http/router_tree.go @@ -80,6 +80,15 @@ func treeUntilLeafGets(c *gin.Context) { if strings.Contains(ret[i].Path, arr[0]) { pathSet[ret[i].Path] = struct{}{} } + + // 根据节点名搜索 + if strings.Contains(ret[i].Name, arr[0]) { + for j := 0; j < cnt; j++ { + if strings.HasPrefix(ret[j].Path, ret[i].Path) { + pathSet[ret[j].Path] = struct{}{} + } + } + } } } } else { @@ -90,6 +99,15 @@ func treeUntilLeafGets(c *gin.Context) { if !strings.Contains(ret[i].Path, arr[j]) { match = false } + + // 根据节点名搜索 + if strings.Contains(ret[i].Name, arr[j]) { + for k := 0; k < cnt; k++ { + if strings.HasPrefix(ret[k].Path, ret[i].Path) { + pathSet[ret[k].Path] = struct{}{} + } + } + } } if match {