mirror of
https://github.com/HDT3213/godis.git
synced 2025-10-04 16:32:41 +08:00
use regex implementing wildcard
This commit is contained in:
@@ -280,7 +280,10 @@ func execPersist(db *DB, args [][]byte) redis.Reply {
|
||||
|
||||
// execKeys returns all keys matching the given pattern
|
||||
func execKeys(db *DB, args [][]byte) redis.Reply {
|
||||
pattern := wildcard.CompilePattern(string(args[0]))
|
||||
pattern, err := wildcard.CompilePattern(string(args[0]))
|
||||
if err != nil {
|
||||
return protocol.MakeErrReply("ERR illegal wildcard")
|
||||
}
|
||||
result := make([][]byte, 0)
|
||||
db.data.ForEach(func(key string, val interface{}) bool {
|
||||
if pattern.IsMatch(key) {
|
||||
|
Reference in New Issue
Block a user