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