redis-shake工具
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

32 lines
734 B

package client
import (
"bytes"
"github.com/alibaba/RedisShake/internal/client/proto"
"github.com/alibaba/RedisShake/internal/log"
)
func ArrayString(replyInterface interface{}, err error) []string {
if err != nil {
log.PanicError(err)
}
replyArray := replyInterface.([]interface{})
replyArrayString := make([]string, len(replyArray))
for inx, item := range replyArray {
replyArrayString[inx] = item.(string)
}
return replyArrayString
}
func EncodeArgv(argv []string, buf *bytes.Buffer) {
writer := proto.NewWriter(buf)
argvInterface := make([]interface{}, len(argv))
for inx, item := range argv {
argvInterface[inx] = item
}
err := writer.WriteArgs(argvInterface)
if err != nil {
log.PanicError(err)
}
}