Struct vs map in protobuf

1.6k Views Asked by At

I am trying to create a field in protobuf so that client can pass in arbitrary key value so that server can read that field. I know there are map and struct in protobuf but I don't see the difference of these two. Any insights? Both client and server are in python

1

There are 1 best solutions below

4
On BEST ANSWER

A struct is strictly defined as a map<string, Value>, mapping to Value types, e.g. a (simple) Python class definition

A Protobuf map can support more than only string keys, e.g. a dict