PgRest.Plan.Call (PgRest v0.2.0)

Copy Markdown View Source

The function call an RPC read plan reads from (PgRest.Plan.Read source: {:call, call}), compiled by PgRest.SQL.Call.

args is how the arguments reach the function:

  • {:direct, %{name => value | [value]}} - GET/HEAD query parameters; a variadic parameter collects its repeated values in order, any other keeps the last

  • {:json, body, keys} - a POST body (the raw JSON text) for a function with named parameters; keys are the argument names the request supplies
  • {:single, body} - a POST body passed whole to the single unnamed json/jsonb parameter

read_only? is true for GET/HEAD and for a POST to a stable or immutable function: the transaction then runs read-only. scope is {resource, scoped_query} when the result rows must be checked against the stored, in-scope rows (result_scope: :stored_rows on a scoped resource), else nil.

Summary

Types

args()

@type args() ::
  {:direct, %{required(String.t()) => String.t() | [String.t()]}}
  | {:json, binary(), [String.t()]}
  | {:single, binary()}

t()

@type t() :: %PgRest.Plan.Call{
  args: args(),
  function: PgRest.Function.t(),
  read_only?: boolean(),
  scope: {module(), Ecto.Query.t()} | nil
}