思考(七十一):Protobuf oneof 实现消息分发

oneof

官方文档介绍: https://developers.google.com/protocol-buffers/docs/reference/go-generated#oneof

需要科学上网,所以直接摘录下内容,方便查阅:

Oneof Fields

For a oneof field, the protobuf compiler generates a single field with an interface type isMessageName_MyField. It also generates a struct >for each of the singular fields within the oneof. These all implement this isMessageName_MyField interface.

For this message with a oneof field:

package account;
message Profile {
 oneof avatar {
   string image_url = 1

你可能感兴趣的:(Go游戏服务器开发的一些思考,protobuf,proto3,oneof,消息分发,golang类型转换性能)