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