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消息定义 消息由至少一个 ...
随机推荐
- 曲线学习PyQt5方案一
PyQt5官方网站没直接给出API,这个很操蛋啊. PtQt4官方网站有完整的API,C++版本的Qt5也能找到完整的API资料.由于Qt5的C++和Python3的类和函数实现应该是一致的,所以可以 ...
- Eclipse & Visual Studio
VS中的解决方案 vs Eclipse中的workspace Maven包管理 vs Nuget类库管理 build path vs
- 虚拟机中Lvs配置
参考:http://zh.linuxvirtualserver.org/node/272 环境,三台centos 5.2.基于ipvsadm的负载均衡,采用DR方式,负载均衡的服务是web. 内核版本 ...
- powerdesinger导出数据库说明文档
设置表结构要展示的属性,以及各个属性的展示列宽 不显示标题 右键单击items,选择format,然后Available栏中选择ListText选项卡,设置表格边框 保存为模板,Report-> ...
- 常用 Git 操作
最新博客链接:https://feiffy.cc/Git 日常用到的GIT的一些操作,记下来,以备参考. 删除文件 git rm filename git commit -m "remove ...
- java URL、HTTP与HTML+CSS
一.Web三大基石 1 二.API(Application Programming Interface,应用程序编程接口) 1 三.题目分析总结: 3 五.HTTP协议与寄信是类似的 6 请求报文 6 ...
- KVM虚拟机添加硬盘
1,创建硬盘 qemu-img create -f raw /opt/GlusterFS1_data.img 30G 硬盘名称为GlusterFS1_data.img 大小为30G 2,编辑虚拟机配置 ...
- Python全栈day21(函数的解耦)
针对上一篇对文件的操作程序,执行一次操作的函数查询,添加,修改,删除都需要在函数里面定义文件处理的过程,整体函数看起来比较乱,代码重复过多 下面新定义一个函数专门用于处理文件操作,然后在不同的函数里面 ...
- ZOJ 3932 Handshakes
Last week, n students participated in the annual programming contest of Marjar University. Students ...
- C# ArcEngine 实现点击要素高亮并弹出其属性
本文是模仿ArcMap里面的Identify(识别)功能,通过点击要素,使其高亮显示并弹出其属性表!本文只做了点击查询! 本文所用的环境为VS2010,AecEngine基于C#语言,界面是用Dev做 ...