Module avro_fixed

Avro fixed type implementation.

Authors: Ilya Staheev (ilya.staheev@klarna.com).

Description

Avro fixed type implementation. Internal data for fixed values is a binary value.

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

custom_prop_name()

custom_prop_name() = binary()

custom_prop_value()

custom_prop_value() = jsone:json_value()

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

name() = binary()

name_raw()

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

namespace()

namespace() = 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_prop_name()

type_prop_name() = namespace | doc | aliases | custom_prop_name()

type_prop_value()

type_prop_value() = namespace() | typedoc() | [name()] | custom_prop_value()

type_props()

type_props() = [{type_prop_name(), type_prop_value()}]

typedoc()

typedoc() = string() | binary()

union_type()

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

Function Index

cast/2Fixed values can be casted from other fixed values, from integers or from binaries.
get_size/1Get size of the declared type.
get_value/1Return (non-recursive) data in the wrapped (boxed) value.
new/2Create a wrapped (boxed) value.
resolve_fullname/2Resolve fullname by newly discovered enclosing namespace.
type/2Declare a fixed type with default properties.
type/3Declare a fixed type.

Function Details

cast/2

cast(Type::avro_type(), Value::term()) -> {ok, avro_value()} | {error, term()}

Fixed values can be casted from other fixed values, from integers or from binaries.

get_size/1

get_size(Avro_fixed_type::fixed_type()) -> pos_integer()

Get size of the declared type.

get_value/1

get_value(Value::avro_value()) -> binary()

Return (non-recursive) data in the wrapped (boxed) value.

new/2

new(Type::fixed_type(), Value::avro:in()) -> avro_value() | no_return()

Create a wrapped (boxed) value.

resolve_fullname/2

resolve_fullname(Avro_fixed_type::fixed_type(), Ns::namespace()) -> fixed_type()

Resolve fullname by newly discovered enclosing namespace.

type/2

type(Name::name_raw(), Size::pos_integer()) -> fixed_type()

Declare a fixed type with default properties.

type/3

type(Name0::name_raw(), Size::pos_integer(), Opts::type_props()) -> fixed_type()

Declare a fixed type.


Generated by EDoc