Authors: Ilya Staheev (ilya.staheev@klarna.com).
Avro enum type implementation.
All symbols in an enum must be unique; duplicates are prohibited.
Internal data for an enum is the symbol string itself.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()]}
index() = avro:enum_index()
map_type() = #avro_map_type{type = avro:type_or_name(), custom = [avro:custom_prop()]}
name_raw() = atom() | string() | binary()
namespace() = 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()]}
symbol() = avro:enum_symbol()
symbol_raw() = avro:enum_symbol_raw()
union_type() = #avro_union_type{id2type = avro_union:id2type(), name2id = avro_union:name2id()}
cast/2 | Enums can be casted from other enums or strings. |
get_index/1 | Get symbol index from boxed value. |
get_index/2 | Get symbol index from type definition. |
get_symbol_from_index/2 | Find symbol from index. |
get_value/1 | Get the enum symbol. |
new/2 | Create a enum wrapped (boxed) value. |
resolve_fullname/2 | Resolve fullname by newly discovered enclosing namespace. |
type/2 | Declare a enum type with default properties. |
type/3 | Declare a enum type. |
cast(Type::avro_type(), Value::symbol_raw()) -> {ok, avro_value()} | {error, term()}
Enums can be casted from other enums or strings.
get_index(Value::avro_value()) -> index()
Get symbol index from boxed value.
get_index(Type::enum_type(), Symbol::symbol_raw()) -> index()
Get symbol index from type definition.
get_symbol_from_index(T::enum_type(), Index::index()) -> symbol()
Find symbol from index.
get_value(Value::avro_value()) -> symbol()
Get the enum symbol.
new(Type::enum_type(), Value::avro_value() | symbol_raw()) -> avro_value() | no_return()
Create a enum wrapped (boxed) value.
resolve_fullname(Avro_enum_type::enum_type(), Ns::namespace()) -> enum_type()
Resolve fullname by newly discovered enclosing namespace.
type(Name::name_raw(), Symbols::[symbol_raw()]) -> enum_type() | no_return()
Declare a enum type with default properties.
type(Name0::name_raw(), Symbols0::[symbol_raw()], Opts::avro:type_props()) -> enum_type() | no_return()
Declare a enum type.
Generated by EDoc