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