[#97] object: Refactor Patch related structs

* Add getters and setters for related types;
* Fix unit-tests.

Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
This commit is contained in:
Airat Arifullin 2024-07-30 17:49:45 +03:00
parent 8ce8cd6ec2
commit 8609f29a60
4 changed files with 111 additions and 39 deletions

View file

@ -1367,12 +1367,12 @@ func (r *PatchRequestBody) StableMarshal(buf []byte) []byte {
}
var offset int
offset += proto.NestedStructureMarshal(patchRequestBodyAddrField, buf[offset:], r.Address)
for i := range r.NewAttributes {
offset += proto.NestedStructureMarshal(patchRequestBodyNewAttrsField, buf[offset:], &r.NewAttributes[i])
offset += proto.NestedStructureMarshal(patchRequestBodyAddrField, buf[offset:], r.address)
for i := range r.newAttributes {
offset += proto.NestedStructureMarshal(patchRequestBodyNewAttrsField, buf[offset:], &r.newAttributes[i])
}
offset += proto.BoolMarshal(patchRequestBodyReplaceAttrField, buf[offset:], r.ReplaceAttributes)
proto.NestedStructureMarshal(patchRequestBodyPatchField, buf[offset:], r.Patch)
offset += proto.BoolMarshal(patchRequestBodyReplaceAttrField, buf[offset:], r.replaceAttributes)
proto.NestedStructureMarshal(patchRequestBodyPatchField, buf[offset:], r.patch)
return buf
}
@ -1383,12 +1383,12 @@ func (r *PatchRequestBody) StableSize() int {
}
var size int
size += proto.NestedStructureSize(patchRequestBodyAddrField, r.Address)
for i := range r.NewAttributes {
size += proto.NestedStructureSize(patchRequestBodyNewAttrsField, &r.NewAttributes[i])
size += proto.NestedStructureSize(patchRequestBodyAddrField, r.address)
for i := range r.newAttributes {
size += proto.NestedStructureSize(patchRequestBodyNewAttrsField, &r.newAttributes[i])
}
size += proto.BoolSize(patchRequestBodyReplaceAttrField, r.ReplaceAttributes)
size += proto.NestedStructureSize(patchRequestBodyPatchField, r.Patch)
size += proto.BoolSize(patchRequestBodyReplaceAttrField, r.replaceAttributes)
size += proto.NestedStructureSize(patchRequestBodyPatchField, r.patch)
return size
}