This module contains top level functions for converting Avro data to and from typed Elm values.
It is designed to be used with the
Avro.Codec module.
One should construct a Codec, then,
use the functions below to read and write Avro encoded binary data.
Make a binary encoder for data using an Avro Codec
It is common when building Avro schemas traditionally to write small schemas for parts of a larger record or set of messages. To do this, one uses named types to create references so that schema definitions can be simplified and reused.
In this library, this can be quite simply done for Codecs by using the
namedType function from the Codec
module.
To read and write data which is separated in this manner, one should first
construct an Environment for all named types used by the reader and
writer. Then, use that environment when constructing a decoder.
Schemas which can be referred to by name in either the readers and writers.
Create a binary decoder for avro data given a Codec and the writer's Schema.
This function will generate a decoder after considering the Named types in the defined set of schemas.
JSON decoder for an Avro Schema
JSON encoder for an Avro Schema
JSON decoder for an Avro Value
JSON encoder for an Avro Value
Create a binary decoder for avro data given a Codec and the writer's Schema.
Fields in Avro data types are not tagged, and records can only be interpreted knowing the exact Schema with which they were written.
Therefore, building a binary decoder not requires a Codec for the type of interest, but also the writer of the data's
Schema.