.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 数据类型的更多相关文章

  1. Protobuf数据类型

    protobuf编译文件和源码在点击打开链接 1:   数据类型: double: 浮点数 float: 单精度浮点 int32: int类型,使用可变长编码,编码负数不够高效,如果有负数那么使用si ...

  2. Google 开源技术protobuf

    http://blog.csdn.net/hguisu/article/details/20721109#0-tsina-1-1601-397232819ff9a47a7b7e80a40613cfe1 ...

  3. Google protobuf proto文件编写规则

    转载自: http://blog.csdn.net/yi_ya/article/details/40404231 1. 简单介绍 protobuf文件:就是定义你要的消息(类似java中的类)和消息中 ...

  4. google protobuf使用

    下载的是github上的:https://github.com/google/protobuf If you get the source from github, you need to gener ...

  5. google_protobuf数据类型

    要通信,必须有协议,否则双方无法理解对方的码流.在protobuf中,协议是由一系列的消息组成的.因此最重要的就是定义通信时使用到的消息格式. Protobuf消息定义 消息由至少一个字段组合而成,类 ...

  6. python读写protobuf

    0.     前期准备 官方protobuf定义 https://code.google.com/p/protobuf/   python使用指南 https://developers.google. ...

  7. ScalaPB(4): 通用跨系统protobuf数据,sbt设置

    我们知道,在集群环境节点之间进行交换的数据必须经过序列化/反序列化处理过程,而在这方面protobuf是一个比较高效.易用的模式.用户首先在.proto文件中用IDL来定义系统中各种需要进行交换的数据 ...

  8. 项目中使用protobuf

    在互种系统中数据通信或数据交换可以使用protobuf,他比json.xml的数据量要小一些. 另外因为消息要单独写一个.proto文件,来生成各平台的代码,所以对跨平台通信来说也比较友好. 一.使用 ...

  9. google protobuf 中的proto文件编写规则

    1. 简单介绍 protobuf文件:就是定义你要的消息(类似Java中的类)和消息中的各个字段及其数据类型(类似java类中的成员变量和他的数据类型) 2. Protobuf消息定义 消息由至少一个 ...

随机推荐

  1. 【BZOJ】1653: [Usaco2006 Feb]Backward Digit Sums(暴力)

    http://www.lydsy.com/JudgeOnline/problem.php?id=1653 看了题解才会的..T_T 我们直接枚举每一种情况(这里用next_permutation,全排 ...

  2. 【BZOJ】1620: [Usaco2008 Nov]Time Management 时间管理(贪心)

    http://www.lydsy.com/JudgeOnline/problem.php?id=1620 一开始想不通啊.. 其实很简单... 每个时间都有个完成时间,那么我们就从最大的 完成时间的开 ...

  3. CSS3文字立体效果

    <!DOCTYPE HTML> <html lang="en-US"> <head> <meta charset="UTF-8& ...

  4. 使用ANT编译项目报错 com.sun.image.codec.jpeg does not exist 解决方法

    项目开发中在对图片进行裁切处理的时候,有时候是会使用到 com.sun 包下的类时. 假设项目使用ant编译,会出现错误 com.sun.image.codec.jpeg does not exist ...

  5. ERROR getting 'android:label' attribute: attribute is not a string value

    这个的原因很多地方都有描述,原因多半是多国语言string.xml 有的有这个值, 有的没有. 关键是怎么定位? 实际上他报错的是当前处理的xml element有问题, 而出错的时候盖住了要处理的. ...

  6. 转载 HTTPS 之fiddler抓包、jmeter请求

    转载自 http://suixiang0923.github.io/2016/01/12/%E6%B5%85%E8%B0%88HTTPS%E4%BB%A5%E5%8F%8AFiddler%E6%8A% ...

  7. jdk 配置时时区设置

    在eclipse中的 Default VM Arguments:添加 -Duser.timezone=Aisa/Shanghai

  8. mac下MAMP的安装和使用

    详情博客:https://my.oschina.net/laiconglin/blog/514139

  9. XML Publiser For Excel Template

    1.XML Publisher定义数据 2.XML Publisher定义模板 模板类型选择Microsoft Excel,默认输出类型选择Excel,上传.xls模板 3.定义并发程序 4.定义请求 ...

  10. Tomcat Server启动报错:Multiple Contexts have a path of "/east".

    原因是 conf/server.xml 文件中多了一个<Context></Context>标签,路径有重复,把他删掉就好了.