This commit is contained in:
anlicheng 2023-08-08 10:28:18 +08:00
parent 8a898192a9
commit 373522a976

View File

@ -101,7 +101,7 @@ simple_mapper() ->
Fields1 = lists:map(fun(#{<<\"key\">> := Key, <<\"value\">> := Val}) -> {Key, Val} end, Fields),
Fields2 = maps:from_list(Fields1),
Bin = jiffy:encode(Fields2#{<<\"location_code\">> => LocationCode}, [force_utf8]),
iolist_to_binary(Bin)
{ok, iolist_to_binary(Bin)}
end.",
Mapper = list_to_binary(Mapper0),
@ -113,7 +113,7 @@ mysql_mapper() ->
Mapper0 = "fun(LocationCode, Fields, Timestamp) ->
Fields1 = lists:map(fun(#{<<\"key\">> := Key, <<\"value\">> := Val}) -> {Key, Val} end, Fields),
Content = jiffy:encode(maps:from_list(Fields1), [force_utf8]),
[{<<\"location_code\">>, LocationCode}, {<<\"content\">>, Content}, {<<\"created_ts\">>, Timestamp}]
{ok, [{<<\"location_code\">>, LocationCode}, {<<\"content\">>, Content}, {<<\"created_ts\">>, Timestamp}]}
end.",
Mapper = list_to_binary(Mapper0),