.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. php -- 魔术方法 之 调用方法:__call()、__callStatic()

    方法重载:当调用一个不存在或者权限不够的方法的时候,会自动调用__call()方法 public function __call($name,$args){}  :用对象调用方法 public sta ...

  2. 对Python线程池

    本文对Python线程池进行详细说明介绍,IDE选择及编码的解决方案进行了一番详细的描述,实为Python初学者必读的Python学习经验心得. AD: 干货来了,不要等!WOT2015 北京站演讲P ...

  3. 九度OJ 上剑指 offer 习题目录

    <剑指Offer>面试题集收录汇总 面试题1 赋值运算符函数 不适合在线模式 面试题2 实现Singleton模式 不适合在线模式 面试题3 二维数组中的查找 已收录 面试题4 替换空格 ...

  4. Hadoop1.2.1 日志格式说明及启停方式

    日志格式: 日志名称解析: Hadoop启停的三种方式: . 停止后面的以此类推...... 另外 hadoop-daemons.sh 表示启动多个,比如datanode跟tasktracker在真实 ...

  5. C#三种字符串拼接方法的效率对比

    C#字符串拼接的方法常用的有:StringBuilder.+.string.Format.List<string>.使用情况不同,效率不同. 1.+的方式 string sql = &qu ...

  6. 【BZOJ3790】神奇项链 Manacher+贪心

    [BZOJ3790]神奇项链 Description 母亲节就要到了,小 H 准备送给她一个特殊的项链.这个项链可以看作一个用小写字 母组成的字符串,每个小写字母表示一种颜色.为了制作这个项链,小 H ...

  7. jQuery设置内容和属性方

    何问起 hovertree.com 设置内容 - text().html() 以及 val()text() - 设置或返回所选元素的文本内容html() - 设置或返回所选元素的内容(包括 HTML ...

  8. 关于微信小程序的场景值

    微信小程序 “场景值”     对运营同学和产品比较有用一般开发者需在这里埋点,获取场景址,看一下小程序,用户一般从哪个路口进的有利于提升产品体验

  9. nginx分发请求的2种方式:1、指明server_name;2、通过location过滤uri来分发请求;

    user nginx; worker_processes 8; # = cpu num; error_log /data/nginx/log/error/error.log warn; # warn, ...

  10. shell (check return of each line)(PIPESTATUS[@])and sudoer

    shell result from cmdline echo $? if 0 then success ;else failure (shell 执行每部返回值,rm -rf 错误,打包不能覆盖) 我 ...