.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. char[]与TCHAR[]互相转换引发的一个问题!

      软件的一个驱动由于开发的年代比较久一些,使用的是非Unicode编码,而当前新的软件使用的是Unicode编码,于是将非Unicode驱动用于Unicode软件上时,就出现了问题! 问题就出现在非 ...

  2. requirejs源码分析,使用注意要点

    本文将深度剖析require.js代码,为了是大家更高效.正确的去使用它,本文不会介绍require的基本使用! 概要 先来一个流程图来概要一下大概流程 在require中,根据AMD(Asynchr ...

  3. MySQL------存储过程的使用

    如图: 1.创建存储过程 create procudure userAdd(na varchar(20),pass varchar(20)) select * from user where name ...

  4. 基于 Golang 的 xls 读取类库:xls

    Golang 编写的 xls 读取类库,能够实现 xls 表格的读取功能 func (w *WorkBook) ReadAllCells() (res [][]string) { for _, she ...

  5. android studio升级时提示 Connection failed. Please check your network connection and try again

    原文地址 http://www.eyeapk.com/android-studio-update.html Mac OSX中修改文件路径为 bin/idea.vmoptions ,添加如下内容,如果无 ...

  6. eclipse控制台不限制显示的行数

    在Preferences中搜索Console,设置Limit console output没有限制即可.

  7. 160607、springmvc+spring使用taskExecutor

    第一步:导入spring core的jar+springmvc的jar 第二步:springmvc的配置文件中 <bean id="taskExecutor" class=& ...

  8. django post 403解决之道(最新版Django)

    写了一个方法,丢出一个post请求,发现报403 百度解决方案: 按提示及google结果修改setting.py,在MIDDLEWARE_CLASSES增加django.middleware.csr ...

  9. springMVC的HandleMapping

    http://blog.chinaunix.net/uid-20415521-id-1949916.html SpingMVC中的HandlerMapping (2007-05-22 11:33) 分 ...

  10. 可序列化对象和byte[]数组之间的互转

    /// <summary> /// 将可序列化对象转成Byte数组 /// </summary> /// <param name="obj">对 ...