Skip to content
Prev Previous commit
Next Next commit
Use short variable names
  • Loading branch information
kivutar committed Jan 5, 2018
commit fd92641bc7912686427806b6610c41465e85669c
20 changes: 11 additions & 9 deletions examples/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,26 +83,28 @@ func main() {
documents[id].Title = p.Args["title"].(string)
documents[id].Content = p.Args["content"].(string)

Copy link
Copy Markdown
Contributor

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.

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)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made a breaking change in master, removing the unnecesary *Subscription parameter from the SendData function. So now it's just

sub.SendData(&data)

}
}
}
Expand Down