Scalar值類型
基本消息字段可以有下列類型其中之一 - 下面的表格顯示在.proto文件中指明的類型和在自動生成類中的相應(yīng)類型。
下面是常用的類型示例:
.proto Type | C++Type | Go Type |
---|---|---|
double | double | float64 |
float | float | float32 |
int32 | int | int32 |
int32 | int | int32 |
int64 | long | int64 |
bool | bool | bool |
string | string | string |
bytes | string | []byte |
參考:https://developers.google.com/protocol-buffers/docs/proto3#scalar
你可以在 Protocol Buffer Encoding 中找到更多資料, 了解當(dāng)你序列化消息的時候, 這些類型是如何編碼的.