-
Notifications
You must be signed in to change notification settings - Fork 1.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
feat(query): variables #9260
Merged
+66
−4
Merged
feat(query): variables #9260
Changes from 8 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
3947206
Trying to add variable injections to query
NicholasLYang 7ab3061
Add testing and variables file
NicholasLYang d1f9d00
nvm too cursed
NicholasLYang cd5eb89
Remove unused variant
NicholasLYang 201c949
Fix test
NicholasLYang cc75ac5
Fix clippy
NicholasLYang 09ce870
Fix test on windows
NicholasLYang 744e861
Oops wrong place
NicholasLYang c774d5e
PR feedback
NicholasLYang eabc2bd
Merge branch 'main' into nicholasyang/query-variables
NicholasLYang 167e2b4
Merge branch 'main' into nicholasyang/query-variables
NicholasLYang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
Setup | ||
$ . ${TESTDIR}/../../../helpers/setup_integration_test.sh | ||
|
||
Create a variables file | ||
$ echo '{ "name": "my-app" }' > vars.json | ||
|
||
Query packages | ||
$ ${TURBO} query 'query($name: String) { package(name: $name) { name } }' --variables vars.json | jq | ||
WARNING query command is experimental and may change in the future | ||
{ | ||
"data": { | ||
"package": { | ||
"name": "my-app" | ||
} | ||
} | ||
} | ||
|
||
Write query to file | ||
$ echo 'query($name: String) { package(name: $name) { name } }' > query.gql | ||
|
||
Run the query | ||
$ ${TURBO} query query.gql --variables vars.json | jq | ||
WARNING query command is experimental and may change in the future | ||
{ | ||
"data": { | ||
"package": { | ||
"name": "my-app" | ||
} | ||
} | ||
} | ||
|
||
Make sure we can't pass variables without a query | ||
$ ${TURBO} query --variables vars.json | ||
ERROR the following required arguments were not provided: | ||
<QUERY> | ||
|
||
Usage: turbo(.exe)? query --variables <VARIABLES> <QUERY> (re) | ||
|
||
For more information, try '--help'. | ||
|
||
[1] | ||
|
||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
suggestion: (sorry if I missed a good reason not to do this) might be nice to move this down with where it's used in the hunk below this one