fix: Redis侧边栏扫描也自动补通配符
RedisScanKeys 端点的 pattern 参数无通配符时自动追加 *, 与查询页 KEYS 命令行为一致,输入 match 即匹配 match*
This commit is contained in:
1 parent
b8df2c0027
commit
7f09ef8e1a
1 file changed
+4
@@ -120,6 +120,10 @@ func RedisScanKeys(c *gin.Context) {
|
|||||||
id := c.Param("id")
|
id := c.Param("id")
|
||||||
dbParam := c.Query("db")
|
dbParam := c.Query("db")
|
||||||
pattern := c.DefaultQuery("pattern", "*")
|
pattern := c.DefaultQuery("pattern", "*")
|
||||||
|
// Auto-append * if pattern has no wildcard (user-friendly fuzzy search)
|
||||||
|
if !strings.Contains(pattern, "*") && !strings.Contains(pattern, "?") && !strings.Contains(pattern, "[") {
|
||||||
|
pattern = pattern + "*"
|
||||||
|
}
|
||||||
count, _ := strconv.Atoi(c.DefaultQuery("count", "100"))
|
count, _ := strconv.Atoi(c.DefaultQuery("count", "100"))
|
||||||
cursorParam := c.DefaultQuery("cursor", "0")
|
cursorParam := c.DefaultQuery("cursor", "0")
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user