Module avro_binary_decoder

Decode Avro values from binary format according to Avro 1.7.5 specification.

Description

Decode Avro values from binary format according to Avro 1.7.5 specification.

Schema is written following parsing canonical form recommendations but keeps all information (attributes are kept even if they are not relevant for parsing).

Data Types

array_type()

array_type() = #avro_array_type{type = avro:type_or_name(), custom = [avro:custom_prop()]}

avro_type()

avro_type() = primitive_type() | array_type() | enum_type() | fixed_type() | map_type() | record_type() | union_type()

decoder_hook_fun()

decoder_hook_fun() = fun((avro_type(), name() | integer(), avro:in(), fun((avro:in()) -> avro:out())) -> avro:out())

decoder_options()

decoder_options() = #{encoding := avro_binary | avro_json, map_type := proplist | map, record_type := proplist | map, is_wrapped := boolean(), hook := decoder_hook_fun()}

enum_type()

enum_type() = #avro_enum_type{name = avro:name(), namespace = avro:namespace(), aliases = [avro:name()], doc = avro:typedoc(), symbols = [avro:enum_symbol()], fullname = avro:fullname(), custom = [avro:custom_prop()]}

fixed_type()

fixed_type() = #avro_fixed_type{name = avro:name(), namespace = avro:namespace(), aliases = [avro:name()], size = pos_integer(), fullname = avro:fullname(), custom = [avro:custom_prop()]}

fullname()

fullname() = binary()

hook()

hook() = decoder_hook_fun()

lkup_fun()

lkup_fun() = fun((fullname()) -> avro_type())

map_type()

map_type() = #avro_map_type{type = avro:type_or_name(), custom = [avro:custom_prop()]}

name()

name() = binary()

name_raw()

name_raw() = atom() | string() | binary()

primitive_type()

primitive_type() = #avro_primitive_type{name = avro:name(), custom = [avro:custom_prop()]}

record_type()

record_type() = #avro_record_type{name = avro:name(), namespace = avro:namespace(), doc = avro:typedoc(), aliases = [avro:name()], fields = [avro:record_field()], fullname = avro:fullname(), custom = [avro:custom_prop()]}

schema_store()

schema_store() = avro_schema_store:store()

type_or_name()

type_or_name() = avro_type() | name_raw()

union_type()

union_type() = #avro_union_type{id2type = avro_union:id2type(), name2id = avro_union:name2id()}

Function Index

decode/3decode/4 equivalent with default hook fun.
decode/4Decode bytes into unwrapped avro value, assuming the input bytes matches the given schema without tailing bytes.
decode_stream/3decode_stream/4 equivalent with default hook fun.
decode_stream/4Decode the header of a byte stream, return unwrapped value and tail bytes in a tuple.

Function Details

decode/3

decode(IoData::iodata(), Type::type_or_name(), StoreOrLkupFun::schema_store() | lkup_fun()) -> avro:out()

decode/4 equivalent with default hook fun.

decode/4

decode(IoData::iodata(), Type::type_or_name(), StoreOrLkupFun::schema_store() | lkup_fun(), Options::decoder_options()) -> avro:out()

Decode bytes into unwrapped avro value, assuming the input bytes matches the given schema without tailing bytes.

decode_stream/3

decode_stream(IoData::iodata(), Type::type_or_name(), StoreOrLkupFun::schema_store() | lkup_fun()) -> {avro:out(), binary()}

decode_stream/4 equivalent with default hook fun.

decode_stream/4

decode_stream(IoData::iodata(), Type::type_or_name(), StoreOrLkupFun::schema_store() | lkup_fun(), Hook::hook() | decoder_options()) -> {avro:out(), binary()}

Decode the header of a byte stream, return unwrapped value and tail bytes in a tuple.


Generated by EDoc