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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = client.RenameNX(ctx, key, newKey).Result()
|
if _, ok := client.(*redis.ClusterClient); ok {
|
||||||
if err != nil {
|
resp.Msg = "RENAME not support in cluster mode yet"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, err = client.RenameNX(ctx, key, newKey).Result(); err != nil {
|
||||||
resp.Msg = err.Error()
|
resp.Msg = err.Error()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,11 +30,6 @@ type Connection struct {
|
||||||
|
|
||||||
type Connections []Connection
|
type Connections []Connection
|
||||||
|
|
||||||
type ConnectionGroup struct {
|
|
||||||
GroupName string `json:"groupName" yaml:"group_name"`
|
|
||||||
Connections []Connection `json:"connections" yaml:"connections"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ConnectionDB struct {
|
type ConnectionDB struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Index int `json:"index"`
|
Index int `json:"index"`
|
||||||
|
|
|
@ -14,6 +14,7 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"tinyrdm/backend/types"
|
"tinyrdm/backend/types"
|
||||||
|
"unicode/utf8"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ConvertTo convert string to specified type
|
// ConvertTo convert string to specified type
|
||||||
|
@ -187,7 +188,9 @@ func decodeJson(str string) (string, bool) {
|
||||||
|
|
||||||
func decodeBase64(str string) (string, bool) {
|
func decodeBase64(str string) (string, bool) {
|
||||||
if decodedStr, err := base64.StdEncoding.DecodeString(str); err == nil {
|
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
|
return str, false
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue