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"},
};
Protobuf 数据类型的更多相关文章
- Protobuf数据类型
protobuf编译文件和源码在点击打开链接 1: 数据类型: double: 浮点数 float: 单精度浮点 int32: int类型,使用可变长编码,编码负数不够高效,如果有负数那么使用si ...
- Google 开源技术protobuf
http://blog.csdn.net/hguisu/article/details/20721109#0-tsina-1-1601-397232819ff9a47a7b7e80a40613cfe1 ...
- Google protobuf proto文件编写规则
转载自: http://blog.csdn.net/yi_ya/article/details/40404231 1. 简单介绍 protobuf文件:就是定义你要的消息(类似java中的类)和消息中 ...
- google protobuf使用
下载的是github上的:https://github.com/google/protobuf If you get the source from github, you need to gener ...
- google_protobuf数据类型
要通信,必须有协议,否则双方无法理解对方的码流.在protobuf中,协议是由一系列的消息组成的.因此最重要的就是定义通信时使用到的消息格式. Protobuf消息定义 消息由至少一个字段组合而成,类 ...
- python读写protobuf
0. 前期准备 官方protobuf定义 https://code.google.com/p/protobuf/ python使用指南 https://developers.google. ...
- ScalaPB(4): 通用跨系统protobuf数据,sbt设置
我们知道,在集群环境节点之间进行交换的数据必须经过序列化/反序列化处理过程,而在这方面protobuf是一个比较高效.易用的模式.用户首先在.proto文件中用IDL来定义系统中各种需要进行交换的数据 ...
- 项目中使用protobuf
在互种系统中数据通信或数据交换可以使用protobuf,他比json.xml的数据量要小一些. 另外因为消息要单独写一个.proto文件,来生成各平台的代码,所以对跨平台通信来说也比较友好. 一.使用 ...
- google protobuf 中的proto文件编写规则
1. 简单介绍 protobuf文件:就是定义你要的消息(类似Java中的类)和消息中的各个字段及其数据类型(类似java类中的成员变量和他的数据类型) 2. Protobuf消息定义 消息由至少一个 ...
随机推荐
- 要立刷金组flag了T_T
刷了那么多银组,发现自己好多不会啊... 果然太弱 在这感谢hzwer神犇的blog.. 大部分题解都从黄学长这里来orz. orz.... 果然我太水
- [转]Loadrunner经典面试题
http://www.mianwww.com/html/category/it-interview/loadrunner/ 史上最全 在LoadRunner中为什么要设置思考时间和pacing 答: ...
- 如何使用github,简单教程
前期准备:先行设置SSH KEY(请看我之前发的关于设置添加SSH的文章) 直接上命令: clone 已有仓库到身边的开发环境中 git clone git@github.com:<yourna ...
- std::unique_lock
/*与Mutex RAII相关,方便线程上锁,相比std::lock_guard提供了更好的上锁解锁控制,反正我是没看出来也是在构造时上锁,在析构时解锁,感觉和lock_gurad大差不差都是在线程函 ...
- [移动云计算开发 01] 解决 windows 7 安装设置 nginx 出现端口占用的问题
一开始 到nginx官网 http://nginx.org/en/download.html 下载 1.4.2版本,解压安装到自己希望设置的文件夹即可, 但是打开localhost却出现了 “NOT ...
- powerdesinger导出数据库说明文档
设置表结构要展示的属性,以及各个属性的展示列宽 不显示标题 右键单击items,选择format,然后Available栏中选择ListText选项卡,设置表格边框 保存为模板,Report-> ...
- Strut2流程分析-----从请求到Action方法()
手写请求会通过strutsPrepareAndExcuteFliter的doFilter()方法 然后会调用StrutsActionProxy类的excute()方法,生成一个代理类(ActionPr ...
- 第九课——redis集群
第九课时作业 静哥 by 2016.4.18~2016.4.25 1.节点 (1)节点概念:一个节点就是redis集群里的一台redis服务器.一个redis集群是由多个节点(node)组成,最初每个 ...
- 20165330 2017-2018-2 《Java程序设计》第3周学习总结
课本知识总结 第四章 类与对象 类:包括类声明和类体 基本格式: class 类名 { 类体的内容 } 类声明: class+类名(注意:类名首字母需大写) 类体:类声明之后的一对"{&qu ...
- CSDN BI Flume
https://so.csdn.net/so/search/s.do?q=bytebuf&t=%20&u=