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