Current section

Files

Jump to
protobuf priv templates enum.ex.eex
Raw

priv/templates/enum.ex.eex

defmodule <%= name %> do
@moduledoc false
use Protobuf<%= options %>
<%= type %>
<%= if not is_nil(desc) do %>
def descriptor do
# credo:disable-for-next-line
<%= desc.__struct__ %>.decode(
<%= desc.__struct__.encode(desc |> Map.from_struct() |> Enum.filter(fn {_, x} -> x != nil end) |> desc.__struct__.new()) |> inspect(limit: :infinity) %>
)
end
<% end %>
<%= Enum.map fields, fn(field) -> %>
field <%= field %>
<% end %>
end