chore: forbid rename key in cluster mode
This commit is contained in:
parent
78bac6078a
commit
4a0807e463
|
@ -1396,8 +1396,12 @@ func (c *connectionService) RenameKey(connName string, db int, key, newKey strin
|
|||
return
|
||||
}
|
||||
|
||||
_, err = client.RenameNX(ctx, key, newKey).Result()
|
||||
if err != nil {
|
||||
if _, ok := client.(*redis.ClusterClient); ok {
|
||||
resp.Msg = "RENAME not support in cluster mode yet"
|
||||
return
|
||||
}
|
||||
|
||||
if _, err = client.RenameNX(ctx, key, newKey).Result(); err != nil {
|
||||
resp.Msg = err.Error()
|
||||
return
|
||||
}
|
||||
|
|
|
@ -30,11 +30,6 @@ type Connection struct {
|
|||
|
||||
type Connections []Connection
|
||||
|
||||
type ConnectionGroup struct {
|
||||
GroupName string `json:"groupName" yaml:"group_name"`
|
||||
Connections []Connection `json:"connections" yaml:"connections"`
|
||||
}
|
||||
|
||||
type ConnectionDB struct {
|
||||
Name string `json:"name"`
|
||||
Index int `json:"index"`
|
||||
|
|
|
@ -14,6 +14,7 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
"tinyrdm/backend/types"
|
||||
"unicode/utf8"
|
||||
)
|
||||
|
||||
// ConvertTo convert string to specified type
|
||||
|
@ -187,7 +188,9 @@ func decodeJson(str string) (string, bool) {
|
|||
|
||||
func decodeBase64(str string) (string, bool) {
|
||||
if decodedStr, err := base64.StdEncoding.DecodeString(str); err == nil {
|
||||
return string(decodedStr), true
|
||||
if s := string(decodedStr); utf8.ValidString(s) {
|
||||
return s, true
|
||||
}
|
||||
}
|
||||
return str, false
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue