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).array_type() = #avro_array_type{type = avro:type_or_name(), custom = [avro:custom_prop()]}
avro_type() = primitive_type() | array_type() | enum_type() | fixed_type() | map_type() | record_type() | union_type()
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() = #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() = #avro_fixed_type{name = avro:name(), namespace = avro:namespace(), aliases = [avro:name()], size = pos_integer(), fullname = avro:fullname(), custom = [avro:custom_prop()]}
map_type() = #avro_map_type{type = avro:type_or_name(), custom = [avro:custom_prop()]}
name_raw() = atom() | string() | binary()
primitive_type() = #avro_primitive_type{name = avro:name(), custom = [avro:custom_prop()]}
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() = avro_type() | name_raw()
union_type() = #avro_union_type{id2type = avro_union:id2type(), name2id = avro_union:name2id()}
encode/3 | Encode unwrapped (raw) values directly without (possibilly recursive) type info wrapped with values. |
encode_value/1 | Encode avro value in binary format. |
int/1 | |
long/1 | |
string/1 | |
zigzag/2 |
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(Avro_value::avro_value()) -> iodata()
Encode avro value in binary format.
int(Int::integer()) -> iodata()
long(Long::integer()) -> iodata()
string(Atom::atom() | iodata()) -> iodata()
zigzag(X1::int | long, Int::integer()) -> integer()
Generated by EDoc