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消息定义 消息由至少一个 ...
随机推荐
- strust2的Action中validateXxx方法的用法
Struts2控制部分时常需要验证来自页面的信息是否合法,若在执行struts2中 public String Xxx()方法操作数据库之前需要验证,ActionSupport提供了一个很好的方法.X ...
- python 获取网页编码格式
f = urllib2.urlopen(url,timeout=10)data = f.read() # decode the htmlcontentType = f.headers.get(' ...
- hdu 2196(求树上每个节点到树上其他节点的最远距离)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2196 思路:首先任意一次dfs求出树上最长直径的一个端点End,然后以该端点为起点再次dfs求出另一个 ...
- ASP.NET MVC5 新特性:Attribute路由使用详解
1.什么是Attribute路由?怎么样启用Attribute路由? 微软在 ASP.NET MVC5 中引入了一种新型路由:Attribute路由,顾名思义,Attribute路由是通过Attrib ...
- pushViewController自定义动画http://blog.csdn.net/ralbatr/article/details/22039233
本文转载至 http://blog.csdn.net/ralbatr/article/details/22039233 实现的主要代码如下: CATransition *transition = ...
- Django学习笔记第四篇--数据处理URL和数据库
一.URL: 1.基础的URL与视图函数的映射 from django.conf.urls import url from django.contrib import admin from appna ...
- LeetCode-Lowest Common Ancestor of a Binary Tre
Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. According ...
- WingIDE6.0神秘代码
python2: import string import random import sha BASE16 = '0123456789ABCDEF' BASE30 = '123456789ABCDE ...
- Using the FutureRequestExecutionService Based on classic (blocking) I/O handle a great number of concurrent connections is more important than performance in terms of a raw data throughput
Chapter 7. Advanced topics http://hc.apache.org/httpcomponents-client-ga/tutorial/html/advanced.html ...
- SaaS成熟度模型分级:
SaaS成熟度模型分级: 根据SaaS应用是否具有可配置性,高性能,可伸缩性的特性,SaaS成熟度模型被分成四级.每一级都比前一级增加三中特性中的一种. 可配置 高性能 可伸缩 Level1 N ...