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消息定义 消息由至少一个 ...
随机推荐
- cx_Freeze的生成可执行文件
①.生成setup.py文件,仿照cx_Freeze给的例子 ②.python setup.py build 生成单个的可执行,会自动带着需要的动态链接库的.默认路径:build\bdist.win3 ...
- jquery ajax生成Select
function DropDownList(url, domId, defaultValue) { /// <summary> /// ajax生成select /// ...
- hdu 1426:Sudoku Killer(DFS深搜,进阶题目,求数独的解)
Sudoku Killer Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Tot ...
- VC++ Debug条件断点使用
If you're trying to reproduce a rare event and getting too many false positives with your breakpoint ...
- SqlAlchemy使用详解
python之sqlalchemy创建表的实例详解 通过sqlalchemy创建表需要三要素:引擎,基类,元素 from sqlalchemy import create_engine from sq ...
- The user specified as a definer (”@’%') does not exist解决方法
报错如下: 遇见这个问题,网上都是千篇一律,改权限( grant all privileges on *.* to root@”%” identified by “.”; flush privil ...
- Android弹出一项权限请求
Intent enableIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE); startActivityForResult(ena ...
- 【黑金原创教程】【TimeQuest】【第四章】内部延迟与其他
声明:本文为黑金动力社区(http://www.heijin.org)原创教程,如需转载请注明出处,谢谢! 黑金动力社区2013年原创教程连载计划: http://www.cnblogs.com/al ...
- 帧动画和骨骼json、极速、二进制对比
对比总结: 1. 帧动画的效率最高,但是图片超过一定帧数,资源图片非常大.比较适合帧数少,大量动画存在,要求效率高的场合. 骨骼json效率较低,已经不推荐使用. 骨骼极速,不支持网格等. 骨骼二进制 ...
- 170420、maven内置常量
Maven工程插件配置中通常会用到一些Maven变量,因此需要找个地方对这些变量进行统一定义,下面介绍如何定义自定义变量. 在根节点project下增加properties节点,所有自定义变量均可以定 ...