Current section
Files
Jump to
Current section
Files
priv/templates/message.ex.eex
defmodule <%= @module %> do
<%= if @module_doc? do %>
<%= if @comment != "" do %>
@moduledoc """
<%= Protobuf.Protoc.Generator.Util.pad_comment(@comment, 2) %>
"""
<% end %>
<% else %>
@moduledoc false
<% end %>
use Protobuf<%= @use_options %>
<%= if @descriptor_fun_body do %>
def descriptor do
# credo:disable-for-next-line
<%= @descriptor_fun_body %>
end
<% end %>
<%= for {%Google.Protobuf.OneofDescriptorProto{name: name}, index} <- Enum.with_index(@oneofs) do %>
<%= if !String.starts_with?(name, "_") do %>
oneof :<%= name %>, <%= index %><% end %>
<% end %>
<%= for f <- @fields do %>
field <%= f %><% end %>
<%= if @transform_module do %>
def transform_module(), do: <%= inspect(@transform_module) %>
<% end %>
<%= if @extensions != [] do %>
extensions [<%= Enum.map_join(@extensions, ", ", fn {start, end_} -> "{#{start}, #{end_}}" end) %>]
<% end %>
end