Protobuf 数据类型
.proto Type
Notes | C++ Type | Java Type | |
double | double | double | |
float | float | float | |
int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int |
int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long |
uint32 | Uses variable-length encoding. | uint32 | int |
uint64 | Uses variable-length encoding. | uint64 | long |
sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int |
sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long |
fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 228. | uint32 | int |
fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 256. | uint64 | long |
sfixed32 | Always four bytes. | int32 | int |
sfixed64 | Always eight bytes. | int64 | long |
bool | bool | boolean | |
string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String |
bytes | May contain any arbitrary sequence of bytes. | string | ByteString |
public static Dictionary<string, string> MySqlToProbuffer = new Dictionary<string, string>()
{
{"varchar", "string"},
{"longtext", "string"},
{"text", "string"},
{"char", "string"},
{"mediumtext", "string"},
{"bigint", "int64"},
{"datetime", "int64"},
{"timestamp", "int64"},
{"int", "int32"},
{"tinyint", "int32"},
{"smallint", "int32"},
{"decimal", "double"},
{"double", "double"},
{"float", "float"},
{"bit", "bool"},
{"blob", "bytes"},
{"longblob", "bytes"},
{"varbinary", "bytes"},
{"binary", "bytes"}
};
public static Dictionary<string, string> ProbufferToJava = new Dictionary<string, string>()
{
{"string", "String"},
{"int32", "Integer"},
{"int64", "Long"},
{"double", "Double"},
{"float", "Float"},
{"bool", "Boolean"},
{"bytes", "ByteString"},
{"uint32", "Integer"},
{"uint64", "Long"},
{"sint32", "Integer"},
{"sint64", "Long"},
{"fixed32", "Integer"},
{"fixed64", "Long"},
{"sfixed32", "Integer"},
{"sfixed64", "Long"},
};
最新文章
- JRebel Windows RegCreateKeyEx(...) returned error code 5.
- 纯CSS完成tab实现5种不同切换对应内容效果
- Python实现支持并发、断点续传的FTP
- DataTable使用技巧总结【转】
- HDU2680 Choose the best route 最短路 分类: ACM 2015-03-18 23:30 37人阅读 评论(0) 收藏
- IIS7报错:如果要使用托管的处理程序,请安装 ASP.NET
- 数据结构(线段树):Educational Codeforces Round 6 620E. New Year Tree
- android layout的布局
- SQL学习之使用常用函数处理数据
- Qt中利用QTime类来控制时间,这里简单介绍一下QTime的成员函数的用法:
- Spark2.1.0——Spark初体验
- CSS中的一下小技巧2之CSS3动画勾选运用
- sqlite处理数据
- Shiro自定义过滤器
- Spark RDD Action 简单用例(一)
- <;转>;jmeter(十三)常见问题及解决方法
- 【Hadoop 分布式部署 一 :分布式部署准备虚拟机 】
- Delphi实现菜单项上出现提示
- AndroidStudio不自己主动加入新创建的文件到VCS
- 安卓程序代写 网上程序代写[转]SVN 在线代码托管工具