github.com/maeglindeveloper/gqlgen@v0.13.1-0.20210413081235-57808b12a0a0/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 "io" 10 "strconv" 11 "sync" 12 "time" 13 14 "github.com/99designs/gqlgen/graphql" 15 "github.com/99designs/gqlgen/graphql/introspection" 16 gqlparser "github.com/vektah/gqlparser/v2" 17 "github.com/vektah/gqlparser/v2/ast" 18 ) 19 20 // region ************************** generated!.gotpl ************************** 21 22 // NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface. 23 func NewExecutableSchema(cfg Config) graphql.ExecutableSchema { 24 return &executableSchema{ 25 resolvers: cfg.Resolvers, 26 directives: cfg.Directives, 27 complexity: cfg.Complexity, 28 } 29 } 30 31 type Config struct { 32 Resolvers ResolverRoot 33 Directives DirectiveRoot 34 Complexity ComplexityRoot 35 } 36 37 type ResolverRoot interface { 38 Mutation() MutationResolver 39 Query() QueryResolver 40 Subscription() SubscriptionResolver 41 } 42 43 type DirectiveRoot struct { 44 User func(ctx context.Context, obj interface{}, next graphql.Resolver, username string) (res interface{}, err error) 45 } 46 47 type ComplexityRoot struct { 48 Chatroom struct { 49 Messages func(childComplexity int) int 50 Name func(childComplexity int) int 51 } 52 53 Message struct { 54 CreatedAt func(childComplexity int) int 55 CreatedBy func(childComplexity int) int 56 ID func(childComplexity int) int 57 Text func(childComplexity int) int 58 } 59 60 Mutation struct { 61 Post func(childComplexity int, text string, username string, roomName string) int 62 } 63 64 Query struct { 65 Room func(childComplexity int, name string) int 66 } 67 68 Subscription struct { 69 MessageAdded func(childComplexity int, roomName string) int 70 } 71 } 72 73 type MutationResolver interface { 74 Post(ctx context.Context, text string, username string, roomName string) (*Message, error) 75 } 76 type QueryResolver interface { 77 Room(ctx context.Context, name string) (*Chatroom, error) 78 } 79 type SubscriptionResolver interface { 80 MessageAdded(ctx context.Context, roomName string) (<-chan *Message, error) 81 } 82 83 type executableSchema struct { 84 resolvers ResolverRoot 85 directives DirectiveRoot 86 complexity ComplexityRoot 87 } 88 89 func (e *executableSchema) Schema() *ast.Schema { 90 return parsedSchema 91 } 92 93 func (e *executableSchema) Complexity(typeName, field string, childComplexity int, rawArgs map[string]interface{}) (int, bool) { 94 ec := executionContext{nil, e} 95 _ = ec 96 switch typeName + "." + field { 97 98 case "Chatroom.messages": 99 if e.complexity.Chatroom.Messages == nil { 100 break 101 } 102 103 return e.complexity.Chatroom.Messages(childComplexity), true 104 105 case "Chatroom.name": 106 if e.complexity.Chatroom.Name == nil { 107 break 108 } 109 110 return e.complexity.Chatroom.Name(childComplexity), true 111 112 case "Message.createdAt": 113 if e.complexity.Message.CreatedAt == nil { 114 break 115 } 116 117 return e.complexity.Message.CreatedAt(childComplexity), true 118 119 case "Message.createdBy": 120 if e.complexity.Message.CreatedBy == nil { 121 break 122 } 123 124 return e.complexity.Message.CreatedBy(childComplexity), true 125 126 case "Message.id": 127 if e.complexity.Message.ID == nil { 128 break 129 } 130 131 return e.complexity.Message.ID(childComplexity), true 132 133 case "Message.text": 134 if e.complexity.Message.Text == nil { 135 break 136 } 137 138 return e.complexity.Message.Text(childComplexity), true 139 140 case "Mutation.post": 141 if e.complexity.Mutation.Post == nil { 142 break 143 } 144 145 args, err := ec.field_Mutation_post_args(context.TODO(), rawArgs) 146 if err != nil { 147 return 0, false 148 } 149 150 return e.complexity.Mutation.Post(childComplexity, args["text"].(string), args["username"].(string), args["roomName"].(string)), true 151 152 case "Query.room": 153 if e.complexity.Query.Room == nil { 154 break 155 } 156 157 args, err := ec.field_Query_room_args(context.TODO(), rawArgs) 158 if err != nil { 159 return 0, false 160 } 161 162 return e.complexity.Query.Room(childComplexity, args["name"].(string)), true 163 164 case "Subscription.messageAdded": 165 if e.complexity.Subscription.MessageAdded == nil { 166 break 167 } 168 169 args, err := ec.field_Subscription_messageAdded_args(context.TODO(), rawArgs) 170 if err != nil { 171 return 0, false 172 } 173 174 return e.complexity.Subscription.MessageAdded(childComplexity, args["roomName"].(string)), true 175 176 } 177 return 0, false 178 } 179 180 func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { 181 rc := graphql.GetOperationContext(ctx) 182 ec := executionContext{rc, e} 183 first := true 184 185 switch rc.Operation.Operation { 186 case ast.Query: 187 return func(ctx context.Context) *graphql.Response { 188 if !first { 189 return nil 190 } 191 first = false 192 data := ec._Query(ctx, rc.Operation.SelectionSet) 193 var buf bytes.Buffer 194 data.MarshalGQL(&buf) 195 196 return &graphql.Response{ 197 Data: buf.Bytes(), 198 } 199 } 200 case ast.Mutation: 201 return func(ctx context.Context) *graphql.Response { 202 if !first { 203 return nil 204 } 205 first = false 206 data := ec._Mutation(ctx, rc.Operation.SelectionSet) 207 var buf bytes.Buffer 208 data.MarshalGQL(&buf) 209 210 return &graphql.Response{ 211 Data: buf.Bytes(), 212 } 213 } 214 case ast.Subscription: 215 next := ec._subscriptionMiddleware(ctx, rc.Operation, func(ctx context.Context) (interface{}, error) { 216 return ec._Subscription(ctx, rc.Operation.SelectionSet), nil 217 }) 218 219 var buf bytes.Buffer 220 return func(ctx context.Context) *graphql.Response { 221 buf.Reset() 222 data := next() 223 224 if data == nil { 225 return nil 226 } 227 data.MarshalGQL(&buf) 228 229 return &graphql.Response{ 230 Data: buf.Bytes(), 231 } 232 } 233 234 default: 235 return graphql.OneShot(graphql.ErrorResponse(ctx, "unsupported GraphQL operation")) 236 } 237 } 238 239 type executionContext struct { 240 *graphql.OperationContext 241 *executableSchema 242 } 243 244 func (ec *executionContext) introspectSchema() (*introspection.Schema, error) { 245 if ec.DisableIntrospection { 246 return nil, errors.New("introspection disabled") 247 } 248 return introspection.WrapSchema(parsedSchema), nil 249 } 250 251 func (ec *executionContext) introspectType(name string) (*introspection.Type, error) { 252 if ec.DisableIntrospection { 253 return nil, errors.New("introspection disabled") 254 } 255 return introspection.WrapTypeFromDef(parsedSchema, parsedSchema.Types[name]), nil 256 } 257 258 var sources = []*ast.Source{ 259 {Name: "schema.graphql", Input: `type Chatroom { 260 name: String! 261 messages: [Message!]! 262 } 263 264 type Message { 265 id: ID! 266 text: String! 267 createdBy: String! 268 createdAt: Time! 269 } 270 271 type Query { 272 room(name:String!): Chatroom 273 } 274 275 type Mutation { 276 post(text: String!, username: String!, roomName: String!): Message! 277 } 278 279 type Subscription { 280 messageAdded(roomName: String!): Message! 281 } 282 283 scalar Time 284 285 directive @user(username: String!) on SUBSCRIPTION 286 `, BuiltIn: false}, 287 } 288 var parsedSchema = gqlparser.MustLoadSchema(sources...) 289 290 // endregion ************************** generated!.gotpl ************************** 291 292 // region ***************************** args.gotpl ***************************** 293 294 func (ec *executionContext) dir_user_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { 295 var err error 296 args := map[string]interface{}{} 297 var arg0 string 298 if tmp, ok := rawArgs["username"]; ok { 299 ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("username")) 300 arg0, err = ec.unmarshalNString2string(ctx, tmp) 301 if err != nil { 302 return nil, err 303 } 304 } 305 args["username"] = arg0 306 return args, nil 307 } 308 309 func (ec *executionContext) field_Mutation_post_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { 310 var err error 311 args := map[string]interface{}{} 312 var arg0 string 313 if tmp, ok := rawArgs["text"]; ok { 314 ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("text")) 315 arg0, err = ec.unmarshalNString2string(ctx, tmp) 316 if err != nil { 317 return nil, err 318 } 319 } 320 args["text"] = arg0 321 var arg1 string 322 if tmp, ok := rawArgs["username"]; ok { 323 ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("username")) 324 arg1, err = ec.unmarshalNString2string(ctx, tmp) 325 if err != nil { 326 return nil, err 327 } 328 } 329 args["username"] = arg1 330 var arg2 string 331 if tmp, ok := rawArgs["roomName"]; ok { 332 ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("roomName")) 333 arg2, err = ec.unmarshalNString2string(ctx, tmp) 334 if err != nil { 335 return nil, err 336 } 337 } 338 args["roomName"] = arg2 339 return args, nil 340 } 341 342 func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { 343 var err error 344 args := map[string]interface{}{} 345 var arg0 string 346 if tmp, ok := rawArgs["name"]; ok { 347 ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) 348 arg0, err = ec.unmarshalNString2string(ctx, tmp) 349 if err != nil { 350 return nil, err 351 } 352 } 353 args["name"] = arg0 354 return args, nil 355 } 356 357 func (ec *executionContext) field_Query_room_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { 358 var err error 359 args := map[string]interface{}{} 360 var arg0 string 361 if tmp, ok := rawArgs["name"]; ok { 362 ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) 363 arg0, err = ec.unmarshalNString2string(ctx, tmp) 364 if err != nil { 365 return nil, err 366 } 367 } 368 args["name"] = arg0 369 return args, nil 370 } 371 372 func (ec *executionContext) field_Subscription_messageAdded_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { 373 var err error 374 args := map[string]interface{}{} 375 var arg0 string 376 if tmp, ok := rawArgs["roomName"]; ok { 377 ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("roomName")) 378 arg0, err = ec.unmarshalNString2string(ctx, tmp) 379 if err != nil { 380 return nil, err 381 } 382 } 383 args["roomName"] = arg0 384 return args, nil 385 } 386 387 func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { 388 var err error 389 args := map[string]interface{}{} 390 var arg0 bool 391 if tmp, ok := rawArgs["includeDeprecated"]; ok { 392 ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) 393 arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) 394 if err != nil { 395 return nil, err 396 } 397 } 398 args["includeDeprecated"] = arg0 399 return args, nil 400 } 401 402 func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { 403 var err error 404 args := map[string]interface{}{} 405 var arg0 bool 406 if tmp, ok := rawArgs["includeDeprecated"]; ok { 407 ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) 408 arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) 409 if err != nil { 410 return nil, err 411 } 412 } 413 args["includeDeprecated"] = arg0 414 return args, nil 415 } 416 417 // endregion ***************************** args.gotpl ***************************** 418 419 // region ************************** directives.gotpl ************************** 420 421 func (ec *executionContext) _subscriptionMiddleware(ctx context.Context, obj *ast.OperationDefinition, next func(ctx context.Context) (interface{}, error)) func() graphql.Marshaler { 422 for _, d := range obj.Directives { 423 switch d.Name { 424 case "user": 425 rawArgs := d.ArgumentMap(ec.Variables) 426 args, err := ec.dir_user_args(ctx, rawArgs) 427 if err != nil { 428 ec.Error(ctx, err) 429 return func() graphql.Marshaler { 430 return graphql.Null 431 } 432 } 433 n := next 434 next = func(ctx context.Context) (interface{}, error) { 435 if ec.directives.User == nil { 436 return nil, errors.New("directive user is not implemented") 437 } 438 return ec.directives.User(ctx, obj, n, args["username"].(string)) 439 } 440 } 441 } 442 tmp, err := next(ctx) 443 if err != nil { 444 ec.Error(ctx, err) 445 return func() graphql.Marshaler { 446 return graphql.Null 447 } 448 } 449 if data, ok := tmp.(func() graphql.Marshaler); ok { 450 return data 451 } 452 ec.Errorf(ctx, `unexpected type %T from directive, should be graphql.Marshaler`, tmp) 453 return func() graphql.Marshaler { 454 return graphql.Null 455 } 456 } 457 458 // endregion ************************** directives.gotpl ************************** 459 460 // region **************************** field.gotpl ***************************** 461 462 func (ec *executionContext) _Chatroom_name(ctx context.Context, field graphql.CollectedField, obj *Chatroom) (ret graphql.Marshaler) { 463 defer func() { 464 if r := recover(); r != nil { 465 ec.Error(ctx, ec.Recover(ctx, r)) 466 ret = graphql.Null 467 } 468 }() 469 fc := &graphql.FieldContext{ 470 Object: "Chatroom", 471 Field: field, 472 Args: nil, 473 IsMethod: false, 474 IsResolver: false, 475 } 476 477 ctx = graphql.WithFieldContext(ctx, fc) 478 resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 479 ctx = rctx // use context from middleware stack in children 480 return obj.Name, nil 481 }) 482 if err != nil { 483 ec.Error(ctx, err) 484 return graphql.Null 485 } 486 if resTmp == nil { 487 if !graphql.HasFieldError(ctx, fc) { 488 ec.Errorf(ctx, "must not be null") 489 } 490 return graphql.Null 491 } 492 res := resTmp.(string) 493 fc.Result = res 494 return ec.marshalNString2string(ctx, field.Selections, res) 495 } 496 497 func (ec *executionContext) _Chatroom_messages(ctx context.Context, field graphql.CollectedField, obj *Chatroom) (ret graphql.Marshaler) { 498 defer func() { 499 if r := recover(); r != nil { 500 ec.Error(ctx, ec.Recover(ctx, r)) 501 ret = graphql.Null 502 } 503 }() 504 fc := &graphql.FieldContext{ 505 Object: "Chatroom", 506 Field: field, 507 Args: nil, 508 IsMethod: false, 509 IsResolver: false, 510 } 511 512 ctx = graphql.WithFieldContext(ctx, fc) 513 resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 514 ctx = rctx // use context from middleware stack in children 515 return obj.Messages, nil 516 }) 517 if err != nil { 518 ec.Error(ctx, err) 519 return graphql.Null 520 } 521 if resTmp == nil { 522 if !graphql.HasFieldError(ctx, fc) { 523 ec.Errorf(ctx, "must not be null") 524 } 525 return graphql.Null 526 } 527 res := resTmp.([]Message) 528 fc.Result = res 529 return ec.marshalNMessage2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋchatᚐMessageᚄ(ctx, field.Selections, res) 530 } 531 532 func (ec *executionContext) _Message_id(ctx context.Context, field graphql.CollectedField, obj *Message) (ret graphql.Marshaler) { 533 defer func() { 534 if r := recover(); r != nil { 535 ec.Error(ctx, ec.Recover(ctx, r)) 536 ret = graphql.Null 537 } 538 }() 539 fc := &graphql.FieldContext{ 540 Object: "Message", 541 Field: field, 542 Args: nil, 543 IsMethod: false, 544 IsResolver: false, 545 } 546 547 ctx = graphql.WithFieldContext(ctx, fc) 548 resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 549 ctx = rctx // use context from middleware stack in children 550 return obj.ID, nil 551 }) 552 if err != nil { 553 ec.Error(ctx, err) 554 return graphql.Null 555 } 556 if resTmp == nil { 557 if !graphql.HasFieldError(ctx, fc) { 558 ec.Errorf(ctx, "must not be null") 559 } 560 return graphql.Null 561 } 562 res := resTmp.(string) 563 fc.Result = res 564 return ec.marshalNID2string(ctx, field.Selections, res) 565 } 566 567 func (ec *executionContext) _Message_text(ctx context.Context, field graphql.CollectedField, obj *Message) (ret graphql.Marshaler) { 568 defer func() { 569 if r := recover(); r != nil { 570 ec.Error(ctx, ec.Recover(ctx, r)) 571 ret = graphql.Null 572 } 573 }() 574 fc := &graphql.FieldContext{ 575 Object: "Message", 576 Field: field, 577 Args: nil, 578 IsMethod: false, 579 IsResolver: false, 580 } 581 582 ctx = graphql.WithFieldContext(ctx, fc) 583 resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 584 ctx = rctx // use context from middleware stack in children 585 return obj.Text, nil 586 }) 587 if err != nil { 588 ec.Error(ctx, err) 589 return graphql.Null 590 } 591 if resTmp == nil { 592 if !graphql.HasFieldError(ctx, fc) { 593 ec.Errorf(ctx, "must not be null") 594 } 595 return graphql.Null 596 } 597 res := resTmp.(string) 598 fc.Result = res 599 return ec.marshalNString2string(ctx, field.Selections, res) 600 } 601 602 func (ec *executionContext) _Message_createdBy(ctx context.Context, field graphql.CollectedField, obj *Message) (ret graphql.Marshaler) { 603 defer func() { 604 if r := recover(); r != nil { 605 ec.Error(ctx, ec.Recover(ctx, r)) 606 ret = graphql.Null 607 } 608 }() 609 fc := &graphql.FieldContext{ 610 Object: "Message", 611 Field: field, 612 Args: nil, 613 IsMethod: false, 614 IsResolver: false, 615 } 616 617 ctx = graphql.WithFieldContext(ctx, fc) 618 resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 619 ctx = rctx // use context from middleware stack in children 620 return obj.CreatedBy, nil 621 }) 622 if err != nil { 623 ec.Error(ctx, err) 624 return graphql.Null 625 } 626 if resTmp == nil { 627 if !graphql.HasFieldError(ctx, fc) { 628 ec.Errorf(ctx, "must not be null") 629 } 630 return graphql.Null 631 } 632 res := resTmp.(string) 633 fc.Result = res 634 return ec.marshalNString2string(ctx, field.Selections, res) 635 } 636 637 func (ec *executionContext) _Message_createdAt(ctx context.Context, field graphql.CollectedField, obj *Message) (ret graphql.Marshaler) { 638 defer func() { 639 if r := recover(); r != nil { 640 ec.Error(ctx, ec.Recover(ctx, r)) 641 ret = graphql.Null 642 } 643 }() 644 fc := &graphql.FieldContext{ 645 Object: "Message", 646 Field: field, 647 Args: nil, 648 IsMethod: false, 649 IsResolver: false, 650 } 651 652 ctx = graphql.WithFieldContext(ctx, fc) 653 resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 654 ctx = rctx // use context from middleware stack in children 655 return obj.CreatedAt, nil 656 }) 657 if err != nil { 658 ec.Error(ctx, err) 659 return graphql.Null 660 } 661 if resTmp == nil { 662 if !graphql.HasFieldError(ctx, fc) { 663 ec.Errorf(ctx, "must not be null") 664 } 665 return graphql.Null 666 } 667 res := resTmp.(time.Time) 668 fc.Result = res 669 return ec.marshalNTime2timeᚐTime(ctx, field.Selections, res) 670 } 671 672 func (ec *executionContext) _Mutation_post(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { 673 defer func() { 674 if r := recover(); r != nil { 675 ec.Error(ctx, ec.Recover(ctx, r)) 676 ret = graphql.Null 677 } 678 }() 679 fc := &graphql.FieldContext{ 680 Object: "Mutation", 681 Field: field, 682 Args: nil, 683 IsMethod: true, 684 IsResolver: true, 685 } 686 687 ctx = graphql.WithFieldContext(ctx, fc) 688 rawArgs := field.ArgumentMap(ec.Variables) 689 args, err := ec.field_Mutation_post_args(ctx, rawArgs) 690 if err != nil { 691 ec.Error(ctx, err) 692 return graphql.Null 693 } 694 fc.Args = args 695 resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 696 ctx = rctx // use context from middleware stack in children 697 return ec.resolvers.Mutation().Post(rctx, args["text"].(string), args["username"].(string), args["roomName"].(string)) 698 }) 699 if err != nil { 700 ec.Error(ctx, err) 701 return graphql.Null 702 } 703 if resTmp == nil { 704 if !graphql.HasFieldError(ctx, fc) { 705 ec.Errorf(ctx, "must not be null") 706 } 707 return graphql.Null 708 } 709 res := resTmp.(*Message) 710 fc.Result = res 711 return ec.marshalNMessage2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋchatᚐMessage(ctx, field.Selections, res) 712 } 713 714 func (ec *executionContext) _Query_room(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { 715 defer func() { 716 if r := recover(); r != nil { 717 ec.Error(ctx, ec.Recover(ctx, r)) 718 ret = graphql.Null 719 } 720 }() 721 fc := &graphql.FieldContext{ 722 Object: "Query", 723 Field: field, 724 Args: nil, 725 IsMethod: true, 726 IsResolver: true, 727 } 728 729 ctx = graphql.WithFieldContext(ctx, fc) 730 rawArgs := field.ArgumentMap(ec.Variables) 731 args, err := ec.field_Query_room_args(ctx, rawArgs) 732 if err != nil { 733 ec.Error(ctx, err) 734 return graphql.Null 735 } 736 fc.Args = args 737 resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 738 ctx = rctx // use context from middleware stack in children 739 return ec.resolvers.Query().Room(rctx, args["name"].(string)) 740 }) 741 if err != nil { 742 ec.Error(ctx, err) 743 return graphql.Null 744 } 745 if resTmp == nil { 746 return graphql.Null 747 } 748 res := resTmp.(*Chatroom) 749 fc.Result = res 750 return ec.marshalOChatroom2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋchatᚐChatroom(ctx, field.Selections, res) 751 } 752 753 func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { 754 defer func() { 755 if r := recover(); r != nil { 756 ec.Error(ctx, ec.Recover(ctx, r)) 757 ret = graphql.Null 758 } 759 }() 760 fc := &graphql.FieldContext{ 761 Object: "Query", 762 Field: field, 763 Args: nil, 764 IsMethod: true, 765 IsResolver: false, 766 } 767 768 ctx = graphql.WithFieldContext(ctx, fc) 769 rawArgs := field.ArgumentMap(ec.Variables) 770 args, err := ec.field_Query___type_args(ctx, rawArgs) 771 if err != nil { 772 ec.Error(ctx, err) 773 return graphql.Null 774 } 775 fc.Args = args 776 resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 777 ctx = rctx // use context from middleware stack in children 778 return ec.introspectType(args["name"].(string)) 779 }) 780 if err != nil { 781 ec.Error(ctx, err) 782 return graphql.Null 783 } 784 if resTmp == nil { 785 return graphql.Null 786 } 787 res := resTmp.(*introspection.Type) 788 fc.Result = res 789 return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) 790 } 791 792 func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { 793 defer func() { 794 if r := recover(); r != nil { 795 ec.Error(ctx, ec.Recover(ctx, r)) 796 ret = graphql.Null 797 } 798 }() 799 fc := &graphql.FieldContext{ 800 Object: "Query", 801 Field: field, 802 Args: nil, 803 IsMethod: true, 804 IsResolver: false, 805 } 806 807 ctx = graphql.WithFieldContext(ctx, fc) 808 resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 809 ctx = rctx // use context from middleware stack in children 810 return ec.introspectSchema() 811 }) 812 if err != nil { 813 ec.Error(ctx, err) 814 return graphql.Null 815 } 816 if resTmp == nil { 817 return graphql.Null 818 } 819 res := resTmp.(*introspection.Schema) 820 fc.Result = res 821 return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res) 822 } 823 824 func (ec *executionContext) _Subscription_messageAdded(ctx context.Context, field graphql.CollectedField) (ret func() graphql.Marshaler) { 825 defer func() { 826 if r := recover(); r != nil { 827 ec.Error(ctx, ec.Recover(ctx, r)) 828 ret = nil 829 } 830 }() 831 fc := &graphql.FieldContext{ 832 Object: "Subscription", 833 Field: field, 834 Args: nil, 835 IsMethod: true, 836 IsResolver: true, 837 } 838 839 ctx = graphql.WithFieldContext(ctx, fc) 840 rawArgs := field.ArgumentMap(ec.Variables) 841 args, err := ec.field_Subscription_messageAdded_args(ctx, rawArgs) 842 if err != nil { 843 ec.Error(ctx, err) 844 return nil 845 } 846 fc.Args = args 847 resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 848 ctx = rctx // use context from middleware stack in children 849 return ec.resolvers.Subscription().MessageAdded(rctx, args["roomName"].(string)) 850 }) 851 if err != nil { 852 ec.Error(ctx, err) 853 return nil 854 } 855 if resTmp == nil { 856 if !graphql.HasFieldError(ctx, fc) { 857 ec.Errorf(ctx, "must not be null") 858 } 859 return nil 860 } 861 return func() graphql.Marshaler { 862 res, ok := <-resTmp.(<-chan *Message) 863 if !ok { 864 return nil 865 } 866 return graphql.WriterFunc(func(w io.Writer) { 867 w.Write([]byte{'{'}) 868 graphql.MarshalString(field.Alias).MarshalGQL(w) 869 w.Write([]byte{':'}) 870 ec.marshalNMessage2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋchatᚐMessage(ctx, field.Selections, res).MarshalGQL(w) 871 w.Write([]byte{'}'}) 872 }) 873 } 874 } 875 876 func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { 877 defer func() { 878 if r := recover(); r != nil { 879 ec.Error(ctx, ec.Recover(ctx, r)) 880 ret = graphql.Null 881 } 882 }() 883 fc := &graphql.FieldContext{ 884 Object: "__Directive", 885 Field: field, 886 Args: nil, 887 IsMethod: false, 888 IsResolver: false, 889 } 890 891 ctx = graphql.WithFieldContext(ctx, fc) 892 resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 893 ctx = rctx // use context from middleware stack in children 894 return obj.Name, nil 895 }) 896 if err != nil { 897 ec.Error(ctx, err) 898 return graphql.Null 899 } 900 if resTmp == nil { 901 if !graphql.HasFieldError(ctx, fc) { 902 ec.Errorf(ctx, "must not be null") 903 } 904 return graphql.Null 905 } 906 res := resTmp.(string) 907 fc.Result = res 908 return ec.marshalNString2string(ctx, field.Selections, res) 909 } 910 911 func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { 912 defer func() { 913 if r := recover(); r != nil { 914 ec.Error(ctx, ec.Recover(ctx, r)) 915 ret = graphql.Null 916 } 917 }() 918 fc := &graphql.FieldContext{ 919 Object: "__Directive", 920 Field: field, 921 Args: nil, 922 IsMethod: false, 923 IsResolver: false, 924 } 925 926 ctx = graphql.WithFieldContext(ctx, fc) 927 resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 928 ctx = rctx // use context from middleware stack in children 929 return obj.Description, nil 930 }) 931 if err != nil { 932 ec.Error(ctx, err) 933 return graphql.Null 934 } 935 if resTmp == nil { 936 return graphql.Null 937 } 938 res := resTmp.(string) 939 fc.Result = res 940 return ec.marshalOString2string(ctx, field.Selections, res) 941 } 942 943 func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { 944 defer func() { 945 if r := recover(); r != nil { 946 ec.Error(ctx, ec.Recover(ctx, r)) 947 ret = graphql.Null 948 } 949 }() 950 fc := &graphql.FieldContext{ 951 Object: "__Directive", 952 Field: field, 953 Args: nil, 954 IsMethod: false, 955 IsResolver: false, 956 } 957 958 ctx = graphql.WithFieldContext(ctx, fc) 959 resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 960 ctx = rctx // use context from middleware stack in children 961 return obj.Locations, nil 962 }) 963 if err != nil { 964 ec.Error(ctx, err) 965 return graphql.Null 966 } 967 if resTmp == nil { 968 if !graphql.HasFieldError(ctx, fc) { 969 ec.Errorf(ctx, "must not be null") 970 } 971 return graphql.Null 972 } 973 res := resTmp.([]string) 974 fc.Result = res 975 return ec.marshalN__DirectiveLocation2ᚕstringᚄ(ctx, field.Selections, res) 976 } 977 978 func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { 979 defer func() { 980 if r := recover(); r != nil { 981 ec.Error(ctx, ec.Recover(ctx, r)) 982 ret = graphql.Null 983 } 984 }() 985 fc := &graphql.FieldContext{ 986 Object: "__Directive", 987 Field: field, 988 Args: nil, 989 IsMethod: false, 990 IsResolver: false, 991 } 992 993 ctx = graphql.WithFieldContext(ctx, fc) 994 resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 995 ctx = rctx // use context from middleware stack in children 996 return obj.Args, nil 997 }) 998 if err != nil { 999 ec.Error(ctx, err) 1000 return graphql.Null 1001 } 1002 if resTmp == nil { 1003 if !graphql.HasFieldError(ctx, fc) { 1004 ec.Errorf(ctx, "must not be null") 1005 } 1006 return graphql.Null 1007 } 1008 res := resTmp.([]introspection.InputValue) 1009 fc.Result = res 1010 return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) 1011 } 1012 1013 func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { 1014 defer func() { 1015 if r := recover(); r != nil { 1016 ec.Error(ctx, ec.Recover(ctx, r)) 1017 ret = graphql.Null 1018 } 1019 }() 1020 fc := &graphql.FieldContext{ 1021 Object: "__EnumValue", 1022 Field: field, 1023 Args: nil, 1024 IsMethod: false, 1025 IsResolver: false, 1026 } 1027 1028 ctx = graphql.WithFieldContext(ctx, fc) 1029 resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 1030 ctx = rctx // use context from middleware stack in children 1031 return obj.Name, nil 1032 }) 1033 if err != nil { 1034 ec.Error(ctx, err) 1035 return graphql.Null 1036 } 1037 if resTmp == nil { 1038 if !graphql.HasFieldError(ctx, fc) { 1039 ec.Errorf(ctx, "must not be null") 1040 } 1041 return graphql.Null 1042 } 1043 res := resTmp.(string) 1044 fc.Result = res 1045 return ec.marshalNString2string(ctx, field.Selections, res) 1046 } 1047 1048 func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { 1049 defer func() { 1050 if r := recover(); r != nil { 1051 ec.Error(ctx, ec.Recover(ctx, r)) 1052 ret = graphql.Null 1053 } 1054 }() 1055 fc := &graphql.FieldContext{ 1056 Object: "__EnumValue", 1057 Field: field, 1058 Args: nil, 1059 IsMethod: false, 1060 IsResolver: false, 1061 } 1062 1063 ctx = graphql.WithFieldContext(ctx, fc) 1064 resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 1065 ctx = rctx // use context from middleware stack in children 1066 return obj.Description, nil 1067 }) 1068 if err != nil { 1069 ec.Error(ctx, err) 1070 return graphql.Null 1071 } 1072 if resTmp == nil { 1073 return graphql.Null 1074 } 1075 res := resTmp.(string) 1076 fc.Result = res 1077 return ec.marshalOString2string(ctx, field.Selections, res) 1078 } 1079 1080 func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { 1081 defer func() { 1082 if r := recover(); r != nil { 1083 ec.Error(ctx, ec.Recover(ctx, r)) 1084 ret = graphql.Null 1085 } 1086 }() 1087 fc := &graphql.FieldContext{ 1088 Object: "__EnumValue", 1089 Field: field, 1090 Args: nil, 1091 IsMethod: true, 1092 IsResolver: false, 1093 } 1094 1095 ctx = graphql.WithFieldContext(ctx, fc) 1096 resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 1097 ctx = rctx // use context from middleware stack in children 1098 return obj.IsDeprecated(), nil 1099 }) 1100 if err != nil { 1101 ec.Error(ctx, err) 1102 return graphql.Null 1103 } 1104 if resTmp == nil { 1105 if !graphql.HasFieldError(ctx, fc) { 1106 ec.Errorf(ctx, "must not be null") 1107 } 1108 return graphql.Null 1109 } 1110 res := resTmp.(bool) 1111 fc.Result = res 1112 return ec.marshalNBoolean2bool(ctx, field.Selections, res) 1113 } 1114 1115 func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { 1116 defer func() { 1117 if r := recover(); r != nil { 1118 ec.Error(ctx, ec.Recover(ctx, r)) 1119 ret = graphql.Null 1120 } 1121 }() 1122 fc := &graphql.FieldContext{ 1123 Object: "__EnumValue", 1124 Field: field, 1125 Args: nil, 1126 IsMethod: true, 1127 IsResolver: false, 1128 } 1129 1130 ctx = graphql.WithFieldContext(ctx, fc) 1131 resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 1132 ctx = rctx // use context from middleware stack in children 1133 return obj.DeprecationReason(), nil 1134 }) 1135 if err != nil { 1136 ec.Error(ctx, err) 1137 return graphql.Null 1138 } 1139 if resTmp == nil { 1140 return graphql.Null 1141 } 1142 res := resTmp.(*string) 1143 fc.Result = res 1144 return ec.marshalOString2ᚖstring(ctx, field.Selections, res) 1145 } 1146 1147 func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { 1148 defer func() { 1149 if r := recover(); r != nil { 1150 ec.Error(ctx, ec.Recover(ctx, r)) 1151 ret = graphql.Null 1152 } 1153 }() 1154 fc := &graphql.FieldContext{ 1155 Object: "__Field", 1156 Field: field, 1157 Args: nil, 1158 IsMethod: false, 1159 IsResolver: false, 1160 } 1161 1162 ctx = graphql.WithFieldContext(ctx, fc) 1163 resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 1164 ctx = rctx // use context from middleware stack in children 1165 return obj.Name, nil 1166 }) 1167 if err != nil { 1168 ec.Error(ctx, err) 1169 return graphql.Null 1170 } 1171 if resTmp == nil { 1172 if !graphql.HasFieldError(ctx, fc) { 1173 ec.Errorf(ctx, "must not be null") 1174 } 1175 return graphql.Null 1176 } 1177 res := resTmp.(string) 1178 fc.Result = res 1179 return ec.marshalNString2string(ctx, field.Selections, res) 1180 } 1181 1182 func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { 1183 defer func() { 1184 if r := recover(); r != nil { 1185 ec.Error(ctx, ec.Recover(ctx, r)) 1186 ret = graphql.Null 1187 } 1188 }() 1189 fc := &graphql.FieldContext{ 1190 Object: "__Field", 1191 Field: field, 1192 Args: nil, 1193 IsMethod: false, 1194 IsResolver: false, 1195 } 1196 1197 ctx = graphql.WithFieldContext(ctx, fc) 1198 resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 1199 ctx = rctx // use context from middleware stack in children 1200 return obj.Description, nil 1201 }) 1202 if err != nil { 1203 ec.Error(ctx, err) 1204 return graphql.Null 1205 } 1206 if resTmp == nil { 1207 return graphql.Null 1208 } 1209 res := resTmp.(string) 1210 fc.Result = res 1211 return ec.marshalOString2string(ctx, field.Selections, res) 1212 } 1213 1214 func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { 1215 defer func() { 1216 if r := recover(); r != nil { 1217 ec.Error(ctx, ec.Recover(ctx, r)) 1218 ret = graphql.Null 1219 } 1220 }() 1221 fc := &graphql.FieldContext{ 1222 Object: "__Field", 1223 Field: field, 1224 Args: nil, 1225 IsMethod: false, 1226 IsResolver: false, 1227 } 1228 1229 ctx = graphql.WithFieldContext(ctx, fc) 1230 resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 1231 ctx = rctx // use context from middleware stack in children 1232 return obj.Args, nil 1233 }) 1234 if err != nil { 1235 ec.Error(ctx, err) 1236 return graphql.Null 1237 } 1238 if resTmp == nil { 1239 if !graphql.HasFieldError(ctx, fc) { 1240 ec.Errorf(ctx, "must not be null") 1241 } 1242 return graphql.Null 1243 } 1244 res := resTmp.([]introspection.InputValue) 1245 fc.Result = res 1246 return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) 1247 } 1248 1249 func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { 1250 defer func() { 1251 if r := recover(); r != nil { 1252 ec.Error(ctx, ec.Recover(ctx, r)) 1253 ret = graphql.Null 1254 } 1255 }() 1256 fc := &graphql.FieldContext{ 1257 Object: "__Field", 1258 Field: field, 1259 Args: nil, 1260 IsMethod: false, 1261 IsResolver: false, 1262 } 1263 1264 ctx = graphql.WithFieldContext(ctx, fc) 1265 resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 1266 ctx = rctx // use context from middleware stack in children 1267 return obj.Type, nil 1268 }) 1269 if err != nil { 1270 ec.Error(ctx, err) 1271 return graphql.Null 1272 } 1273 if resTmp == nil { 1274 if !graphql.HasFieldError(ctx, fc) { 1275 ec.Errorf(ctx, "must not be null") 1276 } 1277 return graphql.Null 1278 } 1279 res := resTmp.(*introspection.Type) 1280 fc.Result = res 1281 return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) 1282 } 1283 1284 func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { 1285 defer func() { 1286 if r := recover(); r != nil { 1287 ec.Error(ctx, ec.Recover(ctx, r)) 1288 ret = graphql.Null 1289 } 1290 }() 1291 fc := &graphql.FieldContext{ 1292 Object: "__Field", 1293 Field: field, 1294 Args: nil, 1295 IsMethod: true, 1296 IsResolver: false, 1297 } 1298 1299 ctx = graphql.WithFieldContext(ctx, fc) 1300 resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 1301 ctx = rctx // use context from middleware stack in children 1302 return obj.IsDeprecated(), nil 1303 }) 1304 if err != nil { 1305 ec.Error(ctx, err) 1306 return graphql.Null 1307 } 1308 if resTmp == nil { 1309 if !graphql.HasFieldError(ctx, fc) { 1310 ec.Errorf(ctx, "must not be null") 1311 } 1312 return graphql.Null 1313 } 1314 res := resTmp.(bool) 1315 fc.Result = res 1316 return ec.marshalNBoolean2bool(ctx, field.Selections, res) 1317 } 1318 1319 func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { 1320 defer func() { 1321 if r := recover(); r != nil { 1322 ec.Error(ctx, ec.Recover(ctx, r)) 1323 ret = graphql.Null 1324 } 1325 }() 1326 fc := &graphql.FieldContext{ 1327 Object: "__Field", 1328 Field: field, 1329 Args: nil, 1330 IsMethod: true, 1331 IsResolver: false, 1332 } 1333 1334 ctx = graphql.WithFieldContext(ctx, fc) 1335 resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 1336 ctx = rctx // use context from middleware stack in children 1337 return obj.DeprecationReason(), nil 1338 }) 1339 if err != nil { 1340 ec.Error(ctx, err) 1341 return graphql.Null 1342 } 1343 if resTmp == nil { 1344 return graphql.Null 1345 } 1346 res := resTmp.(*string) 1347 fc.Result = res 1348 return ec.marshalOString2ᚖstring(ctx, field.Selections, res) 1349 } 1350 1351 func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { 1352 defer func() { 1353 if r := recover(); r != nil { 1354 ec.Error(ctx, ec.Recover(ctx, r)) 1355 ret = graphql.Null 1356 } 1357 }() 1358 fc := &graphql.FieldContext{ 1359 Object: "__InputValue", 1360 Field: field, 1361 Args: nil, 1362 IsMethod: false, 1363 IsResolver: false, 1364 } 1365 1366 ctx = graphql.WithFieldContext(ctx, fc) 1367 resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 1368 ctx = rctx // use context from middleware stack in children 1369 return obj.Name, nil 1370 }) 1371 if err != nil { 1372 ec.Error(ctx, err) 1373 return graphql.Null 1374 } 1375 if resTmp == nil { 1376 if !graphql.HasFieldError(ctx, fc) { 1377 ec.Errorf(ctx, "must not be null") 1378 } 1379 return graphql.Null 1380 } 1381 res := resTmp.(string) 1382 fc.Result = res 1383 return ec.marshalNString2string(ctx, field.Selections, res) 1384 } 1385 1386 func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { 1387 defer func() { 1388 if r := recover(); r != nil { 1389 ec.Error(ctx, ec.Recover(ctx, r)) 1390 ret = graphql.Null 1391 } 1392 }() 1393 fc := &graphql.FieldContext{ 1394 Object: "__InputValue", 1395 Field: field, 1396 Args: nil, 1397 IsMethod: false, 1398 IsResolver: false, 1399 } 1400 1401 ctx = graphql.WithFieldContext(ctx, fc) 1402 resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 1403 ctx = rctx // use context from middleware stack in children 1404 return obj.Description, nil 1405 }) 1406 if err != nil { 1407 ec.Error(ctx, err) 1408 return graphql.Null 1409 } 1410 if resTmp == nil { 1411 return graphql.Null 1412 } 1413 res := resTmp.(string) 1414 fc.Result = res 1415 return ec.marshalOString2string(ctx, field.Selections, res) 1416 } 1417 1418 func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { 1419 defer func() { 1420 if r := recover(); r != nil { 1421 ec.Error(ctx, ec.Recover(ctx, r)) 1422 ret = graphql.Null 1423 } 1424 }() 1425 fc := &graphql.FieldContext{ 1426 Object: "__InputValue", 1427 Field: field, 1428 Args: nil, 1429 IsMethod: false, 1430 IsResolver: false, 1431 } 1432 1433 ctx = graphql.WithFieldContext(ctx, fc) 1434 resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 1435 ctx = rctx // use context from middleware stack in children 1436 return obj.Type, nil 1437 }) 1438 if err != nil { 1439 ec.Error(ctx, err) 1440 return graphql.Null 1441 } 1442 if resTmp == nil { 1443 if !graphql.HasFieldError(ctx, fc) { 1444 ec.Errorf(ctx, "must not be null") 1445 } 1446 return graphql.Null 1447 } 1448 res := resTmp.(*introspection.Type) 1449 fc.Result = res 1450 return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) 1451 } 1452 1453 func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { 1454 defer func() { 1455 if r := recover(); r != nil { 1456 ec.Error(ctx, ec.Recover(ctx, r)) 1457 ret = graphql.Null 1458 } 1459 }() 1460 fc := &graphql.FieldContext{ 1461 Object: "__InputValue", 1462 Field: field, 1463 Args: nil, 1464 IsMethod: false, 1465 IsResolver: false, 1466 } 1467 1468 ctx = graphql.WithFieldContext(ctx, fc) 1469 resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 1470 ctx = rctx // use context from middleware stack in children 1471 return obj.DefaultValue, nil 1472 }) 1473 if err != nil { 1474 ec.Error(ctx, err) 1475 return graphql.Null 1476 } 1477 if resTmp == nil { 1478 return graphql.Null 1479 } 1480 res := resTmp.(*string) 1481 fc.Result = res 1482 return ec.marshalOString2ᚖstring(ctx, field.Selections, res) 1483 } 1484 1485 func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { 1486 defer func() { 1487 if r := recover(); r != nil { 1488 ec.Error(ctx, ec.Recover(ctx, r)) 1489 ret = graphql.Null 1490 } 1491 }() 1492 fc := &graphql.FieldContext{ 1493 Object: "__Schema", 1494 Field: field, 1495 Args: nil, 1496 IsMethod: true, 1497 IsResolver: false, 1498 } 1499 1500 ctx = graphql.WithFieldContext(ctx, fc) 1501 resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 1502 ctx = rctx // use context from middleware stack in children 1503 return obj.Types(), nil 1504 }) 1505 if err != nil { 1506 ec.Error(ctx, err) 1507 return graphql.Null 1508 } 1509 if resTmp == nil { 1510 if !graphql.HasFieldError(ctx, fc) { 1511 ec.Errorf(ctx, "must not be null") 1512 } 1513 return graphql.Null 1514 } 1515 res := resTmp.([]introspection.Type) 1516 fc.Result = res 1517 return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) 1518 } 1519 1520 func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { 1521 defer func() { 1522 if r := recover(); r != nil { 1523 ec.Error(ctx, ec.Recover(ctx, r)) 1524 ret = graphql.Null 1525 } 1526 }() 1527 fc := &graphql.FieldContext{ 1528 Object: "__Schema", 1529 Field: field, 1530 Args: nil, 1531 IsMethod: true, 1532 IsResolver: false, 1533 } 1534 1535 ctx = graphql.WithFieldContext(ctx, fc) 1536 resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 1537 ctx = rctx // use context from middleware stack in children 1538 return obj.QueryType(), nil 1539 }) 1540 if err != nil { 1541 ec.Error(ctx, err) 1542 return graphql.Null 1543 } 1544 if resTmp == nil { 1545 if !graphql.HasFieldError(ctx, fc) { 1546 ec.Errorf(ctx, "must not be null") 1547 } 1548 return graphql.Null 1549 } 1550 res := resTmp.(*introspection.Type) 1551 fc.Result = res 1552 return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) 1553 } 1554 1555 func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { 1556 defer func() { 1557 if r := recover(); r != nil { 1558 ec.Error(ctx, ec.Recover(ctx, r)) 1559 ret = graphql.Null 1560 } 1561 }() 1562 fc := &graphql.FieldContext{ 1563 Object: "__Schema", 1564 Field: field, 1565 Args: nil, 1566 IsMethod: true, 1567 IsResolver: false, 1568 } 1569 1570 ctx = graphql.WithFieldContext(ctx, fc) 1571 resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 1572 ctx = rctx // use context from middleware stack in children 1573 return obj.MutationType(), nil 1574 }) 1575 if err != nil { 1576 ec.Error(ctx, err) 1577 return graphql.Null 1578 } 1579 if resTmp == nil { 1580 return graphql.Null 1581 } 1582 res := resTmp.(*introspection.Type) 1583 fc.Result = res 1584 return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) 1585 } 1586 1587 func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { 1588 defer func() { 1589 if r := recover(); r != nil { 1590 ec.Error(ctx, ec.Recover(ctx, r)) 1591 ret = graphql.Null 1592 } 1593 }() 1594 fc := &graphql.FieldContext{ 1595 Object: "__Schema", 1596 Field: field, 1597 Args: nil, 1598 IsMethod: true, 1599 IsResolver: false, 1600 } 1601 1602 ctx = graphql.WithFieldContext(ctx, fc) 1603 resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 1604 ctx = rctx // use context from middleware stack in children 1605 return obj.SubscriptionType(), nil 1606 }) 1607 if err != nil { 1608 ec.Error(ctx, err) 1609 return graphql.Null 1610 } 1611 if resTmp == nil { 1612 return graphql.Null 1613 } 1614 res := resTmp.(*introspection.Type) 1615 fc.Result = res 1616 return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) 1617 } 1618 1619 func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { 1620 defer func() { 1621 if r := recover(); r != nil { 1622 ec.Error(ctx, ec.Recover(ctx, r)) 1623 ret = graphql.Null 1624 } 1625 }() 1626 fc := &graphql.FieldContext{ 1627 Object: "__Schema", 1628 Field: field, 1629 Args: nil, 1630 IsMethod: true, 1631 IsResolver: false, 1632 } 1633 1634 ctx = graphql.WithFieldContext(ctx, fc) 1635 resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 1636 ctx = rctx // use context from middleware stack in children 1637 return obj.Directives(), nil 1638 }) 1639 if err != nil { 1640 ec.Error(ctx, err) 1641 return graphql.Null 1642 } 1643 if resTmp == nil { 1644 if !graphql.HasFieldError(ctx, fc) { 1645 ec.Errorf(ctx, "must not be null") 1646 } 1647 return graphql.Null 1648 } 1649 res := resTmp.([]introspection.Directive) 1650 fc.Result = res 1651 return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirectiveᚄ(ctx, field.Selections, res) 1652 } 1653 1654 func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { 1655 defer func() { 1656 if r := recover(); r != nil { 1657 ec.Error(ctx, ec.Recover(ctx, r)) 1658 ret = graphql.Null 1659 } 1660 }() 1661 fc := &graphql.FieldContext{ 1662 Object: "__Type", 1663 Field: field, 1664 Args: nil, 1665 IsMethod: true, 1666 IsResolver: false, 1667 } 1668 1669 ctx = graphql.WithFieldContext(ctx, fc) 1670 resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 1671 ctx = rctx // use context from middleware stack in children 1672 return obj.Kind(), nil 1673 }) 1674 if err != nil { 1675 ec.Error(ctx, err) 1676 return graphql.Null 1677 } 1678 if resTmp == nil { 1679 if !graphql.HasFieldError(ctx, fc) { 1680 ec.Errorf(ctx, "must not be null") 1681 } 1682 return graphql.Null 1683 } 1684 res := resTmp.(string) 1685 fc.Result = res 1686 return ec.marshalN__TypeKind2string(ctx, field.Selections, res) 1687 } 1688 1689 func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { 1690 defer func() { 1691 if r := recover(); r != nil { 1692 ec.Error(ctx, ec.Recover(ctx, r)) 1693 ret = graphql.Null 1694 } 1695 }() 1696 fc := &graphql.FieldContext{ 1697 Object: "__Type", 1698 Field: field, 1699 Args: nil, 1700 IsMethod: true, 1701 IsResolver: false, 1702 } 1703 1704 ctx = graphql.WithFieldContext(ctx, fc) 1705 resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 1706 ctx = rctx // use context from middleware stack in children 1707 return obj.Name(), nil 1708 }) 1709 if err != nil { 1710 ec.Error(ctx, err) 1711 return graphql.Null 1712 } 1713 if resTmp == nil { 1714 return graphql.Null 1715 } 1716 res := resTmp.(*string) 1717 fc.Result = res 1718 return ec.marshalOString2ᚖstring(ctx, field.Selections, res) 1719 } 1720 1721 func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { 1722 defer func() { 1723 if r := recover(); r != nil { 1724 ec.Error(ctx, ec.Recover(ctx, r)) 1725 ret = graphql.Null 1726 } 1727 }() 1728 fc := &graphql.FieldContext{ 1729 Object: "__Type", 1730 Field: field, 1731 Args: nil, 1732 IsMethod: true, 1733 IsResolver: false, 1734 } 1735 1736 ctx = graphql.WithFieldContext(ctx, fc) 1737 resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 1738 ctx = rctx // use context from middleware stack in children 1739 return obj.Description(), nil 1740 }) 1741 if err != nil { 1742 ec.Error(ctx, err) 1743 return graphql.Null 1744 } 1745 if resTmp == nil { 1746 return graphql.Null 1747 } 1748 res := resTmp.(string) 1749 fc.Result = res 1750 return ec.marshalOString2string(ctx, field.Selections, res) 1751 } 1752 1753 func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { 1754 defer func() { 1755 if r := recover(); r != nil { 1756 ec.Error(ctx, ec.Recover(ctx, r)) 1757 ret = graphql.Null 1758 } 1759 }() 1760 fc := &graphql.FieldContext{ 1761 Object: "__Type", 1762 Field: field, 1763 Args: nil, 1764 IsMethod: true, 1765 IsResolver: false, 1766 } 1767 1768 ctx = graphql.WithFieldContext(ctx, fc) 1769 rawArgs := field.ArgumentMap(ec.Variables) 1770 args, err := ec.field___Type_fields_args(ctx, rawArgs) 1771 if err != nil { 1772 ec.Error(ctx, err) 1773 return graphql.Null 1774 } 1775 fc.Args = args 1776 resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 1777 ctx = rctx // use context from middleware stack in children 1778 return obj.Fields(args["includeDeprecated"].(bool)), nil 1779 }) 1780 if err != nil { 1781 ec.Error(ctx, err) 1782 return graphql.Null 1783 } 1784 if resTmp == nil { 1785 return graphql.Null 1786 } 1787 res := resTmp.([]introspection.Field) 1788 fc.Result = res 1789 return ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐFieldᚄ(ctx, field.Selections, res) 1790 } 1791 1792 func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { 1793 defer func() { 1794 if r := recover(); r != nil { 1795 ec.Error(ctx, ec.Recover(ctx, r)) 1796 ret = graphql.Null 1797 } 1798 }() 1799 fc := &graphql.FieldContext{ 1800 Object: "__Type", 1801 Field: field, 1802 Args: nil, 1803 IsMethod: true, 1804 IsResolver: false, 1805 } 1806 1807 ctx = graphql.WithFieldContext(ctx, fc) 1808 resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 1809 ctx = rctx // use context from middleware stack in children 1810 return obj.Interfaces(), nil 1811 }) 1812 if err != nil { 1813 ec.Error(ctx, err) 1814 return graphql.Null 1815 } 1816 if resTmp == nil { 1817 return graphql.Null 1818 } 1819 res := resTmp.([]introspection.Type) 1820 fc.Result = res 1821 return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) 1822 } 1823 1824 func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { 1825 defer func() { 1826 if r := recover(); r != nil { 1827 ec.Error(ctx, ec.Recover(ctx, r)) 1828 ret = graphql.Null 1829 } 1830 }() 1831 fc := &graphql.FieldContext{ 1832 Object: "__Type", 1833 Field: field, 1834 Args: nil, 1835 IsMethod: true, 1836 IsResolver: false, 1837 } 1838 1839 ctx = graphql.WithFieldContext(ctx, fc) 1840 resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 1841 ctx = rctx // use context from middleware stack in children 1842 return obj.PossibleTypes(), nil 1843 }) 1844 if err != nil { 1845 ec.Error(ctx, err) 1846 return graphql.Null 1847 } 1848 if resTmp == nil { 1849 return graphql.Null 1850 } 1851 res := resTmp.([]introspection.Type) 1852 fc.Result = res 1853 return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) 1854 } 1855 1856 func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { 1857 defer func() { 1858 if r := recover(); r != nil { 1859 ec.Error(ctx, ec.Recover(ctx, r)) 1860 ret = graphql.Null 1861 } 1862 }() 1863 fc := &graphql.FieldContext{ 1864 Object: "__Type", 1865 Field: field, 1866 Args: nil, 1867 IsMethod: true, 1868 IsResolver: false, 1869 } 1870 1871 ctx = graphql.WithFieldContext(ctx, fc) 1872 rawArgs := field.ArgumentMap(ec.Variables) 1873 args, err := ec.field___Type_enumValues_args(ctx, rawArgs) 1874 if err != nil { 1875 ec.Error(ctx, err) 1876 return graphql.Null 1877 } 1878 fc.Args = args 1879 resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 1880 ctx = rctx // use context from middleware stack in children 1881 return obj.EnumValues(args["includeDeprecated"].(bool)), nil 1882 }) 1883 if err != nil { 1884 ec.Error(ctx, err) 1885 return graphql.Null 1886 } 1887 if resTmp == nil { 1888 return graphql.Null 1889 } 1890 res := resTmp.([]introspection.EnumValue) 1891 fc.Result = res 1892 return ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValueᚄ(ctx, field.Selections, res) 1893 } 1894 1895 func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { 1896 defer func() { 1897 if r := recover(); r != nil { 1898 ec.Error(ctx, ec.Recover(ctx, r)) 1899 ret = graphql.Null 1900 } 1901 }() 1902 fc := &graphql.FieldContext{ 1903 Object: "__Type", 1904 Field: field, 1905 Args: nil, 1906 IsMethod: true, 1907 IsResolver: false, 1908 } 1909 1910 ctx = graphql.WithFieldContext(ctx, fc) 1911 resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 1912 ctx = rctx // use context from middleware stack in children 1913 return obj.InputFields(), nil 1914 }) 1915 if err != nil { 1916 ec.Error(ctx, err) 1917 return graphql.Null 1918 } 1919 if resTmp == nil { 1920 return graphql.Null 1921 } 1922 res := resTmp.([]introspection.InputValue) 1923 fc.Result = res 1924 return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) 1925 } 1926 1927 func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { 1928 defer func() { 1929 if r := recover(); r != nil { 1930 ec.Error(ctx, ec.Recover(ctx, r)) 1931 ret = graphql.Null 1932 } 1933 }() 1934 fc := &graphql.FieldContext{ 1935 Object: "__Type", 1936 Field: field, 1937 Args: nil, 1938 IsMethod: true, 1939 IsResolver: false, 1940 } 1941 1942 ctx = graphql.WithFieldContext(ctx, fc) 1943 resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 1944 ctx = rctx // use context from middleware stack in children 1945 return obj.OfType(), nil 1946 }) 1947 if err != nil { 1948 ec.Error(ctx, err) 1949 return graphql.Null 1950 } 1951 if resTmp == nil { 1952 return graphql.Null 1953 } 1954 res := resTmp.(*introspection.Type) 1955 fc.Result = res 1956 return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) 1957 } 1958 1959 // endregion **************************** field.gotpl ***************************** 1960 1961 // region **************************** input.gotpl ***************************** 1962 1963 // endregion **************************** input.gotpl ***************************** 1964 1965 // region ************************** interface.gotpl *************************** 1966 1967 // endregion ************************** interface.gotpl *************************** 1968 1969 // region **************************** object.gotpl **************************** 1970 1971 var chatroomImplementors = []string{"Chatroom"} 1972 1973 func (ec *executionContext) _Chatroom(ctx context.Context, sel ast.SelectionSet, obj *Chatroom) graphql.Marshaler { 1974 fields := graphql.CollectFields(ec.OperationContext, sel, chatroomImplementors) 1975 1976 out := graphql.NewFieldSet(fields) 1977 var invalids uint32 1978 for i, field := range fields { 1979 switch field.Name { 1980 case "__typename": 1981 out.Values[i] = graphql.MarshalString("Chatroom") 1982 case "name": 1983 out.Values[i] = ec._Chatroom_name(ctx, field, obj) 1984 if out.Values[i] == graphql.Null { 1985 invalids++ 1986 } 1987 case "messages": 1988 out.Values[i] = ec._Chatroom_messages(ctx, field, obj) 1989 if out.Values[i] == graphql.Null { 1990 invalids++ 1991 } 1992 default: 1993 panic("unknown field " + strconv.Quote(field.Name)) 1994 } 1995 } 1996 out.Dispatch() 1997 if invalids > 0 { 1998 return graphql.Null 1999 } 2000 return out 2001 } 2002 2003 var messageImplementors = []string{"Message"} 2004 2005 func (ec *executionContext) _Message(ctx context.Context, sel ast.SelectionSet, obj *Message) graphql.Marshaler { 2006 fields := graphql.CollectFields(ec.OperationContext, sel, messageImplementors) 2007 2008 out := graphql.NewFieldSet(fields) 2009 var invalids uint32 2010 for i, field := range fields { 2011 switch field.Name { 2012 case "__typename": 2013 out.Values[i] = graphql.MarshalString("Message") 2014 case "id": 2015 out.Values[i] = ec._Message_id(ctx, field, obj) 2016 if out.Values[i] == graphql.Null { 2017 invalids++ 2018 } 2019 case "text": 2020 out.Values[i] = ec._Message_text(ctx, field, obj) 2021 if out.Values[i] == graphql.Null { 2022 invalids++ 2023 } 2024 case "createdBy": 2025 out.Values[i] = ec._Message_createdBy(ctx, field, obj) 2026 if out.Values[i] == graphql.Null { 2027 invalids++ 2028 } 2029 case "createdAt": 2030 out.Values[i] = ec._Message_createdAt(ctx, field, obj) 2031 if out.Values[i] == graphql.Null { 2032 invalids++ 2033 } 2034 default: 2035 panic("unknown field " + strconv.Quote(field.Name)) 2036 } 2037 } 2038 out.Dispatch() 2039 if invalids > 0 { 2040 return graphql.Null 2041 } 2042 return out 2043 } 2044 2045 var mutationImplementors = []string{"Mutation"} 2046 2047 func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { 2048 fields := graphql.CollectFields(ec.OperationContext, sel, mutationImplementors) 2049 2050 ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ 2051 Object: "Mutation", 2052 }) 2053 2054 out := graphql.NewFieldSet(fields) 2055 var invalids uint32 2056 for i, field := range fields { 2057 switch field.Name { 2058 case "__typename": 2059 out.Values[i] = graphql.MarshalString("Mutation") 2060 case "post": 2061 out.Values[i] = ec._Mutation_post(ctx, field) 2062 if out.Values[i] == graphql.Null { 2063 invalids++ 2064 } 2065 default: 2066 panic("unknown field " + strconv.Quote(field.Name)) 2067 } 2068 } 2069 out.Dispatch() 2070 if invalids > 0 { 2071 return graphql.Null 2072 } 2073 return out 2074 } 2075 2076 var queryImplementors = []string{"Query"} 2077 2078 func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { 2079 fields := graphql.CollectFields(ec.OperationContext, sel, queryImplementors) 2080 2081 ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ 2082 Object: "Query", 2083 }) 2084 2085 out := graphql.NewFieldSet(fields) 2086 var invalids uint32 2087 for i, field := range fields { 2088 switch field.Name { 2089 case "__typename": 2090 out.Values[i] = graphql.MarshalString("Query") 2091 case "room": 2092 field := field 2093 out.Concurrently(i, func() (res graphql.Marshaler) { 2094 defer func() { 2095 if r := recover(); r != nil { 2096 ec.Error(ctx, ec.Recover(ctx, r)) 2097 } 2098 }() 2099 res = ec._Query_room(ctx, field) 2100 return res 2101 }) 2102 case "__type": 2103 out.Values[i] = ec._Query___type(ctx, field) 2104 case "__schema": 2105 out.Values[i] = ec._Query___schema(ctx, field) 2106 default: 2107 panic("unknown field " + strconv.Quote(field.Name)) 2108 } 2109 } 2110 out.Dispatch() 2111 if invalids > 0 { 2112 return graphql.Null 2113 } 2114 return out 2115 } 2116 2117 var subscriptionImplementors = []string{"Subscription"} 2118 2119 func (ec *executionContext) _Subscription(ctx context.Context, sel ast.SelectionSet) func() graphql.Marshaler { 2120 fields := graphql.CollectFields(ec.OperationContext, sel, subscriptionImplementors) 2121 ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ 2122 Object: "Subscription", 2123 }) 2124 if len(fields) != 1 { 2125 ec.Errorf(ctx, "must subscribe to exactly one stream") 2126 return nil 2127 } 2128 2129 switch fields[0].Name { 2130 case "messageAdded": 2131 return ec._Subscription_messageAdded(ctx, fields[0]) 2132 default: 2133 panic("unknown field " + strconv.Quote(fields[0].Name)) 2134 } 2135 } 2136 2137 var __DirectiveImplementors = []string{"__Directive"} 2138 2139 func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionSet, obj *introspection.Directive) graphql.Marshaler { 2140 fields := graphql.CollectFields(ec.OperationContext, sel, __DirectiveImplementors) 2141 2142 out := graphql.NewFieldSet(fields) 2143 var invalids uint32 2144 for i, field := range fields { 2145 switch field.Name { 2146 case "__typename": 2147 out.Values[i] = graphql.MarshalString("__Directive") 2148 case "name": 2149 out.Values[i] = ec.___Directive_name(ctx, field, obj) 2150 if out.Values[i] == graphql.Null { 2151 invalids++ 2152 } 2153 case "description": 2154 out.Values[i] = ec.___Directive_description(ctx, field, obj) 2155 case "locations": 2156 out.Values[i] = ec.___Directive_locations(ctx, field, obj) 2157 if out.Values[i] == graphql.Null { 2158 invalids++ 2159 } 2160 case "args": 2161 out.Values[i] = ec.___Directive_args(ctx, field, obj) 2162 if out.Values[i] == graphql.Null { 2163 invalids++ 2164 } 2165 default: 2166 panic("unknown field " + strconv.Quote(field.Name)) 2167 } 2168 } 2169 out.Dispatch() 2170 if invalids > 0 { 2171 return graphql.Null 2172 } 2173 return out 2174 } 2175 2176 var __EnumValueImplementors = []string{"__EnumValue"} 2177 2178 func (ec *executionContext) ___EnumValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.EnumValue) graphql.Marshaler { 2179 fields := graphql.CollectFields(ec.OperationContext, sel, __EnumValueImplementors) 2180 2181 out := graphql.NewFieldSet(fields) 2182 var invalids uint32 2183 for i, field := range fields { 2184 switch field.Name { 2185 case "__typename": 2186 out.Values[i] = graphql.MarshalString("__EnumValue") 2187 case "name": 2188 out.Values[i] = ec.___EnumValue_name(ctx, field, obj) 2189 if out.Values[i] == graphql.Null { 2190 invalids++ 2191 } 2192 case "description": 2193 out.Values[i] = ec.___EnumValue_description(ctx, field, obj) 2194 case "isDeprecated": 2195 out.Values[i] = ec.___EnumValue_isDeprecated(ctx, field, obj) 2196 if out.Values[i] == graphql.Null { 2197 invalids++ 2198 } 2199 case "deprecationReason": 2200 out.Values[i] = ec.___EnumValue_deprecationReason(ctx, field, obj) 2201 default: 2202 panic("unknown field " + strconv.Quote(field.Name)) 2203 } 2204 } 2205 out.Dispatch() 2206 if invalids > 0 { 2207 return graphql.Null 2208 } 2209 return out 2210 } 2211 2212 var __FieldImplementors = []string{"__Field"} 2213 2214 func (ec *executionContext) ___Field(ctx context.Context, sel ast.SelectionSet, obj *introspection.Field) graphql.Marshaler { 2215 fields := graphql.CollectFields(ec.OperationContext, sel, __FieldImplementors) 2216 2217 out := graphql.NewFieldSet(fields) 2218 var invalids uint32 2219 for i, field := range fields { 2220 switch field.Name { 2221 case "__typename": 2222 out.Values[i] = graphql.MarshalString("__Field") 2223 case "name": 2224 out.Values[i] = ec.___Field_name(ctx, field, obj) 2225 if out.Values[i] == graphql.Null { 2226 invalids++ 2227 } 2228 case "description": 2229 out.Values[i] = ec.___Field_description(ctx, field, obj) 2230 case "args": 2231 out.Values[i] = ec.___Field_args(ctx, field, obj) 2232 if out.Values[i] == graphql.Null { 2233 invalids++ 2234 } 2235 case "type": 2236 out.Values[i] = ec.___Field_type(ctx, field, obj) 2237 if out.Values[i] == graphql.Null { 2238 invalids++ 2239 } 2240 case "isDeprecated": 2241 out.Values[i] = ec.___Field_isDeprecated(ctx, field, obj) 2242 if out.Values[i] == graphql.Null { 2243 invalids++ 2244 } 2245 case "deprecationReason": 2246 out.Values[i] = ec.___Field_deprecationReason(ctx, field, obj) 2247 default: 2248 panic("unknown field " + strconv.Quote(field.Name)) 2249 } 2250 } 2251 out.Dispatch() 2252 if invalids > 0 { 2253 return graphql.Null 2254 } 2255 return out 2256 } 2257 2258 var __InputValueImplementors = []string{"__InputValue"} 2259 2260 func (ec *executionContext) ___InputValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.InputValue) graphql.Marshaler { 2261 fields := graphql.CollectFields(ec.OperationContext, sel, __InputValueImplementors) 2262 2263 out := graphql.NewFieldSet(fields) 2264 var invalids uint32 2265 for i, field := range fields { 2266 switch field.Name { 2267 case "__typename": 2268 out.Values[i] = graphql.MarshalString("__InputValue") 2269 case "name": 2270 out.Values[i] = ec.___InputValue_name(ctx, field, obj) 2271 if out.Values[i] == graphql.Null { 2272 invalids++ 2273 } 2274 case "description": 2275 out.Values[i] = ec.___InputValue_description(ctx, field, obj) 2276 case "type": 2277 out.Values[i] = ec.___InputValue_type(ctx, field, obj) 2278 if out.Values[i] == graphql.Null { 2279 invalids++ 2280 } 2281 case "defaultValue": 2282 out.Values[i] = ec.___InputValue_defaultValue(ctx, field, obj) 2283 default: 2284 panic("unknown field " + strconv.Quote(field.Name)) 2285 } 2286 } 2287 out.Dispatch() 2288 if invalids > 0 { 2289 return graphql.Null 2290 } 2291 return out 2292 } 2293 2294 var __SchemaImplementors = []string{"__Schema"} 2295 2296 func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet, obj *introspection.Schema) graphql.Marshaler { 2297 fields := graphql.CollectFields(ec.OperationContext, sel, __SchemaImplementors) 2298 2299 out := graphql.NewFieldSet(fields) 2300 var invalids uint32 2301 for i, field := range fields { 2302 switch field.Name { 2303 case "__typename": 2304 out.Values[i] = graphql.MarshalString("__Schema") 2305 case "types": 2306 out.Values[i] = ec.___Schema_types(ctx, field, obj) 2307 if out.Values[i] == graphql.Null { 2308 invalids++ 2309 } 2310 case "queryType": 2311 out.Values[i] = ec.___Schema_queryType(ctx, field, obj) 2312 if out.Values[i] == graphql.Null { 2313 invalids++ 2314 } 2315 case "mutationType": 2316 out.Values[i] = ec.___Schema_mutationType(ctx, field, obj) 2317 case "subscriptionType": 2318 out.Values[i] = ec.___Schema_subscriptionType(ctx, field, obj) 2319 case "directives": 2320 out.Values[i] = ec.___Schema_directives(ctx, field, obj) 2321 if out.Values[i] == graphql.Null { 2322 invalids++ 2323 } 2324 default: 2325 panic("unknown field " + strconv.Quote(field.Name)) 2326 } 2327 } 2328 out.Dispatch() 2329 if invalids > 0 { 2330 return graphql.Null 2331 } 2332 return out 2333 } 2334 2335 var __TypeImplementors = []string{"__Type"} 2336 2337 func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, obj *introspection.Type) graphql.Marshaler { 2338 fields := graphql.CollectFields(ec.OperationContext, sel, __TypeImplementors) 2339 2340 out := graphql.NewFieldSet(fields) 2341 var invalids uint32 2342 for i, field := range fields { 2343 switch field.Name { 2344 case "__typename": 2345 out.Values[i] = graphql.MarshalString("__Type") 2346 case "kind": 2347 out.Values[i] = ec.___Type_kind(ctx, field, obj) 2348 if out.Values[i] == graphql.Null { 2349 invalids++ 2350 } 2351 case "name": 2352 out.Values[i] = ec.___Type_name(ctx, field, obj) 2353 case "description": 2354 out.Values[i] = ec.___Type_description(ctx, field, obj) 2355 case "fields": 2356 out.Values[i] = ec.___Type_fields(ctx, field, obj) 2357 case "interfaces": 2358 out.Values[i] = ec.___Type_interfaces(ctx, field, obj) 2359 case "possibleTypes": 2360 out.Values[i] = ec.___Type_possibleTypes(ctx, field, obj) 2361 case "enumValues": 2362 out.Values[i] = ec.___Type_enumValues(ctx, field, obj) 2363 case "inputFields": 2364 out.Values[i] = ec.___Type_inputFields(ctx, field, obj) 2365 case "ofType": 2366 out.Values[i] = ec.___Type_ofType(ctx, field, obj) 2367 default: 2368 panic("unknown field " + strconv.Quote(field.Name)) 2369 } 2370 } 2371 out.Dispatch() 2372 if invalids > 0 { 2373 return graphql.Null 2374 } 2375 return out 2376 } 2377 2378 // endregion **************************** object.gotpl **************************** 2379 2380 // region ***************************** type.gotpl ***************************** 2381 2382 func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interface{}) (bool, error) { 2383 res, err := graphql.UnmarshalBoolean(v) 2384 return res, graphql.ErrorOnPath(ctx, err) 2385 } 2386 2387 func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { 2388 res := graphql.MarshalBoolean(v) 2389 if res == graphql.Null { 2390 if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { 2391 ec.Errorf(ctx, "must not be null") 2392 } 2393 } 2394 return res 2395 } 2396 2397 func (ec *executionContext) unmarshalNID2string(ctx context.Context, v interface{}) (string, error) { 2398 res, err := graphql.UnmarshalID(v) 2399 return res, graphql.ErrorOnPath(ctx, err) 2400 } 2401 2402 func (ec *executionContext) marshalNID2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { 2403 res := graphql.MarshalID(v) 2404 if res == graphql.Null { 2405 if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { 2406 ec.Errorf(ctx, "must not be null") 2407 } 2408 } 2409 return res 2410 } 2411 2412 func (ec *executionContext) marshalNMessage2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋchatᚐMessage(ctx context.Context, sel ast.SelectionSet, v Message) graphql.Marshaler { 2413 return ec._Message(ctx, sel, &v) 2414 } 2415 2416 func (ec *executionContext) marshalNMessage2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋchatᚐMessageᚄ(ctx context.Context, sel ast.SelectionSet, v []Message) graphql.Marshaler { 2417 ret := make(graphql.Array, len(v)) 2418 var wg sync.WaitGroup 2419 isLen1 := len(v) == 1 2420 if !isLen1 { 2421 wg.Add(len(v)) 2422 } 2423 for i := range v { 2424 i := i 2425 fc := &graphql.FieldContext{ 2426 Index: &i, 2427 Result: &v[i], 2428 } 2429 ctx := graphql.WithFieldContext(ctx, fc) 2430 f := func(i int) { 2431 defer func() { 2432 if r := recover(); r != nil { 2433 ec.Error(ctx, ec.Recover(ctx, r)) 2434 ret = nil 2435 } 2436 }() 2437 if !isLen1 { 2438 defer wg.Done() 2439 } 2440 ret[i] = ec.marshalNMessage2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋchatᚐMessage(ctx, sel, v[i]) 2441 } 2442 if isLen1 { 2443 f(i) 2444 } else { 2445 go f(i) 2446 } 2447 2448 } 2449 wg.Wait() 2450 2451 for _, e := range ret { 2452 if e == graphql.Null { 2453 return graphql.Null 2454 } 2455 } 2456 2457 return ret 2458 } 2459 2460 func (ec *executionContext) marshalNMessage2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋchatᚐMessage(ctx context.Context, sel ast.SelectionSet, v *Message) graphql.Marshaler { 2461 if v == nil { 2462 if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { 2463 ec.Errorf(ctx, "must not be null") 2464 } 2465 return graphql.Null 2466 } 2467 return ec._Message(ctx, sel, v) 2468 } 2469 2470 func (ec *executionContext) unmarshalNString2string(ctx context.Context, v interface{}) (string, error) { 2471 res, err := graphql.UnmarshalString(v) 2472 return res, graphql.ErrorOnPath(ctx, err) 2473 } 2474 2475 func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { 2476 res := graphql.MarshalString(v) 2477 if res == graphql.Null { 2478 if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { 2479 ec.Errorf(ctx, "must not be null") 2480 } 2481 } 2482 return res 2483 } 2484 2485 func (ec *executionContext) unmarshalNTime2timeᚐTime(ctx context.Context, v interface{}) (time.Time, error) { 2486 res, err := graphql.UnmarshalTime(v) 2487 return res, graphql.ErrorOnPath(ctx, err) 2488 } 2489 2490 func (ec *executionContext) marshalNTime2timeᚐTime(ctx context.Context, sel ast.SelectionSet, v time.Time) graphql.Marshaler { 2491 res := graphql.MarshalTime(v) 2492 if res == graphql.Null { 2493 if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { 2494 ec.Errorf(ctx, "must not be null") 2495 } 2496 } 2497 return res 2498 } 2499 2500 func (ec *executionContext) marshalN__Directive2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx context.Context, sel ast.SelectionSet, v introspection.Directive) graphql.Marshaler { 2501 return ec.___Directive(ctx, sel, &v) 2502 } 2503 2504 func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirectiveᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.Directive) graphql.Marshaler { 2505 ret := make(graphql.Array, len(v)) 2506 var wg sync.WaitGroup 2507 isLen1 := len(v) == 1 2508 if !isLen1 { 2509 wg.Add(len(v)) 2510 } 2511 for i := range v { 2512 i := i 2513 fc := &graphql.FieldContext{ 2514 Index: &i, 2515 Result: &v[i], 2516 } 2517 ctx := graphql.WithFieldContext(ctx, fc) 2518 f := func(i int) { 2519 defer func() { 2520 if r := recover(); r != nil { 2521 ec.Error(ctx, ec.Recover(ctx, r)) 2522 ret = nil 2523 } 2524 }() 2525 if !isLen1 { 2526 defer wg.Done() 2527 } 2528 ret[i] = ec.marshalN__Directive2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx, sel, v[i]) 2529 } 2530 if isLen1 { 2531 f(i) 2532 } else { 2533 go f(i) 2534 } 2535 2536 } 2537 wg.Wait() 2538 2539 for _, e := range ret { 2540 if e == graphql.Null { 2541 return graphql.Null 2542 } 2543 } 2544 2545 return ret 2546 } 2547 2548 func (ec *executionContext) unmarshalN__DirectiveLocation2string(ctx context.Context, v interface{}) (string, error) { 2549 res, err := graphql.UnmarshalString(v) 2550 return res, graphql.ErrorOnPath(ctx, err) 2551 } 2552 2553 func (ec *executionContext) marshalN__DirectiveLocation2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { 2554 res := graphql.MarshalString(v) 2555 if res == graphql.Null { 2556 if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { 2557 ec.Errorf(ctx, "must not be null") 2558 } 2559 } 2560 return res 2561 } 2562 2563 func (ec *executionContext) unmarshalN__DirectiveLocation2ᚕstringᚄ(ctx context.Context, v interface{}) ([]string, error) { 2564 var vSlice []interface{} 2565 if v != nil { 2566 if tmp1, ok := v.([]interface{}); ok { 2567 vSlice = tmp1 2568 } else { 2569 vSlice = []interface{}{v} 2570 } 2571 } 2572 var err error 2573 res := make([]string, len(vSlice)) 2574 for i := range vSlice { 2575 ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) 2576 res[i], err = ec.unmarshalN__DirectiveLocation2string(ctx, vSlice[i]) 2577 if err != nil { 2578 return nil, err 2579 } 2580 } 2581 return res, nil 2582 } 2583 2584 func (ec *executionContext) marshalN__DirectiveLocation2ᚕstringᚄ(ctx context.Context, sel ast.SelectionSet, v []string) graphql.Marshaler { 2585 ret := make(graphql.Array, len(v)) 2586 var wg sync.WaitGroup 2587 isLen1 := len(v) == 1 2588 if !isLen1 { 2589 wg.Add(len(v)) 2590 } 2591 for i := range v { 2592 i := i 2593 fc := &graphql.FieldContext{ 2594 Index: &i, 2595 Result: &v[i], 2596 } 2597 ctx := graphql.WithFieldContext(ctx, fc) 2598 f := func(i int) { 2599 defer func() { 2600 if r := recover(); r != nil { 2601 ec.Error(ctx, ec.Recover(ctx, r)) 2602 ret = nil 2603 } 2604 }() 2605 if !isLen1 { 2606 defer wg.Done() 2607 } 2608 ret[i] = ec.marshalN__DirectiveLocation2string(ctx, sel, v[i]) 2609 } 2610 if isLen1 { 2611 f(i) 2612 } else { 2613 go f(i) 2614 } 2615 2616 } 2617 wg.Wait() 2618 2619 for _, e := range ret { 2620 if e == graphql.Null { 2621 return graphql.Null 2622 } 2623 } 2624 2625 return ret 2626 } 2627 2628 func (ec *executionContext) marshalN__EnumValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx context.Context, sel ast.SelectionSet, v introspection.EnumValue) graphql.Marshaler { 2629 return ec.___EnumValue(ctx, sel, &v) 2630 } 2631 2632 func (ec *executionContext) marshalN__Field2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx context.Context, sel ast.SelectionSet, v introspection.Field) graphql.Marshaler { 2633 return ec.___Field(ctx, sel, &v) 2634 } 2635 2636 func (ec *executionContext) marshalN__InputValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx context.Context, sel ast.SelectionSet, v introspection.InputValue) graphql.Marshaler { 2637 return ec.___InputValue(ctx, sel, &v) 2638 } 2639 2640 func (ec *executionContext) marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.InputValue) graphql.Marshaler { 2641 ret := make(graphql.Array, len(v)) 2642 var wg sync.WaitGroup 2643 isLen1 := len(v) == 1 2644 if !isLen1 { 2645 wg.Add(len(v)) 2646 } 2647 for i := range v { 2648 i := i 2649 fc := &graphql.FieldContext{ 2650 Index: &i, 2651 Result: &v[i], 2652 } 2653 ctx := graphql.WithFieldContext(ctx, fc) 2654 f := func(i int) { 2655 defer func() { 2656 if r := recover(); r != nil { 2657 ec.Error(ctx, ec.Recover(ctx, r)) 2658 ret = nil 2659 } 2660 }() 2661 if !isLen1 { 2662 defer wg.Done() 2663 } 2664 ret[i] = ec.marshalN__InputValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, sel, v[i]) 2665 } 2666 if isLen1 { 2667 f(i) 2668 } else { 2669 go f(i) 2670 } 2671 2672 } 2673 wg.Wait() 2674 2675 for _, e := range ret { 2676 if e == graphql.Null { 2677 return graphql.Null 2678 } 2679 } 2680 2681 return ret 2682 } 2683 2684 func (ec *executionContext) marshalN__Type2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v introspection.Type) graphql.Marshaler { 2685 return ec.___Type(ctx, sel, &v) 2686 } 2687 2688 func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.Type) graphql.Marshaler { 2689 ret := make(graphql.Array, len(v)) 2690 var wg sync.WaitGroup 2691 isLen1 := len(v) == 1 2692 if !isLen1 { 2693 wg.Add(len(v)) 2694 } 2695 for i := range v { 2696 i := i 2697 fc := &graphql.FieldContext{ 2698 Index: &i, 2699 Result: &v[i], 2700 } 2701 ctx := graphql.WithFieldContext(ctx, fc) 2702 f := func(i int) { 2703 defer func() { 2704 if r := recover(); r != nil { 2705 ec.Error(ctx, ec.Recover(ctx, r)) 2706 ret = nil 2707 } 2708 }() 2709 if !isLen1 { 2710 defer wg.Done() 2711 } 2712 ret[i] = ec.marshalN__Type2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, sel, v[i]) 2713 } 2714 if isLen1 { 2715 f(i) 2716 } else { 2717 go f(i) 2718 } 2719 2720 } 2721 wg.Wait() 2722 2723 for _, e := range ret { 2724 if e == graphql.Null { 2725 return graphql.Null 2726 } 2727 } 2728 2729 return ret 2730 } 2731 2732 func (ec *executionContext) marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v *introspection.Type) graphql.Marshaler { 2733 if v == nil { 2734 if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { 2735 ec.Errorf(ctx, "must not be null") 2736 } 2737 return graphql.Null 2738 } 2739 return ec.___Type(ctx, sel, v) 2740 } 2741 2742 func (ec *executionContext) unmarshalN__TypeKind2string(ctx context.Context, v interface{}) (string, error) { 2743 res, err := graphql.UnmarshalString(v) 2744 return res, graphql.ErrorOnPath(ctx, err) 2745 } 2746 2747 func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { 2748 res := graphql.MarshalString(v) 2749 if res == graphql.Null { 2750 if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { 2751 ec.Errorf(ctx, "must not be null") 2752 } 2753 } 2754 return res 2755 } 2756 2757 func (ec *executionContext) unmarshalOBoolean2bool(ctx context.Context, v interface{}) (bool, error) { 2758 res, err := graphql.UnmarshalBoolean(v) 2759 return res, graphql.ErrorOnPath(ctx, err) 2760 } 2761 2762 func (ec *executionContext) marshalOBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { 2763 return graphql.MarshalBoolean(v) 2764 } 2765 2766 func (ec *executionContext) unmarshalOBoolean2ᚖbool(ctx context.Context, v interface{}) (*bool, error) { 2767 if v == nil { 2768 return nil, nil 2769 } 2770 res, err := graphql.UnmarshalBoolean(v) 2771 return &res, graphql.ErrorOnPath(ctx, err) 2772 } 2773 2774 func (ec *executionContext) marshalOBoolean2ᚖbool(ctx context.Context, sel ast.SelectionSet, v *bool) graphql.Marshaler { 2775 if v == nil { 2776 return graphql.Null 2777 } 2778 return graphql.MarshalBoolean(*v) 2779 } 2780 2781 func (ec *executionContext) marshalOChatroom2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋchatᚐChatroom(ctx context.Context, sel ast.SelectionSet, v *Chatroom) graphql.Marshaler { 2782 if v == nil { 2783 return graphql.Null 2784 } 2785 return ec._Chatroom(ctx, sel, v) 2786 } 2787 2788 func (ec *executionContext) unmarshalOString2string(ctx context.Context, v interface{}) (string, error) { 2789 res, err := graphql.UnmarshalString(v) 2790 return res, graphql.ErrorOnPath(ctx, err) 2791 } 2792 2793 func (ec *executionContext) marshalOString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { 2794 return graphql.MarshalString(v) 2795 } 2796 2797 func (ec *executionContext) unmarshalOString2ᚖstring(ctx context.Context, v interface{}) (*string, error) { 2798 if v == nil { 2799 return nil, nil 2800 } 2801 res, err := graphql.UnmarshalString(v) 2802 return &res, graphql.ErrorOnPath(ctx, err) 2803 } 2804 2805 func (ec *executionContext) marshalOString2ᚖstring(ctx context.Context, sel ast.SelectionSet, v *string) graphql.Marshaler { 2806 if v == nil { 2807 return graphql.Null 2808 } 2809 return graphql.MarshalString(*v) 2810 } 2811 2812 func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValueᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.EnumValue) graphql.Marshaler { 2813 if v == nil { 2814 return graphql.Null 2815 } 2816 ret := make(graphql.Array, len(v)) 2817 var wg sync.WaitGroup 2818 isLen1 := len(v) == 1 2819 if !isLen1 { 2820 wg.Add(len(v)) 2821 } 2822 for i := range v { 2823 i := i 2824 fc := &graphql.FieldContext{ 2825 Index: &i, 2826 Result: &v[i], 2827 } 2828 ctx := graphql.WithFieldContext(ctx, fc) 2829 f := func(i int) { 2830 defer func() { 2831 if r := recover(); r != nil { 2832 ec.Error(ctx, ec.Recover(ctx, r)) 2833 ret = nil 2834 } 2835 }() 2836 if !isLen1 { 2837 defer wg.Done() 2838 } 2839 ret[i] = ec.marshalN__EnumValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx, sel, v[i]) 2840 } 2841 if isLen1 { 2842 f(i) 2843 } else { 2844 go f(i) 2845 } 2846 2847 } 2848 wg.Wait() 2849 2850 for _, e := range ret { 2851 if e == graphql.Null { 2852 return graphql.Null 2853 } 2854 } 2855 2856 return ret 2857 } 2858 2859 func (ec *executionContext) marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐFieldᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.Field) graphql.Marshaler { 2860 if v == nil { 2861 return graphql.Null 2862 } 2863 ret := make(graphql.Array, len(v)) 2864 var wg sync.WaitGroup 2865 isLen1 := len(v) == 1 2866 if !isLen1 { 2867 wg.Add(len(v)) 2868 } 2869 for i := range v { 2870 i := i 2871 fc := &graphql.FieldContext{ 2872 Index: &i, 2873 Result: &v[i], 2874 } 2875 ctx := graphql.WithFieldContext(ctx, fc) 2876 f := func(i int) { 2877 defer func() { 2878 if r := recover(); r != nil { 2879 ec.Error(ctx, ec.Recover(ctx, r)) 2880 ret = nil 2881 } 2882 }() 2883 if !isLen1 { 2884 defer wg.Done() 2885 } 2886 ret[i] = ec.marshalN__Field2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx, sel, v[i]) 2887 } 2888 if isLen1 { 2889 f(i) 2890 } else { 2891 go f(i) 2892 } 2893 2894 } 2895 wg.Wait() 2896 2897 for _, e := range ret { 2898 if e == graphql.Null { 2899 return graphql.Null 2900 } 2901 } 2902 2903 return ret 2904 } 2905 2906 func (ec *executionContext) marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.InputValue) graphql.Marshaler { 2907 if v == nil { 2908 return graphql.Null 2909 } 2910 ret := make(graphql.Array, len(v)) 2911 var wg sync.WaitGroup 2912 isLen1 := len(v) == 1 2913 if !isLen1 { 2914 wg.Add(len(v)) 2915 } 2916 for i := range v { 2917 i := i 2918 fc := &graphql.FieldContext{ 2919 Index: &i, 2920 Result: &v[i], 2921 } 2922 ctx := graphql.WithFieldContext(ctx, fc) 2923 f := func(i int) { 2924 defer func() { 2925 if r := recover(); r != nil { 2926 ec.Error(ctx, ec.Recover(ctx, r)) 2927 ret = nil 2928 } 2929 }() 2930 if !isLen1 { 2931 defer wg.Done() 2932 } 2933 ret[i] = ec.marshalN__InputValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, sel, v[i]) 2934 } 2935 if isLen1 { 2936 f(i) 2937 } else { 2938 go f(i) 2939 } 2940 2941 } 2942 wg.Wait() 2943 2944 for _, e := range ret { 2945 if e == graphql.Null { 2946 return graphql.Null 2947 } 2948 } 2949 2950 return ret 2951 } 2952 2953 func (ec *executionContext) marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx context.Context, sel ast.SelectionSet, v *introspection.Schema) graphql.Marshaler { 2954 if v == nil { 2955 return graphql.Null 2956 } 2957 return ec.___Schema(ctx, sel, v) 2958 } 2959 2960 func (ec *executionContext) marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.Type) graphql.Marshaler { 2961 if v == nil { 2962 return graphql.Null 2963 } 2964 ret := make(graphql.Array, len(v)) 2965 var wg sync.WaitGroup 2966 isLen1 := len(v) == 1 2967 if !isLen1 { 2968 wg.Add(len(v)) 2969 } 2970 for i := range v { 2971 i := i 2972 fc := &graphql.FieldContext{ 2973 Index: &i, 2974 Result: &v[i], 2975 } 2976 ctx := graphql.WithFieldContext(ctx, fc) 2977 f := func(i int) { 2978 defer func() { 2979 if r := recover(); r != nil { 2980 ec.Error(ctx, ec.Recover(ctx, r)) 2981 ret = nil 2982 } 2983 }() 2984 if !isLen1 { 2985 defer wg.Done() 2986 } 2987 ret[i] = ec.marshalN__Type2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, sel, v[i]) 2988 } 2989 if isLen1 { 2990 f(i) 2991 } else { 2992 go f(i) 2993 } 2994 2995 } 2996 wg.Wait() 2997 2998 for _, e := range ret { 2999 if e == graphql.Null { 3000 return graphql.Null 3001 } 3002 } 3003 3004 return ret 3005 } 3006 3007 func (ec *executionContext) marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v *introspection.Type) graphql.Marshaler { 3008 if v == nil { 3009 return graphql.Null 3010 } 3011 return ec.___Type(ctx, sel, v) 3012 } 3013 3014 // endregion ***************************** type.gotpl *****************************