How to add a int array in protobuf message

后端 未结 1 1259
天涯浪人
天涯浪人 2021-02-05 00:37

I have to compose a protobuf message which should have 1 integer variables and a integer array.

package protobuf;

message myProto {

optional uint32 message_id         


        
相关标签:
1条回答
  • 2021-02-05 01:25

    Array is mapped via "repeated":

     repeated int32 data = 4;
    

    Note you might want sint32/uint32. Also note that in all three cases "packed arrays" can be used, which are more efficient;

    repeated int32 data = 4 [packed=true];
    
    0 讨论(0)
提交回复
热议问题