Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
10
msgpack.go
10
msgpack.go
@@ -35,6 +35,10 @@ func (c *msgpackCodec) Marshal(v interface{}, opts ...codec.Option) ([]byte, err
|
||||
return m.Data, nil
|
||||
case *pb.Frame:
|
||||
return m.Data, nil
|
||||
case codec.RawMessage:
|
||||
return []byte(m), nil
|
||||
case *codec.RawMessage:
|
||||
return []byte(*m), nil
|
||||
}
|
||||
|
||||
return msgpack.Marshal(v)
|
||||
@@ -68,6 +72,12 @@ func (c *msgpackCodec) Unmarshal(b []byte, v interface{}, opts ...codec.Option)
|
||||
case *pb.Frame:
|
||||
m.Data = b
|
||||
return nil
|
||||
case *codec.RawMessage:
|
||||
*m = append((*m)[0:0], b...)
|
||||
return nil
|
||||
case codec.RawMessage:
|
||||
copy(m, b)
|
||||
return nil
|
||||
}
|
||||
|
||||
return msgpack.Unmarshal(b, v)
|
||||
|
Reference in New Issue
Block a user