Skip to content

Commit

Permalink
fix: fix encoder
Browse files Browse the repository at this point in the history
  • Loading branch information
lafirest committed Dec 19, 2023
1 parent 83eabdc commit e992df8
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/erlfdb_tuple.erl
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,14 @@ encode(Double, _, _) when is_float(Double) ->
[<<?DOUBLE>>, enc_float(Double)];

encode(Tuple, Depth, Encoder) when is_tuple(Tuple) ->
Elems = tuple_to_list(Tuple),
Encoded = [encode(E, Depth + 1, Encoder) || E <- Elems],
[<<?NESTED>>, Encoded, <<?NULL>>];
case Encoder(Tuple, Depth) of
{true, Value} ->
Value;
false ->
Elems = tuple_to_list(Tuple),
Encoded = [encode(E, Depth + 1, Encoder) || E <- Elems],
[<<?NESTED>>, Encoded, <<?NULL>>]
end;

encode(Term, Depth, Encoder) ->
case Encoder(Term, Depth) of
Expand Down

0 comments on commit e992df8

Please sign in to comment.