Skip certain indices while encoding

26 views
Skip to first unread message

LakshmiKanth Gupta

unread,
Nov 28, 2022, 3:14:31 AM11/28/22
to Protocol Buffers
Hello All,

message EmployeeData
{
    string name =1;
    string address = 2;
    integer salary =3;
}

1.
When I transmit the EmployeeData., I would like to skip "salary" from encoding.
Is that possible?
2.
Is it possible to tag a void pointer with employeedata object in c++ code?  Some auxillary information

All Inputs are much appreciated.

Thanks in advance,

with best regards,
   Gupta 

Marc Gravell

unread,
Nov 28, 2022, 4:26:11 AM11/28/22
to LakshmiKanth Gupta, Protocol Buffers
For 1 options: a) don't assign a value to salary (unless it is "required" in proto2, which doesn't appear to be the case), or b) create a new EmployeeDataMinimal message that *doesn't have a salary*, and serialize that

(I can't comment on 2; not a C++ person)

--
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/protobuf/a380b0ec-287e-4d9b-8f5c-e9cb5718ef45n%40googlegroups.com.


--
Regards,

Marc

LakshmiKanth Gupta

unread,
Nov 28, 2022, 5:00:02 AM11/28/22
to Protocol Buffers
EmployeeDataMinimal solution doesn't work for me. Use case which I have is much more complex. But many thanks for your helping hand.
Reply all
Reply to author
Forward
0 new messages