Skip to content
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

Support ForEach queries #24

Open
sordina opened this issue Oct 9, 2023 · 1 comment
Open

Support ForEach queries #24

sordina opened this issue Oct 9, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@sordina
Copy link
Contributor

sordina commented Oct 9, 2023

This isn't required for simple N+1 relationships, we would use this for optimised commands.

For example, a function definition could support batch api calls if exposed with array parameter annotation.

/**
 * Answers the question: `Are these users active?`
 * @pure
 * @param ids user-ids to query
 * @batch user_is_active ids id
 */
function users_are_active(ids: Array<string>): boolean {
    ...
}

Exposes users_are_active as normal, and user_is_active as if it had id parameter instead of ids and uses Variables capability to wire up relationships.

N+1 Engine Feature: https://hasurahq.atlassian.net/browse/V3API-194

While we design a solution that would allow per-function batch behaviour declaration that the engine can dispatch on, we could implement blankey ForEach support in TS connector and make the decision to perform a batch call in the connector.

@paf31
Copy link
Collaborator

paf31 commented Nov 21, 2023

One problem right now is that arguments are just Values, so we would need a way to specify them via variables. But the idea seems good in general to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants