mirror of
https://github.com/tiny-craft/tiny-rdm.git
synced 2025-11-02 11:24:06 +08:00
feat: add full search for hash
This commit is contained in:
@@ -692,6 +692,12 @@ func (b *browserService) GetKeyDetail(param types.KeyDetailParam) (resp types.JS
|
||||
}
|
||||
|
||||
case "hash":
|
||||
if !strings.HasPrefix(matchPattern, "*") {
|
||||
matchPattern = "*" + matchPattern
|
||||
}
|
||||
if !strings.HasSuffix(matchPattern, "*") {
|
||||
matchPattern = matchPattern + "*"
|
||||
}
|
||||
loadHashHandle := func() ([]types.HashEntryItem, bool, bool, error) {
|
||||
var items []types.HashEntryItem
|
||||
var loadedVal []string
|
||||
@@ -699,11 +705,11 @@ func (b *browserService) GetKeyDetail(param types.KeyDetailParam) (resp types.JS
|
||||
var reset bool
|
||||
var subErr error
|
||||
scanSize := int64(Preferences().GetScanSize())
|
||||
if param.Full {
|
||||
if param.Full || matchPattern != "*" {
|
||||
// load all
|
||||
cursor, reset = 0, true
|
||||
for {
|
||||
loadedVal, cursor, subErr = client.HScan(ctx, key, cursor, "*", scanSize).Result()
|
||||
loadedVal, cursor, subErr = client.HScan(ctx, key, cursor, matchPattern, scanSize).Result()
|
||||
if subErr != nil {
|
||||
return nil, reset, false, subErr
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user