One node of a read plan (the root, or the target of an embed).
select entries are %{key:, field:, json_path:, cast:}: key is the JSON output
name, field the Ecto field name the scoped source exposes. An aggregate entry is
%{key:, aggregate:, legacy:}, its PgRest.AST.Aggregate holding the Ecto field name and
key as alias; legacy marks the backwards-compatible bare count, which PostgREST does
not treat as an aggregate (it never groups). aggregates? is true when the node or a
to-one spread below it selects a (non-legacy) aggregate: the node then groups by its other
output (SQL.Aggregate.group_by/1, internal), and a to-one spread hoists its aggregates into
the parent. where holds filters
and logic trees whose field names are Ecto field names, plus {:null_embed, output_name, null?} leaves for embed=is.null filters. order is a list of
PgRest.AST.OrderTerm whose names were validated (relation: names an embed
output). limit and offset are the request's window for this node; max_limit
clamps it. output.media is the PgRest.MediaType the root is answered in (JSON until
put_media/2). column_types and categories are keyed by Ecto field name.
source is :resource (the node reads its resource's scoped source) or {:call, PgRest.Plan.Call.t()} for the root of an RPC, which reads the function call instead
(PgRest.SQL.Call). An RPC returning a scalar, a void or a composite
that is no registered resource has resource: nil.
Summary
Functions
Whether the node or any embed below it has an after_load/2 resource.
Whether a select entry is an aggregate PostgREST treats as one (it groups, needs
aggregates: true and is hoisted out of a to-one spread): not the legacy bare count.
Whether a select entry computes an aggregate, the legacy bare count included.
Internal targets, node paths and precomputed queries, without callback context.
The shared per-operation policy key of a junction.
The shared authorization path of a many-to-many junction.
The plan with the media type its root is answered in (output.media): the negotiated
type's PgRest.MediaType.body/1, so a plan type stores the type it explains.
Whether any effective source or column policy requires constraint detail scrubbing.
The {resource module, scoped source query} of every node of the plan, root first, an embed's
many-to-many junction before its target: the one walk over a plan's resources.
What a response about this plan touches, for :explain: its resource modules
(sources/1) and the PgRest.Function of an RPC root.
Types
@type select_entry() :: %{ key: String.t(), field: String.t(), json_path: [PgRest.AST.Field.json_step()], cast: String.t() | nil } | %{key: String.t(), aggregate: PgRest.AST.Aggregate.t(), legacy: boolean()}
@type t() :: %PgRest.Plan.Read{ aggregates?: boolean(), aggregates_allowed?: boolean(), alias: String.t(), allowed_columns: :all | MapSet.t(String.t()), authorization_state: PgRest.Authorization.State.t(), categories: %{required(String.t()) => String.t()}, column_types: %{required(String.t()) => String.t()}, count: :exact | :planned | :estimated | nil, count_allowed?: boolean(), custom_params: [{String.t(), String.t()}], embeds: [PgRest.Plan.Embed.t()], hook_limit: pos_integer() | nil, limit: non_neg_integer() | nil, max_limit: pos_integer() | nil, offset: non_neg_integer(), order: [PgRest.AST.OrderTerm.t()], output: %{media: PgRest.MediaType.t()}, resource: module() | nil, select: [select_entry()], source: :resource | {:call, PgRest.Plan.Call.t()}, source_query: Ecto.Query.t() | nil, where: PgRest.AST.Logic.t() | nil }
Functions
Whether the node or any embed below it has an after_load/2 resource.
@spec aggregate?(select_entry()) :: boolean()
Whether a select entry is an aggregate PostgREST treats as one (it groups, needs
aggregates: true and is hoisted out of a to-one spread): not the legacy bare count.
@spec aggregate_entry?(select_entry()) :: boolean()
Whether a select entry computes an aggregate, the legacy bare count included.
@spec authorization_nodes(t()) :: [PgRest.Authorization.State.authorization_node()]
Internal targets, node paths and precomputed queries, without callback context.
The shared per-operation policy key of a junction.
The shared authorization path of a many-to-many junction.
@spec put_media(t(), PgRest.MediaType.t()) :: t()
The plan with the media type its root is answered in (output.media): the negotiated
type's PgRest.MediaType.body/1, so a plan type stores the type it explains.
Whether any effective source or column policy requires constraint detail scrubbing.
@spec sources(t()) :: [{module(), Ecto.Query.t() | nil}]
The {resource module, scoped source query} of every node of the plan, root first, an embed's
many-to-many junction before its target: the one walk over a plan's resources.
@spec targets(t()) :: [module() | PgRest.Function.t()]
What a response about this plan touches, for :explain: its resource modules
(sources/1) and the PgRest.Function of an RPC root.