klarna / erlavro

Avro support for Erlang/Elixir (http://avro.apache.org/)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

support for map

ananthakumaran opened this issue · comments

is there any plan to add support for map data structure. am I correct in assuming the current format [{key, val}] is used for record/map type because when the project started there was no map in erlang?

We have thought about adding map() support as encoder input,
and maybe allow an option to make decoder return maps too,
but never got time for it.

And it's correct that we started when there is no map() in Erlang.

commented

Does it mean that

erlavro/src/avro_map.erl

Lines 113 to 123 in 19b6068

encode(Type, Value, EncodeFun) ->
ItemsType = avro_map:get_items_type(Type),
lists:map(fun({K, V}) ->
try
EncodeFun(ItemsType, K, V)
catch
C : E ?CAPTURE_STACKTRACE ->
?RAISE_ENC_ERR(C, E, [{map, Type},
{key, K}], ?GET_STACKTRACE)
end
end, Value).
will receive a hashmap as Value instead of a list of record?

fixed in: #86

@jochasinga yes, but a lot more than that. you can find the changes in #86 .
issue closed, thanks a lot @ananthakumaran