Avrora.Encoder.decode

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

Specs

decode(binary()) :: {:ok, map() | [map()]} | {:error, term()}

Decode binary Avro message, loading schema from Schema Registry or Object Container Files.

Examples

...> payload = <<0, 0, 0, 0, 8, 72, 48, 48, 48, 48, 48, 48, 48, 48, 45, 48,
48, 48, 48, 45, 48, 48, 48, 48, 45, 48, 48, 48, 48, 45, 48, 48, 48, 48, 48,
48, 48, 48, 48, 48, 48, 48, 123, 20, 174, 71, 225, 250, 47, 64>>
...> Avrora.Encoder.decode(payload)
{:ok, %{"id" => "00000000-0000-0000-0000-000000000000", "amount" => 15.99}}

Specs

decode(binary(), [{:schema_name, String.t()}]) ::
  {:ok, map() | [map()]} | {:error, term()}

Decode binary Avro message, loading schema from local file or Schema Registry.

Examples

...> payload = <<72, 48, 48, 48, 48, 48, 48, 48, 48, 45, 48, 48, 48, 48, 45,
48, 48, 48, 48, 45, 48, 48, 48, 48, 45, 48, 48, 48, 48, 48, 48, 48, 48, 48,
48, 48, 48, 123, 20, 174, 71, 225, 250, 47, 64>>
...> Avrora.Encoder.decode(payload, schema_name: "io.confluent.Payment")
{:ok, %{"id" => "00000000-0000-0000-0000-000000000000", "amount" => 15.99}}