View Source Protobuf.DSL (protobuf v0.14.1)
Summary
Functions
Define "extend" for a message(the first argument module).
Define extensions range in the message module to allow extensions for this module.
Define a field for the message.
Define oneof in the message module.
Functions
Define "extend" for a message(the first argument module).
Define extensions range in the message module to allow extensions for this module.
Extension ranges are defined as a list of tuples {start, end}, where each tuple is
an exclusive range starting and start and ending at end (the equivalent
of start..end-1 in Elixir).
To simulate the Protobuf max keyword, you can use Protobuf.Extension.max/0.
Examples
These Protobuf definition:
message Foo {
  extensions 1, 10 to 20, 100 to max;
}Would be translated in Elixir to:
extensions [{1, 2}, {10, 21}, {100, Protobuf.Extension.max()}]
  Define a field for the message.
Corresponds to Protobuf declarations such as:
string query = 1;or more generally
<type> <name> = <field_number>;Arguments
name— must be an atom representing the name of the field.field_number— must be an integer representing the field number.options- a keyword list of options, see below.
Options
:proto3_optional- boolean representing whether the field is optional with theproto3syntax. See the documentation:type- atom representing the type of the field.:repeated- boolean representing whether the field is repeated.:optional- boolean representing whether the field is optional.:required- boolean representing whether the field is required.:enum- boolean representing whether the field is a possible value of an enum.:map- boolean representing whether the field is a part of a map.:default- the default value of the field. Must be a valid Elixir term at compile time, that can be encoded with Protobuf and matches with the type of the field.:packed- boolean representing whether the field is packed.:deprecated- boolean representing whether the field is deprecated.:json_name- if present, specifies the name of the field when using the JSON mapping (seeProtobuf.JSON). If not present, the default mapping will be used.
Define oneof in the message module.