-
Notifications
You must be signed in to change notification settings - Fork 26
Add a more complex example #24
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
Open
kivutar
wants to merge
11
commits into
functionalfoundry:master
Choose a base branch
from
kivutar:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
eaed1bd
Add a more complex example
kivutar ecafd07
Resolve at the function level
kivutar a7b92c7
Add subscription filter on docId
kivutar 7710a46
Set graphiql subscriptions endpoint
kivutar a342c2a
Don't export document
kivutar d4bebe8
Use id in place of docId
kivutar a614736
wrap mutation arguments with graphql.NewNonNull
kivutar cdf65d8
Remove useless new lines
kivutar fd92641
Use short variable names
kivutar c881694
EndpointURL was renamed to Endpoint in graphql-go/handler
kivutar fde93d7
Update SendData signature
kivutar 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
Use short variable names
- Loading branch information
commit fd92641bc7912686427806b6610c41465e85669c
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -83,26 +83,28 @@ func main() { | |
| documents[id].Title = p.Args["title"].(string) | ||
| documents[id].Content = p.Args["content"].(string) | ||
|
|
||
| for _, subscriptions := range subscriptionManager.Subscriptions() { | ||
| for _, subscription := range subscriptions { | ||
| for _, subs := range subscriptionManager.Subscriptions() { | ||
| for _, sub := range subs { | ||
| // JSON interface is float64 | ||
| var subID int = int(subscription.Variables["id"].(float64)) | ||
| var subID int = int(sub.Variables["id"].(float64)) | ||
|
|
||
| if id == subID { | ||
| params := graphql.Params{ | ||
| Schema: schema, | ||
| RequestString: subscription.Query, | ||
| VariableValues: subscription.Variables, | ||
| OperationName: subscription.OperationName, | ||
| RequestString: sub.Query, | ||
| VariableValues: sub.Variables, | ||
| OperationName: sub.OperationName, | ||
| } | ||
| result := graphql.Do(params) | ||
|
|
||
| data := graphqlws.DataMessagePayload{ | ||
| Data: result.Data, | ||
| Errors: graphqlws.ErrorsFromGraphQLErrors(result.Errors), | ||
| Data: result.Data, | ||
| Errors: graphqlws.ErrorsFromGraphQLErrors( | ||
| result.Errors, | ||
| ), | ||
| } | ||
|
|
||
| subscription.SendData(subscription, &data) | ||
| sub.SendData(sub, &data) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I made a breaking change in master, removing the unnecesary sub.SendData(&data) |
||
| } | ||
| } | ||
| } | ||
|
|
||
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.
I'd remove empty lines at the beginning of code blocks. Like this one.