Protocol Buffers: (3) Style Guide
来源:互联网 发布:股票画线软件 编辑:程序博客网 时间:2024/05/29 14:23
This document provides a style guide for .proto
files. By following these conventions, you'll make your protocol buffer message definitions and their corresponding classes consistent and easy to read.
Message And Field Names
Use CamelCase (with an initial capital) for message names – for example, SongServerRequest
. Use underscore_separated_names for field names – for example, song_name
.
message SongServerRequest { required string song_name = 1;}
Using this naming convention for field names gives you accessors like the following:
C++: const string& song_name() { ... } void set_song_name(const string& x) { ... }Java: public String getSongName() { ... } public Builder setSongName(String v) { ... }
Enums
Use CamelCase (with an initial capital) for enum type names and CAPITALS_WITH_UNDERSCORES for value names:
enum Foo { FIRST_VALUE = 1; SECOND_VALUE = 2;}
Each enum value should end with a semicolon, not a comma.
Services
If your .proto
defines an RPC service, you should use CamelCase (with an initial capital) for both the service name and any RPC method names:
service FooService { rpc GetSomething(FooRequest) returns (FooResponse);}
- Protocol Buffers: (3) Style Guide
- Protocol Buffers:Style Guide
- Protocol Buffers Style Guide
- Protocol Buffers Developer Guide-Style Guide
- Style Guide中文翻译(Google Protocol Buffers中文教程)
- Protocol Buffers:Language Guide
- [Protocol Buffers] Language Guide
- Protocol Buffers: (2) Language Guide
- Protocol Buffers Developer Guide-Tutorials -C++ Tutorial
- 【Google Protocol Buffer】Style Guide中文翻译
- Language Guide中文翻译(Google Protocol Buffers中文教程)
- Protocol Buffers Language Guide之proto文件类型格式分析
- Protocol Buffers Developer Guide-API Reference --C++ Generated Code
- protocol buffers
- Protocol Buffers
- Protocol Buffers
- Protocol Buffers
- Protocol Buffers
- 尽快了解看来是几点了看法就是了开发
- Java中的聚合-组合
- wp8 《南昌大学家园资讯》-1-界面
- Linux中set,env和export这三个命令的区别 (待领悟)
- poj 2750 Potted Flower 数据结构(线段树)
- Protocol Buffers: (3) Style Guide
- c语言中的字节对齐方法的研究
- hdu--1862 EXCEL排序
- lecture4-神经网络在语言上的应用
- Wpf 笔记
- 自定义dialog
- w3school HTML基础四
- Protocol Buffers: (4) Encoding
- hdu--2020 绝对值排序