[#168] object: Implement binary/JSON encoders/decoders on Object

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2020-11-13 15:51:27 +03:00 committed by Alex Vanin
parent 9cdd14841a
commit 9325e22871
7 changed files with 102 additions and 15 deletions

View file

@ -557,6 +557,17 @@ func (o *Object) StableUnmarshal(data []byte) error {
return nil
}
func (o *Object) Unmarshal(data []byte) error {
m := new(object.Object)
if err := goproto.Unmarshal(data, m); err != nil {
return err
}
*o = *ObjectFromGRPCMessage(m)
return nil
}
func (r *GetRequestBody) StableMarshal(buf []byte) ([]byte, error) {
if r == nil {
return []byte{}, nil