mirror of
https://github.com/atulmy/gql-query-builder.git
synced 2026-04-25 23:55:55 +03:00
[GH-ISSUE #4] Single query, multiple operations #96
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/gql-query-builder#96
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @bebraw on GitHub (Mar 11, 2019).
Original GitHub issue: https://github.com/atulmy/gql-query-builder/issues/4
I have a case roughly like this:
The point is that I would like to execute multiple operations within a single query. As far as I can see, the current API isn't flexible enough for this purpose.
I can work around this by performing multiple separate requests. Any better ideas? Should I try to PR a generalization like this?
@atulmy commented on GitHub (Mar 11, 2019):
@bebraw yes, current implementation is quite basic. If we have this feature baked in, it'd definitely help.
There is this issue open to support params on nested fields which seems like dependency for this use case as well.
If you can send a PR, that would be awesome. Don't forget to add you name under Authors section of readme. Looking forward to it.
@bebraw commented on GitHub (Mar 11, 2019):
@atulmy Ok, I'll give it a go. Given the feature might couples operation with a specific field, likely the API shape has to change. Would a major version be ok? I can likely support the old format while giving a deprecation warning.
@atulmy commented on GitHub (Mar 11, 2019):
Sure.
@bebraw commented on GitHub (Mar 12, 2019):
Here's are my first proposals for the API:
1.
2.
Does it make sense to generate a query that has both mutations and queries in it? If not, then I would go with 2. as then you get
.queryand.mutationand cannot end up with a conflicting state.Let me know what you prefer and I'll implement the variant.
@atulmy commented on GitHub (Mar 12, 2019):
@bebraw the second one looks more comprehensible.
We may also need to support:
Only object:
Array of objects:
And mutation as well:
@bebraw commented on GitHub (Mar 12, 2019):
@atulmy Ok, sounds good. I'll do something basic around this. Would you mind if I ported the project to TypeScript while at it?
@atulmy commented on GitHub (Mar 12, 2019):
Sure. Sounds exciting. Haven't worked with TypeScript yet, this sounds like a good opportunity.
@bebraw commented on GitHub (Mar 13, 2019):
@atulmy You can find my initial PR at #5. It doesn't include the work above, though.
@atulmy commented on GitHub (Mar 13, 2019):
I think we should support following:
@bebraw commented on GitHub (Mar 13, 2019):
Ok, cool. I'll prepare a PR along those lines. It might go to tomorrow. Let's see.
@atulmy commented on GitHub (Mar 13, 2019):
Sure, we can schedule an
npmrelease once updated API is in good shape.