From e992df88b1e4622b1b84bb791a8d75b54b2b869a Mon Sep 17 00:00:00 2001 From: firest Date: Tue, 19 Dec 2023 15:53:56 +0800 Subject: [PATCH] fix: fix encoder --- src/erlfdb_tuple.erl | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/erlfdb_tuple.erl b/src/erlfdb_tuple.erl index 7ed25c4..d596e25 100644 --- a/src/erlfdb_tuple.erl +++ b/src/erlfdb_tuple.erl @@ -267,9 +267,14 @@ encode(Double, _, _) when is_float(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], - [<>, Encoded, <>]; + case Encoder(Tuple, Depth) of + {true, Value} -> + Value; + false -> + Elems = tuple_to_list(Tuple), + Encoded = [encode(E, Depth + 1, Encoder) || E <- Elems], + [<>, Encoded, <>] + end; encode(Term, Depth, Encoder) -> case Encoder(Term, Depth) of