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

How to call multiple queries at the same time? #632

Closed
dingyo777 opened this issue Dec 14, 2023 · 11 comments
Closed

How to call multiple queries at the same time? #632

dingyo777 opened this issue Dec 14, 2023 · 11 comments

Comments

@dingyo777
Copy link

I want to call multiple graphql queries at the same time, something like

{
  first: queryA {
    field1
    field2
  }
  second: queryB {
    field100
    field200
  }
}

How can I do this by DGS framework?
May I get some examples?

I tried to find out it in docs and this github, but I couldn't

@srinivasankavitha
Copy link
Contributor

Hi we don't support this capability in the DGS framework today.

@TLmaK0
Copy link

TLmaK0 commented Jan 13, 2024

@dingyo777 I think it is supported in the 6.x versions #426

@dingyo777
Copy link
Author

dingyo777 commented Mar 9, 2024

@TLmaK0 Thank you for sharing! I will try with it. But it seems that generated kotlin codes with gradle task generateJava not applicable with GraphQLMultiQueryRequest.

FYI, my config at kotlin project is as follows:

generateClient = true
generateDataTypes = true
generateKotlinNullableClasses = true
generateKotlinClosureProjections = true

@dingyo777
Copy link
Author

dingyo777 commented Mar 9, 2024

@mbossenbroek Would you give me some guideline or example? My question is how multiple queries or mutations call at once in kotlin2.

@dingyo777
Copy link
Author

@srinivasankavitha or do you have a plan to support batch queries or batch mutations in kotlin version with code-gen? Currently, with generated types, projection and DgsClient, it is hard to call mutiple queries or mutations at once.

@srinivasankavitha
Copy link
Contributor

Hi @dingyo777 - no we don't use this feature at all internally, so will not be prioritizing it.

@mbossenbroek
Copy link
Contributor

Yeah, I never added support for that in the newer kotlin query api, but I am interested in adding it for a use case that I have... That said, I likely won't get around to adding it for a few months, so not sure if that helps you at all :/

@dingyo777
Copy link
Author

dingyo777 commented Mar 11, 2024

@srinivasankavitha @mbossenbroek
Thank you for your answer. 👍 It will be very helpful if batch query or mutation is possible in newer Kotlin version. Not only me but also others who asked this feature previously. :)

@mbossenbroek
Copy link
Contributor

I should also note that I'm open to contributions if you'd like to throw up a PR. I'd be more than happy to get you started if you're interested in that route.

@mbossenbroek
Copy link
Contributor

@mbossenbroek
Copy link
Contributor

This is released now

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

No branches or pull requests

4 participants