github.com/jepp2078/gqlgen@v0.7.2/example/config/generated.go (about) 1 // Code generated by github.com/99designs/gqlgen, DO NOT EDIT. 2 3 package config 4 5 import ( 6 "bytes" 7 "context" 8 "errors" 9 "strconv" 10 "sync" 11 12 "github.com/99designs/gqlgen/graphql" 13 "github.com/99designs/gqlgen/graphql/introspection" 14 "github.com/vektah/gqlparser" 15 "github.com/vektah/gqlparser/ast" 16 ) 17 18 // NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface. 19 func NewExecutableSchema(cfg Config) graphql.ExecutableSchema { 20 return &executableSchema{ 21 resolvers: cfg.Resolvers, 22 directives: cfg.Directives, 23 complexity: cfg.Complexity, 24 } 25 } 26 27 type Config struct { 28 Resolvers ResolverRoot 29 Directives DirectiveRoot 30 Complexity ComplexityRoot 31 } 32 33 type ResolverRoot interface { 34 Mutation() MutationResolver 35 Query() QueryResolver 36 Todo() TodoResolver 37 } 38 39 type DirectiveRoot struct { 40 } 41 42 type ComplexityRoot struct { 43 Mutation struct { 44 CreateTodo func(childComplexity int, input NewTodo) int 45 } 46 47 Query struct { 48 Todos func(childComplexity int) int 49 } 50 51 Todo struct { 52 Id func(childComplexity int) int 53 DatabaseId func(childComplexity int) int 54 Text func(childComplexity int) int 55 Done func(childComplexity int) int 56 User func(childComplexity int) int 57 } 58 59 User struct { 60 Id func(childComplexity int) int 61 Name func(childComplexity int) int 62 } 63 } 64 65 type MutationResolver interface { 66 CreateTodo(ctx context.Context, input NewTodo) (Todo, error) 67 } 68 type QueryResolver interface { 69 Todos(ctx context.Context) ([]Todo, error) 70 } 71 type TodoResolver interface { 72 ID(ctx context.Context, obj *Todo) (string, error) 73 } 74 75 func field_Mutation_createTodo_args(rawArgs map[string]interface{}) (map[string]interface{}, error) { 76 args := map[string]interface{}{} 77 var arg0 NewTodo 78 if tmp, ok := rawArgs["input"]; ok { 79 var err error 80 arg0, err = UnmarshalNewTodo(tmp) 81 if err != nil { 82 return nil, err 83 } 84 } 85 args["input"] = arg0 86 return args, nil 87 88 } 89 90 func field_Query___type_args(rawArgs map[string]interface{}) (map[string]interface{}, error) { 91 args := map[string]interface{}{} 92 var arg0 string 93 if tmp, ok := rawArgs["name"]; ok { 94 var err error 95 arg0, err = graphql.UnmarshalString(tmp) 96 if err != nil { 97 return nil, err 98 } 99 } 100 args["name"] = arg0 101 return args, nil 102 103 } 104 105 func field___Type_fields_args(rawArgs map[string]interface{}) (map[string]interface{}, error) { 106 args := map[string]interface{}{} 107 var arg0 bool 108 if tmp, ok := rawArgs["includeDeprecated"]; ok { 109 var err error 110 arg0, err = graphql.UnmarshalBoolean(tmp) 111 if err != nil { 112 return nil, err 113 } 114 } 115 args["includeDeprecated"] = arg0 116 return args, nil 117 118 } 119 120 func field___Type_enumValues_args(rawArgs map[string]interface{}) (map[string]interface{}, error) { 121 args := map[string]interface{}{} 122 var arg0 bool 123 if tmp, ok := rawArgs["includeDeprecated"]; ok { 124 var err error 125 arg0, err = graphql.UnmarshalBoolean(tmp) 126 if err != nil { 127 return nil, err 128 } 129 } 130 args["includeDeprecated"] = arg0 131 return args, nil 132 133 } 134 135 type executableSchema struct { 136 resolvers ResolverRoot 137 directives DirectiveRoot 138 complexity ComplexityRoot 139 } 140 141 func (e *executableSchema) Schema() *ast.Schema { 142 return parsedSchema 143 } 144 145 func (e *executableSchema) Complexity(typeName, field string, childComplexity int, rawArgs map[string]interface{}) (int, bool) { 146 switch typeName + "." + field { 147 148 case "Mutation.createTodo": 149 if e.complexity.Mutation.CreateTodo == nil { 150 break 151 } 152 153 args, err := field_Mutation_createTodo_args(rawArgs) 154 if err != nil { 155 return 0, false 156 } 157 158 return e.complexity.Mutation.CreateTodo(childComplexity, args["input"].(NewTodo)), true 159 160 case "Query.todos": 161 if e.complexity.Query.Todos == nil { 162 break 163 } 164 165 return e.complexity.Query.Todos(childComplexity), true 166 167 case "Todo.id": 168 if e.complexity.Todo.Id == nil { 169 break 170 } 171 172 return e.complexity.Todo.Id(childComplexity), true 173 174 case "Todo.databaseId": 175 if e.complexity.Todo.DatabaseId == nil { 176 break 177 } 178 179 return e.complexity.Todo.DatabaseId(childComplexity), true 180 181 case "Todo.text": 182 if e.complexity.Todo.Text == nil { 183 break 184 } 185 186 return e.complexity.Todo.Text(childComplexity), true 187 188 case "Todo.done": 189 if e.complexity.Todo.Done == nil { 190 break 191 } 192 193 return e.complexity.Todo.Done(childComplexity), true 194 195 case "Todo.user": 196 if e.complexity.Todo.User == nil { 197 break 198 } 199 200 return e.complexity.Todo.User(childComplexity), true 201 202 case "User.id": 203 if e.complexity.User.Id == nil { 204 break 205 } 206 207 return e.complexity.User.Id(childComplexity), true 208 209 case "User.name": 210 if e.complexity.User.Name == nil { 211 break 212 } 213 214 return e.complexity.User.Name(childComplexity), true 215 216 } 217 return 0, false 218 } 219 220 func (e *executableSchema) Query(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { 221 ec := executionContext{graphql.GetRequestContext(ctx), e} 222 223 buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte { 224 data := ec._Query(ctx, op.SelectionSet) 225 var buf bytes.Buffer 226 data.MarshalGQL(&buf) 227 return buf.Bytes() 228 }) 229 230 return &graphql.Response{ 231 Data: buf, 232 Errors: ec.Errors, 233 Extensions: ec.Extensions} 234 } 235 236 func (e *executableSchema) Mutation(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { 237 ec := executionContext{graphql.GetRequestContext(ctx), e} 238 239 buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte { 240 data := ec._Mutation(ctx, op.SelectionSet) 241 var buf bytes.Buffer 242 data.MarshalGQL(&buf) 243 return buf.Bytes() 244 }) 245 246 return &graphql.Response{ 247 Data: buf, 248 Errors: ec.Errors, 249 Extensions: ec.Extensions, 250 } 251 } 252 253 func (e *executableSchema) Subscription(ctx context.Context, op *ast.OperationDefinition) func() *graphql.Response { 254 return graphql.OneShot(graphql.ErrorResponse(ctx, "subscriptions are not supported")) 255 } 256 257 type executionContext struct { 258 *graphql.RequestContext 259 *executableSchema 260 } 261 262 var mutationImplementors = []string{"Mutation"} 263 264 // nolint: gocyclo, errcheck, gas, goconst 265 func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { 266 fields := graphql.CollectFields(ctx, sel, mutationImplementors) 267 268 ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ 269 Object: "Mutation", 270 }) 271 272 out := graphql.NewOrderedMap(len(fields)) 273 invalid := false 274 for i, field := range fields { 275 out.Keys[i] = field.Alias 276 277 switch field.Name { 278 case "__typename": 279 out.Values[i] = graphql.MarshalString("Mutation") 280 case "createTodo": 281 out.Values[i] = ec._Mutation_createTodo(ctx, field) 282 if out.Values[i] == graphql.Null { 283 invalid = true 284 } 285 default: 286 panic("unknown field " + strconv.Quote(field.Name)) 287 } 288 } 289 290 if invalid { 291 return graphql.Null 292 } 293 return out 294 } 295 296 // nolint: vetshadow 297 func (ec *executionContext) _Mutation_createTodo(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { 298 ctx = ec.Tracer.StartFieldExecution(ctx, field) 299 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 300 rawArgs := field.ArgumentMap(ec.Variables) 301 args, err := field_Mutation_createTodo_args(rawArgs) 302 if err != nil { 303 ec.Error(ctx, err) 304 return graphql.Null 305 } 306 rctx := &graphql.ResolverContext{ 307 Object: "Mutation", 308 Args: args, 309 Field: field, 310 } 311 ctx = graphql.WithResolverContext(ctx, rctx) 312 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 313 resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { 314 ctx = rctx // use context from middleware stack in children 315 return ec.resolvers.Mutation().CreateTodo(rctx, args["input"].(NewTodo)) 316 }) 317 if resTmp == nil { 318 if !ec.HasError(rctx) { 319 ec.Errorf(ctx, "must not be null") 320 } 321 return graphql.Null 322 } 323 res := resTmp.(Todo) 324 rctx.Result = res 325 ctx = ec.Tracer.StartFieldChildExecution(ctx) 326 327 return ec._Todo(ctx, field.Selections, &res) 328 } 329 330 var queryImplementors = []string{"Query"} 331 332 // nolint: gocyclo, errcheck, gas, goconst 333 func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { 334 fields := graphql.CollectFields(ctx, sel, queryImplementors) 335 336 ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ 337 Object: "Query", 338 }) 339 340 var wg sync.WaitGroup 341 out := graphql.NewOrderedMap(len(fields)) 342 invalid := false 343 for i, field := range fields { 344 out.Keys[i] = field.Alias 345 346 switch field.Name { 347 case "__typename": 348 out.Values[i] = graphql.MarshalString("Query") 349 case "todos": 350 wg.Add(1) 351 go func(i int, field graphql.CollectedField) { 352 out.Values[i] = ec._Query_todos(ctx, field) 353 if out.Values[i] == graphql.Null { 354 invalid = true 355 } 356 wg.Done() 357 }(i, field) 358 case "__type": 359 out.Values[i] = ec._Query___type(ctx, field) 360 case "__schema": 361 out.Values[i] = ec._Query___schema(ctx, field) 362 default: 363 panic("unknown field " + strconv.Quote(field.Name)) 364 } 365 } 366 wg.Wait() 367 if invalid { 368 return graphql.Null 369 } 370 return out 371 } 372 373 // nolint: vetshadow 374 func (ec *executionContext) _Query_todos(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { 375 ctx = ec.Tracer.StartFieldExecution(ctx, field) 376 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 377 rctx := &graphql.ResolverContext{ 378 Object: "Query", 379 Args: nil, 380 Field: field, 381 } 382 ctx = graphql.WithResolverContext(ctx, rctx) 383 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 384 resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { 385 ctx = rctx // use context from middleware stack in children 386 return ec.resolvers.Query().Todos(rctx) 387 }) 388 if resTmp == nil { 389 if !ec.HasError(rctx) { 390 ec.Errorf(ctx, "must not be null") 391 } 392 return graphql.Null 393 } 394 res := resTmp.([]Todo) 395 rctx.Result = res 396 ctx = ec.Tracer.StartFieldChildExecution(ctx) 397 398 arr1 := make(graphql.Array, len(res)) 399 var wg sync.WaitGroup 400 401 isLen1 := len(res) == 1 402 if !isLen1 { 403 wg.Add(len(res)) 404 } 405 406 for idx1 := range res { 407 idx1 := idx1 408 rctx := &graphql.ResolverContext{ 409 Index: &idx1, 410 Result: &res[idx1], 411 } 412 ctx := graphql.WithResolverContext(ctx, rctx) 413 f := func(idx1 int) { 414 if !isLen1 { 415 defer wg.Done() 416 } 417 arr1[idx1] = func() graphql.Marshaler { 418 419 return ec._Todo(ctx, field.Selections, &res[idx1]) 420 }() 421 } 422 if isLen1 { 423 f(idx1) 424 } else { 425 go f(idx1) 426 } 427 428 } 429 wg.Wait() 430 return arr1 431 } 432 433 // nolint: vetshadow 434 func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { 435 ctx = ec.Tracer.StartFieldExecution(ctx, field) 436 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 437 rawArgs := field.ArgumentMap(ec.Variables) 438 args, err := field_Query___type_args(rawArgs) 439 if err != nil { 440 ec.Error(ctx, err) 441 return graphql.Null 442 } 443 rctx := &graphql.ResolverContext{ 444 Object: "Query", 445 Args: args, 446 Field: field, 447 } 448 ctx = graphql.WithResolverContext(ctx, rctx) 449 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 450 resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { 451 ctx = rctx // use context from middleware stack in children 452 return ec.introspectType(args["name"].(string)) 453 }) 454 if resTmp == nil { 455 return graphql.Null 456 } 457 res := resTmp.(*introspection.Type) 458 rctx.Result = res 459 ctx = ec.Tracer.StartFieldChildExecution(ctx) 460 461 if res == nil { 462 return graphql.Null 463 } 464 465 return ec.___Type(ctx, field.Selections, res) 466 } 467 468 // nolint: vetshadow 469 func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { 470 ctx = ec.Tracer.StartFieldExecution(ctx, field) 471 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 472 rctx := &graphql.ResolverContext{ 473 Object: "Query", 474 Args: nil, 475 Field: field, 476 } 477 ctx = graphql.WithResolverContext(ctx, rctx) 478 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 479 resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { 480 ctx = rctx // use context from middleware stack in children 481 return ec.introspectSchema() 482 }) 483 if resTmp == nil { 484 return graphql.Null 485 } 486 res := resTmp.(*introspection.Schema) 487 rctx.Result = res 488 ctx = ec.Tracer.StartFieldChildExecution(ctx) 489 490 if res == nil { 491 return graphql.Null 492 } 493 494 return ec.___Schema(ctx, field.Selections, res) 495 } 496 497 var todoImplementors = []string{"Todo"} 498 499 // nolint: gocyclo, errcheck, gas, goconst 500 func (ec *executionContext) _Todo(ctx context.Context, sel ast.SelectionSet, obj *Todo) graphql.Marshaler { 501 fields := graphql.CollectFields(ctx, sel, todoImplementors) 502 503 var wg sync.WaitGroup 504 out := graphql.NewOrderedMap(len(fields)) 505 invalid := false 506 for i, field := range fields { 507 out.Keys[i] = field.Alias 508 509 switch field.Name { 510 case "__typename": 511 out.Values[i] = graphql.MarshalString("Todo") 512 case "id": 513 wg.Add(1) 514 go func(i int, field graphql.CollectedField) { 515 out.Values[i] = ec._Todo_id(ctx, field, obj) 516 if out.Values[i] == graphql.Null { 517 invalid = true 518 } 519 wg.Done() 520 }(i, field) 521 case "databaseId": 522 out.Values[i] = ec._Todo_databaseId(ctx, field, obj) 523 if out.Values[i] == graphql.Null { 524 invalid = true 525 } 526 case "text": 527 out.Values[i] = ec._Todo_text(ctx, field, obj) 528 if out.Values[i] == graphql.Null { 529 invalid = true 530 } 531 case "done": 532 out.Values[i] = ec._Todo_done(ctx, field, obj) 533 if out.Values[i] == graphql.Null { 534 invalid = true 535 } 536 case "user": 537 out.Values[i] = ec._Todo_user(ctx, field, obj) 538 if out.Values[i] == graphql.Null { 539 invalid = true 540 } 541 default: 542 panic("unknown field " + strconv.Quote(field.Name)) 543 } 544 } 545 wg.Wait() 546 if invalid { 547 return graphql.Null 548 } 549 return out 550 } 551 552 // nolint: vetshadow 553 func (ec *executionContext) _Todo_id(ctx context.Context, field graphql.CollectedField, obj *Todo) graphql.Marshaler { 554 ctx = ec.Tracer.StartFieldExecution(ctx, field) 555 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 556 rctx := &graphql.ResolverContext{ 557 Object: "Todo", 558 Args: nil, 559 Field: field, 560 } 561 ctx = graphql.WithResolverContext(ctx, rctx) 562 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 563 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 564 ctx = rctx // use context from middleware stack in children 565 return ec.resolvers.Todo().ID(rctx, obj) 566 }) 567 if resTmp == nil { 568 if !ec.HasError(rctx) { 569 ec.Errorf(ctx, "must not be null") 570 } 571 return graphql.Null 572 } 573 res := resTmp.(string) 574 rctx.Result = res 575 ctx = ec.Tracer.StartFieldChildExecution(ctx) 576 return graphql.MarshalID(res) 577 } 578 579 // nolint: vetshadow 580 func (ec *executionContext) _Todo_databaseId(ctx context.Context, field graphql.CollectedField, obj *Todo) graphql.Marshaler { 581 ctx = ec.Tracer.StartFieldExecution(ctx, field) 582 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 583 rctx := &graphql.ResolverContext{ 584 Object: "Todo", 585 Args: nil, 586 Field: field, 587 } 588 ctx = graphql.WithResolverContext(ctx, rctx) 589 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 590 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 591 ctx = rctx // use context from middleware stack in children 592 return obj.DatabaseID, nil 593 }) 594 if resTmp == nil { 595 if !ec.HasError(rctx) { 596 ec.Errorf(ctx, "must not be null") 597 } 598 return graphql.Null 599 } 600 res := resTmp.(int) 601 rctx.Result = res 602 ctx = ec.Tracer.StartFieldChildExecution(ctx) 603 return graphql.MarshalInt(res) 604 } 605 606 // nolint: vetshadow 607 func (ec *executionContext) _Todo_text(ctx context.Context, field graphql.CollectedField, obj *Todo) graphql.Marshaler { 608 ctx = ec.Tracer.StartFieldExecution(ctx, field) 609 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 610 rctx := &graphql.ResolverContext{ 611 Object: "Todo", 612 Args: nil, 613 Field: field, 614 } 615 ctx = graphql.WithResolverContext(ctx, rctx) 616 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 617 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 618 ctx = rctx // use context from middleware stack in children 619 return obj.Description, nil 620 }) 621 if resTmp == nil { 622 if !ec.HasError(rctx) { 623 ec.Errorf(ctx, "must not be null") 624 } 625 return graphql.Null 626 } 627 res := resTmp.(string) 628 rctx.Result = res 629 ctx = ec.Tracer.StartFieldChildExecution(ctx) 630 return graphql.MarshalString(res) 631 } 632 633 // nolint: vetshadow 634 func (ec *executionContext) _Todo_done(ctx context.Context, field graphql.CollectedField, obj *Todo) graphql.Marshaler { 635 ctx = ec.Tracer.StartFieldExecution(ctx, field) 636 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 637 rctx := &graphql.ResolverContext{ 638 Object: "Todo", 639 Args: nil, 640 Field: field, 641 } 642 ctx = graphql.WithResolverContext(ctx, rctx) 643 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 644 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 645 ctx = rctx // use context from middleware stack in children 646 return obj.Done, nil 647 }) 648 if resTmp == nil { 649 if !ec.HasError(rctx) { 650 ec.Errorf(ctx, "must not be null") 651 } 652 return graphql.Null 653 } 654 res := resTmp.(bool) 655 rctx.Result = res 656 ctx = ec.Tracer.StartFieldChildExecution(ctx) 657 return graphql.MarshalBoolean(res) 658 } 659 660 // nolint: vetshadow 661 func (ec *executionContext) _Todo_user(ctx context.Context, field graphql.CollectedField, obj *Todo) graphql.Marshaler { 662 ctx = ec.Tracer.StartFieldExecution(ctx, field) 663 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 664 rctx := &graphql.ResolverContext{ 665 Object: "Todo", 666 Args: nil, 667 Field: field, 668 } 669 ctx = graphql.WithResolverContext(ctx, rctx) 670 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 671 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 672 ctx = rctx // use context from middleware stack in children 673 return obj.User, nil 674 }) 675 if resTmp == nil { 676 if !ec.HasError(rctx) { 677 ec.Errorf(ctx, "must not be null") 678 } 679 return graphql.Null 680 } 681 res := resTmp.(User) 682 rctx.Result = res 683 ctx = ec.Tracer.StartFieldChildExecution(ctx) 684 685 return ec._User(ctx, field.Selections, &res) 686 } 687 688 var userImplementors = []string{"User"} 689 690 // nolint: gocyclo, errcheck, gas, goconst 691 func (ec *executionContext) _User(ctx context.Context, sel ast.SelectionSet, obj *User) graphql.Marshaler { 692 fields := graphql.CollectFields(ctx, sel, userImplementors) 693 694 out := graphql.NewOrderedMap(len(fields)) 695 invalid := false 696 for i, field := range fields { 697 out.Keys[i] = field.Alias 698 699 switch field.Name { 700 case "__typename": 701 out.Values[i] = graphql.MarshalString("User") 702 case "id": 703 out.Values[i] = ec._User_id(ctx, field, obj) 704 if out.Values[i] == graphql.Null { 705 invalid = true 706 } 707 case "name": 708 out.Values[i] = ec._User_name(ctx, field, obj) 709 if out.Values[i] == graphql.Null { 710 invalid = true 711 } 712 default: 713 panic("unknown field " + strconv.Quote(field.Name)) 714 } 715 } 716 717 if invalid { 718 return graphql.Null 719 } 720 return out 721 } 722 723 // nolint: vetshadow 724 func (ec *executionContext) _User_id(ctx context.Context, field graphql.CollectedField, obj *User) graphql.Marshaler { 725 ctx = ec.Tracer.StartFieldExecution(ctx, field) 726 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 727 rctx := &graphql.ResolverContext{ 728 Object: "User", 729 Args: nil, 730 Field: field, 731 } 732 ctx = graphql.WithResolverContext(ctx, rctx) 733 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 734 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 735 ctx = rctx // use context from middleware stack in children 736 return obj.ID, nil 737 }) 738 if resTmp == nil { 739 if !ec.HasError(rctx) { 740 ec.Errorf(ctx, "must not be null") 741 } 742 return graphql.Null 743 } 744 res := resTmp.(string) 745 rctx.Result = res 746 ctx = ec.Tracer.StartFieldChildExecution(ctx) 747 return graphql.MarshalID(res) 748 } 749 750 // nolint: vetshadow 751 func (ec *executionContext) _User_name(ctx context.Context, field graphql.CollectedField, obj *User) graphql.Marshaler { 752 ctx = ec.Tracer.StartFieldExecution(ctx, field) 753 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 754 rctx := &graphql.ResolverContext{ 755 Object: "User", 756 Args: nil, 757 Field: field, 758 } 759 ctx = graphql.WithResolverContext(ctx, rctx) 760 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 761 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 762 ctx = rctx // use context from middleware stack in children 763 return obj.FullName(), nil 764 }) 765 if resTmp == nil { 766 if !ec.HasError(rctx) { 767 ec.Errorf(ctx, "must not be null") 768 } 769 return graphql.Null 770 } 771 res := resTmp.(string) 772 rctx.Result = res 773 ctx = ec.Tracer.StartFieldChildExecution(ctx) 774 return graphql.MarshalString(res) 775 } 776 777 var __DirectiveImplementors = []string{"__Directive"} 778 779 // nolint: gocyclo, errcheck, gas, goconst 780 func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionSet, obj *introspection.Directive) graphql.Marshaler { 781 fields := graphql.CollectFields(ctx, sel, __DirectiveImplementors) 782 783 out := graphql.NewOrderedMap(len(fields)) 784 invalid := false 785 for i, field := range fields { 786 out.Keys[i] = field.Alias 787 788 switch field.Name { 789 case "__typename": 790 out.Values[i] = graphql.MarshalString("__Directive") 791 case "name": 792 out.Values[i] = ec.___Directive_name(ctx, field, obj) 793 if out.Values[i] == graphql.Null { 794 invalid = true 795 } 796 case "description": 797 out.Values[i] = ec.___Directive_description(ctx, field, obj) 798 case "locations": 799 out.Values[i] = ec.___Directive_locations(ctx, field, obj) 800 if out.Values[i] == graphql.Null { 801 invalid = true 802 } 803 case "args": 804 out.Values[i] = ec.___Directive_args(ctx, field, obj) 805 if out.Values[i] == graphql.Null { 806 invalid = true 807 } 808 default: 809 panic("unknown field " + strconv.Quote(field.Name)) 810 } 811 } 812 813 if invalid { 814 return graphql.Null 815 } 816 return out 817 } 818 819 // nolint: vetshadow 820 func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { 821 ctx = ec.Tracer.StartFieldExecution(ctx, field) 822 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 823 rctx := &graphql.ResolverContext{ 824 Object: "__Directive", 825 Args: nil, 826 Field: field, 827 } 828 ctx = graphql.WithResolverContext(ctx, rctx) 829 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 830 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 831 ctx = rctx // use context from middleware stack in children 832 return obj.Name, nil 833 }) 834 if resTmp == nil { 835 if !ec.HasError(rctx) { 836 ec.Errorf(ctx, "must not be null") 837 } 838 return graphql.Null 839 } 840 res := resTmp.(string) 841 rctx.Result = res 842 ctx = ec.Tracer.StartFieldChildExecution(ctx) 843 return graphql.MarshalString(res) 844 } 845 846 // nolint: vetshadow 847 func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { 848 ctx = ec.Tracer.StartFieldExecution(ctx, field) 849 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 850 rctx := &graphql.ResolverContext{ 851 Object: "__Directive", 852 Args: nil, 853 Field: field, 854 } 855 ctx = graphql.WithResolverContext(ctx, rctx) 856 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 857 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 858 ctx = rctx // use context from middleware stack in children 859 return obj.Description, nil 860 }) 861 if resTmp == nil { 862 return graphql.Null 863 } 864 res := resTmp.(string) 865 rctx.Result = res 866 ctx = ec.Tracer.StartFieldChildExecution(ctx) 867 return graphql.MarshalString(res) 868 } 869 870 // nolint: vetshadow 871 func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { 872 ctx = ec.Tracer.StartFieldExecution(ctx, field) 873 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 874 rctx := &graphql.ResolverContext{ 875 Object: "__Directive", 876 Args: nil, 877 Field: field, 878 } 879 ctx = graphql.WithResolverContext(ctx, rctx) 880 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 881 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 882 ctx = rctx // use context from middleware stack in children 883 return obj.Locations, nil 884 }) 885 if resTmp == nil { 886 if !ec.HasError(rctx) { 887 ec.Errorf(ctx, "must not be null") 888 } 889 return graphql.Null 890 } 891 res := resTmp.([]string) 892 rctx.Result = res 893 ctx = ec.Tracer.StartFieldChildExecution(ctx) 894 895 arr1 := make(graphql.Array, len(res)) 896 897 for idx1 := range res { 898 arr1[idx1] = func() graphql.Marshaler { 899 return graphql.MarshalString(res[idx1]) 900 }() 901 } 902 903 return arr1 904 } 905 906 // nolint: vetshadow 907 func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { 908 ctx = ec.Tracer.StartFieldExecution(ctx, field) 909 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 910 rctx := &graphql.ResolverContext{ 911 Object: "__Directive", 912 Args: nil, 913 Field: field, 914 } 915 ctx = graphql.WithResolverContext(ctx, rctx) 916 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 917 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 918 ctx = rctx // use context from middleware stack in children 919 return obj.Args, nil 920 }) 921 if resTmp == nil { 922 if !ec.HasError(rctx) { 923 ec.Errorf(ctx, "must not be null") 924 } 925 return graphql.Null 926 } 927 res := resTmp.([]introspection.InputValue) 928 rctx.Result = res 929 ctx = ec.Tracer.StartFieldChildExecution(ctx) 930 931 arr1 := make(graphql.Array, len(res)) 932 var wg sync.WaitGroup 933 934 isLen1 := len(res) == 1 935 if !isLen1 { 936 wg.Add(len(res)) 937 } 938 939 for idx1 := range res { 940 idx1 := idx1 941 rctx := &graphql.ResolverContext{ 942 Index: &idx1, 943 Result: &res[idx1], 944 } 945 ctx := graphql.WithResolverContext(ctx, rctx) 946 f := func(idx1 int) { 947 if !isLen1 { 948 defer wg.Done() 949 } 950 arr1[idx1] = func() graphql.Marshaler { 951 952 return ec.___InputValue(ctx, field.Selections, &res[idx1]) 953 }() 954 } 955 if isLen1 { 956 f(idx1) 957 } else { 958 go f(idx1) 959 } 960 961 } 962 wg.Wait() 963 return arr1 964 } 965 966 var __EnumValueImplementors = []string{"__EnumValue"} 967 968 // nolint: gocyclo, errcheck, gas, goconst 969 func (ec *executionContext) ___EnumValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.EnumValue) graphql.Marshaler { 970 fields := graphql.CollectFields(ctx, sel, __EnumValueImplementors) 971 972 out := graphql.NewOrderedMap(len(fields)) 973 invalid := false 974 for i, field := range fields { 975 out.Keys[i] = field.Alias 976 977 switch field.Name { 978 case "__typename": 979 out.Values[i] = graphql.MarshalString("__EnumValue") 980 case "name": 981 out.Values[i] = ec.___EnumValue_name(ctx, field, obj) 982 if out.Values[i] == graphql.Null { 983 invalid = true 984 } 985 case "description": 986 out.Values[i] = ec.___EnumValue_description(ctx, field, obj) 987 case "isDeprecated": 988 out.Values[i] = ec.___EnumValue_isDeprecated(ctx, field, obj) 989 if out.Values[i] == graphql.Null { 990 invalid = true 991 } 992 case "deprecationReason": 993 out.Values[i] = ec.___EnumValue_deprecationReason(ctx, field, obj) 994 default: 995 panic("unknown field " + strconv.Quote(field.Name)) 996 } 997 } 998 999 if invalid { 1000 return graphql.Null 1001 } 1002 return out 1003 } 1004 1005 // nolint: vetshadow 1006 func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { 1007 ctx = ec.Tracer.StartFieldExecution(ctx, field) 1008 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 1009 rctx := &graphql.ResolverContext{ 1010 Object: "__EnumValue", 1011 Args: nil, 1012 Field: field, 1013 } 1014 ctx = graphql.WithResolverContext(ctx, rctx) 1015 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 1016 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1017 ctx = rctx // use context from middleware stack in children 1018 return obj.Name, nil 1019 }) 1020 if resTmp == nil { 1021 if !ec.HasError(rctx) { 1022 ec.Errorf(ctx, "must not be null") 1023 } 1024 return graphql.Null 1025 } 1026 res := resTmp.(string) 1027 rctx.Result = res 1028 ctx = ec.Tracer.StartFieldChildExecution(ctx) 1029 return graphql.MarshalString(res) 1030 } 1031 1032 // nolint: vetshadow 1033 func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { 1034 ctx = ec.Tracer.StartFieldExecution(ctx, field) 1035 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 1036 rctx := &graphql.ResolverContext{ 1037 Object: "__EnumValue", 1038 Args: nil, 1039 Field: field, 1040 } 1041 ctx = graphql.WithResolverContext(ctx, rctx) 1042 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 1043 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1044 ctx = rctx // use context from middleware stack in children 1045 return obj.Description, nil 1046 }) 1047 if resTmp == nil { 1048 return graphql.Null 1049 } 1050 res := resTmp.(string) 1051 rctx.Result = res 1052 ctx = ec.Tracer.StartFieldChildExecution(ctx) 1053 return graphql.MarshalString(res) 1054 } 1055 1056 // nolint: vetshadow 1057 func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { 1058 ctx = ec.Tracer.StartFieldExecution(ctx, field) 1059 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 1060 rctx := &graphql.ResolverContext{ 1061 Object: "__EnumValue", 1062 Args: nil, 1063 Field: field, 1064 } 1065 ctx = graphql.WithResolverContext(ctx, rctx) 1066 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 1067 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1068 ctx = rctx // use context from middleware stack in children 1069 return obj.IsDeprecated(), nil 1070 }) 1071 if resTmp == nil { 1072 if !ec.HasError(rctx) { 1073 ec.Errorf(ctx, "must not be null") 1074 } 1075 return graphql.Null 1076 } 1077 res := resTmp.(bool) 1078 rctx.Result = res 1079 ctx = ec.Tracer.StartFieldChildExecution(ctx) 1080 return graphql.MarshalBoolean(res) 1081 } 1082 1083 // nolint: vetshadow 1084 func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { 1085 ctx = ec.Tracer.StartFieldExecution(ctx, field) 1086 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 1087 rctx := &graphql.ResolverContext{ 1088 Object: "__EnumValue", 1089 Args: nil, 1090 Field: field, 1091 } 1092 ctx = graphql.WithResolverContext(ctx, rctx) 1093 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 1094 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1095 ctx = rctx // use context from middleware stack in children 1096 return obj.DeprecationReason(), nil 1097 }) 1098 if resTmp == nil { 1099 return graphql.Null 1100 } 1101 res := resTmp.(*string) 1102 rctx.Result = res 1103 ctx = ec.Tracer.StartFieldChildExecution(ctx) 1104 1105 if res == nil { 1106 return graphql.Null 1107 } 1108 return graphql.MarshalString(*res) 1109 } 1110 1111 var __FieldImplementors = []string{"__Field"} 1112 1113 // nolint: gocyclo, errcheck, gas, goconst 1114 func (ec *executionContext) ___Field(ctx context.Context, sel ast.SelectionSet, obj *introspection.Field) graphql.Marshaler { 1115 fields := graphql.CollectFields(ctx, sel, __FieldImplementors) 1116 1117 out := graphql.NewOrderedMap(len(fields)) 1118 invalid := false 1119 for i, field := range fields { 1120 out.Keys[i] = field.Alias 1121 1122 switch field.Name { 1123 case "__typename": 1124 out.Values[i] = graphql.MarshalString("__Field") 1125 case "name": 1126 out.Values[i] = ec.___Field_name(ctx, field, obj) 1127 if out.Values[i] == graphql.Null { 1128 invalid = true 1129 } 1130 case "description": 1131 out.Values[i] = ec.___Field_description(ctx, field, obj) 1132 case "args": 1133 out.Values[i] = ec.___Field_args(ctx, field, obj) 1134 if out.Values[i] == graphql.Null { 1135 invalid = true 1136 } 1137 case "type": 1138 out.Values[i] = ec.___Field_type(ctx, field, obj) 1139 if out.Values[i] == graphql.Null { 1140 invalid = true 1141 } 1142 case "isDeprecated": 1143 out.Values[i] = ec.___Field_isDeprecated(ctx, field, obj) 1144 if out.Values[i] == graphql.Null { 1145 invalid = true 1146 } 1147 case "deprecationReason": 1148 out.Values[i] = ec.___Field_deprecationReason(ctx, field, obj) 1149 default: 1150 panic("unknown field " + strconv.Quote(field.Name)) 1151 } 1152 } 1153 1154 if invalid { 1155 return graphql.Null 1156 } 1157 return out 1158 } 1159 1160 // nolint: vetshadow 1161 func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { 1162 ctx = ec.Tracer.StartFieldExecution(ctx, field) 1163 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 1164 rctx := &graphql.ResolverContext{ 1165 Object: "__Field", 1166 Args: nil, 1167 Field: field, 1168 } 1169 ctx = graphql.WithResolverContext(ctx, rctx) 1170 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 1171 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1172 ctx = rctx // use context from middleware stack in children 1173 return obj.Name, nil 1174 }) 1175 if resTmp == nil { 1176 if !ec.HasError(rctx) { 1177 ec.Errorf(ctx, "must not be null") 1178 } 1179 return graphql.Null 1180 } 1181 res := resTmp.(string) 1182 rctx.Result = res 1183 ctx = ec.Tracer.StartFieldChildExecution(ctx) 1184 return graphql.MarshalString(res) 1185 } 1186 1187 // nolint: vetshadow 1188 func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { 1189 ctx = ec.Tracer.StartFieldExecution(ctx, field) 1190 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 1191 rctx := &graphql.ResolverContext{ 1192 Object: "__Field", 1193 Args: nil, 1194 Field: field, 1195 } 1196 ctx = graphql.WithResolverContext(ctx, rctx) 1197 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 1198 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1199 ctx = rctx // use context from middleware stack in children 1200 return obj.Description, nil 1201 }) 1202 if resTmp == nil { 1203 return graphql.Null 1204 } 1205 res := resTmp.(string) 1206 rctx.Result = res 1207 ctx = ec.Tracer.StartFieldChildExecution(ctx) 1208 return graphql.MarshalString(res) 1209 } 1210 1211 // nolint: vetshadow 1212 func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { 1213 ctx = ec.Tracer.StartFieldExecution(ctx, field) 1214 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 1215 rctx := &graphql.ResolverContext{ 1216 Object: "__Field", 1217 Args: nil, 1218 Field: field, 1219 } 1220 ctx = graphql.WithResolverContext(ctx, rctx) 1221 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 1222 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1223 ctx = rctx // use context from middleware stack in children 1224 return obj.Args, nil 1225 }) 1226 if resTmp == nil { 1227 if !ec.HasError(rctx) { 1228 ec.Errorf(ctx, "must not be null") 1229 } 1230 return graphql.Null 1231 } 1232 res := resTmp.([]introspection.InputValue) 1233 rctx.Result = res 1234 ctx = ec.Tracer.StartFieldChildExecution(ctx) 1235 1236 arr1 := make(graphql.Array, len(res)) 1237 var wg sync.WaitGroup 1238 1239 isLen1 := len(res) == 1 1240 if !isLen1 { 1241 wg.Add(len(res)) 1242 } 1243 1244 for idx1 := range res { 1245 idx1 := idx1 1246 rctx := &graphql.ResolverContext{ 1247 Index: &idx1, 1248 Result: &res[idx1], 1249 } 1250 ctx := graphql.WithResolverContext(ctx, rctx) 1251 f := func(idx1 int) { 1252 if !isLen1 { 1253 defer wg.Done() 1254 } 1255 arr1[idx1] = func() graphql.Marshaler { 1256 1257 return ec.___InputValue(ctx, field.Selections, &res[idx1]) 1258 }() 1259 } 1260 if isLen1 { 1261 f(idx1) 1262 } else { 1263 go f(idx1) 1264 } 1265 1266 } 1267 wg.Wait() 1268 return arr1 1269 } 1270 1271 // nolint: vetshadow 1272 func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { 1273 ctx = ec.Tracer.StartFieldExecution(ctx, field) 1274 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 1275 rctx := &graphql.ResolverContext{ 1276 Object: "__Field", 1277 Args: nil, 1278 Field: field, 1279 } 1280 ctx = graphql.WithResolverContext(ctx, rctx) 1281 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 1282 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1283 ctx = rctx // use context from middleware stack in children 1284 return obj.Type, nil 1285 }) 1286 if resTmp == nil { 1287 if !ec.HasError(rctx) { 1288 ec.Errorf(ctx, "must not be null") 1289 } 1290 return graphql.Null 1291 } 1292 res := resTmp.(*introspection.Type) 1293 rctx.Result = res 1294 ctx = ec.Tracer.StartFieldChildExecution(ctx) 1295 1296 if res == nil { 1297 if !ec.HasError(rctx) { 1298 ec.Errorf(ctx, "must not be null") 1299 } 1300 return graphql.Null 1301 } 1302 1303 return ec.___Type(ctx, field.Selections, res) 1304 } 1305 1306 // nolint: vetshadow 1307 func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { 1308 ctx = ec.Tracer.StartFieldExecution(ctx, field) 1309 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 1310 rctx := &graphql.ResolverContext{ 1311 Object: "__Field", 1312 Args: nil, 1313 Field: field, 1314 } 1315 ctx = graphql.WithResolverContext(ctx, rctx) 1316 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 1317 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1318 ctx = rctx // use context from middleware stack in children 1319 return obj.IsDeprecated(), nil 1320 }) 1321 if resTmp == nil { 1322 if !ec.HasError(rctx) { 1323 ec.Errorf(ctx, "must not be null") 1324 } 1325 return graphql.Null 1326 } 1327 res := resTmp.(bool) 1328 rctx.Result = res 1329 ctx = ec.Tracer.StartFieldChildExecution(ctx) 1330 return graphql.MarshalBoolean(res) 1331 } 1332 1333 // nolint: vetshadow 1334 func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { 1335 ctx = ec.Tracer.StartFieldExecution(ctx, field) 1336 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 1337 rctx := &graphql.ResolverContext{ 1338 Object: "__Field", 1339 Args: nil, 1340 Field: field, 1341 } 1342 ctx = graphql.WithResolverContext(ctx, rctx) 1343 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 1344 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1345 ctx = rctx // use context from middleware stack in children 1346 return obj.DeprecationReason(), nil 1347 }) 1348 if resTmp == nil { 1349 return graphql.Null 1350 } 1351 res := resTmp.(*string) 1352 rctx.Result = res 1353 ctx = ec.Tracer.StartFieldChildExecution(ctx) 1354 1355 if res == nil { 1356 return graphql.Null 1357 } 1358 return graphql.MarshalString(*res) 1359 } 1360 1361 var __InputValueImplementors = []string{"__InputValue"} 1362 1363 // nolint: gocyclo, errcheck, gas, goconst 1364 func (ec *executionContext) ___InputValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.InputValue) graphql.Marshaler { 1365 fields := graphql.CollectFields(ctx, sel, __InputValueImplementors) 1366 1367 out := graphql.NewOrderedMap(len(fields)) 1368 invalid := false 1369 for i, field := range fields { 1370 out.Keys[i] = field.Alias 1371 1372 switch field.Name { 1373 case "__typename": 1374 out.Values[i] = graphql.MarshalString("__InputValue") 1375 case "name": 1376 out.Values[i] = ec.___InputValue_name(ctx, field, obj) 1377 if out.Values[i] == graphql.Null { 1378 invalid = true 1379 } 1380 case "description": 1381 out.Values[i] = ec.___InputValue_description(ctx, field, obj) 1382 case "type": 1383 out.Values[i] = ec.___InputValue_type(ctx, field, obj) 1384 if out.Values[i] == graphql.Null { 1385 invalid = true 1386 } 1387 case "defaultValue": 1388 out.Values[i] = ec.___InputValue_defaultValue(ctx, field, obj) 1389 default: 1390 panic("unknown field " + strconv.Quote(field.Name)) 1391 } 1392 } 1393 1394 if invalid { 1395 return graphql.Null 1396 } 1397 return out 1398 } 1399 1400 // nolint: vetshadow 1401 func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { 1402 ctx = ec.Tracer.StartFieldExecution(ctx, field) 1403 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 1404 rctx := &graphql.ResolverContext{ 1405 Object: "__InputValue", 1406 Args: nil, 1407 Field: field, 1408 } 1409 ctx = graphql.WithResolverContext(ctx, rctx) 1410 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 1411 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1412 ctx = rctx // use context from middleware stack in children 1413 return obj.Name, nil 1414 }) 1415 if resTmp == nil { 1416 if !ec.HasError(rctx) { 1417 ec.Errorf(ctx, "must not be null") 1418 } 1419 return graphql.Null 1420 } 1421 res := resTmp.(string) 1422 rctx.Result = res 1423 ctx = ec.Tracer.StartFieldChildExecution(ctx) 1424 return graphql.MarshalString(res) 1425 } 1426 1427 // nolint: vetshadow 1428 func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { 1429 ctx = ec.Tracer.StartFieldExecution(ctx, field) 1430 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 1431 rctx := &graphql.ResolverContext{ 1432 Object: "__InputValue", 1433 Args: nil, 1434 Field: field, 1435 } 1436 ctx = graphql.WithResolverContext(ctx, rctx) 1437 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 1438 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1439 ctx = rctx // use context from middleware stack in children 1440 return obj.Description, nil 1441 }) 1442 if resTmp == nil { 1443 return graphql.Null 1444 } 1445 res := resTmp.(string) 1446 rctx.Result = res 1447 ctx = ec.Tracer.StartFieldChildExecution(ctx) 1448 return graphql.MarshalString(res) 1449 } 1450 1451 // nolint: vetshadow 1452 func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { 1453 ctx = ec.Tracer.StartFieldExecution(ctx, field) 1454 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 1455 rctx := &graphql.ResolverContext{ 1456 Object: "__InputValue", 1457 Args: nil, 1458 Field: field, 1459 } 1460 ctx = graphql.WithResolverContext(ctx, rctx) 1461 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 1462 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1463 ctx = rctx // use context from middleware stack in children 1464 return obj.Type, nil 1465 }) 1466 if resTmp == nil { 1467 if !ec.HasError(rctx) { 1468 ec.Errorf(ctx, "must not be null") 1469 } 1470 return graphql.Null 1471 } 1472 res := resTmp.(*introspection.Type) 1473 rctx.Result = res 1474 ctx = ec.Tracer.StartFieldChildExecution(ctx) 1475 1476 if res == nil { 1477 if !ec.HasError(rctx) { 1478 ec.Errorf(ctx, "must not be null") 1479 } 1480 return graphql.Null 1481 } 1482 1483 return ec.___Type(ctx, field.Selections, res) 1484 } 1485 1486 // nolint: vetshadow 1487 func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { 1488 ctx = ec.Tracer.StartFieldExecution(ctx, field) 1489 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 1490 rctx := &graphql.ResolverContext{ 1491 Object: "__InputValue", 1492 Args: nil, 1493 Field: field, 1494 } 1495 ctx = graphql.WithResolverContext(ctx, rctx) 1496 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 1497 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1498 ctx = rctx // use context from middleware stack in children 1499 return obj.DefaultValue, nil 1500 }) 1501 if resTmp == nil { 1502 return graphql.Null 1503 } 1504 res := resTmp.(*string) 1505 rctx.Result = res 1506 ctx = ec.Tracer.StartFieldChildExecution(ctx) 1507 1508 if res == nil { 1509 return graphql.Null 1510 } 1511 return graphql.MarshalString(*res) 1512 } 1513 1514 var __SchemaImplementors = []string{"__Schema"} 1515 1516 // nolint: gocyclo, errcheck, gas, goconst 1517 func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet, obj *introspection.Schema) graphql.Marshaler { 1518 fields := graphql.CollectFields(ctx, sel, __SchemaImplementors) 1519 1520 out := graphql.NewOrderedMap(len(fields)) 1521 invalid := false 1522 for i, field := range fields { 1523 out.Keys[i] = field.Alias 1524 1525 switch field.Name { 1526 case "__typename": 1527 out.Values[i] = graphql.MarshalString("__Schema") 1528 case "types": 1529 out.Values[i] = ec.___Schema_types(ctx, field, obj) 1530 if out.Values[i] == graphql.Null { 1531 invalid = true 1532 } 1533 case "queryType": 1534 out.Values[i] = ec.___Schema_queryType(ctx, field, obj) 1535 if out.Values[i] == graphql.Null { 1536 invalid = true 1537 } 1538 case "mutationType": 1539 out.Values[i] = ec.___Schema_mutationType(ctx, field, obj) 1540 case "subscriptionType": 1541 out.Values[i] = ec.___Schema_subscriptionType(ctx, field, obj) 1542 case "directives": 1543 out.Values[i] = ec.___Schema_directives(ctx, field, obj) 1544 if out.Values[i] == graphql.Null { 1545 invalid = true 1546 } 1547 default: 1548 panic("unknown field " + strconv.Quote(field.Name)) 1549 } 1550 } 1551 1552 if invalid { 1553 return graphql.Null 1554 } 1555 return out 1556 } 1557 1558 // nolint: vetshadow 1559 func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { 1560 ctx = ec.Tracer.StartFieldExecution(ctx, field) 1561 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 1562 rctx := &graphql.ResolverContext{ 1563 Object: "__Schema", 1564 Args: nil, 1565 Field: field, 1566 } 1567 ctx = graphql.WithResolverContext(ctx, rctx) 1568 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 1569 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1570 ctx = rctx // use context from middleware stack in children 1571 return obj.Types(), nil 1572 }) 1573 if resTmp == nil { 1574 if !ec.HasError(rctx) { 1575 ec.Errorf(ctx, "must not be null") 1576 } 1577 return graphql.Null 1578 } 1579 res := resTmp.([]introspection.Type) 1580 rctx.Result = res 1581 ctx = ec.Tracer.StartFieldChildExecution(ctx) 1582 1583 arr1 := make(graphql.Array, len(res)) 1584 var wg sync.WaitGroup 1585 1586 isLen1 := len(res) == 1 1587 if !isLen1 { 1588 wg.Add(len(res)) 1589 } 1590 1591 for idx1 := range res { 1592 idx1 := idx1 1593 rctx := &graphql.ResolverContext{ 1594 Index: &idx1, 1595 Result: &res[idx1], 1596 } 1597 ctx := graphql.WithResolverContext(ctx, rctx) 1598 f := func(idx1 int) { 1599 if !isLen1 { 1600 defer wg.Done() 1601 } 1602 arr1[idx1] = func() graphql.Marshaler { 1603 1604 return ec.___Type(ctx, field.Selections, &res[idx1]) 1605 }() 1606 } 1607 if isLen1 { 1608 f(idx1) 1609 } else { 1610 go f(idx1) 1611 } 1612 1613 } 1614 wg.Wait() 1615 return arr1 1616 } 1617 1618 // nolint: vetshadow 1619 func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { 1620 ctx = ec.Tracer.StartFieldExecution(ctx, field) 1621 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 1622 rctx := &graphql.ResolverContext{ 1623 Object: "__Schema", 1624 Args: nil, 1625 Field: field, 1626 } 1627 ctx = graphql.WithResolverContext(ctx, rctx) 1628 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 1629 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1630 ctx = rctx // use context from middleware stack in children 1631 return obj.QueryType(), nil 1632 }) 1633 if resTmp == nil { 1634 if !ec.HasError(rctx) { 1635 ec.Errorf(ctx, "must not be null") 1636 } 1637 return graphql.Null 1638 } 1639 res := resTmp.(*introspection.Type) 1640 rctx.Result = res 1641 ctx = ec.Tracer.StartFieldChildExecution(ctx) 1642 1643 if res == nil { 1644 if !ec.HasError(rctx) { 1645 ec.Errorf(ctx, "must not be null") 1646 } 1647 return graphql.Null 1648 } 1649 1650 return ec.___Type(ctx, field.Selections, res) 1651 } 1652 1653 // nolint: vetshadow 1654 func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { 1655 ctx = ec.Tracer.StartFieldExecution(ctx, field) 1656 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 1657 rctx := &graphql.ResolverContext{ 1658 Object: "__Schema", 1659 Args: nil, 1660 Field: field, 1661 } 1662 ctx = graphql.WithResolverContext(ctx, rctx) 1663 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 1664 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1665 ctx = rctx // use context from middleware stack in children 1666 return obj.MutationType(), nil 1667 }) 1668 if resTmp == nil { 1669 return graphql.Null 1670 } 1671 res := resTmp.(*introspection.Type) 1672 rctx.Result = res 1673 ctx = ec.Tracer.StartFieldChildExecution(ctx) 1674 1675 if res == nil { 1676 return graphql.Null 1677 } 1678 1679 return ec.___Type(ctx, field.Selections, res) 1680 } 1681 1682 // nolint: vetshadow 1683 func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { 1684 ctx = ec.Tracer.StartFieldExecution(ctx, field) 1685 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 1686 rctx := &graphql.ResolverContext{ 1687 Object: "__Schema", 1688 Args: nil, 1689 Field: field, 1690 } 1691 ctx = graphql.WithResolverContext(ctx, rctx) 1692 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 1693 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1694 ctx = rctx // use context from middleware stack in children 1695 return obj.SubscriptionType(), nil 1696 }) 1697 if resTmp == nil { 1698 return graphql.Null 1699 } 1700 res := resTmp.(*introspection.Type) 1701 rctx.Result = res 1702 ctx = ec.Tracer.StartFieldChildExecution(ctx) 1703 1704 if res == nil { 1705 return graphql.Null 1706 } 1707 1708 return ec.___Type(ctx, field.Selections, res) 1709 } 1710 1711 // nolint: vetshadow 1712 func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { 1713 ctx = ec.Tracer.StartFieldExecution(ctx, field) 1714 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 1715 rctx := &graphql.ResolverContext{ 1716 Object: "__Schema", 1717 Args: nil, 1718 Field: field, 1719 } 1720 ctx = graphql.WithResolverContext(ctx, rctx) 1721 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 1722 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1723 ctx = rctx // use context from middleware stack in children 1724 return obj.Directives(), nil 1725 }) 1726 if resTmp == nil { 1727 if !ec.HasError(rctx) { 1728 ec.Errorf(ctx, "must not be null") 1729 } 1730 return graphql.Null 1731 } 1732 res := resTmp.([]introspection.Directive) 1733 rctx.Result = res 1734 ctx = ec.Tracer.StartFieldChildExecution(ctx) 1735 1736 arr1 := make(graphql.Array, len(res)) 1737 var wg sync.WaitGroup 1738 1739 isLen1 := len(res) == 1 1740 if !isLen1 { 1741 wg.Add(len(res)) 1742 } 1743 1744 for idx1 := range res { 1745 idx1 := idx1 1746 rctx := &graphql.ResolverContext{ 1747 Index: &idx1, 1748 Result: &res[idx1], 1749 } 1750 ctx := graphql.WithResolverContext(ctx, rctx) 1751 f := func(idx1 int) { 1752 if !isLen1 { 1753 defer wg.Done() 1754 } 1755 arr1[idx1] = func() graphql.Marshaler { 1756 1757 return ec.___Directive(ctx, field.Selections, &res[idx1]) 1758 }() 1759 } 1760 if isLen1 { 1761 f(idx1) 1762 } else { 1763 go f(idx1) 1764 } 1765 1766 } 1767 wg.Wait() 1768 return arr1 1769 } 1770 1771 var __TypeImplementors = []string{"__Type"} 1772 1773 // nolint: gocyclo, errcheck, gas, goconst 1774 func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, obj *introspection.Type) graphql.Marshaler { 1775 fields := graphql.CollectFields(ctx, sel, __TypeImplementors) 1776 1777 out := graphql.NewOrderedMap(len(fields)) 1778 invalid := false 1779 for i, field := range fields { 1780 out.Keys[i] = field.Alias 1781 1782 switch field.Name { 1783 case "__typename": 1784 out.Values[i] = graphql.MarshalString("__Type") 1785 case "kind": 1786 out.Values[i] = ec.___Type_kind(ctx, field, obj) 1787 if out.Values[i] == graphql.Null { 1788 invalid = true 1789 } 1790 case "name": 1791 out.Values[i] = ec.___Type_name(ctx, field, obj) 1792 case "description": 1793 out.Values[i] = ec.___Type_description(ctx, field, obj) 1794 case "fields": 1795 out.Values[i] = ec.___Type_fields(ctx, field, obj) 1796 case "interfaces": 1797 out.Values[i] = ec.___Type_interfaces(ctx, field, obj) 1798 case "possibleTypes": 1799 out.Values[i] = ec.___Type_possibleTypes(ctx, field, obj) 1800 case "enumValues": 1801 out.Values[i] = ec.___Type_enumValues(ctx, field, obj) 1802 case "inputFields": 1803 out.Values[i] = ec.___Type_inputFields(ctx, field, obj) 1804 case "ofType": 1805 out.Values[i] = ec.___Type_ofType(ctx, field, obj) 1806 default: 1807 panic("unknown field " + strconv.Quote(field.Name)) 1808 } 1809 } 1810 1811 if invalid { 1812 return graphql.Null 1813 } 1814 return out 1815 } 1816 1817 // nolint: vetshadow 1818 func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { 1819 ctx = ec.Tracer.StartFieldExecution(ctx, field) 1820 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 1821 rctx := &graphql.ResolverContext{ 1822 Object: "__Type", 1823 Args: nil, 1824 Field: field, 1825 } 1826 ctx = graphql.WithResolverContext(ctx, rctx) 1827 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 1828 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1829 ctx = rctx // use context from middleware stack in children 1830 return obj.Kind(), nil 1831 }) 1832 if resTmp == nil { 1833 if !ec.HasError(rctx) { 1834 ec.Errorf(ctx, "must not be null") 1835 } 1836 return graphql.Null 1837 } 1838 res := resTmp.(string) 1839 rctx.Result = res 1840 ctx = ec.Tracer.StartFieldChildExecution(ctx) 1841 return graphql.MarshalString(res) 1842 } 1843 1844 // nolint: vetshadow 1845 func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { 1846 ctx = ec.Tracer.StartFieldExecution(ctx, field) 1847 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 1848 rctx := &graphql.ResolverContext{ 1849 Object: "__Type", 1850 Args: nil, 1851 Field: field, 1852 } 1853 ctx = graphql.WithResolverContext(ctx, rctx) 1854 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 1855 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1856 ctx = rctx // use context from middleware stack in children 1857 return obj.Name(), nil 1858 }) 1859 if resTmp == nil { 1860 return graphql.Null 1861 } 1862 res := resTmp.(*string) 1863 rctx.Result = res 1864 ctx = ec.Tracer.StartFieldChildExecution(ctx) 1865 1866 if res == nil { 1867 return graphql.Null 1868 } 1869 return graphql.MarshalString(*res) 1870 } 1871 1872 // nolint: vetshadow 1873 func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { 1874 ctx = ec.Tracer.StartFieldExecution(ctx, field) 1875 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 1876 rctx := &graphql.ResolverContext{ 1877 Object: "__Type", 1878 Args: nil, 1879 Field: field, 1880 } 1881 ctx = graphql.WithResolverContext(ctx, rctx) 1882 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 1883 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1884 ctx = rctx // use context from middleware stack in children 1885 return obj.Description(), nil 1886 }) 1887 if resTmp == nil { 1888 return graphql.Null 1889 } 1890 res := resTmp.(string) 1891 rctx.Result = res 1892 ctx = ec.Tracer.StartFieldChildExecution(ctx) 1893 return graphql.MarshalString(res) 1894 } 1895 1896 // nolint: vetshadow 1897 func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { 1898 ctx = ec.Tracer.StartFieldExecution(ctx, field) 1899 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 1900 rawArgs := field.ArgumentMap(ec.Variables) 1901 args, err := field___Type_fields_args(rawArgs) 1902 if err != nil { 1903 ec.Error(ctx, err) 1904 return graphql.Null 1905 } 1906 rctx := &graphql.ResolverContext{ 1907 Object: "__Type", 1908 Args: args, 1909 Field: field, 1910 } 1911 ctx = graphql.WithResolverContext(ctx, rctx) 1912 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 1913 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1914 ctx = rctx // use context from middleware stack in children 1915 return obj.Fields(args["includeDeprecated"].(bool)), nil 1916 }) 1917 if resTmp == nil { 1918 return graphql.Null 1919 } 1920 res := resTmp.([]introspection.Field) 1921 rctx.Result = res 1922 ctx = ec.Tracer.StartFieldChildExecution(ctx) 1923 1924 arr1 := make(graphql.Array, len(res)) 1925 var wg sync.WaitGroup 1926 1927 isLen1 := len(res) == 1 1928 if !isLen1 { 1929 wg.Add(len(res)) 1930 } 1931 1932 for idx1 := range res { 1933 idx1 := idx1 1934 rctx := &graphql.ResolverContext{ 1935 Index: &idx1, 1936 Result: &res[idx1], 1937 } 1938 ctx := graphql.WithResolverContext(ctx, rctx) 1939 f := func(idx1 int) { 1940 if !isLen1 { 1941 defer wg.Done() 1942 } 1943 arr1[idx1] = func() graphql.Marshaler { 1944 1945 return ec.___Field(ctx, field.Selections, &res[idx1]) 1946 }() 1947 } 1948 if isLen1 { 1949 f(idx1) 1950 } else { 1951 go f(idx1) 1952 } 1953 1954 } 1955 wg.Wait() 1956 return arr1 1957 } 1958 1959 // nolint: vetshadow 1960 func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { 1961 ctx = ec.Tracer.StartFieldExecution(ctx, field) 1962 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 1963 rctx := &graphql.ResolverContext{ 1964 Object: "__Type", 1965 Args: nil, 1966 Field: field, 1967 } 1968 ctx = graphql.WithResolverContext(ctx, rctx) 1969 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 1970 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1971 ctx = rctx // use context from middleware stack in children 1972 return obj.Interfaces(), nil 1973 }) 1974 if resTmp == nil { 1975 return graphql.Null 1976 } 1977 res := resTmp.([]introspection.Type) 1978 rctx.Result = res 1979 ctx = ec.Tracer.StartFieldChildExecution(ctx) 1980 1981 arr1 := make(graphql.Array, len(res)) 1982 var wg sync.WaitGroup 1983 1984 isLen1 := len(res) == 1 1985 if !isLen1 { 1986 wg.Add(len(res)) 1987 } 1988 1989 for idx1 := range res { 1990 idx1 := idx1 1991 rctx := &graphql.ResolverContext{ 1992 Index: &idx1, 1993 Result: &res[idx1], 1994 } 1995 ctx := graphql.WithResolverContext(ctx, rctx) 1996 f := func(idx1 int) { 1997 if !isLen1 { 1998 defer wg.Done() 1999 } 2000 arr1[idx1] = func() graphql.Marshaler { 2001 2002 return ec.___Type(ctx, field.Selections, &res[idx1]) 2003 }() 2004 } 2005 if isLen1 { 2006 f(idx1) 2007 } else { 2008 go f(idx1) 2009 } 2010 2011 } 2012 wg.Wait() 2013 return arr1 2014 } 2015 2016 // nolint: vetshadow 2017 func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { 2018 ctx = ec.Tracer.StartFieldExecution(ctx, field) 2019 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 2020 rctx := &graphql.ResolverContext{ 2021 Object: "__Type", 2022 Args: nil, 2023 Field: field, 2024 } 2025 ctx = graphql.WithResolverContext(ctx, rctx) 2026 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 2027 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 2028 ctx = rctx // use context from middleware stack in children 2029 return obj.PossibleTypes(), nil 2030 }) 2031 if resTmp == nil { 2032 return graphql.Null 2033 } 2034 res := resTmp.([]introspection.Type) 2035 rctx.Result = res 2036 ctx = ec.Tracer.StartFieldChildExecution(ctx) 2037 2038 arr1 := make(graphql.Array, len(res)) 2039 var wg sync.WaitGroup 2040 2041 isLen1 := len(res) == 1 2042 if !isLen1 { 2043 wg.Add(len(res)) 2044 } 2045 2046 for idx1 := range res { 2047 idx1 := idx1 2048 rctx := &graphql.ResolverContext{ 2049 Index: &idx1, 2050 Result: &res[idx1], 2051 } 2052 ctx := graphql.WithResolverContext(ctx, rctx) 2053 f := func(idx1 int) { 2054 if !isLen1 { 2055 defer wg.Done() 2056 } 2057 arr1[idx1] = func() graphql.Marshaler { 2058 2059 return ec.___Type(ctx, field.Selections, &res[idx1]) 2060 }() 2061 } 2062 if isLen1 { 2063 f(idx1) 2064 } else { 2065 go f(idx1) 2066 } 2067 2068 } 2069 wg.Wait() 2070 return arr1 2071 } 2072 2073 // nolint: vetshadow 2074 func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { 2075 ctx = ec.Tracer.StartFieldExecution(ctx, field) 2076 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 2077 rawArgs := field.ArgumentMap(ec.Variables) 2078 args, err := field___Type_enumValues_args(rawArgs) 2079 if err != nil { 2080 ec.Error(ctx, err) 2081 return graphql.Null 2082 } 2083 rctx := &graphql.ResolverContext{ 2084 Object: "__Type", 2085 Args: args, 2086 Field: field, 2087 } 2088 ctx = graphql.WithResolverContext(ctx, rctx) 2089 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 2090 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 2091 ctx = rctx // use context from middleware stack in children 2092 return obj.EnumValues(args["includeDeprecated"].(bool)), nil 2093 }) 2094 if resTmp == nil { 2095 return graphql.Null 2096 } 2097 res := resTmp.([]introspection.EnumValue) 2098 rctx.Result = res 2099 ctx = ec.Tracer.StartFieldChildExecution(ctx) 2100 2101 arr1 := make(graphql.Array, len(res)) 2102 var wg sync.WaitGroup 2103 2104 isLen1 := len(res) == 1 2105 if !isLen1 { 2106 wg.Add(len(res)) 2107 } 2108 2109 for idx1 := range res { 2110 idx1 := idx1 2111 rctx := &graphql.ResolverContext{ 2112 Index: &idx1, 2113 Result: &res[idx1], 2114 } 2115 ctx := graphql.WithResolverContext(ctx, rctx) 2116 f := func(idx1 int) { 2117 if !isLen1 { 2118 defer wg.Done() 2119 } 2120 arr1[idx1] = func() graphql.Marshaler { 2121 2122 return ec.___EnumValue(ctx, field.Selections, &res[idx1]) 2123 }() 2124 } 2125 if isLen1 { 2126 f(idx1) 2127 } else { 2128 go f(idx1) 2129 } 2130 2131 } 2132 wg.Wait() 2133 return arr1 2134 } 2135 2136 // nolint: vetshadow 2137 func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { 2138 ctx = ec.Tracer.StartFieldExecution(ctx, field) 2139 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 2140 rctx := &graphql.ResolverContext{ 2141 Object: "__Type", 2142 Args: nil, 2143 Field: field, 2144 } 2145 ctx = graphql.WithResolverContext(ctx, rctx) 2146 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 2147 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 2148 ctx = rctx // use context from middleware stack in children 2149 return obj.InputFields(), nil 2150 }) 2151 if resTmp == nil { 2152 return graphql.Null 2153 } 2154 res := resTmp.([]introspection.InputValue) 2155 rctx.Result = res 2156 ctx = ec.Tracer.StartFieldChildExecution(ctx) 2157 2158 arr1 := make(graphql.Array, len(res)) 2159 var wg sync.WaitGroup 2160 2161 isLen1 := len(res) == 1 2162 if !isLen1 { 2163 wg.Add(len(res)) 2164 } 2165 2166 for idx1 := range res { 2167 idx1 := idx1 2168 rctx := &graphql.ResolverContext{ 2169 Index: &idx1, 2170 Result: &res[idx1], 2171 } 2172 ctx := graphql.WithResolverContext(ctx, rctx) 2173 f := func(idx1 int) { 2174 if !isLen1 { 2175 defer wg.Done() 2176 } 2177 arr1[idx1] = func() graphql.Marshaler { 2178 2179 return ec.___InputValue(ctx, field.Selections, &res[idx1]) 2180 }() 2181 } 2182 if isLen1 { 2183 f(idx1) 2184 } else { 2185 go f(idx1) 2186 } 2187 2188 } 2189 wg.Wait() 2190 return arr1 2191 } 2192 2193 // nolint: vetshadow 2194 func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { 2195 ctx = ec.Tracer.StartFieldExecution(ctx, field) 2196 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 2197 rctx := &graphql.ResolverContext{ 2198 Object: "__Type", 2199 Args: nil, 2200 Field: field, 2201 } 2202 ctx = graphql.WithResolverContext(ctx, rctx) 2203 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 2204 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 2205 ctx = rctx // use context from middleware stack in children 2206 return obj.OfType(), nil 2207 }) 2208 if resTmp == nil { 2209 return graphql.Null 2210 } 2211 res := resTmp.(*introspection.Type) 2212 rctx.Result = res 2213 ctx = ec.Tracer.StartFieldChildExecution(ctx) 2214 2215 if res == nil { 2216 return graphql.Null 2217 } 2218 2219 return ec.___Type(ctx, field.Selections, res) 2220 } 2221 2222 func UnmarshalNewTodo(v interface{}) (NewTodo, error) { 2223 var it NewTodo 2224 var asMap = v.(map[string]interface{}) 2225 2226 for k, v := range asMap { 2227 switch k { 2228 case "text": 2229 var err error 2230 it.Text, err = graphql.UnmarshalString(v) 2231 if err != nil { 2232 return it, err 2233 } 2234 case "userId": 2235 var err error 2236 it.UserID, err = graphql.UnmarshalString(v) 2237 if err != nil { 2238 return it, err 2239 } 2240 } 2241 } 2242 2243 return it, nil 2244 } 2245 2246 func (ec *executionContext) FieldMiddleware(ctx context.Context, obj interface{}, next graphql.Resolver) (ret interface{}) { 2247 defer func() { 2248 if r := recover(); r != nil { 2249 ec.Error(ctx, ec.Recover(ctx, r)) 2250 ret = nil 2251 } 2252 }() 2253 res, err := ec.ResolverMiddleware(ctx, next) 2254 if err != nil { 2255 ec.Error(ctx, err) 2256 return nil 2257 } 2258 return res 2259 } 2260 2261 func (ec *executionContext) introspectSchema() (*introspection.Schema, error) { 2262 if ec.DisableIntrospection { 2263 return nil, errors.New("introspection disabled") 2264 } 2265 return introspection.WrapSchema(parsedSchema), nil 2266 } 2267 2268 func (ec *executionContext) introspectType(name string) (*introspection.Type, error) { 2269 if ec.DisableIntrospection { 2270 return nil, errors.New("introspection disabled") 2271 } 2272 return introspection.WrapTypeFromDef(parsedSchema, parsedSchema.Types[name]), nil 2273 } 2274 2275 var parsedSchema = gqlparser.MustLoadSchema( 2276 &ast.Source{Name: "schema.graphql", Input: `type Query { 2277 todos: [Todo!]! 2278 } 2279 2280 type Mutation { 2281 createTodo(input: NewTodo!): Todo! 2282 } 2283 `}, 2284 &ast.Source{Name: "todo.graphql", Input: `type Todo { 2285 id: ID! 2286 databaseId: Int! 2287 text: String! 2288 done: Boolean! 2289 user: User! 2290 } 2291 2292 input NewTodo { 2293 text: String! 2294 userId: String! 2295 } 2296 2297 `}, 2298 &ast.Source{Name: "user.graphql", Input: `type User { 2299 id: ID! 2300 name: String! 2301 } 2302 `}, 2303 )