Bier.Response (bier v0.1.0)

Copy Markdown View Source

Shared response rendering for read, RPC, and mutation paths: applies the negotiated media-type transform (Bier.Render), sets the Content-Type and Content-Range, and emits the right status.

Summary

Functions

Render a JSON-array result body for the negotiated media, honoring pagination (Content-Range, 200/206) and out-of-bounds offsets.

Cheap row count without decoding when possible.

Functions

render(conn, body, count, plan, count_mode, media, opts \\ [])

Render a JSON-array result body for the negotiated media, honoring pagination (Content-Range, 200/206) and out-of-bounds offsets.

Options: :columns (CSV column order), :status (override status for mutations, e.g. 201).

row_count(body)

Cheap row count without decoding when possible.

A geo+json body is a FeatureCollection object whose features array carries one Feature per row; PostgREST computes Content-Range from the row window regardless of the negotiated media type (live-verified against 14.12, e.g. 0-2/* on a geo+json read), so the Features are counted as rows.