Renders a JSON-array result body (the text produced by Bier.QueryExecutor)
into the negotiated output format: CSV, a singular object, a nulls-stripped
array/object, or plain JSON.
The bodies themselves are built by PostgreSQL, never re-encoded here: a
decode/encode round trip loses JSON object key order (Elixir maps are
unordered) and the exact numeric text PostgreSQL emitted (45.512230 becomes
45.51223) — issue #109. So null-stripping happens in the aggregate
(Bier.QueryExecutor's json_strip_nulls, upstream's addNullsToSnip), and
the singular form is the array's single element sliced out of the text
PostgreSQL already produced — byte-identical to upstream's
json_agg(_postgrest_t)->0. Only CSV, which is a different serialization
entirely, decodes; it also needs an explicit ordered column list (it cannot
rely on JSON object key order).
Summary
Functions
Transform the executor's JSON-array body for the resolved media type.
Functions
Transform the executor's JSON-array body for the resolved media type.
Returns {:ok, output_string} or {:error, reason} (e.g. a singular
plurality violation).
:columns— ordered column names used for CSV output.
The transform is timed as the response phase of Server-Timing
(Bier.ServerTiming); it runs before the caller calls send_resp, so the
duration is recorded in time for the header.