Module avro_binary_encoder

Encodes Avro values to binary format according to Avro 1.7.5 specification.

Description

Encodes Avro values to 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()

avro_value()

avro_value() = avro:canonicalized_value() | #avro_value{type = avro:type_or_name(), data = avro:avro_value()} | [#avro_value{type = avro:type_or_name(), data = avro:avro_value()}] | [{avro:name(), #avro_value{type = avro:type_or_name(), data = avro:avro_value()}}] | avro_map:data() | {json, binary()} | {binary, binary()}

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()]}

map_type()

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

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()]}

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

encode/3Encode unwrapped (raw) values directly without (possibilly recursive) type info wrapped with values.
encode_value/1Encode avro value in binary format.
int/1
long/1
string/1
zigzag/2

Function Details

encode/3

encode(Sc::avro:schema_all(), Type::type_or_name(), Input::avro_value() | avro:in()) -> iodata()

Encode unwrapped (raw) values directly without (possibilly recursive) type info wrapped with values. i.e. data can be recursive, but recursive types are resolved by schema lookup

encode_value/1

encode_value(Avro_value::avro_value()) -> iodata()

Encode avro value in binary format.

int/1

int(Int::integer()) -> iodata()

long/1

long(Long::integer()) -> iodata()

string/1

string(Atom::atom() | iodata()) -> iodata()

zigzag/2

zigzag(X1::int | long, Int::integer()) -> integer()


Generated by EDoc