@@ -48,13 +48,13 @@ func main() {
48
48
"document" : & graphql.Field {
49
49
Type : documentType ,
50
50
Args : graphql.FieldConfigArgument {
51
- "docId " : & graphql.ArgumentConfig {
51
+ "id " : & graphql.ArgumentConfig {
52
52
Type : graphql .Int ,
53
53
},
54
54
},
55
55
Resolve : func (p graphql.ResolveParams ) (interface {}, error ) {
56
- docID := p .Args ["docId " ].(int )
57
- return documents [docID ], nil
56
+ id := p .Args ["id " ].(int )
57
+ return documents [id ], nil
58
58
},
59
59
},
60
60
},
@@ -68,7 +68,7 @@ func main() {
68
68
"updateDocument" : & graphql.Field {
69
69
Type : documentType ,
70
70
Args : graphql.FieldConfigArgument {
71
- "docId " : & graphql.ArgumentConfig {
71
+ "id " : & graphql.ArgumentConfig {
72
72
Type : graphql .Int ,
73
73
},
74
74
"title" : & graphql.ArgumentConfig {
@@ -80,17 +80,17 @@ func main() {
80
80
},
81
81
Resolve : func (p graphql.ResolveParams ) (interface {}, error ) {
82
82
83
- docID := p .Args ["docId " ].(int )
84
- documents [docID ].Title = p .Args ["title" ].(string )
85
- documents [docID ].Title = p .Args ["title" ].(string )
83
+ id := p .Args ["id " ].(int )
84
+ documents [id ].Title = p .Args ["title" ].(string )
85
+ documents [id ].Title = p .Args ["title" ].(string )
86
86
87
87
for _ , subscriptions := range subscriptionManager .Subscriptions () {
88
88
for _ , subscription := range subscriptions {
89
89
90
90
// JSON interface is float64
91
- var subdocID int = int (subscription .Variables ["docId " ].(float64 ))
91
+ var subID int = int (subscription .Variables ["id " ].(float64 ))
92
92
93
- if docID == subdocID {
93
+ if id == subID {
94
94
95
95
params := graphql.Params {
96
96
Schema : schema ,
@@ -110,7 +110,7 @@ func main() {
110
110
}
111
111
}
112
112
113
- return documents [docID ], nil
113
+ return documents [id ], nil
114
114
},
115
115
},
116
116
},
@@ -124,13 +124,13 @@ func main() {
124
124
"documentUpdates" : & graphql.Field {
125
125
Type : documentType ,
126
126
Args : graphql.FieldConfigArgument {
127
- "docId " : & graphql.ArgumentConfig {
127
+ "id " : & graphql.ArgumentConfig {
128
128
Type : graphql .Int ,
129
129
},
130
130
},
131
131
Resolve : func (p graphql.ResolveParams ) (interface {}, error ) {
132
- docID := p .Args ["docId " ].(int )
133
- return documents [docID ], nil
132
+ id := p .Args ["id " ].(int )
133
+ return documents [id ], nil
134
134
},
135
135
},
136
136
},
0 commit comments