protobuf
weixin_41571449
这个作者很懒,什么都没留下…
展开
-
protobuf解析(一)
protobuf是一种新的消息或数据结构体的定义模式。我们来看下基本写法: 1. 基本数据类型:包括double、float、bool、string、bytes、int32、int64、uint32、uint64、sint32、sint64、fixed32、fixed64、sfixed32、sfixed64; 2. 引用其他message类型 3. 枚举类型:对于枚举类型,protobuf有原创 2018-01-17 01:40:54 · 4359 阅读 · 0 评论 -
protobuf解析(二)
接上节 protobuf到底有多节省字段,我们来比较下 对于 message helloworld { int32 id = 1; string name = 2; } protobuf表示 id = 101, name = hello只需要这么多字段 08 65 12 06 68 65 6C 6C 6F 77 65即101, [68 65 6C 6C 6F]表示h原创 2018-01-18 01:14:38 · 533 阅读 · 0 评论 -
Protobuf解析(三)
接上节说的grpc 关于protobuf需要安装protoc并get几个go包 go get -u github.com/golang/protobuf/proto go get -u github.com/golang/protobuf/protoc-gen-go go get google.golang.org/grpc 我们用grpc-go的例子来跑一跑 proto文件: sy原创 2018-01-18 13:37:08 · 895 阅读 · 0 评论