Pbwire. Schema
(pbwire_elixir v0.1.14)
Copy Markdown
Turns elixir-protobuf generated modules into the schema cache the NIF
understands.
This is the Elixir half of the rule the Erlang binding documents: gpb is
the plugin there (get_msg_defs/0 in, records out), elixir-protobuf is
the plugin here (__message_props__/0 in, structs out). There is no
second wire implementation and no .proto parsing in this package: field
numbers, types, presence and packedness all come from the generated
FieldProps, and the bytes stay in the C core behind :pbwire.
Message and enum names in the generated defs are the Elixir module atoms themselves, so two schemas can never collide the way unqualified gpb record names can.
Summary
Functions
Builds the :pbwire.load_cache/1 defs for modules plus every message
and enum they reference, and the per-module specs Pbwire translates
structs with. Pure: no NIF call, safe to unit test.
The :pbwire.set_opts/1 list for the given Pbwire.load_schema/2 opts.
Types
@type field() :: %{ key: atom(), fnum: non_neg_integer(), rnum: pos_integer(), kind: field_kind(), occurrence: :required | :optional | :repeated | :defaulty, packed?: boolean(), default: term() }
Functions
Builds the :pbwire.load_cache/1 defs for modules plus every message
and enum they reference, and the per-module specs Pbwire translates
structs with. Pure: no NIF call, safe to unit test.
The :pbwire.set_opts/1 list for the given Pbwire.load_schema/2 opts.