Skip to content

Commit b42a77d

Browse files
committed
handle the case where the entity passed to 'retrieve_one_entity' or 'retrieve_entity' has all its properties set to missing. In that case we want to return missing and an empty vector
1 parent dbe03c4 commit b42a77d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Controller/coreORM.retrieve.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,16 @@ function retrieve_entity(filter_object::Union{IEntity,Missing},
4949
end
5050
end
5151

52-
# prepared_query = LibPQ.prepare(dbconn,
53-
# query_string)
54-
5552
# Prepare the query aruments
5653
# NOTE: It would be more elegant to convert the keys in an array of String
5754
# but I didn't find a way to do it
5855
query_args = collect(values(props))
5956

57+
# Return empty array if there is no filter
58+
if isempty(query_args)
59+
return data_type[]
60+
end
61+
6062
result = execute_query_and_handle_result(query_string,
6163
data_type,
6264
query_args,

0 commit comments

Comments
 (0)