To define structure in Protocol buffers. It uses “message” keyword. A message is like a class or structure in C++ and Java.
It also supports nested messages (structure) same as OOPs programming language.
Protocol Buffers support C++, C#, Dart, Go, Java, Python, Ruby and other popular languages.
It has double, float, int32, int 64, uint32, uint64, bool, string, bytes and many other data types. Data type also has default values like C++ or Java’s data type. - For string, the default value is the empty string, For bools, the default value is false, For numeric types, the default values is zero.
Protocol buffers support enums, Map, Any and Array.
Protocol buffers support optional, repeated and required field
Protocol buffers message has field number, field number must be a unique number in the message. The field number is used to identify the field in message binary format. The smallest field number you can specify is 1, and the largest is 229–1, or 536,870,911. You also cannot use the numbers 19000 through 19999.
Github Repo: https://github.com/protocolbuffers/protobuf
Protocol buffers come with the command-line tool protoc. Protoc compiles .proto file into specific language code.
Go Language output
protoc -I=$SRC_DIR — go_out=$DST_DIR $SRC_DIR/addressbook.proto