mirror of
https://github.com/HDT3213/godis.git
synced 2025-10-05 08:46:56 +08:00
Feat:Add "copy" command
Add "copy" command,also fixes the out of range error of select when the number is negative. Move execCopy to "keys.go" , Add test in "keys_test.go", Add "copy.go" and "copy_test.go" file.
This commit is contained in:
@@ -42,7 +42,7 @@ func execSelect(c redis.Connection, args [][]byte) redis.Reply {
|
||||
if err != nil {
|
||||
return protocol.MakeErrReply("ERR invalid DB index")
|
||||
}
|
||||
if dbIndex >= config.Properties.Databases {
|
||||
if dbIndex >= config.Properties.Databases || dbIndex < 0 {
|
||||
return protocol.MakeErrReply("ERR DB index is out of range")
|
||||
}
|
||||
c.SelectDB(dbIndex)
|
||||
|
Reference in New Issue
Block a user