In this paper, the translation of proto3 grammar. Reference website: https://developers.google.com/protocol-buffers/docs/proto3
defining a message type define a message type
Scala value types scalar type
default values default values
enumerations Enumeration
Using other message Types message types using other
Nested Types Nested types
UpdataIng a message types Update message type
Unknown fields far field
any
Oneof
maps
packages packaging
defining services defined service
Json Mapping json map
Options Select Options
Generating Your Classes create your class
this guide describes how to use the protocol buffer language to structure your
Guide how you use language and protocol buffer build their own protocol buffer data, including .proto grammar and build their own proto data structures. This article covers the entire language of proto3, proto2 address syntax reference: "proto2 grammar guide"
defining a message type
syntax = "proto3"; message SearchRequest { string query = 1; int32 page_number = 2; int32 result_per_page = 3; }
- The first line of the file specifies the syntax you are using proto3: If you do not do protocol buffer compiler will assume you are using proto2. This line there is a blank character or comments are not allowed.
- This message defines the SearchRequest three fields (name / value pairs), each type of data SearchRequest message contains three fields that define the data. Each field contains a name and type.