Format map and list query params as JSON

This commit is contained in:
Claudio Ortolina
2026-04-11 23:57:40 +01:00
parent a983698c72
commit 02761428c1
2 changed files with 42 additions and 0 deletions
+4
View File
@@ -135,6 +135,10 @@ defmodule MusicLibrary.QueryReporter do
end
end
defp format_param(value) when is_list(value) or (is_map(value) and not is_struct(value)) do
"'" <> String.replace(JSON.encode!(value), "'", "''") <> "'"
end
defp format_param(value), do: "'" <> String.replace(to_string(value), "'", "''") <> "'"
defp extract_source_location(nil), do: nil