Avrora.Schema.Encoder.to_erlavro

You're seeing just the function to_erlavro, go back to Avrora.Schema.Encoder module for more information.

Specs

to_erlavro(Avrora.Schema.t()) :: {:ok, term()} | {:error, term()}

Convert struct to erlavro format and look it up in avro_schema_store.

Examples

iex> json = ~s({"namespace":"io.confluent","type":"record","name":"Payment","fields":[{"name":"id","type":"string"},{"name":"amount","type":"double"}]})
iex> {:ok, schema} = Avrora.Schema.Encoder.from_json(json)
iex> {:ok, {type, _, _, _, _, _, full_name, _}} = Avrora.Schema.Encoder.to_erlavro(schema)
iex> full_name
"io.confluent.Payment"
iex> type
:avro_record_type