Finds the function a /rpc/<name> request calls, a port of PostgREST's Plan.hs findProc
over the registry snapshot's functions.
A function matches the request's argument names when, writing R for its required
parameter names and O for its optional ones, keys - O == R. That covers no parameters
(keys == []), only required (keys == R), only optional (keys is a subset of O) and
both.
A POST can also reach a function with one unnamed parameter, which takes the whole body. The
invocation says which body media type the request carries and so which parameter type that
is: :post ({:post, :json}, application/json) takes json or jsonb, {:post, :text}
(text/plain) text, {:post, :xml} (text/xml) xml and {:post, :bytea}
(application/octet-stream) bytea. A non-JSON body matches only that unnamed parameter,
never a function found by argument names.
Resolution excludes unnamed parameters other than that single-parameter shape.
Differences from PostgREST
Multi-parameter signatures with an unnamed argument are reported as uncached (PGRST202). PostgREST v14.18 may attempt them: a POST with an empty argument name reaches SQL and fails with 42601; its GET fails parsing that empty name.
Summary
Functions
Resolves schema.name for the request's argument keys.
Types
Functions
@spec resolve( PgRest.Registry.Snapshot.t(), String.t(), String.t(), [String.t()], invocation() ) :: {:ok, PgRest.Function.t()} | {:error, PgRest.Error.t()}
Resolves schema.name for the request's argument keys.