How to define an optional field in protobuf 3

前端 未结 9 1416
无人及你
无人及你 2020-12-22 18:14

I need to specify a message with an optional field in protobuf (proto3 syntax). In terms of proto 2 syntax, the message I want to express is something like:

         


        
9条回答
  •  佛祖请我去吃肉
    2020-12-22 19:12

    There is a good post about this: https://itnext.io/protobuf-and-null-support-1908a15311b6

    The solution depends on your actual use case:

    • Handling partial update

    • Support null

提交回复
热议问题