Get data by pattern #1

Merged
milano15662 merged 4 commits from get-data-by-pattern into master 2022-03-25 10:10:05 +00:00
1 changed files with 6 additions and 1 deletions
Showing only changes of commit 1ab40b99b8 - Show all commits

View File

@ -1,6 +1,9 @@
package redisdb
import "context"
import (
"context"
"fmt"
)
// GetWithPrefixPattern ...
func GetWithPrefixPattern(pattern string, limit int64) (keys []string, values []string) {
@ -16,10 +19,12 @@ func GetWithPrefixPattern(pattern string, limit int64) (keys []string, values []
keys, cursor, err = rdb.Scan(ctx, cursor, pattern, limit).Result()
if err != nil {
fmt.Println("err redis scan: ", err.Error())
return
}
if len(keys) == 0 {
fmt.Println("NO keys")
return
}