Thread overview | |||||
---|---|---|---|---|---|
|
February 06, 2019 How to use dproto for removing and element from a repeated field | ||||
---|---|---|---|---|
| ||||
Hi, I have been using dproto to work with protocol buffers. I have below proto structure message Person { required string name = 1; required string id = 2; repeated string emailId = 3; } Where a person can have multiple email ids. I could add the email id to person using below code person.emailId ~= "new-email"; However if i want to delete a email id from a person strucure, how would i do that. Thanks, Sudhi |
February 06, 2019 Re: How to use dproto for removing and element from a repeated field | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sudhi | On Wednesday, 6 February 2019 at 10:07:06 UTC, Sudhi wrote: > Hi, > > I have been using dproto to work with protocol buffers. I have below proto structure > > message Person > { > required string name = 1; > required string id = 2; > repeated string emailId = 3; > } > > Where a person can have multiple email ids. > > I could add the email id to person using below code > > person.emailId ~= "new-email"; > > However if i want to delete a email id from a person strucure, how would i do that. > > Thanks, > Sudhi https://dlang.org/phobos/std_algorithm_mutation.html#remove |
February 06, 2019 Re: How to use dproto for removing and element from a repeated field | ||||
---|---|---|---|---|
| ||||
Posted in reply to Paul Backus | On Wednesday, 6 February 2019 at 14:31:59 UTC, Paul Backus wrote:
> On Wednesday, 6 February 2019 at 10:07:06 UTC, Sudhi wrote:
>> Hi,
>>
>> I have been using dproto to work with protocol buffers. I have below proto structure
>>
>> message Person
>> {
>> required string name = 1;
>> required string id = 2;
>> repeated string emailId = 3;
>> }
>>
>> Where a person can have multiple email ids.
>>
>> I could add the email id to person using below code
>>
>> person.emailId ~= "new-email";
>>
>> However if i want to delete a email id from a person strucure, how would i do that.
>>
>> Thanks,
>> Sudhi
>
> https://dlang.org/phobos/std_algorithm_mutation.html#remove
Thanks, that worked for me.
|
Copyright © 1999-2021 by the D Language Foundation