跳至正文
Wener Notes

protobuf

约 1 分钟阅读
标签:资源精选
    • Protocol Buffers - Google's data interchange format
    • 包含实现: C++, Java, Python, Objective-C, C#, Ruby, PHP
    • 生成工具
    • 格式化 textpb
  • 实现
      • 面向嵌入式和受限内存设备的 C 实现
    • Dart
      • a small protobuf implementation in C
      • Runtime for Ruby, PHP, Python
bash
brew install protobuf

Reference

  • 使用 protobuf 尽量将 零值 和 空值 平等对待
  • proto2 特性 optional, group, required
    • ⚠️ 不再推荐使用 group, required
    • required & optional - 可以考虑使用 FieldMask
    • optional 使用 oneof 实现
      • 类似 jsonschema
proto
message User {
  extensions 100 to 200;
}

关联信息

反向链接、本文链接的其他页面和外部资料。

站内链接

  • NanoPB
    笔记 · nanopb

    nanopb/nanopb · Zlib, C, Python, Protobuf · 面向嵌入式系统和受限内存设备的 Protocol Buffers ANSI C 实现。 · 通过代码生成将 转为 和 ,运行时不要求使用动态内存即可处理常见的固定大小消息。

  • Protobuf Go
    笔记 · Go

    protocolbuffers/protobuf-go · 2020-03-02 A new Go API for Protocol Buffers · APIv1 github.com/golang/protobuf · github.com/golang/protobuf@v1.4.0 使用 APIv2 实现

  • protoc
    笔记 · protoc

    | flag | for | · | -I,--protopath | 默认当前目录, --descriptorsetin | · | --encode | text -> proto | · | --deterministicoutput | 当 确保 map 顺序固定 |

参考资料

GitHub6 条
最近更新commit 86ea7e6编辑