mirror of
https://github.com/EchoVault/SugarDB.git
synced 2025-10-24 00:14:08 +08:00
added RANDOMKEY embedded spec and test
This commit is contained in:
@@ -552,3 +552,14 @@ func (server *EchoVault) Rename(oldKey string, newKey string) (string, error) {
|
||||
// Parse the simple string response
|
||||
return internal.ParseStringResponse(b)
|
||||
}
|
||||
|
||||
//Randomkey returns a random key
|
||||
//If no keys present in db returns an emtpy string
|
||||
func (server *EchoVault) Randomkey() (string, error) {
|
||||
b, err := server.handleCommand(server.context, internal.EncodeCommand([]string{"RANDOMKEY"}), nil, false, true)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return internal.ParseStringResponse(b)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user