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