@@ -35,7 +35,7 @@ func Execute(p ExecuteParams) (result *Result) {
35
35
go func (out chan <- * Result , done <- chan struct {}) {
36
36
result := & Result {}
37
37
38
- exeContext , err := buildExecutionContext (BuildExecutionCtxParams {
38
+ exeContext , err := buildExecutionContext (buildExecutionCtxParams {
39
39
Schema : p .Schema ,
40
40
Root : p .Root ,
41
41
AST : p .AST ,
@@ -70,7 +70,7 @@ func Execute(p ExecuteParams) (result *Result) {
70
70
}
71
71
}()
72
72
73
- result = executeOperation (ExecuteOperationParams {
73
+ result = executeOperation (executeOperationParams {
74
74
ExecutionContext : exeContext ,
75
75
Root : p .Root ,
76
76
Operation : exeContext .Operation ,
@@ -92,7 +92,7 @@ func Execute(p ExecuteParams) (result *Result) {
92
92
return
93
93
}
94
94
95
- type BuildExecutionCtxParams struct {
95
+ type buildExecutionCtxParams struct {
96
96
Schema Schema
97
97
Root interface {}
98
98
AST * ast.Document
@@ -102,7 +102,8 @@ type BuildExecutionCtxParams struct {
102
102
Result * Result
103
103
Context context.Context
104
104
}
105
- type ExecutionContext struct {
105
+
106
+ type executionContext struct {
106
107
Schema Schema
107
108
Fragments map [string ]ast.Definition
108
109
Root interface {}
@@ -112,8 +113,8 @@ type ExecutionContext struct {
112
113
Context context.Context
113
114
}
114
115
115
- func buildExecutionContext (p BuildExecutionCtxParams ) (* ExecutionContext , error ) {
116
- eCtx := & ExecutionContext {}
116
+ func buildExecutionContext (p buildExecutionCtxParams ) (* executionContext , error ) {
117
+ eCtx := & executionContext {}
117
118
var operation * ast.OperationDefinition
118
119
fragments := map [string ]ast.Definition {}
119
120
@@ -159,25 +160,25 @@ func buildExecutionContext(p BuildExecutionCtxParams) (*ExecutionContext, error)
159
160
return eCtx , nil
160
161
}
161
162
162
- type ExecuteOperationParams struct {
163
- ExecutionContext * ExecutionContext
163
+ type executeOperationParams struct {
164
+ ExecutionContext * executionContext
164
165
Root interface {}
165
166
Operation ast.Definition
166
167
}
167
168
168
- func executeOperation (p ExecuteOperationParams ) * Result {
169
+ func executeOperation (p executeOperationParams ) * Result {
169
170
operationType , err := getOperationRootType (p .ExecutionContext .Schema , p .Operation )
170
171
if err != nil {
171
172
return & Result {Errors : gqlerrors .FormatErrors (err )}
172
173
}
173
174
174
- fields := collectFields (CollectFieldsParams {
175
+ fields := collectFields (collectFieldsParams {
175
176
ExeContext : p .ExecutionContext ,
176
177
RuntimeType : operationType ,
177
178
SelectionSet : p .Operation .GetSelectionSet (),
178
179
})
179
180
180
- executeFieldsParams := ExecuteFieldsParams {
181
+ executeFieldsParams := executeFieldsParams {
181
182
ExecutionContext : p .ExecutionContext ,
182
183
ParentType : operationType ,
183
184
Source : p .Root ,
@@ -238,15 +239,15 @@ func getOperationRootType(schema Schema, operation ast.Definition) (*Object, err
238
239
}
239
240
}
240
241
241
- type ExecuteFieldsParams struct {
242
- ExecutionContext * ExecutionContext
242
+ type executeFieldsParams struct {
243
+ ExecutionContext * executionContext
243
244
ParentType * Object
244
245
Source interface {}
245
246
Fields map [string ][]* ast.Field
246
247
}
247
248
248
249
// Implements the "Evaluating selection sets" section of the spec for "write" mode.
249
- func executeFieldsSerially (p ExecuteFieldsParams ) * Result {
250
+ func executeFieldsSerially (p executeFieldsParams ) * Result {
250
251
if p .Source == nil {
251
252
p .Source = map [string ]interface {}{}
252
253
}
@@ -270,7 +271,7 @@ func executeFieldsSerially(p ExecuteFieldsParams) *Result {
270
271
}
271
272
272
273
// Implements the "Evaluating selection sets" section of the spec for "read" mode.
273
- func executeFields (p ExecuteFieldsParams ) * Result {
274
+ func executeFields (p executeFieldsParams ) * Result {
274
275
if p .Source == nil {
275
276
p .Source = map [string ]interface {}{}
276
277
}
@@ -293,8 +294,8 @@ func executeFields(p ExecuteFieldsParams) *Result {
293
294
}
294
295
}
295
296
296
- type CollectFieldsParams struct {
297
- ExeContext * ExecutionContext
297
+ type collectFieldsParams struct {
298
+ ExeContext * executionContext
298
299
RuntimeType * Object // previously known as OperationType
299
300
SelectionSet * ast.SelectionSet
300
301
Fields map [string ][]* ast.Field
@@ -306,7 +307,7 @@ type CollectFieldsParams struct {
306
307
// CollectFields requires the "runtime type" of an object. For a field which
307
308
// returns and Interface or Union type, the "runtime type" will be the actual
308
309
// Object type returned by that field.
309
- func collectFields (p CollectFieldsParams ) map [string ][]* ast.Field {
310
+ func collectFields (p collectFieldsParams ) map [string ][]* ast.Field {
310
311
311
312
fields := p .Fields
312
313
if fields == nil {
@@ -335,7 +336,7 @@ func collectFields(p CollectFieldsParams) map[string][]*ast.Field {
335
336
! doesFragmentConditionMatch (p .ExeContext , selection , p .RuntimeType ) {
336
337
continue
337
338
}
338
- innerParams := CollectFieldsParams {
339
+ innerParams := collectFieldsParams {
339
340
ExeContext : p .ExeContext ,
340
341
RuntimeType : p .RuntimeType ,
341
342
SelectionSet : selection .SelectionSet ,
@@ -362,7 +363,7 @@ func collectFields(p CollectFieldsParams) map[string][]*ast.Field {
362
363
if ! doesFragmentConditionMatch (p .ExeContext , fragment , p .RuntimeType ) {
363
364
continue
364
365
}
365
- innerParams := CollectFieldsParams {
366
+ innerParams := collectFieldsParams {
366
367
ExeContext : p .ExeContext ,
367
368
RuntimeType : p .RuntimeType ,
368
369
SelectionSet : fragment .GetSelectionSet (),
@@ -378,7 +379,7 @@ func collectFields(p CollectFieldsParams) map[string][]*ast.Field {
378
379
379
380
// Determines if a field should be included based on the @include and @skip
380
381
// directives, where @skip has higher precedence than @include.
381
- func shouldIncludeNode (eCtx * ExecutionContext , directives []* ast.Directive ) bool {
382
+ func shouldIncludeNode (eCtx * executionContext , directives []* ast.Directive ) bool {
382
383
383
384
defaultReturnValue := true
384
385
@@ -436,7 +437,7 @@ func shouldIncludeNode(eCtx *ExecutionContext, directives []*ast.Directive) bool
436
437
}
437
438
438
439
// Determines if a fragment is applicable to the given type.
439
- func doesFragmentConditionMatch (eCtx * ExecutionContext , fragment ast.Node , ttype * Object ) bool {
440
+ func doesFragmentConditionMatch (eCtx * executionContext , fragment ast.Node , ttype * Object ) bool {
440
441
441
442
switch fragment := fragment .(type ) {
442
443
case * ast.FragmentDefinition :
@@ -507,7 +508,7 @@ type resolveFieldResultState struct {
507
508
// figures out the value that the field returns by calling its resolve function,
508
509
// then calls completeValue to complete promises, serialize scalars, or execute
509
510
// the sub-selection-set for objects.
510
- func resolveField (eCtx * ExecutionContext , parentType * Object , source interface {}, fieldASTs []* ast.Field ) (result interface {}, resultState resolveFieldResultState ) {
511
+ func resolveField (eCtx * executionContext , parentType * Object , source interface {}, fieldASTs []* ast.Field ) (result interface {}, resultState resolveFieldResultState ) {
511
512
// catch panic from resolveFn
512
513
var returnType Output
513
514
defer func () (interface {}, resolveFieldResultState ) {
@@ -584,7 +585,7 @@ func resolveField(eCtx *ExecutionContext, parentType *Object, source interface{}
584
585
return completed , resultState
585
586
}
586
587
587
- func completeValueCatchingError (eCtx * ExecutionContext , returnType Type , fieldASTs []* ast.Field , info ResolveInfo , result interface {}) (completed interface {}) {
588
+ func completeValueCatchingError (eCtx * executionContext , returnType Type , fieldASTs []* ast.Field , info ResolveInfo , result interface {}) (completed interface {}) {
588
589
// catch panic
589
590
defer func () interface {} {
590
591
if r := recover (); r != nil {
@@ -608,7 +609,7 @@ func completeValueCatchingError(eCtx *ExecutionContext, returnType Type, fieldAS
608
609
return completed
609
610
}
610
611
611
- func completeValue (eCtx * ExecutionContext , returnType Type , fieldASTs []* ast.Field , info ResolveInfo , result interface {}) interface {} {
612
+ func completeValue (eCtx * executionContext , returnType Type , fieldASTs []* ast.Field , info ResolveInfo , result interface {}) interface {} {
612
613
613
614
resultVal := reflect .ValueOf (result )
614
615
if resultVal .IsValid () && resultVal .Type ().Kind () == reflect .Func {
@@ -678,7 +679,7 @@ func completeValue(eCtx *ExecutionContext, returnType Type, fieldASTs []*ast.Fie
678
679
679
680
// completeAbstractValue completes value of an Abstract type (Union / Interface) by determining the runtime type
680
681
// of that value, then completing based on that type.
681
- func completeAbstractValue (eCtx * ExecutionContext , returnType Abstract , fieldASTs []* ast.Field , info ResolveInfo , result interface {}) interface {} {
682
+ func completeAbstractValue (eCtx * executionContext , returnType Abstract , fieldASTs []* ast.Field , info ResolveInfo , result interface {}) interface {} {
682
683
683
684
var runtimeType * Object
684
685
@@ -715,7 +716,7 @@ func completeAbstractValue(eCtx *ExecutionContext, returnType Abstract, fieldAST
715
716
}
716
717
717
718
// completeObjectValue complete an Object value by executing all sub-selections.
718
- func completeObjectValue (eCtx * ExecutionContext , returnType * Object , fieldASTs []* ast.Field , info ResolveInfo , result interface {}) interface {} {
719
+ func completeObjectValue (eCtx * executionContext , returnType * Object , fieldASTs []* ast.Field , info ResolveInfo , result interface {}) interface {} {
719
720
720
721
// If there is an isTypeOf predicate function, call it with the
721
722
// current result. If isTypeOf returns false, then raise an error rather
@@ -742,7 +743,7 @@ func completeObjectValue(eCtx *ExecutionContext, returnType *Object, fieldASTs [
742
743
}
743
744
selectionSet := fieldAST .SelectionSet
744
745
if selectionSet != nil {
745
- innerParams := CollectFieldsParams {
746
+ innerParams := collectFieldsParams {
746
747
ExeContext : eCtx ,
747
748
RuntimeType : returnType ,
748
749
SelectionSet : selectionSet ,
@@ -752,7 +753,7 @@ func completeObjectValue(eCtx *ExecutionContext, returnType *Object, fieldASTs [
752
753
subFieldASTs = collectFields (innerParams )
753
754
}
754
755
}
755
- executeFieldsParams := ExecuteFieldsParams {
756
+ executeFieldsParams := executeFieldsParams {
756
757
ExecutionContext : eCtx ,
757
758
ParentType : returnType ,
758
759
Source : result ,
@@ -774,7 +775,7 @@ func completeLeafValue(returnType Leaf, result interface{}) interface{} {
774
775
}
775
776
776
777
// completeListValue complete a list value by completing each item in the list with the inner type
777
- func completeListValue (eCtx * ExecutionContext , returnType * List , fieldASTs []* ast.Field , info ResolveInfo , result interface {}) interface {} {
778
+ func completeListValue (eCtx * executionContext , returnType * List , fieldASTs []* ast.Field , info ResolveInfo , result interface {}) interface {} {
778
779
resultVal := reflect .ValueOf (result )
779
780
parentTypeName := ""
780
781
if info .ParentType != nil {
0 commit comments