├── db ├── dbconf.yml └── migrations │ └── 20200413055140_CreateTasks.sql ├── graph ├── resolver.go ├── schema.graphqls ├── model │ └── models_gen.go ├── schema.resolvers.go └── generated │ └── generated.go ├── .gitignore ├── go.mod ├── README.md ├── LICENSE ├── main.go ├── gqlgen.yml └── go.sum /db/dbconf.yml: -------------------------------------------------------------------------------- 1 | development: 2 | driver: postgres 3 | open: user=pguser password=pgpass dbname=gqlgen-echo-sample sslmode=disable -------------------------------------------------------------------------------- /graph/resolver.go: -------------------------------------------------------------------------------- 1 | package graph 2 | 3 | import "github.com/jinzhu/gorm" 4 | 5 | // This file will not be regenerated automatically. 6 | // 7 | // It serves as dependency injection for your app, add any dependencies you require here. 8 | 9 | type Resolver struct { 10 | DB *gorm.DB 11 | } 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Binaries for programs and plugins 2 | *.exe 3 | *.exe~ 4 | *.dll 5 | *.so 6 | *.dylib 7 | 8 | # Test binary, built with `go test -c` 9 | *.test 10 | 11 | # Output of the go coverage tool, specifically when used with LiteIDE 12 | *.out 13 | 14 | # Dependency directories (remove the comment below to include it) 15 | # vendor/ 16 | -------------------------------------------------------------------------------- /graph/schema.graphqls: -------------------------------------------------------------------------------- 1 | type Task { 2 | id: ID! 3 | title: String! 4 | note: String! 5 | completed: Int! 6 | created_at: String! 7 | updated_at: String! 8 | } 9 | 10 | input NewTask { 11 | title: String! 12 | note: String! 13 | } 14 | 15 | type Mutation { 16 | createTask(input: NewTask!): Task! 17 | } 18 | 19 | type Query { 20 | tasks: [Task!]! 21 | } -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/yuuu/gqlgen-echo-sample 2 | 3 | go 1.14 4 | 5 | require ( 6 | bitbucket.org/liamstask/goose v0.0.0-20150115234039-8488cc47d90c // indirect 7 | github.com/99designs/gqlgen v0.11.3 8 | github.com/dgrijalva/jwt-go v3.2.0+incompatible // indirect 9 | github.com/jinzhu/gorm v1.9.12 10 | github.com/labstack/echo v3.3.10+incompatible 11 | github.com/labstack/gommon v0.3.0 // indirect 12 | github.com/vektah/gqlparser/v2 v2.0.1 13 | ) 14 | -------------------------------------------------------------------------------- /graph/model/models_gen.go: -------------------------------------------------------------------------------- 1 | // Code generated by github.com/99designs/gqlgen, DO NOT EDIT. 2 | 3 | package model 4 | 5 | type NewTask struct { 6 | Title string `json:"title"` 7 | Note string `json:"note"` 8 | } 9 | 10 | type Task struct { 11 | ID string `json:"id"` 12 | Title string `json:"title"` 13 | Note string `json:"note"` 14 | Completed int `json:"completed"` 15 | CreatedAt string `json:"created_at"` 16 | UpdatedAt string `json:"updated_at"` 17 | } 18 | -------------------------------------------------------------------------------- /db/migrations/20200413055140_CreateTasks.sql: -------------------------------------------------------------------------------- 1 | 2 | -- +goose Up 3 | -- SQL in section 'Up' is executed when this migration is applied 4 | CREATE TABLE tasks ( 5 | id SERIAL NOT NULL, 6 | title varchar(255) DEFAULT NULL, 7 | note text DEFAULT NULL, 8 | completed integer DEFAULT 0, 9 | created_at TIMESTAMP DEFAULT NULL, 10 | updated_at TIMESTAMP DEFAULT NULL, 11 | PRIMARY KEY(id) 12 | ); 13 | CREATE INDEX task_id on tasks (id); 14 | 15 | -- +goose Down 16 | -- SQL section 'Down' is executed when this migration is rolled back 17 | DROP INDEX task_id; 18 | DROP TABLE tasks; 19 | 20 | 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | gqlgen-echo-sample 2 | ==== 3 | 4 | Sample implementation of a Golang GraphQL server using gqlgen and Echo. 5 | 6 | ## Description 7 | 8 | We combined gqlgen, a GraphQL library, and Echo, a web framework, to build a GraqhQL server implemented in the Go language. 9 | 10 | [https://tech.fusic.co.jp/posts/2020-04-12-gqlgen-echo-sample/](https://tech.fusic.co.jp/posts/2020-04-12-gqlgen-echo-sample/) 11 | 12 | ## Screen Shot 13 | 14 | ![Mutation Sample](https://user-images.githubusercontent.com/8074640/79082385-816da380-7d60-11ea-8461-b42b72680879.png) 15 | 16 | ![Query Sample](https://user-images.githubusercontent.com/8074640/79082387-83cffd80-7d60-11ea-9a98-2ed204e5d2ee.png) 17 | 18 | ## Usage 19 | 20 | 21 | ```bash 22 | $ go get github.com/yuuu/gqlgen-echo-sample 23 | ``` 24 | 25 | 1. Create the database `gqlgen-echo-sample` in PosgtreSQL beforehand. 26 | 2. Modify `db/dbconf.yml` appropriately. 27 | 3. Change the argument of `gorm.Open()` in `main.go` as needed. 28 | 29 | ```bash 30 | $ goose up 31 | $ go run main.go 32 | ``` 33 | 34 | Go to [http://localhost:3000/playground](http://localhost:3000/playground). 35 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Yuhei Okazaki 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /graph/schema.resolvers.go: -------------------------------------------------------------------------------- 1 | package graph 2 | 3 | // This file will be automatically regenerated based on the schema, any resolver implementations 4 | // will be copied through when generating and any unknown code will be moved to the end. 5 | 6 | import ( 7 | "context" 8 | "time" 9 | 10 | "github.com/yuuu/gqlgen-echo-sample/graph/generated" 11 | "github.com/yuuu/gqlgen-echo-sample/graph/model" 12 | ) 13 | 14 | func (r *mutationResolver) CreateTask(ctx context.Context, input model.NewTask) (*model.Task, error) { 15 | timestamp := time.Now().Format("2006-01-02 15:04:05") 16 | 17 | task := model.Task{ 18 | Title: input.Title, 19 | Note: input.Note, 20 | Completed: 0, 21 | CreatedAt: timestamp, 22 | UpdatedAt: timestamp, 23 | } 24 | r.DB.Create(&task) 25 | 26 | return &task, nil 27 | } 28 | 29 | func (r *queryResolver) Tasks(ctx context.Context) ([]*model.Task, error) { 30 | tasks := []*model.Task{} 31 | 32 | r.DB.Find(&tasks) 33 | 34 | return tasks, nil 35 | } 36 | 37 | // Mutation returns generated.MutationResolver implementation. 38 | func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResolver{r} } 39 | 40 | // Query returns generated.QueryResolver implementation. 41 | func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} } 42 | 43 | type mutationResolver struct{ *Resolver } 44 | type queryResolver struct{ *Resolver } 45 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "log" 6 | "net/http" 7 | 8 | "github.com/99designs/gqlgen/graphql/handler" 9 | "github.com/99designs/gqlgen/graphql/playground" 10 | "github.com/jinzhu/gorm" 11 | _ "github.com/jinzhu/gorm/dialects/postgres" 12 | "github.com/yuuu/gqlgen-echo-sample/graph" 13 | "github.com/yuuu/gqlgen-echo-sample/graph/generated" 14 | 15 | "github.com/labstack/echo" 16 | "github.com/labstack/echo/middleware" 17 | ) 18 | 19 | func main() { 20 | db, err := gorm.Open( // 修正 21 | "postgres", 22 | fmt.Sprintf( 23 | "host=%s port=%d user=%s dbname=%s password=%s sslmode=disable", 24 | "127.0.0.1", 5432, "pguser", "gqlgen-echo-sample", "pgpass", 25 | ), 26 | ) 27 | if err != nil { 28 | log.Fatalln(err) 29 | } 30 | 31 | e := echo.New() 32 | 33 | e.Use(middleware.Logger()) 34 | e.Use(middleware.Recover()) 35 | 36 | e.GET("/", welcome()) 37 | 38 | graphqlHandler := handler.NewDefaultServer( 39 | generated.NewExecutableSchema( 40 | generated.Config{Resolvers: &graph.Resolver{DB: db}}, 41 | ), 42 | ) 43 | playgroundHandler := playground.Handler("GraphQL", "/query") 44 | 45 | e.POST("/query", func(c echo.Context) error { 46 | graphqlHandler.ServeHTTP(c.Response(), c.Request()) 47 | return nil 48 | }) 49 | 50 | e.GET("/playground", func(c echo.Context) error { 51 | playgroundHandler.ServeHTTP(c.Response(), c.Request()) 52 | return nil 53 | }) 54 | 55 | err = e.Start(":3000") 56 | if err != nil { 57 | log.Fatalln(err) 58 | } 59 | } 60 | 61 | func welcome() echo.HandlerFunc { 62 | return func(c echo.Context) error { 63 | return c.String(http.StatusOK, "Welcome!") 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /gqlgen.yml: -------------------------------------------------------------------------------- 1 | # Where are all the schema files located? globs are supported eg src/**/*.graphqls 2 | schema: 3 | - graph/*.graphqls 4 | 5 | # Where should the generated server code go? 6 | exec: 7 | filename: graph/generated/generated.go 8 | package: generated 9 | 10 | # Uncomment to enable federation 11 | # federation: 12 | # filename: graph/generated/federation.go 13 | # package: generated 14 | 15 | # Where should any generated models go? 16 | model: 17 | filename: graph/model/models_gen.go 18 | package: model 19 | 20 | # Where should the resolver implementations go? 21 | resolver: 22 | layout: follow-schema 23 | dir: graph 24 | package: graph 25 | 26 | # Optional: turn on use `gqlgen:"fieldName"` tags in your models 27 | # struct_tag: json 28 | 29 | # Optional: turn on to use []Thing instead of []*Thing 30 | # omit_slice_element_pointers: false 31 | 32 | # Optional: set to speed up generation time by not performing a final validation pass. 33 | # skip_validation: true 34 | 35 | # gqlgen will search for any type names in the schema in these go packages 36 | # if they match it will use them, otherwise it will generate them. 37 | autobind: 38 | - "github.com/yuuu/gqlgen-echo-sample/graph/model" 39 | 40 | # This section declares type mapping between the GraphQL and go type systems 41 | # 42 | # The first line in each type will be used as defaults for resolver arguments and 43 | # modelgen, the others will be allowed when binding to fields. Configure them to 44 | # your liking 45 | models: 46 | ID: 47 | model: 48 | - github.com/99designs/gqlgen/graphql.ID 49 | - github.com/99designs/gqlgen/graphql.Int 50 | - github.com/99designs/gqlgen/graphql.Int64 51 | - github.com/99designs/gqlgen/graphql.Int32 52 | Int: 53 | model: 54 | - github.com/99designs/gqlgen/graphql.Int 55 | - github.com/99designs/gqlgen/graphql.Int64 56 | - github.com/99designs/gqlgen/graphql.Int32 57 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | bitbucket.org/liamstask/goose v0.0.0-20150115234039-8488cc47d90c h1:bkb2NMGo3/Du52wvYj9Whth5KZfMV6d3O0Vbr3nz/UE= 2 | bitbucket.org/liamstask/goose v0.0.0-20150115234039-8488cc47d90c/go.mod h1:hSVuE3qU7grINVSwrmzHfpg9k87ALBk+XaualNyUzI4= 3 | github.com/99designs/gqlgen v0.11.3 h1:oFSxl1DFS9X///uHV3y6CEfpcXWrDUxVblR4Xib2bs4= 4 | github.com/99designs/gqlgen v0.11.3/go.mod h1:RgX5GRRdDWNkh4pBrdzNpNPFVsdoUFY2+adM6nb1N+4= 5 | github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= 6 | github.com/agnivade/levenshtein v1.0.1/go.mod h1:CURSv5d9Uaml+FovSIICkLbAUZ9S4RqaHDIsdSBg7lM= 7 | github.com/agnivade/levenshtein v1.0.3 h1:M5ZnqLOoZR8ygVq0FfkXsNOKzMCk0xRiow0R5+5VkQ0= 8 | github.com/agnivade/levenshtein v1.0.3/go.mod h1:4SFRZbbXWLF4MU1T9Qg0pGgH3Pjs+t6ie5efyrwRJXs= 9 | github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= 10 | github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0/go.mod h1:t2tdKJDJF9BV14lnkjHmOQgcvEKgtqs5a1N3LNdJhGE= 11 | github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY= 12 | github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= 13 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 14 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 15 | github.com/denisenkom/go-mssqldb v0.0.0-20191124224453-732737034ffd/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU= 16 | github.com/dgrijalva/jwt-go v1.0.2 h1:KPldsxuKGsS2FPWsNeg9ZO18aCrGKujPoWXn2yo+KQM= 17 | github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= 18 | github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= 19 | github.com/dgryski/trifles v0.0.0-20190318185328-a8d75aae118c/go.mod h1:if7Fbed8SFyPtHLHbg49SI7NAdJiC5WIA09pe59rfAA= 20 | github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5/go.mod h1:a2zkGnVExMxdzMo3M0Hi/3sEU+cWnZpSni0O6/Yb/P0= 21 | github.com/go-chi/chi v3.3.2+incompatible/go.mod h1:eB3wogJHnLi3x/kFX2A+IbTBlXxmMeXJVKy9tTv1XzQ= 22 | github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= 23 | github.com/gogo/protobuf v1.0.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= 24 | github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= 25 | github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 26 | github.com/gorilla/context v0.0.0-20160226214623-1ea25387ff6f/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= 27 | github.com/gorilla/mux v1.6.1/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= 28 | github.com/gorilla/websocket v1.2.0 h1:VJtLvh6VQym50czpZzx07z/kw9EgAxI3x1ZB8taTMQQ= 29 | github.com/gorilla/websocket v1.2.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= 30 | github.com/hashicorp/golang-lru v0.5.0 h1:CL2msUPvZTLb5O648aiLNJw3hnBxN2+1Jq8rCOH9wdo= 31 | github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= 32 | github.com/jinzhu/gorm v1.9.12 h1:Drgk1clyWT9t9ERbzHza6Mj/8FY/CqMyVzOiHviMo6Q= 33 | github.com/jinzhu/gorm v1.9.12/go.mod h1:vhTjlKSJUTWNtcbQtrMBFCxy7eXTzeCAzfL5fBZT/Qs= 34 | github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= 35 | github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= 36 | github.com/jinzhu/now v1.0.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= 37 | github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= 38 | github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= 39 | github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= 40 | github.com/labstack/echo v1.4.4 h1:1bEiBNeGSUKxcPDGfZ/7IgdhJJZx8wV/pICJh4W2NJI= 41 | github.com/labstack/echo v3.3.10+incompatible h1:pGRcYk231ExFAyoAjAfD85kQzRJCRI8bbnE7CX5OEgg= 42 | github.com/labstack/echo v3.3.10+incompatible/go.mod h1:0INS7j/VjnFxD4E2wkz67b8cVwCLbBmJyDaka6Cmk1s= 43 | github.com/labstack/gommon v0.3.0 h1:JEeO0bvc78PKdyHxloTKiF8BD5iGrH8T6MSeGvSgob0= 44 | github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k= 45 | github.com/lib/pq v1.1.1 h1:sJZmqHoEaY7f+NPP8pgLB/WxulyR3fewgCM2qaSlBb4= 46 | github.com/lib/pq v1.1.1/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= 47 | github.com/logrusorgru/aurora v0.0.0-20200102142835-e9ef32dff381/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= 48 | github.com/matryer/moq v0.0.0-20200106131100-75d0ddfc0007 h1:reVOUXwnhsYv/8UqjvhrMOu5CNT9UapHFLbQ2JcXsmg= 49 | github.com/matryer/moq v0.0.0-20200106131100-75d0ddfc0007/go.mod h1:9ELz6aaclSIGnZBoaSLZ3NAl1VTufbOrXBPvtcy6WiQ= 50 | github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= 51 | github.com/mattn/go-colorable v0.1.4 h1:snbPLB8fVfU9iwbbo30TPtbLRzwWu6aJS6Xh4eaaviA= 52 | github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= 53 | github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= 54 | github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= 55 | github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= 56 | github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= 57 | github.com/mattn/go-sqlite3 v2.0.1+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= 58 | github.com/mitchellh/mapstructure v0.0.0-20180203102830-a4e142e9c047 h1:zCoDWFD5nrJJVjbXiDZcVhOBSzKn3o9LgRLLMRNuru8= 59 | github.com/mitchellh/mapstructure v0.0.0-20180203102830-a4e142e9c047/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= 60 | github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74= 61 | github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= 62 | github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= 63 | github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 64 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 65 | github.com/rs/cors v1.6.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= 66 | github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q= 67 | github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= 68 | github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= 69 | github.com/shurcooL/httpfs v0.0.0-20171119174359-809beceb2371/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg= 70 | github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= 71 | github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= 72 | github.com/shurcooL/vfsgen v0.0.0-20180121065927-ffb13db8def0/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw= 73 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 74 | github.com/stretchr/testify v1.2.1/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= 75 | github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= 76 | github.com/urfave/cli/v2 v2.1.1 h1:Qt8FeAtxE/vfdrLmR3rxR6JRE0RoVmbXu8+6kZtYU4k= 77 | github.com/urfave/cli/v2 v2.1.1/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ= 78 | github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= 79 | github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= 80 | github.com/valyala/fasttemplate v1.0.1 h1:tY9CJiPnMXf1ERmG2EyK7gNUd+c6RKGD0IfU8WdUSz8= 81 | github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= 82 | github.com/vektah/dataloaden v0.2.1-0.20190515034641-a19b9a6e7c9e h1:+w0Zm/9gaWpEAyDlU1eKOuk5twTjAjuevXqcJJw8hrg= 83 | github.com/vektah/dataloaden v0.2.1-0.20190515034641-a19b9a6e7c9e/go.mod h1:/HUdMve7rvxZma+2ZELQeNh88+003LL7Pf/CZ089j8U= 84 | github.com/vektah/gqlparser/v2 v2.0.1 h1:xgl5abVnsd4hkN9rk65OJID9bfcLSMuTaTcZj777q1o= 85 | github.com/vektah/gqlparser/v2 v2.0.1/go.mod h1:SyUiHgLATUR8BiYURfTirrTcGpcE+4XkV2se04Px1Ms= 86 | golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= 87 | golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= 88 | golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 h1:ObdrDkeb4kJdCP557AjRjq69pTHfNouLtWZG7j9rPN8= 89 | golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= 90 | golang.org/x/crypto v0.0.0-20191205180655-e7c4368fe9dd h1:GGJVjV8waZKRHrgwvtH66z9ZGVurTD1MT0n1Bb+q4aM= 91 | golang.org/x/crypto v0.0.0-20191205180655-e7c4368fe9dd/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= 92 | golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= 93 | golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 94 | golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 95 | golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 96 | golang.org/x/net v0.0.0-20190620200207-3b0461eec859 h1:R/3boaszxrf1GEUWTVDzSKVwLmSJpwZ1yqXm8j0v2QI= 97 | golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 98 | golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 99 | golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 100 | golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 101 | golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 102 | golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 103 | golang.org/x/sys v0.0.0-20200116001909-b77594299b42 h1:vEOn+mP2zCOVzKckCZy6YsCtDblrpj/w7B9nxGNELpg= 104 | golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 105 | golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= 106 | golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= 107 | golang.org/x/tools v0.0.0-20190125232054-d66bd3c5d5a6/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 108 | golang.org/x/tools v0.0.0-20190515012406-7d7faa4812bd/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= 109 | golang.org/x/tools v0.0.0-20200114235610-7ae403b6b589 h1:rjUrONFu4kLchcZTfp3/96bR8bW8dIa8uz3cR5n0cgM= 110 | golang.org/x/tools v0.0.0-20200114235610-7ae403b6b589/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= 111 | golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 112 | google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= 113 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 114 | gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 115 | gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 116 | gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= 117 | gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 118 | sourcegraph.com/sourcegraph/appdash v0.0.0-20180110180208-2cc67fd64755/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= 119 | sourcegraph.com/sourcegraph/appdash-data v0.0.0-20151005221446-73f23eafcf67/go.mod h1:L5q+DGLGOQFpo1snNEkLOJT2d1YTW66rWNzatr3He1k= 120 | -------------------------------------------------------------------------------- /graph/generated/generated.go: -------------------------------------------------------------------------------- 1 | // Code generated by github.com/99designs/gqlgen, DO NOT EDIT. 2 | 3 | package generated 4 | 5 | import ( 6 | "bytes" 7 | "context" 8 | "errors" 9 | "strconv" 10 | "sync" 11 | "sync/atomic" 12 | 13 | "github.com/99designs/gqlgen/graphql" 14 | "github.com/99designs/gqlgen/graphql/introspection" 15 | gqlparser "github.com/vektah/gqlparser/v2" 16 | "github.com/vektah/gqlparser/v2/ast" 17 | "github.com/yuuu/gqlgen-echo-sample/graph/model" 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 | } 41 | 42 | type DirectiveRoot struct { 43 | } 44 | 45 | type ComplexityRoot struct { 46 | Mutation struct { 47 | CreateTask func(childComplexity int, input model.NewTask) int 48 | } 49 | 50 | Query struct { 51 | Tasks func(childComplexity int) int 52 | } 53 | 54 | Task struct { 55 | Completed func(childComplexity int) int 56 | CreatedAt func(childComplexity int) int 57 | ID func(childComplexity int) int 58 | Note func(childComplexity int) int 59 | Title func(childComplexity int) int 60 | UpdatedAt func(childComplexity int) int 61 | } 62 | } 63 | 64 | type MutationResolver interface { 65 | CreateTask(ctx context.Context, input model.NewTask) (*model.Task, error) 66 | } 67 | type QueryResolver interface { 68 | Tasks(ctx context.Context) ([]*model.Task, error) 69 | } 70 | 71 | type executableSchema struct { 72 | resolvers ResolverRoot 73 | directives DirectiveRoot 74 | complexity ComplexityRoot 75 | } 76 | 77 | func (e *executableSchema) Schema() *ast.Schema { 78 | return parsedSchema 79 | } 80 | 81 | func (e *executableSchema) Complexity(typeName, field string, childComplexity int, rawArgs map[string]interface{}) (int, bool) { 82 | ec := executionContext{nil, e} 83 | _ = ec 84 | switch typeName + "." + field { 85 | 86 | case "Mutation.createTask": 87 | if e.complexity.Mutation.CreateTask == nil { 88 | break 89 | } 90 | 91 | args, err := ec.field_Mutation_createTask_args(context.TODO(), rawArgs) 92 | if err != nil { 93 | return 0, false 94 | } 95 | 96 | return e.complexity.Mutation.CreateTask(childComplexity, args["input"].(model.NewTask)), true 97 | 98 | case "Query.tasks": 99 | if e.complexity.Query.Tasks == nil { 100 | break 101 | } 102 | 103 | return e.complexity.Query.Tasks(childComplexity), true 104 | 105 | case "Task.completed": 106 | if e.complexity.Task.Completed == nil { 107 | break 108 | } 109 | 110 | return e.complexity.Task.Completed(childComplexity), true 111 | 112 | case "Task.created_at": 113 | if e.complexity.Task.CreatedAt == nil { 114 | break 115 | } 116 | 117 | return e.complexity.Task.CreatedAt(childComplexity), true 118 | 119 | case "Task.id": 120 | if e.complexity.Task.ID == nil { 121 | break 122 | } 123 | 124 | return e.complexity.Task.ID(childComplexity), true 125 | 126 | case "Task.note": 127 | if e.complexity.Task.Note == nil { 128 | break 129 | } 130 | 131 | return e.complexity.Task.Note(childComplexity), true 132 | 133 | case "Task.title": 134 | if e.complexity.Task.Title == nil { 135 | break 136 | } 137 | 138 | return e.complexity.Task.Title(childComplexity), true 139 | 140 | case "Task.updated_at": 141 | if e.complexity.Task.UpdatedAt == nil { 142 | break 143 | } 144 | 145 | return e.complexity.Task.UpdatedAt(childComplexity), true 146 | 147 | } 148 | return 0, false 149 | } 150 | 151 | func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { 152 | rc := graphql.GetOperationContext(ctx) 153 | ec := executionContext{rc, e} 154 | first := true 155 | 156 | switch rc.Operation.Operation { 157 | case ast.Query: 158 | return func(ctx context.Context) *graphql.Response { 159 | if !first { 160 | return nil 161 | } 162 | first = false 163 | data := ec._Query(ctx, rc.Operation.SelectionSet) 164 | var buf bytes.Buffer 165 | data.MarshalGQL(&buf) 166 | 167 | return &graphql.Response{ 168 | Data: buf.Bytes(), 169 | } 170 | } 171 | case ast.Mutation: 172 | return func(ctx context.Context) *graphql.Response { 173 | if !first { 174 | return nil 175 | } 176 | first = false 177 | data := ec._Mutation(ctx, rc.Operation.SelectionSet) 178 | var buf bytes.Buffer 179 | data.MarshalGQL(&buf) 180 | 181 | return &graphql.Response{ 182 | Data: buf.Bytes(), 183 | } 184 | } 185 | 186 | default: 187 | return graphql.OneShot(graphql.ErrorResponse(ctx, "unsupported GraphQL operation")) 188 | } 189 | } 190 | 191 | type executionContext struct { 192 | *graphql.OperationContext 193 | *executableSchema 194 | } 195 | 196 | func (ec *executionContext) introspectSchema() (*introspection.Schema, error) { 197 | if ec.DisableIntrospection { 198 | return nil, errors.New("introspection disabled") 199 | } 200 | return introspection.WrapSchema(parsedSchema), nil 201 | } 202 | 203 | func (ec *executionContext) introspectType(name string) (*introspection.Type, error) { 204 | if ec.DisableIntrospection { 205 | return nil, errors.New("introspection disabled") 206 | } 207 | return introspection.WrapTypeFromDef(parsedSchema, parsedSchema.Types[name]), nil 208 | } 209 | 210 | var sources = []*ast.Source{ 211 | &ast.Source{Name: "graph/schema.graphqls", Input: `type Task { 212 | id: ID! 213 | title: String! 214 | note: String! 215 | completed: Int! 216 | created_at: String! 217 | updated_at: String! 218 | } 219 | 220 | input NewTask { 221 | title: String! 222 | note: String! 223 | } 224 | 225 | type Mutation { 226 | createTask(input: NewTask!): Task! 227 | } 228 | 229 | type Query { 230 | tasks: [Task!]! 231 | }`, BuiltIn: false}, 232 | } 233 | var parsedSchema = gqlparser.MustLoadSchema(sources...) 234 | 235 | // endregion ************************** generated!.gotpl ************************** 236 | 237 | // region ***************************** args.gotpl ***************************** 238 | 239 | func (ec *executionContext) field_Mutation_createTask_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { 240 | var err error 241 | args := map[string]interface{}{} 242 | var arg0 model.NewTask 243 | if tmp, ok := rawArgs["input"]; ok { 244 | arg0, err = ec.unmarshalNNewTask2githubᚗcomᚋyuuuᚋgqlgenᚑechoᚑsampleᚋgraphᚋmodelᚐNewTask(ctx, tmp) 245 | if err != nil { 246 | return nil, err 247 | } 248 | } 249 | args["input"] = arg0 250 | return args, nil 251 | } 252 | 253 | func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { 254 | var err error 255 | args := map[string]interface{}{} 256 | var arg0 string 257 | if tmp, ok := rawArgs["name"]; ok { 258 | arg0, err = ec.unmarshalNString2string(ctx, tmp) 259 | if err != nil { 260 | return nil, err 261 | } 262 | } 263 | args["name"] = arg0 264 | return args, nil 265 | } 266 | 267 | func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { 268 | var err error 269 | args := map[string]interface{}{} 270 | var arg0 bool 271 | if tmp, ok := rawArgs["includeDeprecated"]; ok { 272 | arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) 273 | if err != nil { 274 | return nil, err 275 | } 276 | } 277 | args["includeDeprecated"] = arg0 278 | return args, nil 279 | } 280 | 281 | func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { 282 | var err error 283 | args := map[string]interface{}{} 284 | var arg0 bool 285 | if tmp, ok := rawArgs["includeDeprecated"]; ok { 286 | arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) 287 | if err != nil { 288 | return nil, err 289 | } 290 | } 291 | args["includeDeprecated"] = arg0 292 | return args, nil 293 | } 294 | 295 | // endregion ***************************** args.gotpl ***************************** 296 | 297 | // region ************************** directives.gotpl ************************** 298 | 299 | // endregion ************************** directives.gotpl ************************** 300 | 301 | // region **************************** field.gotpl ***************************** 302 | 303 | func (ec *executionContext) _Mutation_createTask(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { 304 | defer func() { 305 | if r := recover(); r != nil { 306 | ec.Error(ctx, ec.Recover(ctx, r)) 307 | ret = graphql.Null 308 | } 309 | }() 310 | fc := &graphql.FieldContext{ 311 | Object: "Mutation", 312 | Field: field, 313 | Args: nil, 314 | IsMethod: true, 315 | } 316 | 317 | ctx = graphql.WithFieldContext(ctx, fc) 318 | rawArgs := field.ArgumentMap(ec.Variables) 319 | args, err := ec.field_Mutation_createTask_args(ctx, rawArgs) 320 | if err != nil { 321 | ec.Error(ctx, err) 322 | return graphql.Null 323 | } 324 | fc.Args = args 325 | resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 326 | ctx = rctx // use context from middleware stack in children 327 | return ec.resolvers.Mutation().CreateTask(rctx, args["input"].(model.NewTask)) 328 | }) 329 | if err != nil { 330 | ec.Error(ctx, err) 331 | return graphql.Null 332 | } 333 | if resTmp == nil { 334 | if !graphql.HasFieldError(ctx, fc) { 335 | ec.Errorf(ctx, "must not be null") 336 | } 337 | return graphql.Null 338 | } 339 | res := resTmp.(*model.Task) 340 | fc.Result = res 341 | return ec.marshalNTask2ᚖgithubᚗcomᚋyuuuᚋgqlgenᚑechoᚑsampleᚋgraphᚋmodelᚐTask(ctx, field.Selections, res) 342 | } 343 | 344 | func (ec *executionContext) _Query_tasks(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { 345 | defer func() { 346 | if r := recover(); r != nil { 347 | ec.Error(ctx, ec.Recover(ctx, r)) 348 | ret = graphql.Null 349 | } 350 | }() 351 | fc := &graphql.FieldContext{ 352 | Object: "Query", 353 | Field: field, 354 | Args: nil, 355 | IsMethod: true, 356 | } 357 | 358 | ctx = graphql.WithFieldContext(ctx, fc) 359 | resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 360 | ctx = rctx // use context from middleware stack in children 361 | return ec.resolvers.Query().Tasks(rctx) 362 | }) 363 | if err != nil { 364 | ec.Error(ctx, err) 365 | return graphql.Null 366 | } 367 | if resTmp == nil { 368 | if !graphql.HasFieldError(ctx, fc) { 369 | ec.Errorf(ctx, "must not be null") 370 | } 371 | return graphql.Null 372 | } 373 | res := resTmp.([]*model.Task) 374 | fc.Result = res 375 | return ec.marshalNTask2ᚕᚖgithubᚗcomᚋyuuuᚋgqlgenᚑechoᚑsampleᚋgraphᚋmodelᚐTaskᚄ(ctx, field.Selections, res) 376 | } 377 | 378 | func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { 379 | defer func() { 380 | if r := recover(); r != nil { 381 | ec.Error(ctx, ec.Recover(ctx, r)) 382 | ret = graphql.Null 383 | } 384 | }() 385 | fc := &graphql.FieldContext{ 386 | Object: "Query", 387 | Field: field, 388 | Args: nil, 389 | IsMethod: true, 390 | } 391 | 392 | ctx = graphql.WithFieldContext(ctx, fc) 393 | rawArgs := field.ArgumentMap(ec.Variables) 394 | args, err := ec.field_Query___type_args(ctx, rawArgs) 395 | if err != nil { 396 | ec.Error(ctx, err) 397 | return graphql.Null 398 | } 399 | fc.Args = args 400 | resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 401 | ctx = rctx // use context from middleware stack in children 402 | return ec.introspectType(args["name"].(string)) 403 | }) 404 | if err != nil { 405 | ec.Error(ctx, err) 406 | return graphql.Null 407 | } 408 | if resTmp == nil { 409 | return graphql.Null 410 | } 411 | res := resTmp.(*introspection.Type) 412 | fc.Result = res 413 | return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) 414 | } 415 | 416 | func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { 417 | defer func() { 418 | if r := recover(); r != nil { 419 | ec.Error(ctx, ec.Recover(ctx, r)) 420 | ret = graphql.Null 421 | } 422 | }() 423 | fc := &graphql.FieldContext{ 424 | Object: "Query", 425 | Field: field, 426 | Args: nil, 427 | IsMethod: true, 428 | } 429 | 430 | ctx = graphql.WithFieldContext(ctx, fc) 431 | resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 432 | ctx = rctx // use context from middleware stack in children 433 | return ec.introspectSchema() 434 | }) 435 | if err != nil { 436 | ec.Error(ctx, err) 437 | return graphql.Null 438 | } 439 | if resTmp == nil { 440 | return graphql.Null 441 | } 442 | res := resTmp.(*introspection.Schema) 443 | fc.Result = res 444 | return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res) 445 | } 446 | 447 | func (ec *executionContext) _Task_id(ctx context.Context, field graphql.CollectedField, obj *model.Task) (ret graphql.Marshaler) { 448 | defer func() { 449 | if r := recover(); r != nil { 450 | ec.Error(ctx, ec.Recover(ctx, r)) 451 | ret = graphql.Null 452 | } 453 | }() 454 | fc := &graphql.FieldContext{ 455 | Object: "Task", 456 | Field: field, 457 | Args: nil, 458 | IsMethod: false, 459 | } 460 | 461 | ctx = graphql.WithFieldContext(ctx, fc) 462 | resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 463 | ctx = rctx // use context from middleware stack in children 464 | return obj.ID, nil 465 | }) 466 | if err != nil { 467 | ec.Error(ctx, err) 468 | return graphql.Null 469 | } 470 | if resTmp == nil { 471 | if !graphql.HasFieldError(ctx, fc) { 472 | ec.Errorf(ctx, "must not be null") 473 | } 474 | return graphql.Null 475 | } 476 | res := resTmp.(string) 477 | fc.Result = res 478 | return ec.marshalNID2string(ctx, field.Selections, res) 479 | } 480 | 481 | func (ec *executionContext) _Task_title(ctx context.Context, field graphql.CollectedField, obj *model.Task) (ret graphql.Marshaler) { 482 | defer func() { 483 | if r := recover(); r != nil { 484 | ec.Error(ctx, ec.Recover(ctx, r)) 485 | ret = graphql.Null 486 | } 487 | }() 488 | fc := &graphql.FieldContext{ 489 | Object: "Task", 490 | Field: field, 491 | Args: nil, 492 | IsMethod: false, 493 | } 494 | 495 | ctx = graphql.WithFieldContext(ctx, fc) 496 | resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 497 | ctx = rctx // use context from middleware stack in children 498 | return obj.Title, nil 499 | }) 500 | if err != nil { 501 | ec.Error(ctx, err) 502 | return graphql.Null 503 | } 504 | if resTmp == nil { 505 | if !graphql.HasFieldError(ctx, fc) { 506 | ec.Errorf(ctx, "must not be null") 507 | } 508 | return graphql.Null 509 | } 510 | res := resTmp.(string) 511 | fc.Result = res 512 | return ec.marshalNString2string(ctx, field.Selections, res) 513 | } 514 | 515 | func (ec *executionContext) _Task_note(ctx context.Context, field graphql.CollectedField, obj *model.Task) (ret graphql.Marshaler) { 516 | defer func() { 517 | if r := recover(); r != nil { 518 | ec.Error(ctx, ec.Recover(ctx, r)) 519 | ret = graphql.Null 520 | } 521 | }() 522 | fc := &graphql.FieldContext{ 523 | Object: "Task", 524 | Field: field, 525 | Args: nil, 526 | IsMethod: false, 527 | } 528 | 529 | ctx = graphql.WithFieldContext(ctx, fc) 530 | resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 531 | ctx = rctx // use context from middleware stack in children 532 | return obj.Note, nil 533 | }) 534 | if err != nil { 535 | ec.Error(ctx, err) 536 | return graphql.Null 537 | } 538 | if resTmp == nil { 539 | if !graphql.HasFieldError(ctx, fc) { 540 | ec.Errorf(ctx, "must not be null") 541 | } 542 | return graphql.Null 543 | } 544 | res := resTmp.(string) 545 | fc.Result = res 546 | return ec.marshalNString2string(ctx, field.Selections, res) 547 | } 548 | 549 | func (ec *executionContext) _Task_completed(ctx context.Context, field graphql.CollectedField, obj *model.Task) (ret graphql.Marshaler) { 550 | defer func() { 551 | if r := recover(); r != nil { 552 | ec.Error(ctx, ec.Recover(ctx, r)) 553 | ret = graphql.Null 554 | } 555 | }() 556 | fc := &graphql.FieldContext{ 557 | Object: "Task", 558 | Field: field, 559 | Args: nil, 560 | IsMethod: false, 561 | } 562 | 563 | ctx = graphql.WithFieldContext(ctx, fc) 564 | resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 565 | ctx = rctx // use context from middleware stack in children 566 | return obj.Completed, nil 567 | }) 568 | if err != nil { 569 | ec.Error(ctx, err) 570 | return graphql.Null 571 | } 572 | if resTmp == nil { 573 | if !graphql.HasFieldError(ctx, fc) { 574 | ec.Errorf(ctx, "must not be null") 575 | } 576 | return graphql.Null 577 | } 578 | res := resTmp.(int) 579 | fc.Result = res 580 | return ec.marshalNInt2int(ctx, field.Selections, res) 581 | } 582 | 583 | func (ec *executionContext) _Task_created_at(ctx context.Context, field graphql.CollectedField, obj *model.Task) (ret graphql.Marshaler) { 584 | defer func() { 585 | if r := recover(); r != nil { 586 | ec.Error(ctx, ec.Recover(ctx, r)) 587 | ret = graphql.Null 588 | } 589 | }() 590 | fc := &graphql.FieldContext{ 591 | Object: "Task", 592 | Field: field, 593 | Args: nil, 594 | IsMethod: false, 595 | } 596 | 597 | ctx = graphql.WithFieldContext(ctx, fc) 598 | resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 599 | ctx = rctx // use context from middleware stack in children 600 | return obj.CreatedAt, nil 601 | }) 602 | if err != nil { 603 | ec.Error(ctx, err) 604 | return graphql.Null 605 | } 606 | if resTmp == nil { 607 | if !graphql.HasFieldError(ctx, fc) { 608 | ec.Errorf(ctx, "must not be null") 609 | } 610 | return graphql.Null 611 | } 612 | res := resTmp.(string) 613 | fc.Result = res 614 | return ec.marshalNString2string(ctx, field.Selections, res) 615 | } 616 | 617 | func (ec *executionContext) _Task_updated_at(ctx context.Context, field graphql.CollectedField, obj *model.Task) (ret graphql.Marshaler) { 618 | defer func() { 619 | if r := recover(); r != nil { 620 | ec.Error(ctx, ec.Recover(ctx, r)) 621 | ret = graphql.Null 622 | } 623 | }() 624 | fc := &graphql.FieldContext{ 625 | Object: "Task", 626 | Field: field, 627 | Args: nil, 628 | IsMethod: false, 629 | } 630 | 631 | ctx = graphql.WithFieldContext(ctx, fc) 632 | resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 633 | ctx = rctx // use context from middleware stack in children 634 | return obj.UpdatedAt, nil 635 | }) 636 | if err != nil { 637 | ec.Error(ctx, err) 638 | return graphql.Null 639 | } 640 | if resTmp == nil { 641 | if !graphql.HasFieldError(ctx, fc) { 642 | ec.Errorf(ctx, "must not be null") 643 | } 644 | return graphql.Null 645 | } 646 | res := resTmp.(string) 647 | fc.Result = res 648 | return ec.marshalNString2string(ctx, field.Selections, res) 649 | } 650 | 651 | func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { 652 | defer func() { 653 | if r := recover(); r != nil { 654 | ec.Error(ctx, ec.Recover(ctx, r)) 655 | ret = graphql.Null 656 | } 657 | }() 658 | fc := &graphql.FieldContext{ 659 | Object: "__Directive", 660 | Field: field, 661 | Args: nil, 662 | IsMethod: false, 663 | } 664 | 665 | ctx = graphql.WithFieldContext(ctx, fc) 666 | resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 667 | ctx = rctx // use context from middleware stack in children 668 | return obj.Name, nil 669 | }) 670 | if err != nil { 671 | ec.Error(ctx, err) 672 | return graphql.Null 673 | } 674 | if resTmp == nil { 675 | if !graphql.HasFieldError(ctx, fc) { 676 | ec.Errorf(ctx, "must not be null") 677 | } 678 | return graphql.Null 679 | } 680 | res := resTmp.(string) 681 | fc.Result = res 682 | return ec.marshalNString2string(ctx, field.Selections, res) 683 | } 684 | 685 | func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { 686 | defer func() { 687 | if r := recover(); r != nil { 688 | ec.Error(ctx, ec.Recover(ctx, r)) 689 | ret = graphql.Null 690 | } 691 | }() 692 | fc := &graphql.FieldContext{ 693 | Object: "__Directive", 694 | Field: field, 695 | Args: nil, 696 | IsMethod: false, 697 | } 698 | 699 | ctx = graphql.WithFieldContext(ctx, fc) 700 | resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 701 | ctx = rctx // use context from middleware stack in children 702 | return obj.Description, nil 703 | }) 704 | if err != nil { 705 | ec.Error(ctx, err) 706 | return graphql.Null 707 | } 708 | if resTmp == nil { 709 | return graphql.Null 710 | } 711 | res := resTmp.(string) 712 | fc.Result = res 713 | return ec.marshalOString2string(ctx, field.Selections, res) 714 | } 715 | 716 | func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { 717 | defer func() { 718 | if r := recover(); r != nil { 719 | ec.Error(ctx, ec.Recover(ctx, r)) 720 | ret = graphql.Null 721 | } 722 | }() 723 | fc := &graphql.FieldContext{ 724 | Object: "__Directive", 725 | Field: field, 726 | Args: nil, 727 | IsMethod: false, 728 | } 729 | 730 | ctx = graphql.WithFieldContext(ctx, fc) 731 | resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 732 | ctx = rctx // use context from middleware stack in children 733 | return obj.Locations, nil 734 | }) 735 | if err != nil { 736 | ec.Error(ctx, err) 737 | return graphql.Null 738 | } 739 | if resTmp == nil { 740 | if !graphql.HasFieldError(ctx, fc) { 741 | ec.Errorf(ctx, "must not be null") 742 | } 743 | return graphql.Null 744 | } 745 | res := resTmp.([]string) 746 | fc.Result = res 747 | return ec.marshalN__DirectiveLocation2ᚕstringᚄ(ctx, field.Selections, res) 748 | } 749 | 750 | func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { 751 | defer func() { 752 | if r := recover(); r != nil { 753 | ec.Error(ctx, ec.Recover(ctx, r)) 754 | ret = graphql.Null 755 | } 756 | }() 757 | fc := &graphql.FieldContext{ 758 | Object: "__Directive", 759 | Field: field, 760 | Args: nil, 761 | IsMethod: false, 762 | } 763 | 764 | ctx = graphql.WithFieldContext(ctx, fc) 765 | resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 766 | ctx = rctx // use context from middleware stack in children 767 | return obj.Args, nil 768 | }) 769 | if err != nil { 770 | ec.Error(ctx, err) 771 | return graphql.Null 772 | } 773 | if resTmp == nil { 774 | if !graphql.HasFieldError(ctx, fc) { 775 | ec.Errorf(ctx, "must not be null") 776 | } 777 | return graphql.Null 778 | } 779 | res := resTmp.([]introspection.InputValue) 780 | fc.Result = res 781 | return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) 782 | } 783 | 784 | func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { 785 | defer func() { 786 | if r := recover(); r != nil { 787 | ec.Error(ctx, ec.Recover(ctx, r)) 788 | ret = graphql.Null 789 | } 790 | }() 791 | fc := &graphql.FieldContext{ 792 | Object: "__EnumValue", 793 | Field: field, 794 | Args: nil, 795 | IsMethod: false, 796 | } 797 | 798 | ctx = graphql.WithFieldContext(ctx, fc) 799 | resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 800 | ctx = rctx // use context from middleware stack in children 801 | return obj.Name, nil 802 | }) 803 | if err != nil { 804 | ec.Error(ctx, err) 805 | return graphql.Null 806 | } 807 | if resTmp == nil { 808 | if !graphql.HasFieldError(ctx, fc) { 809 | ec.Errorf(ctx, "must not be null") 810 | } 811 | return graphql.Null 812 | } 813 | res := resTmp.(string) 814 | fc.Result = res 815 | return ec.marshalNString2string(ctx, field.Selections, res) 816 | } 817 | 818 | func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { 819 | defer func() { 820 | if r := recover(); r != nil { 821 | ec.Error(ctx, ec.Recover(ctx, r)) 822 | ret = graphql.Null 823 | } 824 | }() 825 | fc := &graphql.FieldContext{ 826 | Object: "__EnumValue", 827 | Field: field, 828 | Args: nil, 829 | IsMethod: false, 830 | } 831 | 832 | ctx = graphql.WithFieldContext(ctx, fc) 833 | resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 834 | ctx = rctx // use context from middleware stack in children 835 | return obj.Description, nil 836 | }) 837 | if err != nil { 838 | ec.Error(ctx, err) 839 | return graphql.Null 840 | } 841 | if resTmp == nil { 842 | return graphql.Null 843 | } 844 | res := resTmp.(string) 845 | fc.Result = res 846 | return ec.marshalOString2string(ctx, field.Selections, res) 847 | } 848 | 849 | func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { 850 | defer func() { 851 | if r := recover(); r != nil { 852 | ec.Error(ctx, ec.Recover(ctx, r)) 853 | ret = graphql.Null 854 | } 855 | }() 856 | fc := &graphql.FieldContext{ 857 | Object: "__EnumValue", 858 | Field: field, 859 | Args: nil, 860 | IsMethod: true, 861 | } 862 | 863 | ctx = graphql.WithFieldContext(ctx, fc) 864 | resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 865 | ctx = rctx // use context from middleware stack in children 866 | return obj.IsDeprecated(), nil 867 | }) 868 | if err != nil { 869 | ec.Error(ctx, err) 870 | return graphql.Null 871 | } 872 | if resTmp == nil { 873 | if !graphql.HasFieldError(ctx, fc) { 874 | ec.Errorf(ctx, "must not be null") 875 | } 876 | return graphql.Null 877 | } 878 | res := resTmp.(bool) 879 | fc.Result = res 880 | return ec.marshalNBoolean2bool(ctx, field.Selections, res) 881 | } 882 | 883 | func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { 884 | defer func() { 885 | if r := recover(); r != nil { 886 | ec.Error(ctx, ec.Recover(ctx, r)) 887 | ret = graphql.Null 888 | } 889 | }() 890 | fc := &graphql.FieldContext{ 891 | Object: "__EnumValue", 892 | Field: field, 893 | Args: nil, 894 | IsMethod: true, 895 | } 896 | 897 | ctx = graphql.WithFieldContext(ctx, fc) 898 | resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 899 | ctx = rctx // use context from middleware stack in children 900 | return obj.DeprecationReason(), nil 901 | }) 902 | if err != nil { 903 | ec.Error(ctx, err) 904 | return graphql.Null 905 | } 906 | if resTmp == nil { 907 | return graphql.Null 908 | } 909 | res := resTmp.(*string) 910 | fc.Result = res 911 | return ec.marshalOString2ᚖstring(ctx, field.Selections, res) 912 | } 913 | 914 | func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { 915 | defer func() { 916 | if r := recover(); r != nil { 917 | ec.Error(ctx, ec.Recover(ctx, r)) 918 | ret = graphql.Null 919 | } 920 | }() 921 | fc := &graphql.FieldContext{ 922 | Object: "__Field", 923 | Field: field, 924 | Args: nil, 925 | IsMethod: false, 926 | } 927 | 928 | ctx = graphql.WithFieldContext(ctx, fc) 929 | resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 930 | ctx = rctx // use context from middleware stack in children 931 | return obj.Name, nil 932 | }) 933 | if err != nil { 934 | ec.Error(ctx, err) 935 | return graphql.Null 936 | } 937 | if resTmp == nil { 938 | if !graphql.HasFieldError(ctx, fc) { 939 | ec.Errorf(ctx, "must not be null") 940 | } 941 | return graphql.Null 942 | } 943 | res := resTmp.(string) 944 | fc.Result = res 945 | return ec.marshalNString2string(ctx, field.Selections, res) 946 | } 947 | 948 | func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { 949 | defer func() { 950 | if r := recover(); r != nil { 951 | ec.Error(ctx, ec.Recover(ctx, r)) 952 | ret = graphql.Null 953 | } 954 | }() 955 | fc := &graphql.FieldContext{ 956 | Object: "__Field", 957 | Field: field, 958 | Args: nil, 959 | IsMethod: false, 960 | } 961 | 962 | ctx = graphql.WithFieldContext(ctx, fc) 963 | resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 964 | ctx = rctx // use context from middleware stack in children 965 | return obj.Description, nil 966 | }) 967 | if err != nil { 968 | ec.Error(ctx, err) 969 | return graphql.Null 970 | } 971 | if resTmp == nil { 972 | return graphql.Null 973 | } 974 | res := resTmp.(string) 975 | fc.Result = res 976 | return ec.marshalOString2string(ctx, field.Selections, res) 977 | } 978 | 979 | func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { 980 | defer func() { 981 | if r := recover(); r != nil { 982 | ec.Error(ctx, ec.Recover(ctx, r)) 983 | ret = graphql.Null 984 | } 985 | }() 986 | fc := &graphql.FieldContext{ 987 | Object: "__Field", 988 | Field: field, 989 | Args: nil, 990 | IsMethod: 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) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (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: "__Field", 1022 | Field: field, 1023 | Args: nil, 1024 | IsMethod: false, 1025 | } 1026 | 1027 | ctx = graphql.WithFieldContext(ctx, fc) 1028 | resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 1029 | ctx = rctx // use context from middleware stack in children 1030 | return obj.Type, nil 1031 | }) 1032 | if err != nil { 1033 | ec.Error(ctx, err) 1034 | return graphql.Null 1035 | } 1036 | if resTmp == nil { 1037 | if !graphql.HasFieldError(ctx, fc) { 1038 | ec.Errorf(ctx, "must not be null") 1039 | } 1040 | return graphql.Null 1041 | } 1042 | res := resTmp.(*introspection.Type) 1043 | fc.Result = res 1044 | return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) 1045 | } 1046 | 1047 | func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { 1048 | defer func() { 1049 | if r := recover(); r != nil { 1050 | ec.Error(ctx, ec.Recover(ctx, r)) 1051 | ret = graphql.Null 1052 | } 1053 | }() 1054 | fc := &graphql.FieldContext{ 1055 | Object: "__Field", 1056 | Field: field, 1057 | Args: nil, 1058 | IsMethod: true, 1059 | } 1060 | 1061 | ctx = graphql.WithFieldContext(ctx, fc) 1062 | resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 1063 | ctx = rctx // use context from middleware stack in children 1064 | return obj.IsDeprecated(), nil 1065 | }) 1066 | if err != nil { 1067 | ec.Error(ctx, err) 1068 | return graphql.Null 1069 | } 1070 | if resTmp == nil { 1071 | if !graphql.HasFieldError(ctx, fc) { 1072 | ec.Errorf(ctx, "must not be null") 1073 | } 1074 | return graphql.Null 1075 | } 1076 | res := resTmp.(bool) 1077 | fc.Result = res 1078 | return ec.marshalNBoolean2bool(ctx, field.Selections, res) 1079 | } 1080 | 1081 | func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { 1082 | defer func() { 1083 | if r := recover(); r != nil { 1084 | ec.Error(ctx, ec.Recover(ctx, r)) 1085 | ret = graphql.Null 1086 | } 1087 | }() 1088 | fc := &graphql.FieldContext{ 1089 | Object: "__Field", 1090 | Field: field, 1091 | Args: nil, 1092 | IsMethod: true, 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.DeprecationReason(), nil 1099 | }) 1100 | if err != nil { 1101 | ec.Error(ctx, err) 1102 | return graphql.Null 1103 | } 1104 | if resTmp == nil { 1105 | return graphql.Null 1106 | } 1107 | res := resTmp.(*string) 1108 | fc.Result = res 1109 | return ec.marshalOString2ᚖstring(ctx, field.Selections, res) 1110 | } 1111 | 1112 | func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { 1113 | defer func() { 1114 | if r := recover(); r != nil { 1115 | ec.Error(ctx, ec.Recover(ctx, r)) 1116 | ret = graphql.Null 1117 | } 1118 | }() 1119 | fc := &graphql.FieldContext{ 1120 | Object: "__InputValue", 1121 | Field: field, 1122 | Args: nil, 1123 | IsMethod: false, 1124 | } 1125 | 1126 | ctx = graphql.WithFieldContext(ctx, fc) 1127 | resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 1128 | ctx = rctx // use context from middleware stack in children 1129 | return obj.Name, nil 1130 | }) 1131 | if err != nil { 1132 | ec.Error(ctx, err) 1133 | return graphql.Null 1134 | } 1135 | if resTmp == nil { 1136 | if !graphql.HasFieldError(ctx, fc) { 1137 | ec.Errorf(ctx, "must not be null") 1138 | } 1139 | return graphql.Null 1140 | } 1141 | res := resTmp.(string) 1142 | fc.Result = res 1143 | return ec.marshalNString2string(ctx, field.Selections, res) 1144 | } 1145 | 1146 | func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { 1147 | defer func() { 1148 | if r := recover(); r != nil { 1149 | ec.Error(ctx, ec.Recover(ctx, r)) 1150 | ret = graphql.Null 1151 | } 1152 | }() 1153 | fc := &graphql.FieldContext{ 1154 | Object: "__InputValue", 1155 | Field: field, 1156 | Args: nil, 1157 | IsMethod: false, 1158 | } 1159 | 1160 | ctx = graphql.WithFieldContext(ctx, fc) 1161 | resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 1162 | ctx = rctx // use context from middleware stack in children 1163 | return obj.Description, nil 1164 | }) 1165 | if err != nil { 1166 | ec.Error(ctx, err) 1167 | return graphql.Null 1168 | } 1169 | if resTmp == nil { 1170 | return graphql.Null 1171 | } 1172 | res := resTmp.(string) 1173 | fc.Result = res 1174 | return ec.marshalOString2string(ctx, field.Selections, res) 1175 | } 1176 | 1177 | func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { 1178 | defer func() { 1179 | if r := recover(); r != nil { 1180 | ec.Error(ctx, ec.Recover(ctx, r)) 1181 | ret = graphql.Null 1182 | } 1183 | }() 1184 | fc := &graphql.FieldContext{ 1185 | Object: "__InputValue", 1186 | Field: field, 1187 | Args: nil, 1188 | IsMethod: false, 1189 | } 1190 | 1191 | ctx = graphql.WithFieldContext(ctx, fc) 1192 | resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 1193 | ctx = rctx // use context from middleware stack in children 1194 | return obj.Type, nil 1195 | }) 1196 | if err != nil { 1197 | ec.Error(ctx, err) 1198 | return graphql.Null 1199 | } 1200 | if resTmp == nil { 1201 | if !graphql.HasFieldError(ctx, fc) { 1202 | ec.Errorf(ctx, "must not be null") 1203 | } 1204 | return graphql.Null 1205 | } 1206 | res := resTmp.(*introspection.Type) 1207 | fc.Result = res 1208 | return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) 1209 | } 1210 | 1211 | func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { 1212 | defer func() { 1213 | if r := recover(); r != nil { 1214 | ec.Error(ctx, ec.Recover(ctx, r)) 1215 | ret = graphql.Null 1216 | } 1217 | }() 1218 | fc := &graphql.FieldContext{ 1219 | Object: "__InputValue", 1220 | Field: field, 1221 | Args: nil, 1222 | IsMethod: false, 1223 | } 1224 | 1225 | ctx = graphql.WithFieldContext(ctx, fc) 1226 | resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 1227 | ctx = rctx // use context from middleware stack in children 1228 | return obj.DefaultValue, nil 1229 | }) 1230 | if err != nil { 1231 | ec.Error(ctx, err) 1232 | return graphql.Null 1233 | } 1234 | if resTmp == nil { 1235 | return graphql.Null 1236 | } 1237 | res := resTmp.(*string) 1238 | fc.Result = res 1239 | return ec.marshalOString2ᚖstring(ctx, field.Selections, res) 1240 | } 1241 | 1242 | func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { 1243 | defer func() { 1244 | if r := recover(); r != nil { 1245 | ec.Error(ctx, ec.Recover(ctx, r)) 1246 | ret = graphql.Null 1247 | } 1248 | }() 1249 | fc := &graphql.FieldContext{ 1250 | Object: "__Schema", 1251 | Field: field, 1252 | Args: nil, 1253 | IsMethod: true, 1254 | } 1255 | 1256 | ctx = graphql.WithFieldContext(ctx, fc) 1257 | resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 1258 | ctx = rctx // use context from middleware stack in children 1259 | return obj.Types(), nil 1260 | }) 1261 | if err != nil { 1262 | ec.Error(ctx, err) 1263 | return graphql.Null 1264 | } 1265 | if resTmp == nil { 1266 | if !graphql.HasFieldError(ctx, fc) { 1267 | ec.Errorf(ctx, "must not be null") 1268 | } 1269 | return graphql.Null 1270 | } 1271 | res := resTmp.([]introspection.Type) 1272 | fc.Result = res 1273 | return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) 1274 | } 1275 | 1276 | func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { 1277 | defer func() { 1278 | if r := recover(); r != nil { 1279 | ec.Error(ctx, ec.Recover(ctx, r)) 1280 | ret = graphql.Null 1281 | } 1282 | }() 1283 | fc := &graphql.FieldContext{ 1284 | Object: "__Schema", 1285 | Field: field, 1286 | Args: nil, 1287 | IsMethod: true, 1288 | } 1289 | 1290 | ctx = graphql.WithFieldContext(ctx, fc) 1291 | resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 1292 | ctx = rctx // use context from middleware stack in children 1293 | return obj.QueryType(), nil 1294 | }) 1295 | if err != nil { 1296 | ec.Error(ctx, err) 1297 | return graphql.Null 1298 | } 1299 | if resTmp == nil { 1300 | if !graphql.HasFieldError(ctx, fc) { 1301 | ec.Errorf(ctx, "must not be null") 1302 | } 1303 | return graphql.Null 1304 | } 1305 | res := resTmp.(*introspection.Type) 1306 | fc.Result = res 1307 | return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) 1308 | } 1309 | 1310 | func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { 1311 | defer func() { 1312 | if r := recover(); r != nil { 1313 | ec.Error(ctx, ec.Recover(ctx, r)) 1314 | ret = graphql.Null 1315 | } 1316 | }() 1317 | fc := &graphql.FieldContext{ 1318 | Object: "__Schema", 1319 | Field: field, 1320 | Args: nil, 1321 | IsMethod: true, 1322 | } 1323 | 1324 | ctx = graphql.WithFieldContext(ctx, fc) 1325 | resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 1326 | ctx = rctx // use context from middleware stack in children 1327 | return obj.MutationType(), nil 1328 | }) 1329 | if err != nil { 1330 | ec.Error(ctx, err) 1331 | return graphql.Null 1332 | } 1333 | if resTmp == nil { 1334 | return graphql.Null 1335 | } 1336 | res := resTmp.(*introspection.Type) 1337 | fc.Result = res 1338 | return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) 1339 | } 1340 | 1341 | func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { 1342 | defer func() { 1343 | if r := recover(); r != nil { 1344 | ec.Error(ctx, ec.Recover(ctx, r)) 1345 | ret = graphql.Null 1346 | } 1347 | }() 1348 | fc := &graphql.FieldContext{ 1349 | Object: "__Schema", 1350 | Field: field, 1351 | Args: nil, 1352 | IsMethod: true, 1353 | } 1354 | 1355 | ctx = graphql.WithFieldContext(ctx, fc) 1356 | resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 1357 | ctx = rctx // use context from middleware stack in children 1358 | return obj.SubscriptionType(), nil 1359 | }) 1360 | if err != nil { 1361 | ec.Error(ctx, err) 1362 | return graphql.Null 1363 | } 1364 | if resTmp == nil { 1365 | return graphql.Null 1366 | } 1367 | res := resTmp.(*introspection.Type) 1368 | fc.Result = res 1369 | return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) 1370 | } 1371 | 1372 | func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { 1373 | defer func() { 1374 | if r := recover(); r != nil { 1375 | ec.Error(ctx, ec.Recover(ctx, r)) 1376 | ret = graphql.Null 1377 | } 1378 | }() 1379 | fc := &graphql.FieldContext{ 1380 | Object: "__Schema", 1381 | Field: field, 1382 | Args: nil, 1383 | IsMethod: true, 1384 | } 1385 | 1386 | ctx = graphql.WithFieldContext(ctx, fc) 1387 | resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 1388 | ctx = rctx // use context from middleware stack in children 1389 | return obj.Directives(), nil 1390 | }) 1391 | if err != nil { 1392 | ec.Error(ctx, err) 1393 | return graphql.Null 1394 | } 1395 | if resTmp == nil { 1396 | if !graphql.HasFieldError(ctx, fc) { 1397 | ec.Errorf(ctx, "must not be null") 1398 | } 1399 | return graphql.Null 1400 | } 1401 | res := resTmp.([]introspection.Directive) 1402 | fc.Result = res 1403 | return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirectiveᚄ(ctx, field.Selections, res) 1404 | } 1405 | 1406 | func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { 1407 | defer func() { 1408 | if r := recover(); r != nil { 1409 | ec.Error(ctx, ec.Recover(ctx, r)) 1410 | ret = graphql.Null 1411 | } 1412 | }() 1413 | fc := &graphql.FieldContext{ 1414 | Object: "__Type", 1415 | Field: field, 1416 | Args: nil, 1417 | IsMethod: true, 1418 | } 1419 | 1420 | ctx = graphql.WithFieldContext(ctx, fc) 1421 | resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 1422 | ctx = rctx // use context from middleware stack in children 1423 | return obj.Kind(), nil 1424 | }) 1425 | if err != nil { 1426 | ec.Error(ctx, err) 1427 | return graphql.Null 1428 | } 1429 | if resTmp == nil { 1430 | if !graphql.HasFieldError(ctx, fc) { 1431 | ec.Errorf(ctx, "must not be null") 1432 | } 1433 | return graphql.Null 1434 | } 1435 | res := resTmp.(string) 1436 | fc.Result = res 1437 | return ec.marshalN__TypeKind2string(ctx, field.Selections, res) 1438 | } 1439 | 1440 | func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { 1441 | defer func() { 1442 | if r := recover(); r != nil { 1443 | ec.Error(ctx, ec.Recover(ctx, r)) 1444 | ret = graphql.Null 1445 | } 1446 | }() 1447 | fc := &graphql.FieldContext{ 1448 | Object: "__Type", 1449 | Field: field, 1450 | Args: nil, 1451 | IsMethod: true, 1452 | } 1453 | 1454 | ctx = graphql.WithFieldContext(ctx, fc) 1455 | resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 1456 | ctx = rctx // use context from middleware stack in children 1457 | return obj.Name(), nil 1458 | }) 1459 | if err != nil { 1460 | ec.Error(ctx, err) 1461 | return graphql.Null 1462 | } 1463 | if resTmp == nil { 1464 | return graphql.Null 1465 | } 1466 | res := resTmp.(*string) 1467 | fc.Result = res 1468 | return ec.marshalOString2ᚖstring(ctx, field.Selections, res) 1469 | } 1470 | 1471 | func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { 1472 | defer func() { 1473 | if r := recover(); r != nil { 1474 | ec.Error(ctx, ec.Recover(ctx, r)) 1475 | ret = graphql.Null 1476 | } 1477 | }() 1478 | fc := &graphql.FieldContext{ 1479 | Object: "__Type", 1480 | Field: field, 1481 | Args: nil, 1482 | IsMethod: true, 1483 | } 1484 | 1485 | ctx = graphql.WithFieldContext(ctx, fc) 1486 | resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 1487 | ctx = rctx // use context from middleware stack in children 1488 | return obj.Description(), nil 1489 | }) 1490 | if err != nil { 1491 | ec.Error(ctx, err) 1492 | return graphql.Null 1493 | } 1494 | if resTmp == nil { 1495 | return graphql.Null 1496 | } 1497 | res := resTmp.(string) 1498 | fc.Result = res 1499 | return ec.marshalOString2string(ctx, field.Selections, res) 1500 | } 1501 | 1502 | func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { 1503 | defer func() { 1504 | if r := recover(); r != nil { 1505 | ec.Error(ctx, ec.Recover(ctx, r)) 1506 | ret = graphql.Null 1507 | } 1508 | }() 1509 | fc := &graphql.FieldContext{ 1510 | Object: "__Type", 1511 | Field: field, 1512 | Args: nil, 1513 | IsMethod: true, 1514 | } 1515 | 1516 | ctx = graphql.WithFieldContext(ctx, fc) 1517 | rawArgs := field.ArgumentMap(ec.Variables) 1518 | args, err := ec.field___Type_fields_args(ctx, rawArgs) 1519 | if err != nil { 1520 | ec.Error(ctx, err) 1521 | return graphql.Null 1522 | } 1523 | fc.Args = args 1524 | resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 1525 | ctx = rctx // use context from middleware stack in children 1526 | return obj.Fields(args["includeDeprecated"].(bool)), nil 1527 | }) 1528 | if err != nil { 1529 | ec.Error(ctx, err) 1530 | return graphql.Null 1531 | } 1532 | if resTmp == nil { 1533 | return graphql.Null 1534 | } 1535 | res := resTmp.([]introspection.Field) 1536 | fc.Result = res 1537 | return ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐFieldᚄ(ctx, field.Selections, res) 1538 | } 1539 | 1540 | func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { 1541 | defer func() { 1542 | if r := recover(); r != nil { 1543 | ec.Error(ctx, ec.Recover(ctx, r)) 1544 | ret = graphql.Null 1545 | } 1546 | }() 1547 | fc := &graphql.FieldContext{ 1548 | Object: "__Type", 1549 | Field: field, 1550 | Args: nil, 1551 | IsMethod: true, 1552 | } 1553 | 1554 | ctx = graphql.WithFieldContext(ctx, fc) 1555 | resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 1556 | ctx = rctx // use context from middleware stack in children 1557 | return obj.Interfaces(), nil 1558 | }) 1559 | if err != nil { 1560 | ec.Error(ctx, err) 1561 | return graphql.Null 1562 | } 1563 | if resTmp == nil { 1564 | return graphql.Null 1565 | } 1566 | res := resTmp.([]introspection.Type) 1567 | fc.Result = res 1568 | return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) 1569 | } 1570 | 1571 | func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { 1572 | defer func() { 1573 | if r := recover(); r != nil { 1574 | ec.Error(ctx, ec.Recover(ctx, r)) 1575 | ret = graphql.Null 1576 | } 1577 | }() 1578 | fc := &graphql.FieldContext{ 1579 | Object: "__Type", 1580 | Field: field, 1581 | Args: nil, 1582 | IsMethod: true, 1583 | } 1584 | 1585 | ctx = graphql.WithFieldContext(ctx, fc) 1586 | resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 1587 | ctx = rctx // use context from middleware stack in children 1588 | return obj.PossibleTypes(), nil 1589 | }) 1590 | if err != nil { 1591 | ec.Error(ctx, err) 1592 | return graphql.Null 1593 | } 1594 | if resTmp == nil { 1595 | return graphql.Null 1596 | } 1597 | res := resTmp.([]introspection.Type) 1598 | fc.Result = res 1599 | return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) 1600 | } 1601 | 1602 | func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { 1603 | defer func() { 1604 | if r := recover(); r != nil { 1605 | ec.Error(ctx, ec.Recover(ctx, r)) 1606 | ret = graphql.Null 1607 | } 1608 | }() 1609 | fc := &graphql.FieldContext{ 1610 | Object: "__Type", 1611 | Field: field, 1612 | Args: nil, 1613 | IsMethod: true, 1614 | } 1615 | 1616 | ctx = graphql.WithFieldContext(ctx, fc) 1617 | rawArgs := field.ArgumentMap(ec.Variables) 1618 | args, err := ec.field___Type_enumValues_args(ctx, rawArgs) 1619 | if err != nil { 1620 | ec.Error(ctx, err) 1621 | return graphql.Null 1622 | } 1623 | fc.Args = args 1624 | resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 1625 | ctx = rctx // use context from middleware stack in children 1626 | return obj.EnumValues(args["includeDeprecated"].(bool)), nil 1627 | }) 1628 | if err != nil { 1629 | ec.Error(ctx, err) 1630 | return graphql.Null 1631 | } 1632 | if resTmp == nil { 1633 | return graphql.Null 1634 | } 1635 | res := resTmp.([]introspection.EnumValue) 1636 | fc.Result = res 1637 | return ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValueᚄ(ctx, field.Selections, res) 1638 | } 1639 | 1640 | func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { 1641 | defer func() { 1642 | if r := recover(); r != nil { 1643 | ec.Error(ctx, ec.Recover(ctx, r)) 1644 | ret = graphql.Null 1645 | } 1646 | }() 1647 | fc := &graphql.FieldContext{ 1648 | Object: "__Type", 1649 | Field: field, 1650 | Args: nil, 1651 | IsMethod: true, 1652 | } 1653 | 1654 | ctx = graphql.WithFieldContext(ctx, fc) 1655 | resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 1656 | ctx = rctx // use context from middleware stack in children 1657 | return obj.InputFields(), nil 1658 | }) 1659 | if err != nil { 1660 | ec.Error(ctx, err) 1661 | return graphql.Null 1662 | } 1663 | if resTmp == nil { 1664 | return graphql.Null 1665 | } 1666 | res := resTmp.([]introspection.InputValue) 1667 | fc.Result = res 1668 | return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) 1669 | } 1670 | 1671 | func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { 1672 | defer func() { 1673 | if r := recover(); r != nil { 1674 | ec.Error(ctx, ec.Recover(ctx, r)) 1675 | ret = graphql.Null 1676 | } 1677 | }() 1678 | fc := &graphql.FieldContext{ 1679 | Object: "__Type", 1680 | Field: field, 1681 | Args: nil, 1682 | IsMethod: true, 1683 | } 1684 | 1685 | ctx = graphql.WithFieldContext(ctx, fc) 1686 | resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { 1687 | ctx = rctx // use context from middleware stack in children 1688 | return obj.OfType(), nil 1689 | }) 1690 | if err != nil { 1691 | ec.Error(ctx, err) 1692 | return graphql.Null 1693 | } 1694 | if resTmp == nil { 1695 | return graphql.Null 1696 | } 1697 | res := resTmp.(*introspection.Type) 1698 | fc.Result = res 1699 | return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) 1700 | } 1701 | 1702 | // endregion **************************** field.gotpl ***************************** 1703 | 1704 | // region **************************** input.gotpl ***************************** 1705 | 1706 | func (ec *executionContext) unmarshalInputNewTask(ctx context.Context, obj interface{}) (model.NewTask, error) { 1707 | var it model.NewTask 1708 | var asMap = obj.(map[string]interface{}) 1709 | 1710 | for k, v := range asMap { 1711 | switch k { 1712 | case "title": 1713 | var err error 1714 | it.Title, err = ec.unmarshalNString2string(ctx, v) 1715 | if err != nil { 1716 | return it, err 1717 | } 1718 | case "note": 1719 | var err error 1720 | it.Note, err = ec.unmarshalNString2string(ctx, v) 1721 | if err != nil { 1722 | return it, err 1723 | } 1724 | } 1725 | } 1726 | 1727 | return it, nil 1728 | } 1729 | 1730 | // endregion **************************** input.gotpl ***************************** 1731 | 1732 | // region ************************** interface.gotpl *************************** 1733 | 1734 | // endregion ************************** interface.gotpl *************************** 1735 | 1736 | // region **************************** object.gotpl **************************** 1737 | 1738 | var mutationImplementors = []string{"Mutation"} 1739 | 1740 | func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { 1741 | fields := graphql.CollectFields(ec.OperationContext, sel, mutationImplementors) 1742 | 1743 | ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ 1744 | Object: "Mutation", 1745 | }) 1746 | 1747 | out := graphql.NewFieldSet(fields) 1748 | var invalids uint32 1749 | for i, field := range fields { 1750 | switch field.Name { 1751 | case "__typename": 1752 | out.Values[i] = graphql.MarshalString("Mutation") 1753 | case "createTask": 1754 | out.Values[i] = ec._Mutation_createTask(ctx, field) 1755 | if out.Values[i] == graphql.Null { 1756 | invalids++ 1757 | } 1758 | default: 1759 | panic("unknown field " + strconv.Quote(field.Name)) 1760 | } 1761 | } 1762 | out.Dispatch() 1763 | if invalids > 0 { 1764 | return graphql.Null 1765 | } 1766 | return out 1767 | } 1768 | 1769 | var queryImplementors = []string{"Query"} 1770 | 1771 | func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { 1772 | fields := graphql.CollectFields(ec.OperationContext, sel, queryImplementors) 1773 | 1774 | ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ 1775 | Object: "Query", 1776 | }) 1777 | 1778 | out := graphql.NewFieldSet(fields) 1779 | var invalids uint32 1780 | for i, field := range fields { 1781 | switch field.Name { 1782 | case "__typename": 1783 | out.Values[i] = graphql.MarshalString("Query") 1784 | case "tasks": 1785 | field := field 1786 | out.Concurrently(i, func() (res graphql.Marshaler) { 1787 | defer func() { 1788 | if r := recover(); r != nil { 1789 | ec.Error(ctx, ec.Recover(ctx, r)) 1790 | } 1791 | }() 1792 | res = ec._Query_tasks(ctx, field) 1793 | if res == graphql.Null { 1794 | atomic.AddUint32(&invalids, 1) 1795 | } 1796 | return res 1797 | }) 1798 | case "__type": 1799 | out.Values[i] = ec._Query___type(ctx, field) 1800 | case "__schema": 1801 | out.Values[i] = ec._Query___schema(ctx, field) 1802 | default: 1803 | panic("unknown field " + strconv.Quote(field.Name)) 1804 | } 1805 | } 1806 | out.Dispatch() 1807 | if invalids > 0 { 1808 | return graphql.Null 1809 | } 1810 | return out 1811 | } 1812 | 1813 | var taskImplementors = []string{"Task"} 1814 | 1815 | func (ec *executionContext) _Task(ctx context.Context, sel ast.SelectionSet, obj *model.Task) graphql.Marshaler { 1816 | fields := graphql.CollectFields(ec.OperationContext, sel, taskImplementors) 1817 | 1818 | out := graphql.NewFieldSet(fields) 1819 | var invalids uint32 1820 | for i, field := range fields { 1821 | switch field.Name { 1822 | case "__typename": 1823 | out.Values[i] = graphql.MarshalString("Task") 1824 | case "id": 1825 | out.Values[i] = ec._Task_id(ctx, field, obj) 1826 | if out.Values[i] == graphql.Null { 1827 | invalids++ 1828 | } 1829 | case "title": 1830 | out.Values[i] = ec._Task_title(ctx, field, obj) 1831 | if out.Values[i] == graphql.Null { 1832 | invalids++ 1833 | } 1834 | case "note": 1835 | out.Values[i] = ec._Task_note(ctx, field, obj) 1836 | if out.Values[i] == graphql.Null { 1837 | invalids++ 1838 | } 1839 | case "completed": 1840 | out.Values[i] = ec._Task_completed(ctx, field, obj) 1841 | if out.Values[i] == graphql.Null { 1842 | invalids++ 1843 | } 1844 | case "created_at": 1845 | out.Values[i] = ec._Task_created_at(ctx, field, obj) 1846 | if out.Values[i] == graphql.Null { 1847 | invalids++ 1848 | } 1849 | case "updated_at": 1850 | out.Values[i] = ec._Task_updated_at(ctx, field, obj) 1851 | if out.Values[i] == graphql.Null { 1852 | invalids++ 1853 | } 1854 | default: 1855 | panic("unknown field " + strconv.Quote(field.Name)) 1856 | } 1857 | } 1858 | out.Dispatch() 1859 | if invalids > 0 { 1860 | return graphql.Null 1861 | } 1862 | return out 1863 | } 1864 | 1865 | var __DirectiveImplementors = []string{"__Directive"} 1866 | 1867 | func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionSet, obj *introspection.Directive) graphql.Marshaler { 1868 | fields := graphql.CollectFields(ec.OperationContext, sel, __DirectiveImplementors) 1869 | 1870 | out := graphql.NewFieldSet(fields) 1871 | var invalids uint32 1872 | for i, field := range fields { 1873 | switch field.Name { 1874 | case "__typename": 1875 | out.Values[i] = graphql.MarshalString("__Directive") 1876 | case "name": 1877 | out.Values[i] = ec.___Directive_name(ctx, field, obj) 1878 | if out.Values[i] == graphql.Null { 1879 | invalids++ 1880 | } 1881 | case "description": 1882 | out.Values[i] = ec.___Directive_description(ctx, field, obj) 1883 | case "locations": 1884 | out.Values[i] = ec.___Directive_locations(ctx, field, obj) 1885 | if out.Values[i] == graphql.Null { 1886 | invalids++ 1887 | } 1888 | case "args": 1889 | out.Values[i] = ec.___Directive_args(ctx, field, obj) 1890 | if out.Values[i] == graphql.Null { 1891 | invalids++ 1892 | } 1893 | default: 1894 | panic("unknown field " + strconv.Quote(field.Name)) 1895 | } 1896 | } 1897 | out.Dispatch() 1898 | if invalids > 0 { 1899 | return graphql.Null 1900 | } 1901 | return out 1902 | } 1903 | 1904 | var __EnumValueImplementors = []string{"__EnumValue"} 1905 | 1906 | func (ec *executionContext) ___EnumValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.EnumValue) graphql.Marshaler { 1907 | fields := graphql.CollectFields(ec.OperationContext, sel, __EnumValueImplementors) 1908 | 1909 | out := graphql.NewFieldSet(fields) 1910 | var invalids uint32 1911 | for i, field := range fields { 1912 | switch field.Name { 1913 | case "__typename": 1914 | out.Values[i] = graphql.MarshalString("__EnumValue") 1915 | case "name": 1916 | out.Values[i] = ec.___EnumValue_name(ctx, field, obj) 1917 | if out.Values[i] == graphql.Null { 1918 | invalids++ 1919 | } 1920 | case "description": 1921 | out.Values[i] = ec.___EnumValue_description(ctx, field, obj) 1922 | case "isDeprecated": 1923 | out.Values[i] = ec.___EnumValue_isDeprecated(ctx, field, obj) 1924 | if out.Values[i] == graphql.Null { 1925 | invalids++ 1926 | } 1927 | case "deprecationReason": 1928 | out.Values[i] = ec.___EnumValue_deprecationReason(ctx, field, obj) 1929 | default: 1930 | panic("unknown field " + strconv.Quote(field.Name)) 1931 | } 1932 | } 1933 | out.Dispatch() 1934 | if invalids > 0 { 1935 | return graphql.Null 1936 | } 1937 | return out 1938 | } 1939 | 1940 | var __FieldImplementors = []string{"__Field"} 1941 | 1942 | func (ec *executionContext) ___Field(ctx context.Context, sel ast.SelectionSet, obj *introspection.Field) graphql.Marshaler { 1943 | fields := graphql.CollectFields(ec.OperationContext, sel, __FieldImplementors) 1944 | 1945 | out := graphql.NewFieldSet(fields) 1946 | var invalids uint32 1947 | for i, field := range fields { 1948 | switch field.Name { 1949 | case "__typename": 1950 | out.Values[i] = graphql.MarshalString("__Field") 1951 | case "name": 1952 | out.Values[i] = ec.___Field_name(ctx, field, obj) 1953 | if out.Values[i] == graphql.Null { 1954 | invalids++ 1955 | } 1956 | case "description": 1957 | out.Values[i] = ec.___Field_description(ctx, field, obj) 1958 | case "args": 1959 | out.Values[i] = ec.___Field_args(ctx, field, obj) 1960 | if out.Values[i] == graphql.Null { 1961 | invalids++ 1962 | } 1963 | case "type": 1964 | out.Values[i] = ec.___Field_type(ctx, field, obj) 1965 | if out.Values[i] == graphql.Null { 1966 | invalids++ 1967 | } 1968 | case "isDeprecated": 1969 | out.Values[i] = ec.___Field_isDeprecated(ctx, field, obj) 1970 | if out.Values[i] == graphql.Null { 1971 | invalids++ 1972 | } 1973 | case "deprecationReason": 1974 | out.Values[i] = ec.___Field_deprecationReason(ctx, field, obj) 1975 | default: 1976 | panic("unknown field " + strconv.Quote(field.Name)) 1977 | } 1978 | } 1979 | out.Dispatch() 1980 | if invalids > 0 { 1981 | return graphql.Null 1982 | } 1983 | return out 1984 | } 1985 | 1986 | var __InputValueImplementors = []string{"__InputValue"} 1987 | 1988 | func (ec *executionContext) ___InputValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.InputValue) graphql.Marshaler { 1989 | fields := graphql.CollectFields(ec.OperationContext, sel, __InputValueImplementors) 1990 | 1991 | out := graphql.NewFieldSet(fields) 1992 | var invalids uint32 1993 | for i, field := range fields { 1994 | switch field.Name { 1995 | case "__typename": 1996 | out.Values[i] = graphql.MarshalString("__InputValue") 1997 | case "name": 1998 | out.Values[i] = ec.___InputValue_name(ctx, field, obj) 1999 | if out.Values[i] == graphql.Null { 2000 | invalids++ 2001 | } 2002 | case "description": 2003 | out.Values[i] = ec.___InputValue_description(ctx, field, obj) 2004 | case "type": 2005 | out.Values[i] = ec.___InputValue_type(ctx, field, obj) 2006 | if out.Values[i] == graphql.Null { 2007 | invalids++ 2008 | } 2009 | case "defaultValue": 2010 | out.Values[i] = ec.___InputValue_defaultValue(ctx, field, obj) 2011 | default: 2012 | panic("unknown field " + strconv.Quote(field.Name)) 2013 | } 2014 | } 2015 | out.Dispatch() 2016 | if invalids > 0 { 2017 | return graphql.Null 2018 | } 2019 | return out 2020 | } 2021 | 2022 | var __SchemaImplementors = []string{"__Schema"} 2023 | 2024 | func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet, obj *introspection.Schema) graphql.Marshaler { 2025 | fields := graphql.CollectFields(ec.OperationContext, sel, __SchemaImplementors) 2026 | 2027 | out := graphql.NewFieldSet(fields) 2028 | var invalids uint32 2029 | for i, field := range fields { 2030 | switch field.Name { 2031 | case "__typename": 2032 | out.Values[i] = graphql.MarshalString("__Schema") 2033 | case "types": 2034 | out.Values[i] = ec.___Schema_types(ctx, field, obj) 2035 | if out.Values[i] == graphql.Null { 2036 | invalids++ 2037 | } 2038 | case "queryType": 2039 | out.Values[i] = ec.___Schema_queryType(ctx, field, obj) 2040 | if out.Values[i] == graphql.Null { 2041 | invalids++ 2042 | } 2043 | case "mutationType": 2044 | out.Values[i] = ec.___Schema_mutationType(ctx, field, obj) 2045 | case "subscriptionType": 2046 | out.Values[i] = ec.___Schema_subscriptionType(ctx, field, obj) 2047 | case "directives": 2048 | out.Values[i] = ec.___Schema_directives(ctx, field, obj) 2049 | if out.Values[i] == graphql.Null { 2050 | invalids++ 2051 | } 2052 | default: 2053 | panic("unknown field " + strconv.Quote(field.Name)) 2054 | } 2055 | } 2056 | out.Dispatch() 2057 | if invalids > 0 { 2058 | return graphql.Null 2059 | } 2060 | return out 2061 | } 2062 | 2063 | var __TypeImplementors = []string{"__Type"} 2064 | 2065 | func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, obj *introspection.Type) graphql.Marshaler { 2066 | fields := graphql.CollectFields(ec.OperationContext, sel, __TypeImplementors) 2067 | 2068 | out := graphql.NewFieldSet(fields) 2069 | var invalids uint32 2070 | for i, field := range fields { 2071 | switch field.Name { 2072 | case "__typename": 2073 | out.Values[i] = graphql.MarshalString("__Type") 2074 | case "kind": 2075 | out.Values[i] = ec.___Type_kind(ctx, field, obj) 2076 | if out.Values[i] == graphql.Null { 2077 | invalids++ 2078 | } 2079 | case "name": 2080 | out.Values[i] = ec.___Type_name(ctx, field, obj) 2081 | case "description": 2082 | out.Values[i] = ec.___Type_description(ctx, field, obj) 2083 | case "fields": 2084 | out.Values[i] = ec.___Type_fields(ctx, field, obj) 2085 | case "interfaces": 2086 | out.Values[i] = ec.___Type_interfaces(ctx, field, obj) 2087 | case "possibleTypes": 2088 | out.Values[i] = ec.___Type_possibleTypes(ctx, field, obj) 2089 | case "enumValues": 2090 | out.Values[i] = ec.___Type_enumValues(ctx, field, obj) 2091 | case "inputFields": 2092 | out.Values[i] = ec.___Type_inputFields(ctx, field, obj) 2093 | case "ofType": 2094 | out.Values[i] = ec.___Type_ofType(ctx, field, obj) 2095 | default: 2096 | panic("unknown field " + strconv.Quote(field.Name)) 2097 | } 2098 | } 2099 | out.Dispatch() 2100 | if invalids > 0 { 2101 | return graphql.Null 2102 | } 2103 | return out 2104 | } 2105 | 2106 | // endregion **************************** object.gotpl **************************** 2107 | 2108 | // region ***************************** type.gotpl ***************************** 2109 | 2110 | func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interface{}) (bool, error) { 2111 | return graphql.UnmarshalBoolean(v) 2112 | } 2113 | 2114 | func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { 2115 | res := graphql.MarshalBoolean(v) 2116 | if res == graphql.Null { 2117 | if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { 2118 | ec.Errorf(ctx, "must not be null") 2119 | } 2120 | } 2121 | return res 2122 | } 2123 | 2124 | func (ec *executionContext) unmarshalNID2string(ctx context.Context, v interface{}) (string, error) { 2125 | return graphql.UnmarshalID(v) 2126 | } 2127 | 2128 | func (ec *executionContext) marshalNID2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { 2129 | res := graphql.MarshalID(v) 2130 | if res == graphql.Null { 2131 | if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { 2132 | ec.Errorf(ctx, "must not be null") 2133 | } 2134 | } 2135 | return res 2136 | } 2137 | 2138 | func (ec *executionContext) unmarshalNInt2int(ctx context.Context, v interface{}) (int, error) { 2139 | return graphql.UnmarshalInt(v) 2140 | } 2141 | 2142 | func (ec *executionContext) marshalNInt2int(ctx context.Context, sel ast.SelectionSet, v int) graphql.Marshaler { 2143 | res := graphql.MarshalInt(v) 2144 | if res == graphql.Null { 2145 | if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { 2146 | ec.Errorf(ctx, "must not be null") 2147 | } 2148 | } 2149 | return res 2150 | } 2151 | 2152 | func (ec *executionContext) unmarshalNNewTask2githubᚗcomᚋyuuuᚋgqlgenᚑechoᚑsampleᚋgraphᚋmodelᚐNewTask(ctx context.Context, v interface{}) (model.NewTask, error) { 2153 | return ec.unmarshalInputNewTask(ctx, v) 2154 | } 2155 | 2156 | func (ec *executionContext) unmarshalNString2string(ctx context.Context, v interface{}) (string, error) { 2157 | return graphql.UnmarshalString(v) 2158 | } 2159 | 2160 | func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { 2161 | res := graphql.MarshalString(v) 2162 | if res == graphql.Null { 2163 | if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { 2164 | ec.Errorf(ctx, "must not be null") 2165 | } 2166 | } 2167 | return res 2168 | } 2169 | 2170 | func (ec *executionContext) marshalNTask2githubᚗcomᚋyuuuᚋgqlgenᚑechoᚑsampleᚋgraphᚋmodelᚐTask(ctx context.Context, sel ast.SelectionSet, v model.Task) graphql.Marshaler { 2171 | return ec._Task(ctx, sel, &v) 2172 | } 2173 | 2174 | func (ec *executionContext) marshalNTask2ᚕᚖgithubᚗcomᚋyuuuᚋgqlgenᚑechoᚑsampleᚋgraphᚋmodelᚐTaskᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.Task) graphql.Marshaler { 2175 | ret := make(graphql.Array, len(v)) 2176 | var wg sync.WaitGroup 2177 | isLen1 := len(v) == 1 2178 | if !isLen1 { 2179 | wg.Add(len(v)) 2180 | } 2181 | for i := range v { 2182 | i := i 2183 | fc := &graphql.FieldContext{ 2184 | Index: &i, 2185 | Result: &v[i], 2186 | } 2187 | ctx := graphql.WithFieldContext(ctx, fc) 2188 | f := func(i int) { 2189 | defer func() { 2190 | if r := recover(); r != nil { 2191 | ec.Error(ctx, ec.Recover(ctx, r)) 2192 | ret = nil 2193 | } 2194 | }() 2195 | if !isLen1 { 2196 | defer wg.Done() 2197 | } 2198 | ret[i] = ec.marshalNTask2ᚖgithubᚗcomᚋyuuuᚋgqlgenᚑechoᚑsampleᚋgraphᚋmodelᚐTask(ctx, sel, v[i]) 2199 | } 2200 | if isLen1 { 2201 | f(i) 2202 | } else { 2203 | go f(i) 2204 | } 2205 | 2206 | } 2207 | wg.Wait() 2208 | return ret 2209 | } 2210 | 2211 | func (ec *executionContext) marshalNTask2ᚖgithubᚗcomᚋyuuuᚋgqlgenᚑechoᚑsampleᚋgraphᚋmodelᚐTask(ctx context.Context, sel ast.SelectionSet, v *model.Task) graphql.Marshaler { 2212 | if v == nil { 2213 | if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { 2214 | ec.Errorf(ctx, "must not be null") 2215 | } 2216 | return graphql.Null 2217 | } 2218 | return ec._Task(ctx, sel, v) 2219 | } 2220 | 2221 | func (ec *executionContext) marshalN__Directive2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx context.Context, sel ast.SelectionSet, v introspection.Directive) graphql.Marshaler { 2222 | return ec.___Directive(ctx, sel, &v) 2223 | } 2224 | 2225 | func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirectiveᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.Directive) graphql.Marshaler { 2226 | ret := make(graphql.Array, len(v)) 2227 | var wg sync.WaitGroup 2228 | isLen1 := len(v) == 1 2229 | if !isLen1 { 2230 | wg.Add(len(v)) 2231 | } 2232 | for i := range v { 2233 | i := i 2234 | fc := &graphql.FieldContext{ 2235 | Index: &i, 2236 | Result: &v[i], 2237 | } 2238 | ctx := graphql.WithFieldContext(ctx, fc) 2239 | f := func(i int) { 2240 | defer func() { 2241 | if r := recover(); r != nil { 2242 | ec.Error(ctx, ec.Recover(ctx, r)) 2243 | ret = nil 2244 | } 2245 | }() 2246 | if !isLen1 { 2247 | defer wg.Done() 2248 | } 2249 | ret[i] = ec.marshalN__Directive2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx, sel, v[i]) 2250 | } 2251 | if isLen1 { 2252 | f(i) 2253 | } else { 2254 | go f(i) 2255 | } 2256 | 2257 | } 2258 | wg.Wait() 2259 | return ret 2260 | } 2261 | 2262 | func (ec *executionContext) unmarshalN__DirectiveLocation2string(ctx context.Context, v interface{}) (string, error) { 2263 | return graphql.UnmarshalString(v) 2264 | } 2265 | 2266 | func (ec *executionContext) marshalN__DirectiveLocation2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { 2267 | res := graphql.MarshalString(v) 2268 | if res == graphql.Null { 2269 | if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { 2270 | ec.Errorf(ctx, "must not be null") 2271 | } 2272 | } 2273 | return res 2274 | } 2275 | 2276 | func (ec *executionContext) unmarshalN__DirectiveLocation2ᚕstringᚄ(ctx context.Context, v interface{}) ([]string, error) { 2277 | var vSlice []interface{} 2278 | if v != nil { 2279 | if tmp1, ok := v.([]interface{}); ok { 2280 | vSlice = tmp1 2281 | } else { 2282 | vSlice = []interface{}{v} 2283 | } 2284 | } 2285 | var err error 2286 | res := make([]string, len(vSlice)) 2287 | for i := range vSlice { 2288 | res[i], err = ec.unmarshalN__DirectiveLocation2string(ctx, vSlice[i]) 2289 | if err != nil { 2290 | return nil, err 2291 | } 2292 | } 2293 | return res, nil 2294 | } 2295 | 2296 | func (ec *executionContext) marshalN__DirectiveLocation2ᚕstringᚄ(ctx context.Context, sel ast.SelectionSet, v []string) graphql.Marshaler { 2297 | ret := make(graphql.Array, len(v)) 2298 | var wg sync.WaitGroup 2299 | isLen1 := len(v) == 1 2300 | if !isLen1 { 2301 | wg.Add(len(v)) 2302 | } 2303 | for i := range v { 2304 | i := i 2305 | fc := &graphql.FieldContext{ 2306 | Index: &i, 2307 | Result: &v[i], 2308 | } 2309 | ctx := graphql.WithFieldContext(ctx, fc) 2310 | f := func(i int) { 2311 | defer func() { 2312 | if r := recover(); r != nil { 2313 | ec.Error(ctx, ec.Recover(ctx, r)) 2314 | ret = nil 2315 | } 2316 | }() 2317 | if !isLen1 { 2318 | defer wg.Done() 2319 | } 2320 | ret[i] = ec.marshalN__DirectiveLocation2string(ctx, sel, v[i]) 2321 | } 2322 | if isLen1 { 2323 | f(i) 2324 | } else { 2325 | go f(i) 2326 | } 2327 | 2328 | } 2329 | wg.Wait() 2330 | return ret 2331 | } 2332 | 2333 | func (ec *executionContext) marshalN__EnumValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx context.Context, sel ast.SelectionSet, v introspection.EnumValue) graphql.Marshaler { 2334 | return ec.___EnumValue(ctx, sel, &v) 2335 | } 2336 | 2337 | func (ec *executionContext) marshalN__Field2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx context.Context, sel ast.SelectionSet, v introspection.Field) graphql.Marshaler { 2338 | return ec.___Field(ctx, sel, &v) 2339 | } 2340 | 2341 | func (ec *executionContext) marshalN__InputValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx context.Context, sel ast.SelectionSet, v introspection.InputValue) graphql.Marshaler { 2342 | return ec.___InputValue(ctx, sel, &v) 2343 | } 2344 | 2345 | func (ec *executionContext) marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.InputValue) graphql.Marshaler { 2346 | ret := make(graphql.Array, len(v)) 2347 | var wg sync.WaitGroup 2348 | isLen1 := len(v) == 1 2349 | if !isLen1 { 2350 | wg.Add(len(v)) 2351 | } 2352 | for i := range v { 2353 | i := i 2354 | fc := &graphql.FieldContext{ 2355 | Index: &i, 2356 | Result: &v[i], 2357 | } 2358 | ctx := graphql.WithFieldContext(ctx, fc) 2359 | f := func(i int) { 2360 | defer func() { 2361 | if r := recover(); r != nil { 2362 | ec.Error(ctx, ec.Recover(ctx, r)) 2363 | ret = nil 2364 | } 2365 | }() 2366 | if !isLen1 { 2367 | defer wg.Done() 2368 | } 2369 | ret[i] = ec.marshalN__InputValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, sel, v[i]) 2370 | } 2371 | if isLen1 { 2372 | f(i) 2373 | } else { 2374 | go f(i) 2375 | } 2376 | 2377 | } 2378 | wg.Wait() 2379 | return ret 2380 | } 2381 | 2382 | func (ec *executionContext) marshalN__Type2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v introspection.Type) graphql.Marshaler { 2383 | return ec.___Type(ctx, sel, &v) 2384 | } 2385 | 2386 | func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.Type) graphql.Marshaler { 2387 | ret := make(graphql.Array, len(v)) 2388 | var wg sync.WaitGroup 2389 | isLen1 := len(v) == 1 2390 | if !isLen1 { 2391 | wg.Add(len(v)) 2392 | } 2393 | for i := range v { 2394 | i := i 2395 | fc := &graphql.FieldContext{ 2396 | Index: &i, 2397 | Result: &v[i], 2398 | } 2399 | ctx := graphql.WithFieldContext(ctx, fc) 2400 | f := func(i int) { 2401 | defer func() { 2402 | if r := recover(); r != nil { 2403 | ec.Error(ctx, ec.Recover(ctx, r)) 2404 | ret = nil 2405 | } 2406 | }() 2407 | if !isLen1 { 2408 | defer wg.Done() 2409 | } 2410 | ret[i] = ec.marshalN__Type2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, sel, v[i]) 2411 | } 2412 | if isLen1 { 2413 | f(i) 2414 | } else { 2415 | go f(i) 2416 | } 2417 | 2418 | } 2419 | wg.Wait() 2420 | return ret 2421 | } 2422 | 2423 | func (ec *executionContext) marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v *introspection.Type) graphql.Marshaler { 2424 | if v == nil { 2425 | if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { 2426 | ec.Errorf(ctx, "must not be null") 2427 | } 2428 | return graphql.Null 2429 | } 2430 | return ec.___Type(ctx, sel, v) 2431 | } 2432 | 2433 | func (ec *executionContext) unmarshalN__TypeKind2string(ctx context.Context, v interface{}) (string, error) { 2434 | return graphql.UnmarshalString(v) 2435 | } 2436 | 2437 | func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { 2438 | res := graphql.MarshalString(v) 2439 | if res == graphql.Null { 2440 | if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { 2441 | ec.Errorf(ctx, "must not be null") 2442 | } 2443 | } 2444 | return res 2445 | } 2446 | 2447 | func (ec *executionContext) unmarshalOBoolean2bool(ctx context.Context, v interface{}) (bool, error) { 2448 | return graphql.UnmarshalBoolean(v) 2449 | } 2450 | 2451 | func (ec *executionContext) marshalOBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { 2452 | return graphql.MarshalBoolean(v) 2453 | } 2454 | 2455 | func (ec *executionContext) unmarshalOBoolean2ᚖbool(ctx context.Context, v interface{}) (*bool, error) { 2456 | if v == nil { 2457 | return nil, nil 2458 | } 2459 | res, err := ec.unmarshalOBoolean2bool(ctx, v) 2460 | return &res, err 2461 | } 2462 | 2463 | func (ec *executionContext) marshalOBoolean2ᚖbool(ctx context.Context, sel ast.SelectionSet, v *bool) graphql.Marshaler { 2464 | if v == nil { 2465 | return graphql.Null 2466 | } 2467 | return ec.marshalOBoolean2bool(ctx, sel, *v) 2468 | } 2469 | 2470 | func (ec *executionContext) unmarshalOString2string(ctx context.Context, v interface{}) (string, error) { 2471 | return graphql.UnmarshalString(v) 2472 | } 2473 | 2474 | func (ec *executionContext) marshalOString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { 2475 | return graphql.MarshalString(v) 2476 | } 2477 | 2478 | func (ec *executionContext) unmarshalOString2ᚖstring(ctx context.Context, v interface{}) (*string, error) { 2479 | if v == nil { 2480 | return nil, nil 2481 | } 2482 | res, err := ec.unmarshalOString2string(ctx, v) 2483 | return &res, err 2484 | } 2485 | 2486 | func (ec *executionContext) marshalOString2ᚖstring(ctx context.Context, sel ast.SelectionSet, v *string) graphql.Marshaler { 2487 | if v == nil { 2488 | return graphql.Null 2489 | } 2490 | return ec.marshalOString2string(ctx, sel, *v) 2491 | } 2492 | 2493 | func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValueᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.EnumValue) graphql.Marshaler { 2494 | if v == nil { 2495 | return graphql.Null 2496 | } 2497 | ret := make(graphql.Array, len(v)) 2498 | var wg sync.WaitGroup 2499 | isLen1 := len(v) == 1 2500 | if !isLen1 { 2501 | wg.Add(len(v)) 2502 | } 2503 | for i := range v { 2504 | i := i 2505 | fc := &graphql.FieldContext{ 2506 | Index: &i, 2507 | Result: &v[i], 2508 | } 2509 | ctx := graphql.WithFieldContext(ctx, fc) 2510 | f := func(i int) { 2511 | defer func() { 2512 | if r := recover(); r != nil { 2513 | ec.Error(ctx, ec.Recover(ctx, r)) 2514 | ret = nil 2515 | } 2516 | }() 2517 | if !isLen1 { 2518 | defer wg.Done() 2519 | } 2520 | ret[i] = ec.marshalN__EnumValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx, sel, v[i]) 2521 | } 2522 | if isLen1 { 2523 | f(i) 2524 | } else { 2525 | go f(i) 2526 | } 2527 | 2528 | } 2529 | wg.Wait() 2530 | return ret 2531 | } 2532 | 2533 | func (ec *executionContext) marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐFieldᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.Field) graphql.Marshaler { 2534 | if v == nil { 2535 | return graphql.Null 2536 | } 2537 | ret := make(graphql.Array, len(v)) 2538 | var wg sync.WaitGroup 2539 | isLen1 := len(v) == 1 2540 | if !isLen1 { 2541 | wg.Add(len(v)) 2542 | } 2543 | for i := range v { 2544 | i := i 2545 | fc := &graphql.FieldContext{ 2546 | Index: &i, 2547 | Result: &v[i], 2548 | } 2549 | ctx := graphql.WithFieldContext(ctx, fc) 2550 | f := func(i int) { 2551 | defer func() { 2552 | if r := recover(); r != nil { 2553 | ec.Error(ctx, ec.Recover(ctx, r)) 2554 | ret = nil 2555 | } 2556 | }() 2557 | if !isLen1 { 2558 | defer wg.Done() 2559 | } 2560 | ret[i] = ec.marshalN__Field2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx, sel, v[i]) 2561 | } 2562 | if isLen1 { 2563 | f(i) 2564 | } else { 2565 | go f(i) 2566 | } 2567 | 2568 | } 2569 | wg.Wait() 2570 | return ret 2571 | } 2572 | 2573 | func (ec *executionContext) marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.InputValue) graphql.Marshaler { 2574 | if v == nil { 2575 | return graphql.Null 2576 | } 2577 | ret := make(graphql.Array, len(v)) 2578 | var wg sync.WaitGroup 2579 | isLen1 := len(v) == 1 2580 | if !isLen1 { 2581 | wg.Add(len(v)) 2582 | } 2583 | for i := range v { 2584 | i := i 2585 | fc := &graphql.FieldContext{ 2586 | Index: &i, 2587 | Result: &v[i], 2588 | } 2589 | ctx := graphql.WithFieldContext(ctx, fc) 2590 | f := func(i int) { 2591 | defer func() { 2592 | if r := recover(); r != nil { 2593 | ec.Error(ctx, ec.Recover(ctx, r)) 2594 | ret = nil 2595 | } 2596 | }() 2597 | if !isLen1 { 2598 | defer wg.Done() 2599 | } 2600 | ret[i] = ec.marshalN__InputValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, sel, v[i]) 2601 | } 2602 | if isLen1 { 2603 | f(i) 2604 | } else { 2605 | go f(i) 2606 | } 2607 | 2608 | } 2609 | wg.Wait() 2610 | return ret 2611 | } 2612 | 2613 | func (ec *executionContext) marshalO__Schema2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx context.Context, sel ast.SelectionSet, v introspection.Schema) graphql.Marshaler { 2614 | return ec.___Schema(ctx, sel, &v) 2615 | } 2616 | 2617 | func (ec *executionContext) marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx context.Context, sel ast.SelectionSet, v *introspection.Schema) graphql.Marshaler { 2618 | if v == nil { 2619 | return graphql.Null 2620 | } 2621 | return ec.___Schema(ctx, sel, v) 2622 | } 2623 | 2624 | func (ec *executionContext) marshalO__Type2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v introspection.Type) graphql.Marshaler { 2625 | return ec.___Type(ctx, sel, &v) 2626 | } 2627 | 2628 | func (ec *executionContext) marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.Type) graphql.Marshaler { 2629 | if v == nil { 2630 | return graphql.Null 2631 | } 2632 | ret := make(graphql.Array, len(v)) 2633 | var wg sync.WaitGroup 2634 | isLen1 := len(v) == 1 2635 | if !isLen1 { 2636 | wg.Add(len(v)) 2637 | } 2638 | for i := range v { 2639 | i := i 2640 | fc := &graphql.FieldContext{ 2641 | Index: &i, 2642 | Result: &v[i], 2643 | } 2644 | ctx := graphql.WithFieldContext(ctx, fc) 2645 | f := func(i int) { 2646 | defer func() { 2647 | if r := recover(); r != nil { 2648 | ec.Error(ctx, ec.Recover(ctx, r)) 2649 | ret = nil 2650 | } 2651 | }() 2652 | if !isLen1 { 2653 | defer wg.Done() 2654 | } 2655 | ret[i] = ec.marshalN__Type2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, sel, v[i]) 2656 | } 2657 | if isLen1 { 2658 | f(i) 2659 | } else { 2660 | go f(i) 2661 | } 2662 | 2663 | } 2664 | wg.Wait() 2665 | return ret 2666 | } 2667 | 2668 | func (ec *executionContext) marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v *introspection.Type) graphql.Marshaler { 2669 | if v == nil { 2670 | return graphql.Null 2671 | } 2672 | return ec.___Type(ctx, sel, v) 2673 | } 2674 | 2675 | // endregion ***************************** type.gotpl ***************************** 2676 | --------------------------------------------------------------------------------