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