-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
GraphQL: DX Relational Where Query #6255
GraphQL: DX Relational Where Query #6255
Conversation
Codecov Report
@@ Coverage Diff @@
## master #6255 +/- ##
=========================================
- Coverage 94.01% 93.92% -0.1%
=========================================
Files 169 169
Lines 11529 11564 +35
=========================================
+ Hits 10839 10861 +22
- Misses 690 703 +13
Continue to review full report at Codecov.
|
Everything should be okay now 🚀 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job! I have few comments.
@@ -964,8 +921,6 @@ const STRING_WHERE_INPUT = new GraphQLInputObjectType({ | |||
in: inOp(GraphQLString), | |||
notIn: notIn(GraphQLString), | |||
exists, | |||
inQueryKey, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should not remove these options from string, float, id, etc. With these options, the users are currently able to do something like:
countries(where: { continent: { inQueryKey: { query: { className: "Country", where: { name: { equalTo: "US" } } }, key: "continent" } } }) {
...
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hummm, from my point of view it's hard to understand this query without reading a documentation. The inQueryKey
feature is interesting to implement but i think we need first to re-design the input before re-implementing this feature. 😄 ? like playing with Enum
for key
and className
, but this is not the purpose of this PR... We need to avoid people using inputs that can be deprecated in a near futur 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I think it would be better keep it here while we don't improve. Someone can be already using this feature and they will have no alternative.
So, to avoid some confusion between regular I added support of Result: {
countries(
where: { companies: { haveNot: { name: { equalTo: "imACompany1" } }, } }
) {
edges {
node {
name
president {
name
}
companies {
edges {
node {
name
}
}
}
}
}
}
} |
Tests are okay (postgres tested with my local set up), just (again) a Postgres fail... |
@Moumouls great job with the I think persons(where: { spouse: { have: { name: { equalTo: "John" } } } }) { ... } But for relation is little bit strange to me: persons(where: { children: { have: { name: { equalTo: "John" } } } }) { ... } It looks to me that it should only return persons whose ALL children have name equal to "John". But that's not the case, right? I can't think a better name though. Maybe existWith? I am not good in giving names :) so if you prefer I am also okay in moving forward with the current ones. Another minor comment. For relation, it should probably be better countries(where: { companies: { exist: true } }) { ... } |
@dplewis Postgres tests are hanging in many branches. Sometimes it works for all of them then it stops working for all of them. I guess it is a Travis issue or at least some misconfiguration from our side... |
@davimacedo I opened a PR to address this. Hopefully it works |
@dplewis I'm not sure about logging, as it does not seem relevant to the Especially for the error related to writing something to a file. The library never writes anything to a file. |
@Moumouls The build should be good now. |
I think we will keep the |
Ok. No problem. Can you please only address my last open conversation and let's go to merge? |
Seems to have a random |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice job! LGTM!
* DX Relational Where Query * Remove WherePointer & fix tests * Add have, haveNot, exists on Pointer/Relation where input * Merge branch 'master' into gql-relational-query * Enable inQueryKey * better descrption
Allow to execute complexe relational queries like:
Query: Find countries containing companies that contains at least one employee named "John"
This system works for
Pointer
andRelation
Parse fields