apache/dubbo-go-hessian2

希望hessian库提供一个接口,可以将[]byte 和 map 结构互转。

LaurenceLiZhixin opened this issue · 0 comments

What would you like to be added:

希望hessian库提供一个接口,可以将[]byte 转为map实现,并可以将map恢复为[]byte,例如

type User struct{
    Name string
    Age uint32
}

type (u *User) JavaClassName() string{
    return "org.apache.com.myUser"
}

enc := hessian.NewEncoder()
data1 := enc.Encode(&User{}) // encode to []byte

dec := hessian.NewDecoder(data) 

myMap := dec.DecodeMap() // todo []byte to map[string]interface{}
// myMap["name"] == "xxx"
// myMap["age"] == "11"

date2 := enc.EncodeMap(myMap, "org.apache.com.myUser") // data2 should be equal to data1

Why is this needed: