We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
This issue is written in response for #1514 (comment)
Please don't reject this proposal outright from theorethical standpoint that queries must be without side effects.
There are 2 cross-cutting concerns that could be solved with impure functions:
Consider the following scenario:
With impure function it could be implemented as:
This way only first query will execute long time, next queries will be fast and aggregated data will be shared between users.
Such functions would work extremely well in case of subscriptions.
Sometimes arises a need to have log of queries.
E.g. right now I have a need to check that frontend application pass correct hasura session parameter into functions.
With impure functions it could be dumb simple: create log table, write function parameters into it.
Right now I don't have such option. I need to check it by other means.
Logging in query functions would be extremely well in development environments.
From theorethical standpoint both cases violates principle that graphlq queries must be "side-effect free".
From practical POV - I think that even Seymour Peyton-Jones will not object such "violations".
Please consider such functionality.
The text was updated successfully, but these errors were encountered:
These are definitely useful and practical things I would like having when working with Hasura.
Sorry, something went wrong.
Thank you for the detailed description of the use-case. VOLATILE functions will be supported as queries as well (ref: #1514 (comment)).
No branches or pull requests
This issue is written in response for #1514 (comment)
Please don't reject this proposal outright from theorethical standpoint that queries must be without side effects.
There are 2 cross-cutting concerns that could be solved with impure functions:
Server-side memoization
Consider the following scenario:
With impure function it could be implemented as:
This way only first query will execute long time, next queries will be fast and aggregated data will be shared between users.
Such functions would work extremely well in case of subscriptions.
Logging
Sometimes arises a need to have log of queries.
E.g. right now I have a need to check that frontend application pass correct hasura session parameter into functions.
With impure functions it could be dumb simple: create log table, write function parameters into it.
Right now I don't have such option. I need to check it by other means.
Logging in query functions would be extremely well in development environments.
Overall
From theorethical standpoint both cases violates principle that graphlq queries must be "side-effect free".
From practical POV - I think that even Seymour Peyton-Jones will not object such "violations".
Please consider such functionality.
The text was updated successfully, but these errors were encountered: