protobuf-elixir
A pure Elixir implementation of Google Protobuf
Why this instead of gpb or exprotobuf?
It will have some must-have and other cool features like:
- A protoc plugin to generate Elixir code like what other official libs do.
- Use structs for messages instead Erlang records.
- Generate simple and explicit code with the power of Macro. (see test/protobuf/dsl_test.exs)
- Support Typespec in generated code.
Installation
If available in Hex, the package can be installed
by adding protobuf to your list of dependencies in mix.exs:
def deps do
[{:protobuf, "~> 0.1.0"}]
end
Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/protobuf.
Features
- Define messages with DSL
- Decode basic messages
- Skip unknown fields
- Decode embedded messages
- Decode packed and repeated fields
- Encode messages
- protoc plugin
- map
- Support default values
- Validate values
- oneof
Acknowledgements
Many thanks to gpb and golang/protobuf as good examples of writing Protobuf decoder/encoder.