Open dvv opened 1 year ago
it isn't currently possible to have additional parameters using the computed column feature. This feature is related to #222 but lets track it separately here as it'll probably be implemented in a separate PR
@olirice I managed to generate correct (hopefully) schema fields for the subj here https://github.com/dvv/pg_graphql/blob/master/src/graphql.rs#L2028-L2060.
create or replace function app._roles(app.user, i int = 123, s text = '456') returns text[] stable return array[s]::text[];
roles(i: Int = 123, s: String = "456"): [String]
Then I issue
query profile {
theUser {
id
username
roles(i: 222, s: "111")
}
}
but the app._roles()
is given only the first argument.
Please point out where to look for passing other arguments?
Please hold off on this feature. We need to make some decisions internally about how to differentiate between functions which extend base types and functions that are on the Query object and that'll have a significant impact on implementation
any progress with this feature?
Not yet. We've been focusing on extending filtering options and upsert support
Summary
To allow
to be natively used like
Rationale
To allow for a richer computed fields resolution logic.
Design
We already analyze computed field functions signatures to insert them into the schema. I believe we could as well detect function argument name and type and auto-add schema input fields for additional arguments.
Drawbacks
Don't see any.
Alternatives
Certainly we can pass additional info down to computed field resolver via global
variables
by doingin
app.graphql()
and usingin the computed field function.
The above is just a lot of hackish plus it pushes to pass data beside the schema and bypasses input validation.