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