protobuf中的枚举缺省值应该为ENUN_TYPE_UNSPECIFIED

来源:互联网 发布:python清屏 编辑:程序博客网 时间:2024/05/16 13:47
protobuf中的枚举缺省值应该为ENUN_TYPE_UNSPECIFIED

(金庆的专栏 2017.11)

Googol 公布的 API Design 规范中,*.proto 中的枚举缺省值建议为 ENUN_TYPE_UNSPECIFIED。

https://mp.weixin.qq.com/s?__biz=MzA5ODg4Mzk2OQ==&mid=2247483705&idx=1&sn=cc2ffef9ac431510c1791dbe6e774b85

The first value should be named ENUM_TYPE_UNSPECIFIED as it is returned when an enum value is not explicitly specified.

enum FooBar {
  // The first value represents the default and must be == 0.
  FOO_BAR_UNSPECIFIED = 0;
  FIRST_VALUE = 1;
  SECOND_VALUE = 2;
}


参考:protobuf中的枚举缺省值应该为UNKNOWN
http://blog.csdn.net/jq0123/article/details/52219597

原创粉丝点击