support lua in decode mode

v4
vinllen 5 years ago
parent 7b8d3e2c6a
commit d7e515adb2
  1. 16
      src/redis-shake/decode.go

@ -136,11 +136,25 @@ func (cmd *CmdDecode) decoderMain(ipipe <-chan *rdb.BinEntry, opipe chan<- strin
return string(b) return string(b)
} }
for e := range ipipe { for e := range ipipe {
var b bytes.Buffer
if e.Type == rdb.RdbFlagAUX && string(e.Key) == "lua" {
o := &struct {
Type string `json:"type"`
Key string `json:"key"`
Value64 string `json:"value64"`
}{
"aux", "lua", string(e.Value),
}
fmt.Fprintf(&b, "%s\n", toJson(o))
cmd.nentry.Incr()
opipe <- b.String()
continue
}
o, err := rdb.DecodeDump(e.Value) o, err := rdb.DecodeDump(e.Value)
if err != nil { if err != nil {
log.PanicError(err, "decode failed") log.PanicError(err, "decode failed")
} }
var b bytes.Buffer
switch obj := o.(type) { switch obj := o.(type) {
default: default:
log.Panicf("unknown object %v", o) log.Panicf("unknown object %v", o)

Loading…
Cancel
Save