protobuf-语法

https://blog.csdn.net/qq_22660775/article/details/89163881

https://blog.csdn.net/qq_22660775/article/details/89044538

生成命令:

protoc -I <生成文件目录>  <*.proto文件路径> --go_out=plugins=grpc:<生成文件目录>   

语法:

message xxx {
  // 字段规则:required -> 字段只能也必须出现 1 次
  // 字段规则:optional -> 字段可出现 0 次或1次
  // 字段规则:repeated -> 字段可出现任意多次(包括 0)
  // 类型:int32、int64、sint32、sint64、string、32-bit ....
  // 字段编号:0 ~ 536870911(除去 19000 到 19999 之间的数字)
  字段规则 类型 名称 = 字段编号;
}
发布了24 篇原创文章 · 获赞 1 · 访问量 1263

猜你喜欢

转载自blog.csdn.net/birdswillbecomdragon/article/details/104616178
今日推荐