-
-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extend computed fields with additional parameters #295
Comments
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 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 |
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.
The text was updated successfully, but these errors were encountered: