Splits an RPC request into function arguments and row filters, as PostgREST's
pRequestFilter/isRpcRead do, and builds the arguments of the call.
On a read (GET/HEAD) the query string carries both: a key is a filter when it is reserved
or PgRest.Grammar.Filter.parse_condition/2 accepts its value, and an argument otherwise.
On a POST every query parameter is a filter and the arguments are the keys of the JSON body
(an array body: the keys its objects share), or the columns= list when given.
A parameter without a value (?a) is dropped, as PostgREST's nonemptyParams does.
Summary
Functions
The body media type of a conn (its Content-Type): :text, :xml, :bytea, or :json
for anything else, as PostgREST defaults to JSON.
The arguments of the call of function (PgRest.Plan.Call args). A read passes the
function's parameters the query string names (a variadic one every value in order, any other
the last). A JSON POST passes the raw body once, to json_to_recordset, or whole to a single
unnamed parameter; a non-JSON POST always reaches a single unnamed parameter.
Checks a JSON RPC body before resolution: an array must hold objects that all have the same
keys (PGRST102), as a bulk write's rows must. A columns= list must parse.
How the request calls its function, for PgRest.RPC.Resolver.resolve/5.
Returns {argument_keys, filter_params} for an invocation (invocation/1). Argument keys
are deduplicated; the resolver matches them as a set.
Functions
@spec body_media(Plug.Conn.t()) :: :json | :text | :xml | :bytea
The body media type of a conn (its Content-Type): :text, :xml, :bytea, or :json
for anything else, as PostgREST defaults to JSON.
@spec call_args(PgRest.Request.t(), PgRest.Function.t()) :: PgRest.Plan.Call.args()
The arguments of the call of function (PgRest.Plan.Call args). A read passes the
function's parameters the query string names (a variadic one every value in order, any other
the last). A JSON POST passes the raw body once, to json_to_recordset, or whole to a single
unnamed parameter; a non-JSON POST always reaches a single unnamed parameter.
@spec check_body(PgRest.Request.t()) :: :ok | {:error, PgRest.Error.t()}
Checks a JSON RPC body before resolution: an array must hold objects that all have the same
keys (PGRST102), as a bulk write's rows must. A columns= list must parse.
@spec invocation(PgRest.Request.t()) :: PgRest.RPC.Resolver.invocation()
How the request calls its function, for PgRest.RPC.Resolver.resolve/5.
@spec split(PgRest.Request.t(), PgRest.RPC.Resolver.invocation()) :: {[String.t()], [{String.t(), String.t()}]}
Returns {argument_keys, filter_params} for an invocation (invocation/1). Argument keys
are deduplicated; the resolver matches them as a set.