merge_from suport?
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
Research direction
Start by reviewing the existing pb.fields traversal approach and the protoc-loaded message definitions shown in the example. Clarify the intended merge_from behavior for a Person value built from Chinese data, including how matching fields and repeated contacts should be handled; the issue is done when that behavior is specified and supported.
Written by the indexing model from the issue text.
Description
Hi guys, is there any plan about supporting merge_from inteface?
The code below is a example.
As far as I can see, I have to use pb.fields to traverse all the fields and try to merge the values.
But I don't think it is a good idea, any suggestions about the implements?
local pb = require "pb"
local protoc = require "protoc"
assert(protoc:load [[
message Phone {
optional string name = 1;
optional int64 phonenumber = 2;
}
message Person {
optional string name = 1;
optional int32 age = 2;
optional string address = 3;
repeated Phone contacts = 4;
}
message Chinese {
optional string name = 1;
optional int32 age = 2;
optional string address = 3;
repeated Phone contacts = 4;
optional string wechat = 5;
}
]])
-- lua table data
local chinese_data = {
name = "ilse",
age = 18,
wechat = "+86-13333333333",
contacts = {
{ name = "alice", phonenumber = 12312341234 },
{ name = "bob", phonenumber = 45645674567 }
}
}
local person_data = pb.merge_from("Person", chinese_data )
- Dominant language
- Lua
- Stars
- 1.9k
- Forks
- 400
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from starwing/lua-protobuf
-
question
Difficulty 3/5 1-2 days Newbie friendliness 45/100
starwing/lua-protobuf#285 · 3 comments ·
-
question
Difficulty 3/5 1-2 days Newbie friendliness 35/100
starwing/lua-protobuf#282 · 4 comments ·
-
question
Difficulty 5/5 Over a week Newbie friendliness 15/100
starwing/lua-protobuf#279 · 2 comments ·
-
question
Difficulty 4/5 3-5 days Newbie friendliness 30/100
starwing/lua-protobuf#278 · 2 comments ·
-
question
Difficulty 4/5 3-5 days Newbie friendliness 30/100
starwing/lua-protobuf#273 · 1 comment ·
All issues in starwing/lua-protobuf
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
-
[Eco] Egg Config Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
pterodactyl/game-eggs#634 ·
-
Feature Request
Difficulty 1/5 Under an hour Newbie friendliness 72/100
Questie/QuestieTrace#33 ·