@@ -245,77 +245,6 @@ func generateTypeExprFromFieldTypeForReturn(typePrefix string, fieldType *schema
245245 return baseTypeExpr
246246}
247247
248- func generateApplyQueryResponseFuncDecls (operationDefinition * schema.OperationDefinition , indexes * schema.Indexes , nestCount int , typePrefix string ) []ast.Decl {
249- ret := make ([]ast.Decl , 0 )
250- for _ , field := range operationDefinition .Fields {
251- _ , isScalar := indexes .ScalarIndex [string (field .Type .GetRootType ().Name )]
252- if field .Type .GetRootType ().IsPrimitive () || isScalar {
253- continue
254- }
255-
256- ret = append (ret , generateApplyQueryResponseFuncDeclFromField (field , indexes , typePrefix , string (field .Name ), true ))
257- ret = append (ret , generateApplyNestedFieldQueryResponseFuncDecls (field .Type , indexes , typePrefix , string (field .Name ))... )
258- }
259-
260- return ret
261- }
262-
263- func getNestCount (fieldType * schema.FieldType , nestcount int ) int {
264- if fieldType .IsList {
265- return getNestCount (fieldType .ListType , nestcount + 1 )
266- }
267-
268- return nestcount
269- }
270-
271- func generateApplyNestedFieldQueryResponseFuncDecls (fieldType * schema.FieldType , indexes * schema.Indexes , typePrefix , operationPrefix string ) []ast.Decl {
272- ret := make ([]ast.Decl , 0 )
273-
274- rootType := fieldType .GetRootType ()
275- typeDefinition := indexes .TypeIndex [string (rootType .Name )]
276- if typeDefinition != nil {
277- ret = append (ret , generateApplyNestedFieldQueryResponseFuncDeclsFromTypeDefinition (typeDefinition , indexes , typePrefix , operationPrefix )... )
278- }
279-
280- if unionDefinitinon := indexes .UnionIndex [string (rootType .Name )]; unionDefinitinon != nil {
281- for _ , unionType := range unionDefinitinon .Types {
282- typeDefinition , ok := indexes .TypeIndex [string (unionType )]
283- if ! ok {
284- continue
285- }
286-
287- ret = append (ret , generateApplyNestedFieldQueryResponseFuncDeclsFromTypeDefinition (typeDefinition , indexes , typePrefix , operationPrefix )... )
288- }
289- }
290-
291- interfaceDefinition := indexes .InterfaceIndex [string (rootType .Name )]
292- if interfaceDefinition != nil {
293- interfaceImplementedTypes := indexes .GetImplementedType (interfaceDefinition )
294- for _ , implementedType := range interfaceImplementedTypes {
295- ret = append (ret , generateApplyNestedFieldQueryResponseFuncDeclsFromTypeDefinition (implementedType , indexes , typePrefix , operationPrefix )... )
296- }
297- }
298-
299- return ret
300- }
301-
302- func generateApplyNestedFieldQueryResponseFuncDeclsFromTypeDefinition (typeDefinition * schema.TypeDefinition , indexes * schema.Indexes , typePrefix , operationPrefix string ) []ast.Decl {
303- ret := make ([]ast.Decl , 0 )
304-
305- for _ , field := range typeDefinition .Fields {
306- _ , isScalar := indexes .ScalarIndex [string (field .Type .Name )]
307- _ , isEnum := indexes .EnumIndex [string (field .Type .Name )]
308-
309- if field .Type .GetRootType ().IsPrimitive () || isScalar || isEnum {
310- continue
311- }
312-
313- ret = append (ret , generateApplyQueryResponseFuncDeclFromField (field , indexes , typePrefix , operationPrefix , false ))
314- }
315-
316- return ret
317- }
318-
319248func generateQueryExecutor (query * schema.OperationDefinition ) * ast.FuncDecl {
320249 return & ast.FuncDecl {
321250 Name : ast .NewIdent ("queryExecutor" ),
0 commit comments