追加 protobuf 重复字段

Append protobuf repeated field

message ColectionData
{
   repeated collection1 = 1;
   repeated collection2 = 2;
}

我正在从消息中检索数据,例如

auto collection = collectionData.collection1();

现在,我需要将 collection 附加到 collectionData.collection2()

这可以通过collection.MergeFrom()

来实现