diff --git a/.travis.yml b/.travis.yml index a405fecc7ceafb5e36fab44b6338774e11e1d3aa..95c86e7f5690c842584c62814b6e633f26a1e974 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,5 @@ matrix: include: - - language: go - go: "1.8" - language: go go: "1.9" - language: go diff --git a/Gopkg.lock b/Gopkg.lock index 40e69d5bfd366e0db536d15ec2589d996e161304..409b69a0222f646c19c4e5258e7aa9dde6eb2e38 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -2,22 +2,28 @@ [[projects]] - digest = "1:e8f6639eaa399c8595b9a2dee175514a9f3842888dc080e2776360dc604150dc" + digest = "1:d28d302ab337b9ea3af38c04429e198ab422c1e026592aebcf7aec66ebbc4645" name = "github.com/99designs/gqlgen" packages = [ + "api", "cmd", "codegen", + "codegen/config", "codegen/templates", "complexity", "graphql", "graphql/introspection", "handler", - "internal/gopath", + "internal/code", "internal/imports", + "plugin", + "plugin/modelgen", + "plugin/resolvergen", + "plugin/servergen", ] pruneopts = "UT" - revision = "da1e07f5876c0fb79cbad19006f7135be08590d6" - version = "v0.7.2" + revision = "010a79b66f08732cb70d133dcab297a8ee895572" + version = "v0.8.3" [[projects]] branch = "master" @@ -300,9 +306,9 @@ version = "v1.2.2" [[projects]] - digest = "1:0ec412b28282c10ac6ce56039120741bb738814e4874d23c15fdff37f6aa7a62" + digest = "1:823766f4e1833bd562339317d905475fe46789da3863b2da7a1871f9f12bb4b3" name = "github.com/theckman/goconstraint" - packages = ["go1.8/gte"] + packages = ["go1.9/gte"] pruneopts = "UT" revision = "93babf24513d0e8277635da8169fcc5a46ae3f6a" version = "v1.11.0" @@ -382,13 +388,15 @@ [[projects]] branch = "master" - digest = "1:d22891f2d4a24a531ae01994abae377ec9d8a45ec8849aa95c27dc36014b8c24" + digest = "1:090a56ffcfac7f9095b601438e520f4b3609f3442afbaf151f750e2e377c3508" name = "golang.org/x/tools" packages = [ "go/ast/astutil", - "go/buildutil", + "go/gcexportdata", "go/internal/cgo", - "go/loader", + "go/internal/gcimporter", + "go/packages", + "go/types/typeutil", "imports", "internal/fastwalk", ] @@ -444,7 +452,7 @@ "github.com/spf13/cobra/doc", "github.com/stretchr/testify/assert", "github.com/stretchr/testify/require", - "github.com/theckman/goconstraint/go1.8/gte", + "github.com/theckman/goconstraint/go1.9/gte", "github.com/vektah/gqlgen/client", "github.com/vektah/gqlparser", "github.com/vektah/gqlparser/ast", diff --git a/Gopkg.toml b/Gopkg.toml index 0fe18091366c9750393d31d487764b2b81724513..15242ed8dac464109e0cc5fe3a7e8e4686c32048 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -58,7 +58,7 @@ [[constraint]] name = "github.com/99designs/gqlgen" - version = "0.7.1" + version = "0.8.3" [[constraint]] name = "github.com/MichaelMure/gocui" diff --git a/git-bug.go b/git-bug.go index c3a942e117a50606455e3cc8594cbbef4357aef7..20bf74bcb91e093f823ec1e818cfe756ae0e20fc 100644 --- a/git-bug.go +++ b/git-bug.go @@ -8,8 +8,8 @@ package main import ( "github.com/MichaelMure/git-bug/commands" - // minimal go version is 1.8 - _ "github.com/theckman/goconstraint/go1.8/gte" + // minimal go version is 1.9 + _ "github.com/theckman/goconstraint/go1.9/gte" ) func main() { diff --git a/graphql/connections/connection_template.go b/graphql/connections/connection_template.go index 412eb31856223f9386d79feebdc4f10c8748ec70..4370957c4867c56d806d86b81e76b35d5d15cccd 100644 --- a/graphql/connections/connection_template.go +++ b/graphql/connections/connection_template.go @@ -29,10 +29,10 @@ type NameConMaker func( edges []EdgeType, nodes []NodeType, info models.PageInfo, - totalCount int) (ConnectionType, error) + totalCount int) (*ConnectionType, error) // NameCon will paginate a source according to the input of a relay connection -func NameCon(source []NodeType, edgeMaker NameEdgeMaker, conMaker NameConMaker, input models.ConnectionInput) (ConnectionType, error) { +func NameCon(source []NodeType, edgeMaker NameEdgeMaker, conMaker NameConMaker, input models.ConnectionInput) (*ConnectionType, error) { var nodes []NodeType var edges []EdgeType var cursors []string diff --git a/graphql/connections/gen_comment.go b/graphql/connections/gen_comment.go index 6df21c588c9815e1294c9f227e272f3710f94017..021320c6bbac70eed2846f98c523bd89fce201b3 100644 --- a/graphql/connections/gen_comment.go +++ b/graphql/connections/gen_comment.go @@ -20,10 +20,10 @@ type CommentConMaker func( edges []models.CommentEdge, nodes []bug.Comment, info models.PageInfo, - totalCount int) (models.CommentConnection, error) + totalCount int) (*models.CommentConnection, error) // CommentCon will paginate a source according to the input of a relay connection -func CommentCon(source []bug.Comment, edgeMaker CommentEdgeMaker, conMaker CommentConMaker, input models.ConnectionInput) (models.CommentConnection, error) { +func CommentCon(source []bug.Comment, edgeMaker CommentEdgeMaker, conMaker CommentConMaker, input models.ConnectionInput) (*models.CommentConnection, error) { var nodes []bug.Comment var edges []models.CommentEdge var cursors []string diff --git a/graphql/connections/gen_identity.go b/graphql/connections/gen_identity.go index 2ba2f98f7e33c6c1d0c0d7658c09f07928786954..6c1e713739698405fe533e4b5e03a35e089eccb5 100644 --- a/graphql/connections/gen_identity.go +++ b/graphql/connections/gen_identity.go @@ -20,10 +20,10 @@ type IdentityConMaker func( edges []models.IdentityEdge, nodes []identity.Interface, info models.PageInfo, - totalCount int) (models.IdentityConnection, error) + totalCount int) (*models.IdentityConnection, error) // IdentityCon will paginate a source according to the input of a relay connection -func IdentityCon(source []identity.Interface, edgeMaker IdentityEdgeMaker, conMaker IdentityConMaker, input models.ConnectionInput) (models.IdentityConnection, error) { +func IdentityCon(source []identity.Interface, edgeMaker IdentityEdgeMaker, conMaker IdentityConMaker, input models.ConnectionInput) (*models.IdentityConnection, error) { var nodes []identity.Interface var edges []models.IdentityEdge var cursors []string diff --git a/graphql/connections/gen_lazy_bug.go b/graphql/connections/gen_lazy_bug.go index ba0a65fa0e493dc76921326b6932fe028a753b45..e9da5cc7cad3852ac7d68d50af724255b1998a27 100644 --- a/graphql/connections/gen_lazy_bug.go +++ b/graphql/connections/gen_lazy_bug.go @@ -19,10 +19,10 @@ type LazyBugConMaker func( edges []LazyBugEdge, nodes []string, info models.PageInfo, - totalCount int) (models.BugConnection, error) + totalCount int) (*models.BugConnection, error) // LazyBugCon will paginate a source according to the input of a relay connection -func LazyBugCon(source []string, edgeMaker LazyBugEdgeMaker, conMaker LazyBugConMaker, input models.ConnectionInput) (models.BugConnection, error) { +func LazyBugCon(source []string, edgeMaker LazyBugEdgeMaker, conMaker LazyBugConMaker, input models.ConnectionInput) (*models.BugConnection, error) { var nodes []string var edges []LazyBugEdge var cursors []string diff --git a/graphql/connections/gen_lazy_identity.go b/graphql/connections/gen_lazy_identity.go index 28501171ba839741c1591934cf69e2e0d90b0ba0..8bb2097dbf5c8c2f4cef136bd1335db5785a649f 100644 --- a/graphql/connections/gen_lazy_identity.go +++ b/graphql/connections/gen_lazy_identity.go @@ -19,10 +19,10 @@ type LazyIdentityConMaker func( edges []LazyIdentityEdge, nodes []string, info models.PageInfo, - totalCount int) (models.IdentityConnection, error) + totalCount int) (*models.IdentityConnection, error) // LazyIdentityCon will paginate a source according to the input of a relay connection -func LazyIdentityCon(source []string, edgeMaker LazyIdentityEdgeMaker, conMaker LazyIdentityConMaker, input models.ConnectionInput) (models.IdentityConnection, error) { +func LazyIdentityCon(source []string, edgeMaker LazyIdentityEdgeMaker, conMaker LazyIdentityConMaker, input models.ConnectionInput) (*models.IdentityConnection, error) { var nodes []string var edges []LazyIdentityEdge var cursors []string diff --git a/graphql/connections/gen_operation.go b/graphql/connections/gen_operation.go index 3fbd724f793fff823dc6b7f9cdf6b797b330eb69..f9273f063283578e24e5f20cad1801df8eb408dd 100644 --- a/graphql/connections/gen_operation.go +++ b/graphql/connections/gen_operation.go @@ -20,10 +20,10 @@ type OperationConMaker func( edges []models.OperationEdge, nodes []bug.Operation, info models.PageInfo, - totalCount int) (models.OperationConnection, error) + totalCount int) (*models.OperationConnection, error) // OperationCon will paginate a source according to the input of a relay connection -func OperationCon(source []bug.Operation, edgeMaker OperationEdgeMaker, conMaker OperationConMaker, input models.ConnectionInput) (models.OperationConnection, error) { +func OperationCon(source []bug.Operation, edgeMaker OperationEdgeMaker, conMaker OperationConMaker, input models.ConnectionInput) (*models.OperationConnection, error) { var nodes []bug.Operation var edges []models.OperationEdge var cursors []string diff --git a/graphql/connections/gen_timeline.go b/graphql/connections/gen_timeline.go index 1a4b2fe5e019254f607795eebe6a3ec0105aacb4..ad3fbf5b4a0987f8eae731862857c044426c4c78 100644 --- a/graphql/connections/gen_timeline.go +++ b/graphql/connections/gen_timeline.go @@ -20,10 +20,10 @@ type TimelineItemConMaker func( edges []models.TimelineItemEdge, nodes []bug.TimelineItem, info models.PageInfo, - totalCount int) (models.TimelineItemConnection, error) + totalCount int) (*models.TimelineItemConnection, error) // TimelineItemCon will paginate a source according to the input of a relay connection -func TimelineItemCon(source []bug.TimelineItem, edgeMaker TimelineItemEdgeMaker, conMaker TimelineItemConMaker, input models.ConnectionInput) (models.TimelineItemConnection, error) { +func TimelineItemCon(source []bug.TimelineItem, edgeMaker TimelineItemEdgeMaker, conMaker TimelineItemConMaker, input models.ConnectionInput) (*models.TimelineItemConnection, error) { var nodes []bug.TimelineItem var edges []models.TimelineItemEdge var cursors []string diff --git a/graphql/graph/gen_graph.go b/graphql/graph/gen_graph.go index 9c0003f2cba8ac56df0c3e36f175423064a9d57a..516a474b9e9906a97cb8e76012e87dee340203f0 100644 --- a/graphql/graph/gen_graph.go +++ b/graphql/graph/gen_graph.go @@ -21,6 +21,8 @@ import ( "github.com/vektah/gqlparser/ast" ) +// region ************************** generated!.gotpl ************************** + // NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface. func NewExecutableSchema(cfg Config) graphql.ExecutableSchema { return &executableSchema{ @@ -61,39 +63,39 @@ type DirectiveRoot struct { type ComplexityRoot struct { AddCommentOperation struct { - Hash func(childComplexity int) int Author func(childComplexity int) int Date func(childComplexity int) int - Message func(childComplexity int) int Files func(childComplexity int) int + Hash func(childComplexity int) int + Message func(childComplexity int) int } AddCommentTimelineItem struct { - Hash func(childComplexity int) int Author func(childComplexity int) int - Message func(childComplexity int) int - MessageIsEmpty func(childComplexity int) int - Files func(childComplexity int) int CreatedAt func(childComplexity int) int - LastEdit func(childComplexity int) int Edited func(childComplexity int) int + Files func(childComplexity int) int + Hash func(childComplexity int) int History func(childComplexity int) int + LastEdit func(childComplexity int) int + Message func(childComplexity int) int + MessageIsEmpty func(childComplexity int) int } Bug struct { - Id func(childComplexity int) int - HumanId func(childComplexity int) int - Status func(childComplexity int) int - Title func(childComplexity int) int - Labels func(childComplexity int) int + Actors func(childComplexity int, after *string, before *string, first *int, last *int) int Author func(childComplexity int) int + Comments func(childComplexity int, after *string, before *string, first *int, last *int) int CreatedAt func(childComplexity int) int + HumanId func(childComplexity int) int + Id func(childComplexity int) int + Labels func(childComplexity int) int LastEdit func(childComplexity int) int - Actors func(childComplexity int, after *string, before *string, first *int, last *int) int + Operations func(childComplexity int, after *string, before *string, first *int, last *int) int Participants func(childComplexity int, after *string, before *string, first *int, last *int) int - Comments func(childComplexity int, after *string, before *string, first *int, last *int) int + Status func(childComplexity int) int Timeline func(childComplexity int, after *string, before *string, first *int, last *int) int - Operations func(childComplexity int, after *string, before *string, first *int, last *int) int + Title func(childComplexity int) int } BugConnection struct { @@ -110,8 +112,8 @@ type ComplexityRoot struct { Comment struct { Author func(childComplexity int) int - Message func(childComplexity int) int Files func(childComplexity int) int + Message func(childComplexity int) int } CommentConnection struct { @@ -127,49 +129,49 @@ type ComplexityRoot struct { } CommentHistoryStep struct { - Message func(childComplexity int) int Date func(childComplexity int) int + Message func(childComplexity int) int } CreateOperation struct { - Hash func(childComplexity int) int Author func(childComplexity int) int Date func(childComplexity int) int - Title func(childComplexity int) int - Message func(childComplexity int) int Files func(childComplexity int) int + Hash func(childComplexity int) int + Message func(childComplexity int) int + Title func(childComplexity int) int } CreateTimelineItem struct { - Hash func(childComplexity int) int Author func(childComplexity int) int - Message func(childComplexity int) int - MessageIsEmpty func(childComplexity int) int - Files func(childComplexity int) int CreatedAt func(childComplexity int) int - LastEdit func(childComplexity int) int Edited func(childComplexity int) int + Files func(childComplexity int) int + Hash func(childComplexity int) int History func(childComplexity int) int + LastEdit func(childComplexity int) int + Message func(childComplexity int) int + MessageIsEmpty func(childComplexity int) int } EditCommentOperation struct { - Hash func(childComplexity int) int Author func(childComplexity int) int Date func(childComplexity int) int - Target func(childComplexity int) int - Message func(childComplexity int) int Files func(childComplexity int) int + Hash func(childComplexity int) int + Message func(childComplexity int) int + Target func(childComplexity int) int } Identity struct { - Id func(childComplexity int) int - HumanId func(childComplexity int) int - Name func(childComplexity int) int - Email func(childComplexity int) int - Login func(childComplexity int) int + AvatarURL func(childComplexity int) int DisplayName func(childComplexity int) int - AvatarUrl func(childComplexity int) int + Email func(childComplexity int) int + HumanID func(childComplexity int) int + ID func(childComplexity int) int IsProtected func(childComplexity int) int + Login func(childComplexity int) int + Name func(childComplexity int) int } IdentityConnection struct { @@ -185,29 +187,29 @@ type ComplexityRoot struct { } LabelChangeOperation struct { - Hash func(childComplexity int) int + Added func(childComplexity int) int Author func(childComplexity int) int Date func(childComplexity int) int - Added func(childComplexity int) int + Hash func(childComplexity int) int Removed func(childComplexity int) int } LabelChangeTimelineItem struct { - Hash func(childComplexity int) int + Added func(childComplexity int) int Author func(childComplexity int) int Date func(childComplexity int) int - Added func(childComplexity int) int + Hash func(childComplexity int) int Removed func(childComplexity int) int } Mutation struct { - NewBug func(childComplexity int, repoRef *string, title string, message string, files []git.Hash) int AddComment func(childComplexity int, repoRef *string, prefix string, message string, files []git.Hash) int ChangeLabels func(childComplexity int, repoRef *string, prefix string, added []string, removed []string) int - Open func(childComplexity int, repoRef *string, prefix string) int Close func(childComplexity int, repoRef *string, prefix string) int - SetTitle func(childComplexity int, repoRef *string, prefix string, title string) int Commit func(childComplexity int, repoRef *string, prefix string) int + NewBug func(childComplexity int, repoRef *string, title string, message string, files []git.Hash) int + Open func(childComplexity int, repoRef *string, prefix string) int + SetTitle func(childComplexity int, repoRef *string, prefix string, title string) int } OperationConnection struct { @@ -223,10 +225,10 @@ type ComplexityRoot struct { } PageInfo struct { + EndCursor func(childComplexity int) int HasNextPage func(childComplexity int) int HasPreviousPage func(childComplexity int) int StartCursor func(childComplexity int) int - EndCursor func(childComplexity int) int } Query struct { @@ -236,38 +238,38 @@ type ComplexityRoot struct { Repository struct { AllBugs func(childComplexity int, after *string, before *string, first *int, last *int, query *string) int - Bug func(childComplexity int, prefix string) int AllIdentities func(childComplexity int, after *string, before *string, first *int, last *int) int + Bug func(childComplexity int, prefix string) int Identity func(childComplexity int, prefix string) int UserIdentity func(childComplexity int) int } SetStatusOperation struct { - Hash func(childComplexity int) int Author func(childComplexity int) int Date func(childComplexity int) int + Hash func(childComplexity int) int Status func(childComplexity int) int } SetStatusTimelineItem struct { - Hash func(childComplexity int) int Author func(childComplexity int) int Date func(childComplexity int) int + Hash func(childComplexity int) int Status func(childComplexity int) int } SetTitleOperation struct { - Hash func(childComplexity int) int Author func(childComplexity int) int Date func(childComplexity int) int + Hash func(childComplexity int) int Title func(childComplexity int) int Was func(childComplexity int) int } SetTitleTimelineItem struct { - Hash func(childComplexity int) int Author func(childComplexity int) int Date func(childComplexity int) int + Hash func(childComplexity int) int Title func(childComplexity int) int Was func(childComplexity int) int } @@ -286,34 +288,34 @@ type ComplexityRoot struct { } type AddCommentOperationResolver interface { - Date(ctx context.Context, obj *bug.AddCommentOperation) (time.Time, error) + Date(ctx context.Context, obj *bug.AddCommentOperation) (*time.Time, error) } type AddCommentTimelineItemResolver interface { - CreatedAt(ctx context.Context, obj *bug.AddCommentTimelineItem) (time.Time, error) - LastEdit(ctx context.Context, obj *bug.AddCommentTimelineItem) (time.Time, error) + CreatedAt(ctx context.Context, obj *bug.AddCommentTimelineItem) (*time.Time, error) + LastEdit(ctx context.Context, obj *bug.AddCommentTimelineItem) (*time.Time, error) } type BugResolver interface { Status(ctx context.Context, obj *bug.Snapshot) (models.Status, error) - LastEdit(ctx context.Context, obj *bug.Snapshot) (time.Time, error) - Actors(ctx context.Context, obj *bug.Snapshot, after *string, before *string, first *int, last *int) (models.IdentityConnection, error) - Participants(ctx context.Context, obj *bug.Snapshot, after *string, before *string, first *int, last *int) (models.IdentityConnection, error) - Comments(ctx context.Context, obj *bug.Snapshot, after *string, before *string, first *int, last *int) (models.CommentConnection, error) - Timeline(ctx context.Context, obj *bug.Snapshot, after *string, before *string, first *int, last *int) (models.TimelineItemConnection, error) - Operations(ctx context.Context, obj *bug.Snapshot, after *string, before *string, first *int, last *int) (models.OperationConnection, error) + LastEdit(ctx context.Context, obj *bug.Snapshot) (*time.Time, error) + Actors(ctx context.Context, obj *bug.Snapshot, after *string, before *string, first *int, last *int) (*models.IdentityConnection, error) + Participants(ctx context.Context, obj *bug.Snapshot, after *string, before *string, first *int, last *int) (*models.IdentityConnection, error) + Comments(ctx context.Context, obj *bug.Snapshot, after *string, before *string, first *int, last *int) (*models.CommentConnection, error) + Timeline(ctx context.Context, obj *bug.Snapshot, after *string, before *string, first *int, last *int) (*models.TimelineItemConnection, error) + Operations(ctx context.Context, obj *bug.Snapshot, after *string, before *string, first *int, last *int) (*models.OperationConnection, error) } type CommentHistoryStepResolver interface { - Date(ctx context.Context, obj *bug.CommentHistoryStep) (time.Time, error) + Date(ctx context.Context, obj *bug.CommentHistoryStep) (*time.Time, error) } type CreateOperationResolver interface { - Date(ctx context.Context, obj *bug.CreateOperation) (time.Time, error) + Date(ctx context.Context, obj *bug.CreateOperation) (*time.Time, error) } type CreateTimelineItemResolver interface { - CreatedAt(ctx context.Context, obj *bug.CreateTimelineItem) (time.Time, error) - LastEdit(ctx context.Context, obj *bug.CreateTimelineItem) (time.Time, error) + CreatedAt(ctx context.Context, obj *bug.CreateTimelineItem) (*time.Time, error) + LastEdit(ctx context.Context, obj *bug.CreateTimelineItem) (*time.Time, error) } type EditCommentOperationResolver interface { - Date(ctx context.Context, obj *bug.EditCommentOperation) (time.Time, error) + Date(ctx context.Context, obj *bug.EditCommentOperation) (*time.Time, error) } type IdentityResolver interface { ID(ctx context.Context, obj *identity.Interface) (string, error) @@ -326,2060 +328,3809 @@ type IdentityResolver interface { IsProtected(ctx context.Context, obj *identity.Interface) (bool, error) } type LabelChangeOperationResolver interface { - Date(ctx context.Context, obj *bug.LabelChangeOperation) (time.Time, error) + Date(ctx context.Context, obj *bug.LabelChangeOperation) (*time.Time, error) } type LabelChangeTimelineItemResolver interface { - Date(ctx context.Context, obj *bug.LabelChangeTimelineItem) (time.Time, error) + Date(ctx context.Context, obj *bug.LabelChangeTimelineItem) (*time.Time, error) } type MutationResolver interface { - NewBug(ctx context.Context, repoRef *string, title string, message string, files []git.Hash) (bug.Snapshot, error) - AddComment(ctx context.Context, repoRef *string, prefix string, message string, files []git.Hash) (bug.Snapshot, error) - ChangeLabels(ctx context.Context, repoRef *string, prefix string, added []string, removed []string) (bug.Snapshot, error) - Open(ctx context.Context, repoRef *string, prefix string) (bug.Snapshot, error) - Close(ctx context.Context, repoRef *string, prefix string) (bug.Snapshot, error) - SetTitle(ctx context.Context, repoRef *string, prefix string, title string) (bug.Snapshot, error) - Commit(ctx context.Context, repoRef *string, prefix string) (bug.Snapshot, error) + NewBug(ctx context.Context, repoRef *string, title string, message string, files []git.Hash) (*bug.Snapshot, error) + AddComment(ctx context.Context, repoRef *string, prefix string, message string, files []git.Hash) (*bug.Snapshot, error) + ChangeLabels(ctx context.Context, repoRef *string, prefix string, added []string, removed []string) (*bug.Snapshot, error) + Open(ctx context.Context, repoRef *string, prefix string) (*bug.Snapshot, error) + Close(ctx context.Context, repoRef *string, prefix string) (*bug.Snapshot, error) + SetTitle(ctx context.Context, repoRef *string, prefix string, title string) (*bug.Snapshot, error) + Commit(ctx context.Context, repoRef *string, prefix string) (*bug.Snapshot, error) } type QueryResolver interface { DefaultRepository(ctx context.Context) (*models.Repository, error) Repository(ctx context.Context, id string) (*models.Repository, error) } type RepositoryResolver interface { - AllBugs(ctx context.Context, obj *models.Repository, after *string, before *string, first *int, last *int, query *string) (models.BugConnection, error) + AllBugs(ctx context.Context, obj *models.Repository, after *string, before *string, first *int, last *int, query *string) (*models.BugConnection, error) Bug(ctx context.Context, obj *models.Repository, prefix string) (*bug.Snapshot, error) - AllIdentities(ctx context.Context, obj *models.Repository, after *string, before *string, first *int, last *int) (models.IdentityConnection, error) - Identity(ctx context.Context, obj *models.Repository, prefix string) (*identity.Interface, error) - UserIdentity(ctx context.Context, obj *models.Repository) (*identity.Interface, error) + AllIdentities(ctx context.Context, obj *models.Repository, after *string, before *string, first *int, last *int) (*models.IdentityConnection, error) + Identity(ctx context.Context, obj *models.Repository, prefix string) (identity.Interface, error) + UserIdentity(ctx context.Context, obj *models.Repository) (identity.Interface, error) } type SetStatusOperationResolver interface { - Date(ctx context.Context, obj *bug.SetStatusOperation) (time.Time, error) + Date(ctx context.Context, obj *bug.SetStatusOperation) (*time.Time, error) Status(ctx context.Context, obj *bug.SetStatusOperation) (models.Status, error) } type SetStatusTimelineItemResolver interface { - Date(ctx context.Context, obj *bug.SetStatusTimelineItem) (time.Time, error) + Date(ctx context.Context, obj *bug.SetStatusTimelineItem) (*time.Time, error) Status(ctx context.Context, obj *bug.SetStatusTimelineItem) (models.Status, error) } type SetTitleOperationResolver interface { - Date(ctx context.Context, obj *bug.SetTitleOperation) (time.Time, error) + Date(ctx context.Context, obj *bug.SetTitleOperation) (*time.Time, error) } type SetTitleTimelineItemResolver interface { - Date(ctx context.Context, obj *bug.SetTitleTimelineItem) (time.Time, error) + Date(ctx context.Context, obj *bug.SetTitleTimelineItem) (*time.Time, error) } -func field_Bug_actors_args(rawArgs map[string]interface{}) (map[string]interface{}, error) { - args := map[string]interface{}{} - var arg0 *string - if tmp, ok := rawArgs["after"]; ok { - var err error - var ptr1 string - if tmp != nil { - ptr1, err = graphql.UnmarshalString(tmp) - arg0 = &ptr1 - } +type executableSchema struct { + resolvers ResolverRoot + directives DirectiveRoot + complexity ComplexityRoot +} - if err != nil { - return nil, err - } - } - args["after"] = arg0 - var arg1 *string - if tmp, ok := rawArgs["before"]; ok { - var err error - var ptr1 string - if tmp != nil { - ptr1, err = graphql.UnmarshalString(tmp) - arg1 = &ptr1 - } +func (e *executableSchema) Schema() *ast.Schema { + return parsedSchema +} - if err != nil { - return nil, err - } - } - args["before"] = arg1 - var arg2 *int - if tmp, ok := rawArgs["first"]; ok { - var err error - var ptr1 int - if tmp != nil { - ptr1, err = graphql.UnmarshalInt(tmp) - arg2 = &ptr1 +func (e *executableSchema) Complexity(typeName, field string, childComplexity int, rawArgs map[string]interface{}) (int, bool) { + ec := executionContext{nil, e} + _ = ec + switch typeName + "." + field { + + case "AddCommentOperation.Author": + if e.complexity.AddCommentOperation.Author == nil { + break } - if err != nil { - return nil, err + return e.complexity.AddCommentOperation.Author(childComplexity), true + + case "AddCommentOperation.Date": + if e.complexity.AddCommentOperation.Date == nil { + break } - } - args["first"] = arg2 - var arg3 *int - if tmp, ok := rawArgs["last"]; ok { - var err error - var ptr1 int - if tmp != nil { - ptr1, err = graphql.UnmarshalInt(tmp) - arg3 = &ptr1 + + return e.complexity.AddCommentOperation.Date(childComplexity), true + + case "AddCommentOperation.Files": + if e.complexity.AddCommentOperation.Files == nil { + break } - if err != nil { - return nil, err + return e.complexity.AddCommentOperation.Files(childComplexity), true + + case "AddCommentOperation.Hash": + if e.complexity.AddCommentOperation.Hash == nil { + break } - } - args["last"] = arg3 - return args, nil -} + return e.complexity.AddCommentOperation.Hash(childComplexity), true -func field_Bug_participants_args(rawArgs map[string]interface{}) (map[string]interface{}, error) { - args := map[string]interface{}{} - var arg0 *string - if tmp, ok := rawArgs["after"]; ok { - var err error - var ptr1 string - if tmp != nil { - ptr1, err = graphql.UnmarshalString(tmp) - arg0 = &ptr1 + case "AddCommentOperation.Message": + if e.complexity.AddCommentOperation.Message == nil { + break } - if err != nil { - return nil, err + return e.complexity.AddCommentOperation.Message(childComplexity), true + + case "AddCommentTimelineItem.Author": + if e.complexity.AddCommentTimelineItem.Author == nil { + break } - } - args["after"] = arg0 - var arg1 *string - if tmp, ok := rawArgs["before"]; ok { - var err error - var ptr1 string - if tmp != nil { - ptr1, err = graphql.UnmarshalString(tmp) - arg1 = &ptr1 + + return e.complexity.AddCommentTimelineItem.Author(childComplexity), true + + case "AddCommentTimelineItem.CreatedAt": + if e.complexity.AddCommentTimelineItem.CreatedAt == nil { + break } - if err != nil { - return nil, err + return e.complexity.AddCommentTimelineItem.CreatedAt(childComplexity), true + + case "AddCommentTimelineItem.Edited": + if e.complexity.AddCommentTimelineItem.Edited == nil { + break } - } - args["before"] = arg1 - var arg2 *int - if tmp, ok := rawArgs["first"]; ok { - var err error - var ptr1 int - if tmp != nil { - ptr1, err = graphql.UnmarshalInt(tmp) - arg2 = &ptr1 + + return e.complexity.AddCommentTimelineItem.Edited(childComplexity), true + + case "AddCommentTimelineItem.Files": + if e.complexity.AddCommentTimelineItem.Files == nil { + break } - if err != nil { - return nil, err + return e.complexity.AddCommentTimelineItem.Files(childComplexity), true + + case "AddCommentTimelineItem.Hash": + if e.complexity.AddCommentTimelineItem.Hash == nil { + break } - } - args["first"] = arg2 - var arg3 *int - if tmp, ok := rawArgs["last"]; ok { - var err error - var ptr1 int - if tmp != nil { - ptr1, err = graphql.UnmarshalInt(tmp) - arg3 = &ptr1 + + return e.complexity.AddCommentTimelineItem.Hash(childComplexity), true + + case "AddCommentTimelineItem.History": + if e.complexity.AddCommentTimelineItem.History == nil { + break } - if err != nil { - return nil, err + return e.complexity.AddCommentTimelineItem.History(childComplexity), true + + case "AddCommentTimelineItem.LastEdit": + if e.complexity.AddCommentTimelineItem.LastEdit == nil { + break } - } - args["last"] = arg3 - return args, nil -} + return e.complexity.AddCommentTimelineItem.LastEdit(childComplexity), true -func field_Bug_comments_args(rawArgs map[string]interface{}) (map[string]interface{}, error) { - args := map[string]interface{}{} - var arg0 *string - if tmp, ok := rawArgs["after"]; ok { - var err error - var ptr1 string - if tmp != nil { - ptr1, err = graphql.UnmarshalString(tmp) - arg0 = &ptr1 + case "AddCommentTimelineItem.Message": + if e.complexity.AddCommentTimelineItem.Message == nil { + break } - if err != nil { - return nil, err + return e.complexity.AddCommentTimelineItem.Message(childComplexity), true + + case "AddCommentTimelineItem.MessageIsEmpty": + if e.complexity.AddCommentTimelineItem.MessageIsEmpty == nil { + break } - } - args["after"] = arg0 - var arg1 *string - if tmp, ok := rawArgs["before"]; ok { - var err error - var ptr1 string - if tmp != nil { - ptr1, err = graphql.UnmarshalString(tmp) - arg1 = &ptr1 + + return e.complexity.AddCommentTimelineItem.MessageIsEmpty(childComplexity), true + + case "Bug.Actors": + if e.complexity.Bug.Actors == nil { + break } + args, err := ec.field_Bug_actors_args(context.TODO(), rawArgs) if err != nil { - return nil, err - } - } - args["before"] = arg1 - var arg2 *int - if tmp, ok := rawArgs["first"]; ok { - var err error - var ptr1 int - if tmp != nil { - ptr1, err = graphql.UnmarshalInt(tmp) - arg2 = &ptr1 + return 0, false } - if err != nil { - return nil, err + return e.complexity.Bug.Actors(childComplexity, args["after"].(*string), args["before"].(*string), args["first"].(*int), args["last"].(*int)), true + + case "Bug.Author": + if e.complexity.Bug.Author == nil { + break } - } - args["first"] = arg2 - var arg3 *int - if tmp, ok := rawArgs["last"]; ok { - var err error - var ptr1 int - if tmp != nil { - ptr1, err = graphql.UnmarshalInt(tmp) - arg3 = &ptr1 + + return e.complexity.Bug.Author(childComplexity), true + + case "Bug.Comments": + if e.complexity.Bug.Comments == nil { + break } + args, err := ec.field_Bug_comments_args(context.TODO(), rawArgs) if err != nil { - return nil, err + return 0, false } - } - args["last"] = arg3 - return args, nil -} + return e.complexity.Bug.Comments(childComplexity, args["after"].(*string), args["before"].(*string), args["first"].(*int), args["last"].(*int)), true -func field_Bug_timeline_args(rawArgs map[string]interface{}) (map[string]interface{}, error) { - args := map[string]interface{}{} - var arg0 *string - if tmp, ok := rawArgs["after"]; ok { - var err error - var ptr1 string - if tmp != nil { - ptr1, err = graphql.UnmarshalString(tmp) - arg0 = &ptr1 + case "Bug.CreatedAt": + if e.complexity.Bug.CreatedAt == nil { + break } - if err != nil { - return nil, err - } - } - args["after"] = arg0 - var arg1 *string - if tmp, ok := rawArgs["before"]; ok { - var err error - var ptr1 string - if tmp != nil { - ptr1, err = graphql.UnmarshalString(tmp) - arg1 = &ptr1 + return e.complexity.Bug.CreatedAt(childComplexity), true + + case "Bug.HumanId": + if e.complexity.Bug.HumanId == nil { + break } - if err != nil { - return nil, err + return e.complexity.Bug.HumanId(childComplexity), true + + case "Bug.Id": + if e.complexity.Bug.Id == nil { + break } - } - args["before"] = arg1 - var arg2 *int - if tmp, ok := rawArgs["first"]; ok { - var err error - var ptr1 int - if tmp != nil { - ptr1, err = graphql.UnmarshalInt(tmp) - arg2 = &ptr1 + + return e.complexity.Bug.Id(childComplexity), true + + case "Bug.Labels": + if e.complexity.Bug.Labels == nil { + break } - if err != nil { - return nil, err + return e.complexity.Bug.Labels(childComplexity), true + + case "Bug.LastEdit": + if e.complexity.Bug.LastEdit == nil { + break } - } - args["first"] = arg2 - var arg3 *int - if tmp, ok := rawArgs["last"]; ok { - var err error - var ptr1 int - if tmp != nil { - ptr1, err = graphql.UnmarshalInt(tmp) - arg3 = &ptr1 + + return e.complexity.Bug.LastEdit(childComplexity), true + + case "Bug.Operations": + if e.complexity.Bug.Operations == nil { + break } + args, err := ec.field_Bug_operations_args(context.TODO(), rawArgs) if err != nil { - return nil, err + return 0, false } - } - args["last"] = arg3 - return args, nil -} + return e.complexity.Bug.Operations(childComplexity, args["after"].(*string), args["before"].(*string), args["first"].(*int), args["last"].(*int)), true -func field_Bug_operations_args(rawArgs map[string]interface{}) (map[string]interface{}, error) { - args := map[string]interface{}{} - var arg0 *string - if tmp, ok := rawArgs["after"]; ok { - var err error - var ptr1 string - if tmp != nil { - ptr1, err = graphql.UnmarshalString(tmp) - arg0 = &ptr1 + case "Bug.Participants": + if e.complexity.Bug.Participants == nil { + break } + args, err := ec.field_Bug_participants_args(context.TODO(), rawArgs) if err != nil { - return nil, err - } - } - args["after"] = arg0 - var arg1 *string - if tmp, ok := rawArgs["before"]; ok { - var err error - var ptr1 string - if tmp != nil { - ptr1, err = graphql.UnmarshalString(tmp) - arg1 = &ptr1 + return 0, false } - if err != nil { - return nil, err + return e.complexity.Bug.Participants(childComplexity, args["after"].(*string), args["before"].(*string), args["first"].(*int), args["last"].(*int)), true + + case "Bug.Status": + if e.complexity.Bug.Status == nil { + break } - } - args["before"] = arg1 - var arg2 *int - if tmp, ok := rawArgs["first"]; ok { - var err error - var ptr1 int - if tmp != nil { - ptr1, err = graphql.UnmarshalInt(tmp) - arg2 = &ptr1 + + return e.complexity.Bug.Status(childComplexity), true + + case "Bug.Timeline": + if e.complexity.Bug.Timeline == nil { + break } + args, err := ec.field_Bug_timeline_args(context.TODO(), rawArgs) if err != nil { - return nil, err - } - } - args["first"] = arg2 - var arg3 *int - if tmp, ok := rawArgs["last"]; ok { - var err error - var ptr1 int - if tmp != nil { - ptr1, err = graphql.UnmarshalInt(tmp) - arg3 = &ptr1 + return 0, false } - if err != nil { - return nil, err + return e.complexity.Bug.Timeline(childComplexity, args["after"].(*string), args["before"].(*string), args["first"].(*int), args["last"].(*int)), true + + case "Bug.Title": + if e.complexity.Bug.Title == nil { + break } - } - args["last"] = arg3 - return args, nil -} + return e.complexity.Bug.Title(childComplexity), true -func field_Mutation_newBug_args(rawArgs map[string]interface{}) (map[string]interface{}, error) { - args := map[string]interface{}{} - var arg0 *string - if tmp, ok := rawArgs["repoRef"]; ok { - var err error - var ptr1 string - if tmp != nil { - ptr1, err = graphql.UnmarshalString(tmp) - arg0 = &ptr1 + case "BugConnection.Edges": + if e.complexity.BugConnection.Edges == nil { + break } - if err != nil { - return nil, err + return e.complexity.BugConnection.Edges(childComplexity), true + + case "BugConnection.Nodes": + if e.complexity.BugConnection.Nodes == nil { + break } - } - args["repoRef"] = arg0 - var arg1 string - if tmp, ok := rawArgs["title"]; ok { - var err error - arg1, err = graphql.UnmarshalString(tmp) - if err != nil { - return nil, err + + return e.complexity.BugConnection.Nodes(childComplexity), true + + case "BugConnection.PageInfo": + if e.complexity.BugConnection.PageInfo == nil { + break } - } - args["title"] = arg1 - var arg2 string - if tmp, ok := rawArgs["message"]; ok { - var err error - arg2, err = graphql.UnmarshalString(tmp) - if err != nil { - return nil, err + + return e.complexity.BugConnection.PageInfo(childComplexity), true + + case "BugConnection.TotalCount": + if e.complexity.BugConnection.TotalCount == nil { + break } - } - args["message"] = arg2 - var arg3 []git.Hash - if tmp, ok := rawArgs["files"]; ok { - var err error - var rawIf1 []interface{} - if tmp != nil { - if tmp1, ok := tmp.([]interface{}); ok { - rawIf1 = tmp1 - } else { - rawIf1 = []interface{}{tmp} - } + + return e.complexity.BugConnection.TotalCount(childComplexity), true + + case "BugEdge.Cursor": + if e.complexity.BugEdge.Cursor == nil { + break } - arg3 = make([]git.Hash, len(rawIf1)) - for idx1 := range rawIf1 { - err = (&arg3[idx1]).UnmarshalGQL(rawIf1[idx1]) + + return e.complexity.BugEdge.Cursor(childComplexity), true + + case "BugEdge.Node": + if e.complexity.BugEdge.Node == nil { + break } - if err != nil { - return nil, err + + return e.complexity.BugEdge.Node(childComplexity), true + + case "Comment.Author": + if e.complexity.Comment.Author == nil { + break } - } - args["files"] = arg3 - return args, nil -} + return e.complexity.Comment.Author(childComplexity), true -func field_Mutation_addComment_args(rawArgs map[string]interface{}) (map[string]interface{}, error) { - args := map[string]interface{}{} - var arg0 *string - if tmp, ok := rawArgs["repoRef"]; ok { - var err error - var ptr1 string - if tmp != nil { - ptr1, err = graphql.UnmarshalString(tmp) - arg0 = &ptr1 + case "Comment.Files": + if e.complexity.Comment.Files == nil { + break } - if err != nil { - return nil, err + return e.complexity.Comment.Files(childComplexity), true + + case "Comment.Message": + if e.complexity.Comment.Message == nil { + break } - } - args["repoRef"] = arg0 - var arg1 string - if tmp, ok := rawArgs["prefix"]; ok { - var err error - arg1, err = graphql.UnmarshalString(tmp) - if err != nil { - return nil, err + + return e.complexity.Comment.Message(childComplexity), true + + case "CommentConnection.Edges": + if e.complexity.CommentConnection.Edges == nil { + break } - } - args["prefix"] = arg1 - var arg2 string - if tmp, ok := rawArgs["message"]; ok { - var err error - arg2, err = graphql.UnmarshalString(tmp) - if err != nil { - return nil, err + + return e.complexity.CommentConnection.Edges(childComplexity), true + + case "CommentConnection.Nodes": + if e.complexity.CommentConnection.Nodes == nil { + break } - } - args["message"] = arg2 - var arg3 []git.Hash - if tmp, ok := rawArgs["files"]; ok { - var err error - var rawIf1 []interface{} - if tmp != nil { - if tmp1, ok := tmp.([]interface{}); ok { - rawIf1 = tmp1 - } else { - rawIf1 = []interface{}{tmp} - } + + return e.complexity.CommentConnection.Nodes(childComplexity), true + + case "CommentConnection.PageInfo": + if e.complexity.CommentConnection.PageInfo == nil { + break } - arg3 = make([]git.Hash, len(rawIf1)) - for idx1 := range rawIf1 { - err = (&arg3[idx1]).UnmarshalGQL(rawIf1[idx1]) + + return e.complexity.CommentConnection.PageInfo(childComplexity), true + + case "CommentConnection.TotalCount": + if e.complexity.CommentConnection.TotalCount == nil { + break } - if err != nil { - return nil, err + + return e.complexity.CommentConnection.TotalCount(childComplexity), true + + case "CommentEdge.Cursor": + if e.complexity.CommentEdge.Cursor == nil { + break } - } - args["files"] = arg3 - return args, nil -} + return e.complexity.CommentEdge.Cursor(childComplexity), true -func field_Mutation_changeLabels_args(rawArgs map[string]interface{}) (map[string]interface{}, error) { - args := map[string]interface{}{} - var arg0 *string - if tmp, ok := rawArgs["repoRef"]; ok { - var err error - var ptr1 string - if tmp != nil { - ptr1, err = graphql.UnmarshalString(tmp) - arg0 = &ptr1 + case "CommentEdge.Node": + if e.complexity.CommentEdge.Node == nil { + break } - if err != nil { - return nil, err + return e.complexity.CommentEdge.Node(childComplexity), true + + case "CommentHistoryStep.Date": + if e.complexity.CommentHistoryStep.Date == nil { + break } - } - args["repoRef"] = arg0 - var arg1 string - if tmp, ok := rawArgs["prefix"]; ok { - var err error - arg1, err = graphql.UnmarshalString(tmp) - if err != nil { - return nil, err + + return e.complexity.CommentHistoryStep.Date(childComplexity), true + + case "CommentHistoryStep.Message": + if e.complexity.CommentHistoryStep.Message == nil { + break } - } - args["prefix"] = arg1 - var arg2 []string - if tmp, ok := rawArgs["added"]; ok { - var err error - var rawIf1 []interface{} - if tmp != nil { - if tmp1, ok := tmp.([]interface{}); ok { - rawIf1 = tmp1 - } else { - rawIf1 = []interface{}{tmp} - } + + return e.complexity.CommentHistoryStep.Message(childComplexity), true + + case "CreateOperation.Author": + if e.complexity.CreateOperation.Author == nil { + break } - arg2 = make([]string, len(rawIf1)) - for idx1 := range rawIf1 { - arg2[idx1], err = graphql.UnmarshalString(rawIf1[idx1]) + + return e.complexity.CreateOperation.Author(childComplexity), true + + case "CreateOperation.Date": + if e.complexity.CreateOperation.Date == nil { + break } - if err != nil { - return nil, err - } - } - args["added"] = arg2 - var arg3 []string - if tmp, ok := rawArgs["removed"]; ok { - var err error - var rawIf1 []interface{} - if tmp != nil { - if tmp1, ok := tmp.([]interface{}); ok { - rawIf1 = tmp1 - } else { - rawIf1 = []interface{}{tmp} - } - } - arg3 = make([]string, len(rawIf1)) - for idx1 := range rawIf1 { - arg3[idx1], err = graphql.UnmarshalString(rawIf1[idx1]) + + return e.complexity.CreateOperation.Date(childComplexity), true + + case "CreateOperation.Files": + if e.complexity.CreateOperation.Files == nil { + break } - if err != nil { - return nil, err + + return e.complexity.CreateOperation.Files(childComplexity), true + + case "CreateOperation.Hash": + if e.complexity.CreateOperation.Hash == nil { + break } - } - args["removed"] = arg3 - return args, nil -} + return e.complexity.CreateOperation.Hash(childComplexity), true -func field_Mutation_open_args(rawArgs map[string]interface{}) (map[string]interface{}, error) { - args := map[string]interface{}{} - var arg0 *string - if tmp, ok := rawArgs["repoRef"]; ok { - var err error - var ptr1 string - if tmp != nil { - ptr1, err = graphql.UnmarshalString(tmp) - arg0 = &ptr1 + case "CreateOperation.Message": + if e.complexity.CreateOperation.Message == nil { + break } - if err != nil { - return nil, err + return e.complexity.CreateOperation.Message(childComplexity), true + + case "CreateOperation.Title": + if e.complexity.CreateOperation.Title == nil { + break } - } - args["repoRef"] = arg0 - var arg1 string - if tmp, ok := rawArgs["prefix"]; ok { - var err error - arg1, err = graphql.UnmarshalString(tmp) - if err != nil { - return nil, err + + return e.complexity.CreateOperation.Title(childComplexity), true + + case "CreateTimelineItem.Author": + if e.complexity.CreateTimelineItem.Author == nil { + break } - } - args["prefix"] = arg1 - return args, nil -} + return e.complexity.CreateTimelineItem.Author(childComplexity), true -func field_Mutation_close_args(rawArgs map[string]interface{}) (map[string]interface{}, error) { - args := map[string]interface{}{} - var arg0 *string - if tmp, ok := rawArgs["repoRef"]; ok { - var err error - var ptr1 string - if tmp != nil { - ptr1, err = graphql.UnmarshalString(tmp) - arg0 = &ptr1 + case "CreateTimelineItem.CreatedAt": + if e.complexity.CreateTimelineItem.CreatedAt == nil { + break } - if err != nil { - return nil, err + return e.complexity.CreateTimelineItem.CreatedAt(childComplexity), true + + case "CreateTimelineItem.Edited": + if e.complexity.CreateTimelineItem.Edited == nil { + break } - } - args["repoRef"] = arg0 - var arg1 string - if tmp, ok := rawArgs["prefix"]; ok { - var err error - arg1, err = graphql.UnmarshalString(tmp) - if err != nil { - return nil, err + + return e.complexity.CreateTimelineItem.Edited(childComplexity), true + + case "CreateTimelineItem.Files": + if e.complexity.CreateTimelineItem.Files == nil { + break } - } - args["prefix"] = arg1 - return args, nil -} + return e.complexity.CreateTimelineItem.Files(childComplexity), true -func field_Mutation_setTitle_args(rawArgs map[string]interface{}) (map[string]interface{}, error) { - args := map[string]interface{}{} - var arg0 *string - if tmp, ok := rawArgs["repoRef"]; ok { - var err error - var ptr1 string - if tmp != nil { - ptr1, err = graphql.UnmarshalString(tmp) - arg0 = &ptr1 + case "CreateTimelineItem.Hash": + if e.complexity.CreateTimelineItem.Hash == nil { + break } - if err != nil { - return nil, err + return e.complexity.CreateTimelineItem.Hash(childComplexity), true + + case "CreateTimelineItem.History": + if e.complexity.CreateTimelineItem.History == nil { + break } - } - args["repoRef"] = arg0 - var arg1 string - if tmp, ok := rawArgs["prefix"]; ok { - var err error - arg1, err = graphql.UnmarshalString(tmp) - if err != nil { - return nil, err + + return e.complexity.CreateTimelineItem.History(childComplexity), true + + case "CreateTimelineItem.LastEdit": + if e.complexity.CreateTimelineItem.LastEdit == nil { + break } - } - args["prefix"] = arg1 - var arg2 string - if tmp, ok := rawArgs["title"]; ok { - var err error - arg2, err = graphql.UnmarshalString(tmp) - if err != nil { - return nil, err + + return e.complexity.CreateTimelineItem.LastEdit(childComplexity), true + + case "CreateTimelineItem.Message": + if e.complexity.CreateTimelineItem.Message == nil { + break } - } - args["title"] = arg2 - return args, nil -} + return e.complexity.CreateTimelineItem.Message(childComplexity), true -func field_Mutation_commit_args(rawArgs map[string]interface{}) (map[string]interface{}, error) { - args := map[string]interface{}{} - var arg0 *string - if tmp, ok := rawArgs["repoRef"]; ok { - var err error - var ptr1 string - if tmp != nil { - ptr1, err = graphql.UnmarshalString(tmp) - arg0 = &ptr1 + case "CreateTimelineItem.MessageIsEmpty": + if e.complexity.CreateTimelineItem.MessageIsEmpty == nil { + break } - if err != nil { - return nil, err + return e.complexity.CreateTimelineItem.MessageIsEmpty(childComplexity), true + + case "EditCommentOperation.Author": + if e.complexity.EditCommentOperation.Author == nil { + break } - } - args["repoRef"] = arg0 - var arg1 string - if tmp, ok := rawArgs["prefix"]; ok { - var err error - arg1, err = graphql.UnmarshalString(tmp) - if err != nil { - return nil, err + + return e.complexity.EditCommentOperation.Author(childComplexity), true + + case "EditCommentOperation.Date": + if e.complexity.EditCommentOperation.Date == nil { + break } - } - args["prefix"] = arg1 - return args, nil -} + return e.complexity.EditCommentOperation.Date(childComplexity), true -func field_Query_repository_args(rawArgs map[string]interface{}) (map[string]interface{}, error) { - args := map[string]interface{}{} - var arg0 string - if tmp, ok := rawArgs["id"]; ok { - var err error - arg0, err = graphql.UnmarshalString(tmp) - if err != nil { - return nil, err + case "EditCommentOperation.Files": + if e.complexity.EditCommentOperation.Files == nil { + break } - } - args["id"] = arg0 - return args, nil -} + return e.complexity.EditCommentOperation.Files(childComplexity), true -func field_Query___type_args(rawArgs map[string]interface{}) (map[string]interface{}, error) { - args := map[string]interface{}{} - var arg0 string - if tmp, ok := rawArgs["name"]; ok { - var err error - arg0, err = graphql.UnmarshalString(tmp) - if err != nil { - return nil, err + case "EditCommentOperation.Hash": + if e.complexity.EditCommentOperation.Hash == nil { + break } - } - args["name"] = arg0 - return args, nil -} + return e.complexity.EditCommentOperation.Hash(childComplexity), true -func field_Repository_allBugs_args(rawArgs map[string]interface{}) (map[string]interface{}, error) { - args := map[string]interface{}{} - var arg0 *string - if tmp, ok := rawArgs["after"]; ok { - var err error - var ptr1 string - if tmp != nil { - ptr1, err = graphql.UnmarshalString(tmp) - arg0 = &ptr1 + case "EditCommentOperation.Message": + if e.complexity.EditCommentOperation.Message == nil { + break } - if err != nil { - return nil, err + return e.complexity.EditCommentOperation.Message(childComplexity), true + + case "EditCommentOperation.Target": + if e.complexity.EditCommentOperation.Target == nil { + break } - } - args["after"] = arg0 - var arg1 *string - if tmp, ok := rawArgs["before"]; ok { - var err error - var ptr1 string - if tmp != nil { - ptr1, err = graphql.UnmarshalString(tmp) - arg1 = &ptr1 + + return e.complexity.EditCommentOperation.Target(childComplexity), true + + case "Identity.AvatarURL": + if e.complexity.Identity.AvatarURL == nil { + break } - if err != nil { - return nil, err + return e.complexity.Identity.AvatarURL(childComplexity), true + + case "Identity.DisplayName": + if e.complexity.Identity.DisplayName == nil { + break } - } - args["before"] = arg1 - var arg2 *int - if tmp, ok := rawArgs["first"]; ok { - var err error - var ptr1 int - if tmp != nil { - ptr1, err = graphql.UnmarshalInt(tmp) - arg2 = &ptr1 + + return e.complexity.Identity.DisplayName(childComplexity), true + + case "Identity.Email": + if e.complexity.Identity.Email == nil { + break } - if err != nil { - return nil, err + return e.complexity.Identity.Email(childComplexity), true + + case "Identity.HumanID": + if e.complexity.Identity.HumanID == nil { + break } - } - args["first"] = arg2 - var arg3 *int - if tmp, ok := rawArgs["last"]; ok { - var err error - var ptr1 int - if tmp != nil { - ptr1, err = graphql.UnmarshalInt(tmp) - arg3 = &ptr1 + + return e.complexity.Identity.HumanID(childComplexity), true + + case "Identity.ID": + if e.complexity.Identity.ID == nil { + break } - if err != nil { - return nil, err + return e.complexity.Identity.ID(childComplexity), true + + case "Identity.IsProtected": + if e.complexity.Identity.IsProtected == nil { + break } - } - args["last"] = arg3 - var arg4 *string - if tmp, ok := rawArgs["query"]; ok { - var err error - var ptr1 string - if tmp != nil { - ptr1, err = graphql.UnmarshalString(tmp) - arg4 = &ptr1 + + return e.complexity.Identity.IsProtected(childComplexity), true + + case "Identity.Login": + if e.complexity.Identity.Login == nil { + break } - if err != nil { - return nil, err + return e.complexity.Identity.Login(childComplexity), true + + case "Identity.Name": + if e.complexity.Identity.Name == nil { + break } - } - args["query"] = arg4 - return args, nil -} + return e.complexity.Identity.Name(childComplexity), true -func field_Repository_bug_args(rawArgs map[string]interface{}) (map[string]interface{}, error) { - args := map[string]interface{}{} - var arg0 string - if tmp, ok := rawArgs["prefix"]; ok { - var err error - arg0, err = graphql.UnmarshalString(tmp) - if err != nil { - return nil, err + case "IdentityConnection.Edges": + if e.complexity.IdentityConnection.Edges == nil { + break } - } - args["prefix"] = arg0 - return args, nil -} + return e.complexity.IdentityConnection.Edges(childComplexity), true -func field_Repository_allIdentities_args(rawArgs map[string]interface{}) (map[string]interface{}, error) { - args := map[string]interface{}{} - var arg0 *string - if tmp, ok := rawArgs["after"]; ok { - var err error - var ptr1 string - if tmp != nil { - ptr1, err = graphql.UnmarshalString(tmp) - arg0 = &ptr1 + case "IdentityConnection.Nodes": + if e.complexity.IdentityConnection.Nodes == nil { + break } - if err != nil { - return nil, err - } - } - args["after"] = arg0 - var arg1 *string - if tmp, ok := rawArgs["before"]; ok { - var err error - var ptr1 string - if tmp != nil { - ptr1, err = graphql.UnmarshalString(tmp) - arg1 = &ptr1 - } + return e.complexity.IdentityConnection.Nodes(childComplexity), true - if err != nil { - return nil, err + case "IdentityConnection.PageInfo": + if e.complexity.IdentityConnection.PageInfo == nil { + break } - } - args["before"] = arg1 - var arg2 *int - if tmp, ok := rawArgs["first"]; ok { - var err error - var ptr1 int - if tmp != nil { - ptr1, err = graphql.UnmarshalInt(tmp) - arg2 = &ptr1 + + return e.complexity.IdentityConnection.PageInfo(childComplexity), true + + case "IdentityConnection.TotalCount": + if e.complexity.IdentityConnection.TotalCount == nil { + break } - if err != nil { - return nil, err + return e.complexity.IdentityConnection.TotalCount(childComplexity), true + + case "IdentityEdge.Cursor": + if e.complexity.IdentityEdge.Cursor == nil { + break } - } - args["first"] = arg2 - var arg3 *int - if tmp, ok := rawArgs["last"]; ok { - var err error - var ptr1 int - if tmp != nil { - ptr1, err = graphql.UnmarshalInt(tmp) - arg3 = &ptr1 + + return e.complexity.IdentityEdge.Cursor(childComplexity), true + + case "IdentityEdge.Node": + if e.complexity.IdentityEdge.Node == nil { + break } - if err != nil { - return nil, err + return e.complexity.IdentityEdge.Node(childComplexity), true + + case "LabelChangeOperation.Added": + if e.complexity.LabelChangeOperation.Added == nil { + break } - } - args["last"] = arg3 - return args, nil -} + return e.complexity.LabelChangeOperation.Added(childComplexity), true -func field_Repository_identity_args(rawArgs map[string]interface{}) (map[string]interface{}, error) { - args := map[string]interface{}{} - var arg0 string - if tmp, ok := rawArgs["prefix"]; ok { - var err error - arg0, err = graphql.UnmarshalString(tmp) - if err != nil { - return nil, err + case "LabelChangeOperation.Author": + if e.complexity.LabelChangeOperation.Author == nil { + break } - } - args["prefix"] = arg0 - return args, nil -} + return e.complexity.LabelChangeOperation.Author(childComplexity), true -func field___Type_fields_args(rawArgs map[string]interface{}) (map[string]interface{}, error) { - args := map[string]interface{}{} - var arg0 bool - if tmp, ok := rawArgs["includeDeprecated"]; ok { - var err error - arg0, err = graphql.UnmarshalBoolean(tmp) - if err != nil { - return nil, err + case "LabelChangeOperation.Date": + if e.complexity.LabelChangeOperation.Date == nil { + break } - } - args["includeDeprecated"] = arg0 - return args, nil -} + return e.complexity.LabelChangeOperation.Date(childComplexity), true -func field___Type_enumValues_args(rawArgs map[string]interface{}) (map[string]interface{}, error) { - args := map[string]interface{}{} - var arg0 bool - if tmp, ok := rawArgs["includeDeprecated"]; ok { - var err error - arg0, err = graphql.UnmarshalBoolean(tmp) - if err != nil { - return nil, err + case "LabelChangeOperation.Hash": + if e.complexity.LabelChangeOperation.Hash == nil { + break } - } - args["includeDeprecated"] = arg0 - return args, nil -} + return e.complexity.LabelChangeOperation.Hash(childComplexity), true -type executableSchema struct { - resolvers ResolverRoot - directives DirectiveRoot - complexity ComplexityRoot -} + case "LabelChangeOperation.Removed": + if e.complexity.LabelChangeOperation.Removed == nil { + break + } -func (e *executableSchema) Schema() *ast.Schema { - return parsedSchema -} + return e.complexity.LabelChangeOperation.Removed(childComplexity), true -func (e *executableSchema) Complexity(typeName, field string, childComplexity int, rawArgs map[string]interface{}) (int, bool) { - switch typeName + "." + field { + case "LabelChangeTimelineItem.Added": + if e.complexity.LabelChangeTimelineItem.Added == nil { + break + } - case "AddCommentOperation.hash": - if e.complexity.AddCommentOperation.Hash == nil { + return e.complexity.LabelChangeTimelineItem.Added(childComplexity), true + + case "LabelChangeTimelineItem.Author": + if e.complexity.LabelChangeTimelineItem.Author == nil { break } - return e.complexity.AddCommentOperation.Hash(childComplexity), true + return e.complexity.LabelChangeTimelineItem.Author(childComplexity), true - case "AddCommentOperation.author": - if e.complexity.AddCommentOperation.Author == nil { + case "LabelChangeTimelineItem.Date": + if e.complexity.LabelChangeTimelineItem.Date == nil { break } - return e.complexity.AddCommentOperation.Author(childComplexity), true + return e.complexity.LabelChangeTimelineItem.Date(childComplexity), true - case "AddCommentOperation.date": - if e.complexity.AddCommentOperation.Date == nil { + case "LabelChangeTimelineItem.Hash": + if e.complexity.LabelChangeTimelineItem.Hash == nil { break } - return e.complexity.AddCommentOperation.Date(childComplexity), true + return e.complexity.LabelChangeTimelineItem.Hash(childComplexity), true - case "AddCommentOperation.message": - if e.complexity.AddCommentOperation.Message == nil { + case "LabelChangeTimelineItem.Removed": + if e.complexity.LabelChangeTimelineItem.Removed == nil { break } - return e.complexity.AddCommentOperation.Message(childComplexity), true + return e.complexity.LabelChangeTimelineItem.Removed(childComplexity), true - case "AddCommentOperation.files": - if e.complexity.AddCommentOperation.Files == nil { + case "Mutation.AddComment": + if e.complexity.Mutation.AddComment == nil { break } - return e.complexity.AddCommentOperation.Files(childComplexity), true + args, err := ec.field_Mutation_addComment_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } - case "AddCommentTimelineItem.hash": - if e.complexity.AddCommentTimelineItem.Hash == nil { + return e.complexity.Mutation.AddComment(childComplexity, args["repoRef"].(*string), args["prefix"].(string), args["message"].(string), args["files"].([]git.Hash)), true + + case "Mutation.ChangeLabels": + if e.complexity.Mutation.ChangeLabels == nil { break } - return e.complexity.AddCommentTimelineItem.Hash(childComplexity), true + args, err := ec.field_Mutation_changeLabels_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } - case "AddCommentTimelineItem.author": - if e.complexity.AddCommentTimelineItem.Author == nil { + return e.complexity.Mutation.ChangeLabels(childComplexity, args["repoRef"].(*string), args["prefix"].(string), args["added"].([]string), args["removed"].([]string)), true + + case "Mutation.Close": + if e.complexity.Mutation.Close == nil { break } - return e.complexity.AddCommentTimelineItem.Author(childComplexity), true + args, err := ec.field_Mutation_close_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } - case "AddCommentTimelineItem.message": - if e.complexity.AddCommentTimelineItem.Message == nil { + return e.complexity.Mutation.Close(childComplexity, args["repoRef"].(*string), args["prefix"].(string)), true + + case "Mutation.Commit": + if e.complexity.Mutation.Commit == nil { break } - return e.complexity.AddCommentTimelineItem.Message(childComplexity), true + args, err := ec.field_Mutation_commit_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } - case "AddCommentTimelineItem.messageIsEmpty": - if e.complexity.AddCommentTimelineItem.MessageIsEmpty == nil { + return e.complexity.Mutation.Commit(childComplexity, args["repoRef"].(*string), args["prefix"].(string)), true + + case "Mutation.NewBug": + if e.complexity.Mutation.NewBug == nil { break } - return e.complexity.AddCommentTimelineItem.MessageIsEmpty(childComplexity), true + args, err := ec.field_Mutation_newBug_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } - case "AddCommentTimelineItem.files": - if e.complexity.AddCommentTimelineItem.Files == nil { + return e.complexity.Mutation.NewBug(childComplexity, args["repoRef"].(*string), args["title"].(string), args["message"].(string), args["files"].([]git.Hash)), true + + case "Mutation.Open": + if e.complexity.Mutation.Open == nil { break } - return e.complexity.AddCommentTimelineItem.Files(childComplexity), true + args, err := ec.field_Mutation_open_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } - case "AddCommentTimelineItem.createdAt": - if e.complexity.AddCommentTimelineItem.CreatedAt == nil { + return e.complexity.Mutation.Open(childComplexity, args["repoRef"].(*string), args["prefix"].(string)), true + + case "Mutation.SetTitle": + if e.complexity.Mutation.SetTitle == nil { break } - return e.complexity.AddCommentTimelineItem.CreatedAt(childComplexity), true + args, err := ec.field_Mutation_setTitle_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } - case "AddCommentTimelineItem.lastEdit": - if e.complexity.AddCommentTimelineItem.LastEdit == nil { + return e.complexity.Mutation.SetTitle(childComplexity, args["repoRef"].(*string), args["prefix"].(string), args["title"].(string)), true + + case "OperationConnection.Edges": + if e.complexity.OperationConnection.Edges == nil { break } - return e.complexity.AddCommentTimelineItem.LastEdit(childComplexity), true + return e.complexity.OperationConnection.Edges(childComplexity), true - case "AddCommentTimelineItem.edited": - if e.complexity.AddCommentTimelineItem.Edited == nil { + case "OperationConnection.Nodes": + if e.complexity.OperationConnection.Nodes == nil { break } - return e.complexity.AddCommentTimelineItem.Edited(childComplexity), true + return e.complexity.OperationConnection.Nodes(childComplexity), true - case "AddCommentTimelineItem.history": - if e.complexity.AddCommentTimelineItem.History == nil { + case "OperationConnection.PageInfo": + if e.complexity.OperationConnection.PageInfo == nil { break } - return e.complexity.AddCommentTimelineItem.History(childComplexity), true + return e.complexity.OperationConnection.PageInfo(childComplexity), true - case "Bug.id": - if e.complexity.Bug.Id == nil { + case "OperationConnection.TotalCount": + if e.complexity.OperationConnection.TotalCount == nil { break } - return e.complexity.Bug.Id(childComplexity), true + return e.complexity.OperationConnection.TotalCount(childComplexity), true - case "Bug.humanId": - if e.complexity.Bug.HumanId == nil { + case "OperationEdge.Cursor": + if e.complexity.OperationEdge.Cursor == nil { break } - return e.complexity.Bug.HumanId(childComplexity), true + return e.complexity.OperationEdge.Cursor(childComplexity), true - case "Bug.status": - if e.complexity.Bug.Status == nil { + case "OperationEdge.Node": + if e.complexity.OperationEdge.Node == nil { break } - return e.complexity.Bug.Status(childComplexity), true + return e.complexity.OperationEdge.Node(childComplexity), true - case "Bug.title": - if e.complexity.Bug.Title == nil { + case "PageInfo.EndCursor": + if e.complexity.PageInfo.EndCursor == nil { break } - return e.complexity.Bug.Title(childComplexity), true + return e.complexity.PageInfo.EndCursor(childComplexity), true - case "Bug.labels": - if e.complexity.Bug.Labels == nil { + case "PageInfo.HasNextPage": + if e.complexity.PageInfo.HasNextPage == nil { break } - return e.complexity.Bug.Labels(childComplexity), true + return e.complexity.PageInfo.HasNextPage(childComplexity), true - case "Bug.author": - if e.complexity.Bug.Author == nil { + case "PageInfo.HasPreviousPage": + if e.complexity.PageInfo.HasPreviousPage == nil { break } - return e.complexity.Bug.Author(childComplexity), true + return e.complexity.PageInfo.HasPreviousPage(childComplexity), true - case "Bug.createdAt": - if e.complexity.Bug.CreatedAt == nil { + case "PageInfo.StartCursor": + if e.complexity.PageInfo.StartCursor == nil { break } - return e.complexity.Bug.CreatedAt(childComplexity), true + return e.complexity.PageInfo.StartCursor(childComplexity), true - case "Bug.lastEdit": - if e.complexity.Bug.LastEdit == nil { + case "Query.DefaultRepository": + if e.complexity.Query.DefaultRepository == nil { break } - return e.complexity.Bug.LastEdit(childComplexity), true + return e.complexity.Query.DefaultRepository(childComplexity), true - case "Bug.actors": - if e.complexity.Bug.Actors == nil { + case "Query.Repository": + if e.complexity.Query.Repository == nil { break } - args, err := field_Bug_actors_args(rawArgs) + args, err := ec.field_Query_repository_args(context.TODO(), rawArgs) if err != nil { return 0, false } - return e.complexity.Bug.Actors(childComplexity, args["after"].(*string), args["before"].(*string), args["first"].(*int), args["last"].(*int)), true + return e.complexity.Query.Repository(childComplexity, args["id"].(string)), true - case "Bug.participants": - if e.complexity.Bug.Participants == nil { + case "Repository.AllBugs": + if e.complexity.Repository.AllBugs == nil { break } - args, err := field_Bug_participants_args(rawArgs) + args, err := ec.field_Repository_allBugs_args(context.TODO(), rawArgs) if err != nil { return 0, false } - return e.complexity.Bug.Participants(childComplexity, args["after"].(*string), args["before"].(*string), args["first"].(*int), args["last"].(*int)), true + return e.complexity.Repository.AllBugs(childComplexity, args["after"].(*string), args["before"].(*string), args["first"].(*int), args["last"].(*int), args["query"].(*string)), true - case "Bug.comments": - if e.complexity.Bug.Comments == nil { + case "Repository.AllIdentities": + if e.complexity.Repository.AllIdentities == nil { break } - args, err := field_Bug_comments_args(rawArgs) + args, err := ec.field_Repository_allIdentities_args(context.TODO(), rawArgs) if err != nil { return 0, false } - return e.complexity.Bug.Comments(childComplexity, args["after"].(*string), args["before"].(*string), args["first"].(*int), args["last"].(*int)), true + return e.complexity.Repository.AllIdentities(childComplexity, args["after"].(*string), args["before"].(*string), args["first"].(*int), args["last"].(*int)), true - case "Bug.timeline": - if e.complexity.Bug.Timeline == nil { + case "Repository.Bug": + if e.complexity.Repository.Bug == nil { break } - args, err := field_Bug_timeline_args(rawArgs) + args, err := ec.field_Repository_bug_args(context.TODO(), rawArgs) if err != nil { return 0, false } - return e.complexity.Bug.Timeline(childComplexity, args["after"].(*string), args["before"].(*string), args["first"].(*int), args["last"].(*int)), true + return e.complexity.Repository.Bug(childComplexity, args["prefix"].(string)), true - case "Bug.operations": - if e.complexity.Bug.Operations == nil { + case "Repository.Identity": + if e.complexity.Repository.Identity == nil { break } - args, err := field_Bug_operations_args(rawArgs) + args, err := ec.field_Repository_identity_args(context.TODO(), rawArgs) if err != nil { return 0, false } - return e.complexity.Bug.Operations(childComplexity, args["after"].(*string), args["before"].(*string), args["first"].(*int), args["last"].(*int)), true + return e.complexity.Repository.Identity(childComplexity, args["prefix"].(string)), true - case "BugConnection.edges": - if e.complexity.BugConnection.Edges == nil { + case "Repository.UserIdentity": + if e.complexity.Repository.UserIdentity == nil { break } - return e.complexity.BugConnection.Edges(childComplexity), true + return e.complexity.Repository.UserIdentity(childComplexity), true - case "BugConnection.nodes": - if e.complexity.BugConnection.Nodes == nil { + case "SetStatusOperation.Author": + if e.complexity.SetStatusOperation.Author == nil { break } - return e.complexity.BugConnection.Nodes(childComplexity), true + return e.complexity.SetStatusOperation.Author(childComplexity), true - case "BugConnection.pageInfo": - if e.complexity.BugConnection.PageInfo == nil { + case "SetStatusOperation.Date": + if e.complexity.SetStatusOperation.Date == nil { break } - return e.complexity.BugConnection.PageInfo(childComplexity), true + return e.complexity.SetStatusOperation.Date(childComplexity), true - case "BugConnection.totalCount": - if e.complexity.BugConnection.TotalCount == nil { + case "SetStatusOperation.Hash": + if e.complexity.SetStatusOperation.Hash == nil { break } - return e.complexity.BugConnection.TotalCount(childComplexity), true + return e.complexity.SetStatusOperation.Hash(childComplexity), true - case "BugEdge.cursor": - if e.complexity.BugEdge.Cursor == nil { - break - } - - return e.complexity.BugEdge.Cursor(childComplexity), true - - case "BugEdge.node": - if e.complexity.BugEdge.Node == nil { + case "SetStatusOperation.Status": + if e.complexity.SetStatusOperation.Status == nil { break } - return e.complexity.BugEdge.Node(childComplexity), true + return e.complexity.SetStatusOperation.Status(childComplexity), true - case "Comment.author": - if e.complexity.Comment.Author == nil { + case "SetStatusTimelineItem.Author": + if e.complexity.SetStatusTimelineItem.Author == nil { break } - return e.complexity.Comment.Author(childComplexity), true + return e.complexity.SetStatusTimelineItem.Author(childComplexity), true - case "Comment.message": - if e.complexity.Comment.Message == nil { + case "SetStatusTimelineItem.Date": + if e.complexity.SetStatusTimelineItem.Date == nil { break } - return e.complexity.Comment.Message(childComplexity), true + return e.complexity.SetStatusTimelineItem.Date(childComplexity), true - case "Comment.files": - if e.complexity.Comment.Files == nil { + case "SetStatusTimelineItem.Hash": + if e.complexity.SetStatusTimelineItem.Hash == nil { break } - return e.complexity.Comment.Files(childComplexity), true + return e.complexity.SetStatusTimelineItem.Hash(childComplexity), true - case "CommentConnection.edges": - if e.complexity.CommentConnection.Edges == nil { + case "SetStatusTimelineItem.Status": + if e.complexity.SetStatusTimelineItem.Status == nil { break } - return e.complexity.CommentConnection.Edges(childComplexity), true + return e.complexity.SetStatusTimelineItem.Status(childComplexity), true - case "CommentConnection.nodes": - if e.complexity.CommentConnection.Nodes == nil { + case "SetTitleOperation.Author": + if e.complexity.SetTitleOperation.Author == nil { break } - return e.complexity.CommentConnection.Nodes(childComplexity), true + return e.complexity.SetTitleOperation.Author(childComplexity), true - case "CommentConnection.pageInfo": - if e.complexity.CommentConnection.PageInfo == nil { + case "SetTitleOperation.Date": + if e.complexity.SetTitleOperation.Date == nil { break } - return e.complexity.CommentConnection.PageInfo(childComplexity), true + return e.complexity.SetTitleOperation.Date(childComplexity), true - case "CommentConnection.totalCount": - if e.complexity.CommentConnection.TotalCount == nil { + case "SetTitleOperation.Hash": + if e.complexity.SetTitleOperation.Hash == nil { break } - return e.complexity.CommentConnection.TotalCount(childComplexity), true + return e.complexity.SetTitleOperation.Hash(childComplexity), true - case "CommentEdge.cursor": - if e.complexity.CommentEdge.Cursor == nil { + case "SetTitleOperation.Title": + if e.complexity.SetTitleOperation.Title == nil { break } - return e.complexity.CommentEdge.Cursor(childComplexity), true + return e.complexity.SetTitleOperation.Title(childComplexity), true - case "CommentEdge.node": - if e.complexity.CommentEdge.Node == nil { + case "SetTitleOperation.Was": + if e.complexity.SetTitleOperation.Was == nil { break } - return e.complexity.CommentEdge.Node(childComplexity), true + return e.complexity.SetTitleOperation.Was(childComplexity), true - case "CommentHistoryStep.message": - if e.complexity.CommentHistoryStep.Message == nil { + case "SetTitleTimelineItem.Author": + if e.complexity.SetTitleTimelineItem.Author == nil { break } - return e.complexity.CommentHistoryStep.Message(childComplexity), true + return e.complexity.SetTitleTimelineItem.Author(childComplexity), true - case "CommentHistoryStep.date": - if e.complexity.CommentHistoryStep.Date == nil { + case "SetTitleTimelineItem.Date": + if e.complexity.SetTitleTimelineItem.Date == nil { break } - return e.complexity.CommentHistoryStep.Date(childComplexity), true + return e.complexity.SetTitleTimelineItem.Date(childComplexity), true - case "CreateOperation.hash": - if e.complexity.CreateOperation.Hash == nil { + case "SetTitleTimelineItem.Hash": + if e.complexity.SetTitleTimelineItem.Hash == nil { break } - return e.complexity.CreateOperation.Hash(childComplexity), true + return e.complexity.SetTitleTimelineItem.Hash(childComplexity), true - case "CreateOperation.author": - if e.complexity.CreateOperation.Author == nil { + case "SetTitleTimelineItem.Title": + if e.complexity.SetTitleTimelineItem.Title == nil { break } - return e.complexity.CreateOperation.Author(childComplexity), true + return e.complexity.SetTitleTimelineItem.Title(childComplexity), true - case "CreateOperation.date": - if e.complexity.CreateOperation.Date == nil { + case "SetTitleTimelineItem.Was": + if e.complexity.SetTitleTimelineItem.Was == nil { break } - return e.complexity.CreateOperation.Date(childComplexity), true + return e.complexity.SetTitleTimelineItem.Was(childComplexity), true - case "CreateOperation.title": - if e.complexity.CreateOperation.Title == nil { + case "TimelineItemConnection.Edges": + if e.complexity.TimelineItemConnection.Edges == nil { break } - return e.complexity.CreateOperation.Title(childComplexity), true + return e.complexity.TimelineItemConnection.Edges(childComplexity), true - case "CreateOperation.message": - if e.complexity.CreateOperation.Message == nil { + case "TimelineItemConnection.Nodes": + if e.complexity.TimelineItemConnection.Nodes == nil { break } - return e.complexity.CreateOperation.Message(childComplexity), true + return e.complexity.TimelineItemConnection.Nodes(childComplexity), true - case "CreateOperation.files": - if e.complexity.CreateOperation.Files == nil { + case "TimelineItemConnection.PageInfo": + if e.complexity.TimelineItemConnection.PageInfo == nil { break } - return e.complexity.CreateOperation.Files(childComplexity), true + return e.complexity.TimelineItemConnection.PageInfo(childComplexity), true - case "CreateTimelineItem.hash": - if e.complexity.CreateTimelineItem.Hash == nil { + case "TimelineItemConnection.TotalCount": + if e.complexity.TimelineItemConnection.TotalCount == nil { break } - return e.complexity.CreateTimelineItem.Hash(childComplexity), true + return e.complexity.TimelineItemConnection.TotalCount(childComplexity), true - case "CreateTimelineItem.author": - if e.complexity.CreateTimelineItem.Author == nil { + case "TimelineItemEdge.Cursor": + if e.complexity.TimelineItemEdge.Cursor == nil { break } - return e.complexity.CreateTimelineItem.Author(childComplexity), true + return e.complexity.TimelineItemEdge.Cursor(childComplexity), true - case "CreateTimelineItem.message": - if e.complexity.CreateTimelineItem.Message == nil { + case "TimelineItemEdge.Node": + if e.complexity.TimelineItemEdge.Node == nil { break } - return e.complexity.CreateTimelineItem.Message(childComplexity), true - - case "CreateTimelineItem.messageIsEmpty": - if e.complexity.CreateTimelineItem.MessageIsEmpty == nil { - break - } + return e.complexity.TimelineItemEdge.Node(childComplexity), true - return e.complexity.CreateTimelineItem.MessageIsEmpty(childComplexity), true + } + return 0, false +} - case "CreateTimelineItem.files": - if e.complexity.CreateTimelineItem.Files == nil { - break - } +func (e *executableSchema) Query(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { + ec := executionContext{graphql.GetRequestContext(ctx), e} - return e.complexity.CreateTimelineItem.Files(childComplexity), true + buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte { + data := ec._Query(ctx, op.SelectionSet) + var buf bytes.Buffer + data.MarshalGQL(&buf) + return buf.Bytes() + }) - case "CreateTimelineItem.createdAt": - if e.complexity.CreateTimelineItem.CreatedAt == nil { - break - } + return &graphql.Response{ + Data: buf, + Errors: ec.Errors, + Extensions: ec.Extensions, + } +} - return e.complexity.CreateTimelineItem.CreatedAt(childComplexity), true +func (e *executableSchema) Mutation(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { + ec := executionContext{graphql.GetRequestContext(ctx), e} - case "CreateTimelineItem.lastEdit": - if e.complexity.CreateTimelineItem.LastEdit == nil { - break - } + buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte { + data := ec._Mutation(ctx, op.SelectionSet) + var buf bytes.Buffer + data.MarshalGQL(&buf) + return buf.Bytes() + }) - return e.complexity.CreateTimelineItem.LastEdit(childComplexity), true + return &graphql.Response{ + Data: buf, + Errors: ec.Errors, + Extensions: ec.Extensions, + } +} - case "CreateTimelineItem.edited": - if e.complexity.CreateTimelineItem.Edited == nil { - break - } +func (e *executableSchema) Subscription(ctx context.Context, op *ast.OperationDefinition) func() *graphql.Response { + return graphql.OneShot(graphql.ErrorResponse(ctx, "subscriptions are not supported")) +} - return e.complexity.CreateTimelineItem.Edited(childComplexity), true +type executionContext struct { + *graphql.RequestContext + *executableSchema +} - case "CreateTimelineItem.history": - if e.complexity.CreateTimelineItem.History == nil { - break +func (ec *executionContext) FieldMiddleware(ctx context.Context, obj interface{}, next graphql.Resolver) (ret interface{}) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil } + }() + res, err := ec.ResolverMiddleware(ctx, next) + if err != nil { + ec.Error(ctx, err) + return nil + } + return res +} - return e.complexity.CreateTimelineItem.History(childComplexity), true +func (ec *executionContext) introspectSchema() (*introspection.Schema, error) { + if ec.DisableIntrospection { + return nil, errors.New("introspection disabled") + } + return introspection.WrapSchema(parsedSchema), nil +} - case "EditCommentOperation.hash": - if e.complexity.EditCommentOperation.Hash == nil { - break - } +func (ec *executionContext) introspectType(name string) (*introspection.Type, error) { + if ec.DisableIntrospection { + return nil, errors.New("introspection disabled") + } + return introspection.WrapTypeFromDef(parsedSchema, parsedSchema.Types[name]), nil +} - return e.complexity.EditCommentOperation.Hash(childComplexity), true +var parsedSchema = gqlparser.MustLoadSchema( + &ast.Source{Name: "schema/bug.graphql", Input: `"""Represents a comment on a bug.""" +type Comment implements Authored { + """The author of this comment.""" + author: Identity! - case "EditCommentOperation.author": - if e.complexity.EditCommentOperation.Author == nil { - break - } + """The message of this comment.""" + message: String! - return e.complexity.EditCommentOperation.Author(childComplexity), true + """All media's hash referenced in this comment""" + files: [Hash!]! +} - case "EditCommentOperation.date": - if e.complexity.EditCommentOperation.Date == nil { - break - } +type CommentConnection { + edges: [CommentEdge!]! + nodes: [Comment!]! + pageInfo: PageInfo! + totalCount: Int! +} - return e.complexity.EditCommentOperation.Date(childComplexity), true +type CommentEdge { + cursor: String! + node: Comment! +} - case "EditCommentOperation.target": - if e.complexity.EditCommentOperation.Target == nil { - break - } +enum Status { + OPEN + CLOSED +} - return e.complexity.EditCommentOperation.Target(childComplexity), true +type Bug { + """The identifier for this bug""" + id: String! + """The human version (truncated) identifier for this bug""" + humanId: String! + status: Status! + title: String! + labels: [Label!]! + author: Identity! + createdAt: Time! + lastEdit: Time! - case "EditCommentOperation.message": - if e.complexity.EditCommentOperation.Message == nil { - break - } + """The actors of the bug. Actors are Identity that have interacted with the bug.""" + actors( + """Returns the elements in the list that come after the specified cursor.""" + after: String + """Returns the elements in the list that come before the specified cursor.""" + before: String + """Returns the first _n_ elements from the list.""" + first: Int + """Returns the last _n_ elements from the list.""" + last: Int + ): IdentityConnection! - return e.complexity.EditCommentOperation.Message(childComplexity), true + """The participants of the bug. Participants are Identity that have created or + added a comment on the bug.""" + participants( + """Returns the elements in the list that come after the specified cursor.""" + after: String + """Returns the elements in the list that come before the specified cursor.""" + before: String + """Returns the first _n_ elements from the list.""" + first: Int + """Returns the last _n_ elements from the list.""" + last: Int + ): IdentityConnection! - case "EditCommentOperation.files": - if e.complexity.EditCommentOperation.Files == nil { - break - } - - return e.complexity.EditCommentOperation.Files(childComplexity), true + comments( + """Returns the elements in the list that come after the specified cursor.""" + after: String + """Returns the elements in the list that come before the specified cursor.""" + before: String + """Returns the first _n_ elements from the list.""" + first: Int + """Returns the last _n_ elements from the list.""" + last: Int + ): CommentConnection! - case "Identity.id": - if e.complexity.Identity.Id == nil { - break - } + timeline( + """Returns the elements in the list that come after the specified cursor.""" + after: String + """Returns the elements in the list that come before the specified cursor.""" + before: String + """Returns the first _n_ elements from the list.""" + first: Int + """Returns the last _n_ elements from the list.""" + last: Int + ): TimelineItemConnection! - return e.complexity.Identity.Id(childComplexity), true + operations( + """Returns the elements in the list that come after the specified cursor.""" + after: String + """Returns the elements in the list that come before the specified cursor.""" + before: String + """Returns the first _n_ elements from the list.""" + first: Int + """Returns the last _n_ elements from the list.""" + last: Int + ): OperationConnection! +} - case "Identity.humanId": - if e.complexity.Identity.HumanId == nil { - break - } +"""The connection type for Bug.""" +type BugConnection { + """A list of edges.""" + edges: [BugEdge!]! + nodes: [Bug!]! + """Information to aid in pagination.""" + pageInfo: PageInfo! + """Identifies the total count of items in the connection.""" + totalCount: Int! +} - return e.complexity.Identity.HumanId(childComplexity), true +"""An edge in a connection.""" +type BugEdge { + """A cursor for use in pagination.""" + cursor: String! + """The item at the end of the edge.""" + node: Bug! +} - case "Identity.name": - if e.complexity.Identity.Name == nil { - break - } +`}, + &ast.Source{Name: "schema/identity.graphql", Input: `"""Represents an identity""" +type Identity { + """The identifier for this identity""" + id: String! + """The human version (truncated) identifier for this identity""" + humanId: String! + """The name of the person, if known.""" + name: String + """The email of the person, if known.""" + email: String + """The login of the person, if known.""" + login: String + """A string containing the either the name of the person, its login or both""" + displayName: String! + """An url to an avatar""" + avatarUrl: String + """isProtected is true if the chain of git commits started to be signed. + If that's the case, only signed commit with a valid key for this identity can be added.""" + isProtected: Boolean! +} - return e.complexity.Identity.Name(childComplexity), true +type IdentityConnection { + edges: [IdentityEdge!]! + nodes: [Identity!]! + pageInfo: PageInfo! + totalCount: Int! +} - case "Identity.email": - if e.complexity.Identity.Email == nil { - break - } +type IdentityEdge { + cursor: String! + node: Identity! +}`}, + &ast.Source{Name: "schema/operations.graphql", Input: `"""An operation applied to a bug.""" +interface Operation { + """The hash of the operation""" + hash: Hash! + """The operations author.""" + author: Identity! + """The datetime when this operation was issued.""" + date: Time! +} - return e.complexity.Identity.Email(childComplexity), true +# Connection - case "Identity.login": - if e.complexity.Identity.Login == nil { - break - } +"""The connection type for an Operation""" +type OperationConnection { + edges: [OperationEdge!]! + nodes: [Operation!]! + pageInfo: PageInfo! + totalCount: Int! +} - return e.complexity.Identity.Login(childComplexity), true +"""Represent an Operation""" +type OperationEdge { + cursor: String! + node: Operation! +} - case "Identity.displayName": - if e.complexity.Identity.DisplayName == nil { - break - } +# Operations - return e.complexity.Identity.DisplayName(childComplexity), true +type CreateOperation implements Operation & Authored { + """The hash of the operation""" + hash: Hash! + """The author of this object.""" + author: Identity! + """The datetime when this operation was issued.""" + date: Time! - case "Identity.avatarUrl": - if e.complexity.Identity.AvatarUrl == nil { - break - } + title: String! + message: String! + files: [Hash!]! +} - return e.complexity.Identity.AvatarUrl(childComplexity), true +type SetTitleOperation implements Operation & Authored { + """The hash of the operation""" + hash: Hash! + """The author of this object.""" + author: Identity! + """The datetime when this operation was issued.""" + date: Time! - case "Identity.isProtected": - if e.complexity.Identity.IsProtected == nil { - break - } + title: String! + was: String! +} - return e.complexity.Identity.IsProtected(childComplexity), true +type AddCommentOperation implements Operation & Authored { + """The hash of the operation""" + hash: Hash! + """The author of this object.""" + author: Identity! + """The datetime when this operation was issued.""" + date: Time! - case "IdentityConnection.edges": - if e.complexity.IdentityConnection.Edges == nil { - break - } + message: String! + files: [Hash!]! +} - return e.complexity.IdentityConnection.Edges(childComplexity), true +type EditCommentOperation implements Operation & Authored { + """The hash of the operation""" + hash: Hash! + """The author of this object.""" + author: Identity! + """The datetime when this operation was issued.""" + date: Time! - case "IdentityConnection.nodes": - if e.complexity.IdentityConnection.Nodes == nil { - break - } + target: Hash! + message: String! + files: [Hash!]! +} - return e.complexity.IdentityConnection.Nodes(childComplexity), true +type SetStatusOperation implements Operation & Authored { + """The hash of the operation""" + hash: Hash! + """The author of this object.""" + author: Identity! + """The datetime when this operation was issued.""" + date: Time! - case "IdentityConnection.pageInfo": - if e.complexity.IdentityConnection.PageInfo == nil { - break - } + status: Status! +} - return e.complexity.IdentityConnection.PageInfo(childComplexity), true +type LabelChangeOperation implements Operation & Authored { + """The hash of the operation""" + hash: Hash! + """The author of this object.""" + author: Identity! + """The datetime when this operation was issued.""" + date: Time! - case "IdentityConnection.totalCount": - if e.complexity.IdentityConnection.TotalCount == nil { - break - } + added: [Label!]! + removed: [Label!]! +} +`}, + &ast.Source{Name: "schema/repository.graphql", Input: ` +type Repository { + """All the bugs""" + allBugs( + """Returns the elements in the list that come after the specified cursor.""" + after: String + """Returns the elements in the list that come before the specified cursor.""" + before: String + """Returns the first _n_ elements from the list.""" + first: Int + """Returns the last _n_ elements from the list.""" + last: Int + """A query to select and order bugs""" + query: String + ): BugConnection! - return e.complexity.IdentityConnection.TotalCount(childComplexity), true + bug(prefix: String!): Bug - case "IdentityEdge.cursor": - if e.complexity.IdentityEdge.Cursor == nil { - break - } + """All the identities""" + allIdentities( + """Returns the elements in the list that come after the specified cursor.""" + after: String + """Returns the elements in the list that come before the specified cursor.""" + before: String + """Returns the first _n_ elements from the list.""" + first: Int + """Returns the last _n_ elements from the list.""" + last: Int + ): IdentityConnection! - return e.complexity.IdentityEdge.Cursor(childComplexity), true + identity(prefix: String!):Identity - case "IdentityEdge.node": - if e.complexity.IdentityEdge.Node == nil { - break - } + """The identity created or selected by the user as its own""" + userIdentity:Identity +}`}, + &ast.Source{Name: "schema/root.graphql", Input: `type Query { + defaultRepository: Repository + repository(id: String!): Repository +} - return e.complexity.IdentityEdge.Node(childComplexity), true +type Mutation { + newBug(repoRef: String, title: String!, message: String!, files: [Hash!]): Bug! - case "LabelChangeOperation.hash": - if e.complexity.LabelChangeOperation.Hash == nil { - break - } - - return e.complexity.LabelChangeOperation.Hash(childComplexity), true - - case "LabelChangeOperation.author": - if e.complexity.LabelChangeOperation.Author == nil { - break - } - - return e.complexity.LabelChangeOperation.Author(childComplexity), true - - case "LabelChangeOperation.date": - if e.complexity.LabelChangeOperation.Date == nil { - break - } + addComment(repoRef: String, prefix: String!, message: String!, files: [Hash!]): Bug! + changeLabels(repoRef: String, prefix: String!, added: [String!], removed: [String!]): Bug! + open(repoRef: String, prefix: String!): Bug! + close(repoRef: String, prefix: String!): Bug! + setTitle(repoRef: String, prefix: String!, title: String!): Bug! - return e.complexity.LabelChangeOperation.Date(childComplexity), true + commit(repoRef: String, prefix: String!): Bug! +} +`}, + &ast.Source{Name: "schema/timeline.graphql", Input: `"""An item in the timeline of events""" +interface TimelineItem { + """The hash of the source operation""" + hash: Hash! +} - case "LabelChangeOperation.added": - if e.complexity.LabelChangeOperation.Added == nil { - break - } +"""CommentHistoryStep hold one version of a message in the history""" +type CommentHistoryStep { + message: String! + date: Time! +} - return e.complexity.LabelChangeOperation.Added(childComplexity), true +# Connection - case "LabelChangeOperation.removed": - if e.complexity.LabelChangeOperation.Removed == nil { - break - } +"""The connection type for TimelineItem""" +type TimelineItemConnection { + edges: [TimelineItemEdge!]! + nodes: [TimelineItem!]! + pageInfo: PageInfo! + totalCount: Int! +} - return e.complexity.LabelChangeOperation.Removed(childComplexity), true +"""Represent a TimelineItem""" +type TimelineItemEdge { + cursor: String! + node: TimelineItem! +} - case "LabelChangeTimelineItem.hash": - if e.complexity.LabelChangeTimelineItem.Hash == nil { - break - } +# Items - return e.complexity.LabelChangeTimelineItem.Hash(childComplexity), true +"""CreateTimelineItem is a TimelineItem that represent the creation of a bug and its message edition history""" +type CreateTimelineItem implements TimelineItem { + """The hash of the source operation""" + hash: Hash! + author: Identity! + message: String! + messageIsEmpty: Boolean! + files: [Hash!]! + createdAt: Time! + lastEdit: Time! + edited: Boolean! + history: [CommentHistoryStep!]! +} - case "LabelChangeTimelineItem.author": - if e.complexity.LabelChangeTimelineItem.Author == nil { - break - } +"""AddCommentTimelineItem is a TimelineItem that represent a Comment and its edition history""" +type AddCommentTimelineItem implements TimelineItem { + """The hash of the source operation""" + hash: Hash! + author: Identity! + message: String! + messageIsEmpty: Boolean! + files: [Hash!]! + createdAt: Time! + lastEdit: Time! + edited: Boolean! + history: [CommentHistoryStep!]! +} - return e.complexity.LabelChangeTimelineItem.Author(childComplexity), true +"""LabelChangeTimelineItem is a TimelineItem that represent a change in the labels of a bug""" +type LabelChangeTimelineItem implements TimelineItem { + """The hash of the source operation""" + hash: Hash! + author: Identity! + date: Time! + added: [Label!]! + removed: [Label!]! +} - case "LabelChangeTimelineItem.date": - if e.complexity.LabelChangeTimelineItem.Date == nil { - break - } +"""SetStatusTimelineItem is a TimelineItem that represent a change in the status of a bug""" +type SetStatusTimelineItem implements TimelineItem { + """The hash of the source operation""" + hash: Hash! + author: Identity! + date: Time! + status: Status! +} - return e.complexity.LabelChangeTimelineItem.Date(childComplexity), true +"""LabelChangeTimelineItem is a TimelineItem that represent a change in the title of a bug""" +type SetTitleTimelineItem implements TimelineItem { + """The hash of the source operation""" + hash: Hash! + author: Identity! + date: Time! + title: String! + was: String! +} +`}, + &ast.Source{Name: "schema/types.graphql", Input: `scalar Time +scalar Label +scalar Hash - case "LabelChangeTimelineItem.added": - if e.complexity.LabelChangeTimelineItem.Added == nil { - break - } +"""Information about pagination in a connection.""" +type PageInfo { + """When paginating forwards, are there more items?""" + hasNextPage: Boolean! + """When paginating backwards, are there more items?""" + hasPreviousPage: Boolean! + """When paginating backwards, the cursor to continue.""" + startCursor: String! + """When paginating forwards, the cursor to continue.""" + endCursor: String! +} - return e.complexity.LabelChangeTimelineItem.Added(childComplexity), true +"""An object that has an author.""" +interface Authored { + """The author of this object.""" + author: Identity! +}`}, +) - case "LabelChangeTimelineItem.removed": - if e.complexity.LabelChangeTimelineItem.Removed == nil { - break - } +// endregion ************************** generated!.gotpl ************************** - return e.complexity.LabelChangeTimelineItem.Removed(childComplexity), true +// region ***************************** args.gotpl ***************************** - case "Mutation.newBug": - if e.complexity.Mutation.NewBug == nil { - break +func (ec *executionContext) field_Bug_actors_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 *string + if tmp, ok := rawArgs["after"]; ok { + arg0, err = ec.unmarshalOString2ᚖstring(ctx, tmp) + if err != nil { + return nil, err } - - args, err := field_Mutation_newBug_args(rawArgs) + } + args["after"] = arg0 + var arg1 *string + if tmp, ok := rawArgs["before"]; ok { + arg1, err = ec.unmarshalOString2ᚖstring(ctx, tmp) if err != nil { - return 0, false + return nil, err } - - return e.complexity.Mutation.NewBug(childComplexity, args["repoRef"].(*string), args["title"].(string), args["message"].(string), args["files"].([]git.Hash)), true - - case "Mutation.addComment": - if e.complexity.Mutation.AddComment == nil { - break + } + args["before"] = arg1 + var arg2 *int + if tmp, ok := rawArgs["first"]; ok { + arg2, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + if err != nil { + return nil, err } - - args, err := field_Mutation_addComment_args(rawArgs) + } + args["first"] = arg2 + var arg3 *int + if tmp, ok := rawArgs["last"]; ok { + arg3, err = ec.unmarshalOInt2ᚖint(ctx, tmp) if err != nil { - return 0, false + return nil, err } + } + args["last"] = arg3 + return args, nil +} - return e.complexity.Mutation.AddComment(childComplexity, args["repoRef"].(*string), args["prefix"].(string), args["message"].(string), args["files"].([]git.Hash)), true - - case "Mutation.changeLabels": - if e.complexity.Mutation.ChangeLabels == nil { - break +func (ec *executionContext) field_Bug_comments_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 *string + if tmp, ok := rawArgs["after"]; ok { + arg0, err = ec.unmarshalOString2ᚖstring(ctx, tmp) + if err != nil { + return nil, err } - - args, err := field_Mutation_changeLabels_args(rawArgs) + } + args["after"] = arg0 + var arg1 *string + if tmp, ok := rawArgs["before"]; ok { + arg1, err = ec.unmarshalOString2ᚖstring(ctx, tmp) if err != nil { - return 0, false + return nil, err } - - return e.complexity.Mutation.ChangeLabels(childComplexity, args["repoRef"].(*string), args["prefix"].(string), args["added"].([]string), args["removed"].([]string)), true - - case "Mutation.open": - if e.complexity.Mutation.Open == nil { - break + } + args["before"] = arg1 + var arg2 *int + if tmp, ok := rawArgs["first"]; ok { + arg2, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + if err != nil { + return nil, err } - - args, err := field_Mutation_open_args(rawArgs) + } + args["first"] = arg2 + var arg3 *int + if tmp, ok := rawArgs["last"]; ok { + arg3, err = ec.unmarshalOInt2ᚖint(ctx, tmp) if err != nil { - return 0, false + return nil, err } + } + args["last"] = arg3 + return args, nil +} - return e.complexity.Mutation.Open(childComplexity, args["repoRef"].(*string), args["prefix"].(string)), true - - case "Mutation.close": - if e.complexity.Mutation.Close == nil { - break +func (ec *executionContext) field_Bug_operations_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 *string + if tmp, ok := rawArgs["after"]; ok { + arg0, err = ec.unmarshalOString2ᚖstring(ctx, tmp) + if err != nil { + return nil, err } - - args, err := field_Mutation_close_args(rawArgs) + } + args["after"] = arg0 + var arg1 *string + if tmp, ok := rawArgs["before"]; ok { + arg1, err = ec.unmarshalOString2ᚖstring(ctx, tmp) if err != nil { - return 0, false + return nil, err } - - return e.complexity.Mutation.Close(childComplexity, args["repoRef"].(*string), args["prefix"].(string)), true - - case "Mutation.setTitle": - if e.complexity.Mutation.SetTitle == nil { - break + } + args["before"] = arg1 + var arg2 *int + if tmp, ok := rawArgs["first"]; ok { + arg2, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + if err != nil { + return nil, err } - - args, err := field_Mutation_setTitle_args(rawArgs) + } + args["first"] = arg2 + var arg3 *int + if tmp, ok := rawArgs["last"]; ok { + arg3, err = ec.unmarshalOInt2ᚖint(ctx, tmp) if err != nil { - return 0, false + return nil, err } + } + args["last"] = arg3 + return args, nil +} - return e.complexity.Mutation.SetTitle(childComplexity, args["repoRef"].(*string), args["prefix"].(string), args["title"].(string)), true - - case "Mutation.commit": - if e.complexity.Mutation.Commit == nil { - break +func (ec *executionContext) field_Bug_participants_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 *string + if tmp, ok := rawArgs["after"]; ok { + arg0, err = ec.unmarshalOString2ᚖstring(ctx, tmp) + if err != nil { + return nil, err } - - args, err := field_Mutation_commit_args(rawArgs) + } + args["after"] = arg0 + var arg1 *string + if tmp, ok := rawArgs["before"]; ok { + arg1, err = ec.unmarshalOString2ᚖstring(ctx, tmp) if err != nil { - return 0, false + return nil, err } - - return e.complexity.Mutation.Commit(childComplexity, args["repoRef"].(*string), args["prefix"].(string)), true - - case "OperationConnection.edges": - if e.complexity.OperationConnection.Edges == nil { - break + } + args["before"] = arg1 + var arg2 *int + if tmp, ok := rawArgs["first"]; ok { + arg2, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + if err != nil { + return nil, err } - - return e.complexity.OperationConnection.Edges(childComplexity), true - - case "OperationConnection.nodes": - if e.complexity.OperationConnection.Nodes == nil { - break + } + args["first"] = arg2 + var arg3 *int + if tmp, ok := rawArgs["last"]; ok { + arg3, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + if err != nil { + return nil, err } + } + args["last"] = arg3 + return args, nil +} - return e.complexity.OperationConnection.Nodes(childComplexity), true - - case "OperationConnection.pageInfo": - if e.complexity.OperationConnection.PageInfo == nil { - break +func (ec *executionContext) field_Bug_timeline_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 *string + if tmp, ok := rawArgs["after"]; ok { + arg0, err = ec.unmarshalOString2ᚖstring(ctx, tmp) + if err != nil { + return nil, err } - - return e.complexity.OperationConnection.PageInfo(childComplexity), true - - case "OperationConnection.totalCount": - if e.complexity.OperationConnection.TotalCount == nil { - break + } + args["after"] = arg0 + var arg1 *string + if tmp, ok := rawArgs["before"]; ok { + arg1, err = ec.unmarshalOString2ᚖstring(ctx, tmp) + if err != nil { + return nil, err } - - return e.complexity.OperationConnection.TotalCount(childComplexity), true - - case "OperationEdge.cursor": - if e.complexity.OperationEdge.Cursor == nil { - break + } + args["before"] = arg1 + var arg2 *int + if tmp, ok := rawArgs["first"]; ok { + arg2, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + if err != nil { + return nil, err } - - return e.complexity.OperationEdge.Cursor(childComplexity), true - - case "OperationEdge.node": - if e.complexity.OperationEdge.Node == nil { - break + } + args["first"] = arg2 + var arg3 *int + if tmp, ok := rawArgs["last"]; ok { + arg3, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + if err != nil { + return nil, err } + } + args["last"] = arg3 + return args, nil +} - return e.complexity.OperationEdge.Node(childComplexity), true - - case "PageInfo.hasNextPage": - if e.complexity.PageInfo.HasNextPage == nil { - break +func (ec *executionContext) field_Mutation_addComment_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 *string + if tmp, ok := rawArgs["repoRef"]; ok { + arg0, err = ec.unmarshalOString2ᚖstring(ctx, tmp) + if err != nil { + return nil, err } - - return e.complexity.PageInfo.HasNextPage(childComplexity), true - - case "PageInfo.hasPreviousPage": - if e.complexity.PageInfo.HasPreviousPage == nil { - break + } + args["repoRef"] = arg0 + var arg1 string + if tmp, ok := rawArgs["prefix"]; ok { + arg1, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err } - - return e.complexity.PageInfo.HasPreviousPage(childComplexity), true - - case "PageInfo.startCursor": - if e.complexity.PageInfo.StartCursor == nil { - break + } + args["prefix"] = arg1 + var arg2 string + if tmp, ok := rawArgs["message"]; ok { + arg2, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err } - - return e.complexity.PageInfo.StartCursor(childComplexity), true - - case "PageInfo.endCursor": - if e.complexity.PageInfo.EndCursor == nil { - break + } + args["message"] = arg2 + var arg3 []git.Hash + if tmp, ok := rawArgs["files"]; ok { + arg3, err = ec.unmarshalOHash2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋutilᚋgitᚐHash(ctx, tmp) + if err != nil { + return nil, err } + } + args["files"] = arg3 + return args, nil +} - return e.complexity.PageInfo.EndCursor(childComplexity), true - - case "Query.defaultRepository": - if e.complexity.Query.DefaultRepository == nil { - break +func (ec *executionContext) field_Mutation_changeLabels_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 *string + if tmp, ok := rawArgs["repoRef"]; ok { + arg0, err = ec.unmarshalOString2ᚖstring(ctx, tmp) + if err != nil { + return nil, err } - - return e.complexity.Query.DefaultRepository(childComplexity), true - - case "Query.repository": - if e.complexity.Query.Repository == nil { - break + } + args["repoRef"] = arg0 + var arg1 string + if tmp, ok := rawArgs["prefix"]; ok { + arg1, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err } - - args, err := field_Query_repository_args(rawArgs) + } + args["prefix"] = arg1 + var arg2 []string + if tmp, ok := rawArgs["added"]; ok { + arg2, err = ec.unmarshalOString2ᚕstring(ctx, tmp) if err != nil { - return 0, false + return nil, err } - - return e.complexity.Query.Repository(childComplexity, args["id"].(string)), true - - case "Repository.allBugs": - if e.complexity.Repository.AllBugs == nil { - break + } + args["added"] = arg2 + var arg3 []string + if tmp, ok := rawArgs["removed"]; ok { + arg3, err = ec.unmarshalOString2ᚕstring(ctx, tmp) + if err != nil { + return nil, err } + } + args["removed"] = arg3 + return args, nil +} - args, err := field_Repository_allBugs_args(rawArgs) +func (ec *executionContext) field_Mutation_close_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 *string + if tmp, ok := rawArgs["repoRef"]; ok { + arg0, err = ec.unmarshalOString2ᚖstring(ctx, tmp) if err != nil { - return 0, false + return nil, err } - - return e.complexity.Repository.AllBugs(childComplexity, args["after"].(*string), args["before"].(*string), args["first"].(*int), args["last"].(*int), args["query"].(*string)), true - - case "Repository.bug": - if e.complexity.Repository.Bug == nil { - break + } + args["repoRef"] = arg0 + var arg1 string + if tmp, ok := rawArgs["prefix"]; ok { + arg1, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err } + } + args["prefix"] = arg1 + return args, nil +} - args, err := field_Repository_bug_args(rawArgs) +func (ec *executionContext) field_Mutation_commit_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 *string + if tmp, ok := rawArgs["repoRef"]; ok { + arg0, err = ec.unmarshalOString2ᚖstring(ctx, tmp) if err != nil { - return 0, false + return nil, err } - - return e.complexity.Repository.Bug(childComplexity, args["prefix"].(string)), true - - case "Repository.allIdentities": - if e.complexity.Repository.AllIdentities == nil { - break + } + args["repoRef"] = arg0 + var arg1 string + if tmp, ok := rawArgs["prefix"]; ok { + arg1, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err } + } + args["prefix"] = arg1 + return args, nil +} - args, err := field_Repository_allIdentities_args(rawArgs) +func (ec *executionContext) field_Mutation_newBug_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 *string + if tmp, ok := rawArgs["repoRef"]; ok { + arg0, err = ec.unmarshalOString2ᚖstring(ctx, tmp) if err != nil { - return 0, false + return nil, err } - - return e.complexity.Repository.AllIdentities(childComplexity, args["after"].(*string), args["before"].(*string), args["first"].(*int), args["last"].(*int)), true - - case "Repository.identity": - if e.complexity.Repository.Identity == nil { - break + } + args["repoRef"] = arg0 + var arg1 string + if tmp, ok := rawArgs["title"]; ok { + arg1, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err } - - args, err := field_Repository_identity_args(rawArgs) + } + args["title"] = arg1 + var arg2 string + if tmp, ok := rawArgs["message"]; ok { + arg2, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { - return 0, false + return nil, err } - - return e.complexity.Repository.Identity(childComplexity, args["prefix"].(string)), true - - case "Repository.userIdentity": - if e.complexity.Repository.UserIdentity == nil { - break + } + args["message"] = arg2 + var arg3 []git.Hash + if tmp, ok := rawArgs["files"]; ok { + arg3, err = ec.unmarshalOHash2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋutilᚋgitᚐHash(ctx, tmp) + if err != nil { + return nil, err } + } + args["files"] = arg3 + return args, nil +} - return e.complexity.Repository.UserIdentity(childComplexity), true - - case "SetStatusOperation.hash": - if e.complexity.SetStatusOperation.Hash == nil { - break - } - - return e.complexity.SetStatusOperation.Hash(childComplexity), true - - case "SetStatusOperation.author": - if e.complexity.SetStatusOperation.Author == nil { - break +func (ec *executionContext) field_Mutation_open_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 *string + if tmp, ok := rawArgs["repoRef"]; ok { + arg0, err = ec.unmarshalOString2ᚖstring(ctx, tmp) + if err != nil { + return nil, err } - - return e.complexity.SetStatusOperation.Author(childComplexity), true - - case "SetStatusOperation.date": - if e.complexity.SetStatusOperation.Date == nil { - break + } + args["repoRef"] = arg0 + var arg1 string + if tmp, ok := rawArgs["prefix"]; ok { + arg1, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err } + } + args["prefix"] = arg1 + return args, nil +} - return e.complexity.SetStatusOperation.Date(childComplexity), true - - case "SetStatusOperation.status": - if e.complexity.SetStatusOperation.Status == nil { - break +func (ec *executionContext) field_Mutation_setTitle_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 *string + if tmp, ok := rawArgs["repoRef"]; ok { + arg0, err = ec.unmarshalOString2ᚖstring(ctx, tmp) + if err != nil { + return nil, err } - - return e.complexity.SetStatusOperation.Status(childComplexity), true - - case "SetStatusTimelineItem.hash": - if e.complexity.SetStatusTimelineItem.Hash == nil { - break + } + args["repoRef"] = arg0 + var arg1 string + if tmp, ok := rawArgs["prefix"]; ok { + arg1, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err } - - return e.complexity.SetStatusTimelineItem.Hash(childComplexity), true - - case "SetStatusTimelineItem.author": - if e.complexity.SetStatusTimelineItem.Author == nil { - break + } + args["prefix"] = arg1 + var arg2 string + if tmp, ok := rawArgs["title"]; ok { + arg2, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err } + } + args["title"] = arg2 + return args, nil +} - return e.complexity.SetStatusTimelineItem.Author(childComplexity), true - - case "SetStatusTimelineItem.date": - if e.complexity.SetStatusTimelineItem.Date == nil { - break +func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["name"]; ok { + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err } + } + args["name"] = arg0 + return args, nil +} - return e.complexity.SetStatusTimelineItem.Date(childComplexity), true - - case "SetStatusTimelineItem.status": - if e.complexity.SetStatusTimelineItem.Status == nil { - break +func (ec *executionContext) field_Query_repository_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["id"]; ok { + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err } + } + args["id"] = arg0 + return args, nil +} - return e.complexity.SetStatusTimelineItem.Status(childComplexity), true - - case "SetTitleOperation.hash": - if e.complexity.SetTitleOperation.Hash == nil { - break +func (ec *executionContext) field_Repository_allBugs_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 *string + if tmp, ok := rawArgs["after"]; ok { + arg0, err = ec.unmarshalOString2ᚖstring(ctx, tmp) + if err != nil { + return nil, err } - - return e.complexity.SetTitleOperation.Hash(childComplexity), true - - case "SetTitleOperation.author": - if e.complexity.SetTitleOperation.Author == nil { - break + } + args["after"] = arg0 + var arg1 *string + if tmp, ok := rawArgs["before"]; ok { + arg1, err = ec.unmarshalOString2ᚖstring(ctx, tmp) + if err != nil { + return nil, err } - - return e.complexity.SetTitleOperation.Author(childComplexity), true - - case "SetTitleOperation.date": - if e.complexity.SetTitleOperation.Date == nil { - break + } + args["before"] = arg1 + var arg2 *int + if tmp, ok := rawArgs["first"]; ok { + arg2, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + if err != nil { + return nil, err } - - return e.complexity.SetTitleOperation.Date(childComplexity), true - - case "SetTitleOperation.title": - if e.complexity.SetTitleOperation.Title == nil { - break + } + args["first"] = arg2 + var arg3 *int + if tmp, ok := rawArgs["last"]; ok { + arg3, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + if err != nil { + return nil, err } - - return e.complexity.SetTitleOperation.Title(childComplexity), true - - case "SetTitleOperation.was": - if e.complexity.SetTitleOperation.Was == nil { - break + } + args["last"] = arg3 + var arg4 *string + if tmp, ok := rawArgs["query"]; ok { + arg4, err = ec.unmarshalOString2ᚖstring(ctx, tmp) + if err != nil { + return nil, err } + } + args["query"] = arg4 + return args, nil +} - return e.complexity.SetTitleOperation.Was(childComplexity), true - - case "SetTitleTimelineItem.hash": - if e.complexity.SetTitleTimelineItem.Hash == nil { - break +func (ec *executionContext) field_Repository_allIdentities_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 *string + if tmp, ok := rawArgs["after"]; ok { + arg0, err = ec.unmarshalOString2ᚖstring(ctx, tmp) + if err != nil { + return nil, err } - - return e.complexity.SetTitleTimelineItem.Hash(childComplexity), true - - case "SetTitleTimelineItem.author": - if e.complexity.SetTitleTimelineItem.Author == nil { - break + } + args["after"] = arg0 + var arg1 *string + if tmp, ok := rawArgs["before"]; ok { + arg1, err = ec.unmarshalOString2ᚖstring(ctx, tmp) + if err != nil { + return nil, err } - - return e.complexity.SetTitleTimelineItem.Author(childComplexity), true - - case "SetTitleTimelineItem.date": - if e.complexity.SetTitleTimelineItem.Date == nil { - break + } + args["before"] = arg1 + var arg2 *int + if tmp, ok := rawArgs["first"]; ok { + arg2, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + if err != nil { + return nil, err } - - return e.complexity.SetTitleTimelineItem.Date(childComplexity), true - - case "SetTitleTimelineItem.title": - if e.complexity.SetTitleTimelineItem.Title == nil { - break + } + args["first"] = arg2 + var arg3 *int + if tmp, ok := rawArgs["last"]; ok { + arg3, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + if err != nil { + return nil, err } + } + args["last"] = arg3 + return args, nil +} - return e.complexity.SetTitleTimelineItem.Title(childComplexity), true - - case "SetTitleTimelineItem.was": - if e.complexity.SetTitleTimelineItem.Was == nil { - break +func (ec *executionContext) field_Repository_bug_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["prefix"]; ok { + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err } + } + args["prefix"] = arg0 + return args, nil +} - return e.complexity.SetTitleTimelineItem.Was(childComplexity), true - - case "TimelineItemConnection.edges": - if e.complexity.TimelineItemConnection.Edges == nil { - break +func (ec *executionContext) field_Repository_identity_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["prefix"]; ok { + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err } + } + args["prefix"] = arg0 + return args, nil +} - return e.complexity.TimelineItemConnection.Edges(childComplexity), true - - case "TimelineItemConnection.nodes": - if e.complexity.TimelineItemConnection.Nodes == nil { - break +func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 bool + if tmp, ok := rawArgs["includeDeprecated"]; ok { + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + if err != nil { + return nil, err } + } + args["includeDeprecated"] = arg0 + return args, nil +} - return e.complexity.TimelineItemConnection.Nodes(childComplexity), true - - case "TimelineItemConnection.pageInfo": - if e.complexity.TimelineItemConnection.PageInfo == nil { - break +func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 bool + if tmp, ok := rawArgs["includeDeprecated"]; ok { + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + if err != nil { + return nil, err } + } + args["includeDeprecated"] = arg0 + return args, nil +} - return e.complexity.TimelineItemConnection.PageInfo(childComplexity), true +// endregion ***************************** args.gotpl ***************************** - case "TimelineItemConnection.totalCount": - if e.complexity.TimelineItemConnection.TotalCount == nil { - break +// region **************************** field.gotpl ***************************** + +func (ec *executionContext) _AddCommentOperation_hash(ctx context.Context, field graphql.CollectedField, obj *bug.AddCommentOperation) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "AddCommentOperation", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Hash() + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(git.Hash) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNHash2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋutilᚋgitᚐHash(ctx, field.Selections, res) +} + +func (ec *executionContext) _AddCommentOperation_author(ctx context.Context, field graphql.CollectedField, obj *bug.AddCommentOperation) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "AddCommentOperation", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Author, nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(identity.Interface) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNIdentity2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋidentityᚐInterface(ctx, field.Selections, res) +} + +func (ec *executionContext) _AddCommentOperation_date(ctx context.Context, field graphql.CollectedField, obj *bug.AddCommentOperation) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "AddCommentOperation", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.AddCommentOperation().Date(rctx, obj) + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*time.Time) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNTime2ᚖtimeᚐTime(ctx, field.Selections, res) +} + +func (ec *executionContext) _AddCommentOperation_message(ctx context.Context, field graphql.CollectedField, obj *bug.AddCommentOperation) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "AddCommentOperation", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Message, nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _AddCommentOperation_files(ctx context.Context, field graphql.CollectedField, obj *bug.AddCommentOperation) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "AddCommentOperation", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Files, nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]git.Hash) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNHash2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋutilᚋgitᚐHash(ctx, field.Selections, res) +} + +func (ec *executionContext) _AddCommentTimelineItem_hash(ctx context.Context, field graphql.CollectedField, obj *bug.AddCommentTimelineItem) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "AddCommentTimelineItem", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Hash(), nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(git.Hash) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNHash2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋutilᚋgitᚐHash(ctx, field.Selections, res) +} + +func (ec *executionContext) _AddCommentTimelineItem_author(ctx context.Context, field graphql.CollectedField, obj *bug.AddCommentTimelineItem) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "AddCommentTimelineItem", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Author, nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(identity.Interface) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNIdentity2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋidentityᚐInterface(ctx, field.Selections, res) +} + +func (ec *executionContext) _AddCommentTimelineItem_message(ctx context.Context, field graphql.CollectedField, obj *bug.AddCommentTimelineItem) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "AddCommentTimelineItem", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Message, nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _AddCommentTimelineItem_messageIsEmpty(ctx context.Context, field graphql.CollectedField, obj *bug.AddCommentTimelineItem) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "AddCommentTimelineItem", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.MessageIsEmpty(), nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) _AddCommentTimelineItem_files(ctx context.Context, field graphql.CollectedField, obj *bug.AddCommentTimelineItem) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "AddCommentTimelineItem", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Files, nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]git.Hash) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNHash2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋutilᚋgitᚐHash(ctx, field.Selections, res) +} + +func (ec *executionContext) _AddCommentTimelineItem_createdAt(ctx context.Context, field graphql.CollectedField, obj *bug.AddCommentTimelineItem) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "AddCommentTimelineItem", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.AddCommentTimelineItem().CreatedAt(rctx, obj) + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*time.Time) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNTime2ᚖtimeᚐTime(ctx, field.Selections, res) +} + +func (ec *executionContext) _AddCommentTimelineItem_lastEdit(ctx context.Context, field graphql.CollectedField, obj *bug.AddCommentTimelineItem) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "AddCommentTimelineItem", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.AddCommentTimelineItem().LastEdit(rctx, obj) + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*time.Time) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNTime2ᚖtimeᚐTime(ctx, field.Selections, res) +} + +func (ec *executionContext) _AddCommentTimelineItem_edited(ctx context.Context, field graphql.CollectedField, obj *bug.AddCommentTimelineItem) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "AddCommentTimelineItem", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Edited(), nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) _AddCommentTimelineItem_history(ctx context.Context, field graphql.CollectedField, obj *bug.AddCommentTimelineItem) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "AddCommentTimelineItem", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.History, nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]bug.CommentHistoryStep) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNCommentHistoryStep2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐCommentHistoryStep(ctx, field.Selections, res) +} + +func (ec *executionContext) _Bug_id(ctx context.Context, field graphql.CollectedField, obj *bug.Snapshot) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "Bug", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Id(), nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _Bug_humanId(ctx context.Context, field graphql.CollectedField, obj *bug.Snapshot) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "Bug", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.HumanId(), nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _Bug_status(ctx context.Context, field graphql.CollectedField, obj *bug.Snapshot) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "Bug", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Bug().Status(rctx, obj) + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(models.Status) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNStatus2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐStatus(ctx, field.Selections, res) +} + +func (ec *executionContext) _Bug_title(ctx context.Context, field graphql.CollectedField, obj *bug.Snapshot) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "Bug", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Title, nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _Bug_labels(ctx context.Context, field graphql.CollectedField, obj *bug.Snapshot) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "Bug", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Labels, nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]bug.Label) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNLabel2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐLabel(ctx, field.Selections, res) +} + +func (ec *executionContext) _Bug_author(ctx context.Context, field graphql.CollectedField, obj *bug.Snapshot) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "Bug", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Author, nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(identity.Interface) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNIdentity2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋidentityᚐInterface(ctx, field.Selections, res) +} + +func (ec *executionContext) _Bug_createdAt(ctx context.Context, field graphql.CollectedField, obj *bug.Snapshot) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "Bug", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.CreatedAt, nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(time.Time) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNTime2timeᚐTime(ctx, field.Selections, res) +} + +func (ec *executionContext) _Bug_lastEdit(ctx context.Context, field graphql.CollectedField, obj *bug.Snapshot) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "Bug", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Bug().LastEdit(rctx, obj) + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*time.Time) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNTime2ᚖtimeᚐTime(ctx, field.Selections, res) +} + +func (ec *executionContext) _Bug_actors(ctx context.Context, field graphql.CollectedField, obj *bug.Snapshot) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "Bug", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithResolverContext(ctx, rctx) + rawArgs := field.ArgumentMap(ec.Variables) + args, err := ec.field_Bug_actors_args(ctx, rawArgs) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + rctx.Args = args + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Bug().Actors(rctx, obj, args["after"].(*string), args["before"].(*string), args["first"].(*int), args["last"].(*int)) + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*models.IdentityConnection) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNIdentityConnection2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐIdentityConnection(ctx, field.Selections, res) +} + +func (ec *executionContext) _Bug_participants(ctx context.Context, field graphql.CollectedField, obj *bug.Snapshot) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "Bug", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithResolverContext(ctx, rctx) + rawArgs := field.ArgumentMap(ec.Variables) + args, err := ec.field_Bug_participants_args(ctx, rawArgs) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + rctx.Args = args + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Bug().Participants(rctx, obj, args["after"].(*string), args["before"].(*string), args["first"].(*int), args["last"].(*int)) + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*models.IdentityConnection) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNIdentityConnection2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐIdentityConnection(ctx, field.Selections, res) +} + +func (ec *executionContext) _Bug_comments(ctx context.Context, field graphql.CollectedField, obj *bug.Snapshot) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "Bug", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithResolverContext(ctx, rctx) + rawArgs := field.ArgumentMap(ec.Variables) + args, err := ec.field_Bug_comments_args(ctx, rawArgs) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + rctx.Args = args + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Bug().Comments(rctx, obj, args["after"].(*string), args["before"].(*string), args["first"].(*int), args["last"].(*int)) + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*models.CommentConnection) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNCommentConnection2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐCommentConnection(ctx, field.Selections, res) +} + +func (ec *executionContext) _Bug_timeline(ctx context.Context, field graphql.CollectedField, obj *bug.Snapshot) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "Bug", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithResolverContext(ctx, rctx) + rawArgs := field.ArgumentMap(ec.Variables) + args, err := ec.field_Bug_timeline_args(ctx, rawArgs) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + rctx.Args = args + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Bug().Timeline(rctx, obj, args["after"].(*string), args["before"].(*string), args["first"].(*int), args["last"].(*int)) + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*models.TimelineItemConnection) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNTimelineItemConnection2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐTimelineItemConnection(ctx, field.Selections, res) +} + +func (ec *executionContext) _Bug_operations(ctx context.Context, field graphql.CollectedField, obj *bug.Snapshot) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "Bug", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithResolverContext(ctx, rctx) + rawArgs := field.ArgumentMap(ec.Variables) + args, err := ec.field_Bug_operations_args(ctx, rawArgs) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + rctx.Args = args + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Bug().Operations(rctx, obj, args["after"].(*string), args["before"].(*string), args["first"].(*int), args["last"].(*int)) + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*models.OperationConnection) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNOperationConnection2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐOperationConnection(ctx, field.Selections, res) +} + +func (ec *executionContext) _BugConnection_edges(ctx context.Context, field graphql.CollectedField, obj *models.BugConnection) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "BugConnection", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Edges, nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]models.BugEdge) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNBugEdge2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐBugEdge(ctx, field.Selections, res) +} + +func (ec *executionContext) _BugConnection_nodes(ctx context.Context, field graphql.CollectedField, obj *models.BugConnection) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "BugConnection", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Nodes, nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]bug.Snapshot) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNBug2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐSnapshot(ctx, field.Selections, res) +} + +func (ec *executionContext) _BugConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *models.BugConnection) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "BugConnection", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.PageInfo, nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(models.PageInfo) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNPageInfo2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐPageInfo(ctx, field.Selections, res) +} + +func (ec *executionContext) _BugConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *models.BugConnection) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "BugConnection", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.TotalCount, nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNInt2int(ctx, field.Selections, res) +} + +func (ec *executionContext) _BugEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *models.BugEdge) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "BugEdge", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Cursor, nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _BugEdge_node(ctx context.Context, field graphql.CollectedField, obj *models.BugEdge) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "BugEdge", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Node, nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bug.Snapshot) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNBug2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐSnapshot(ctx, field.Selections, res) +} + +func (ec *executionContext) _Comment_author(ctx context.Context, field graphql.CollectedField, obj *bug.Comment) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "Comment", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Author, nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(identity.Interface) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNIdentity2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋidentityᚐInterface(ctx, field.Selections, res) +} + +func (ec *executionContext) _Comment_message(ctx context.Context, field graphql.CollectedField, obj *bug.Comment) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "Comment", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Message, nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _Comment_files(ctx context.Context, field graphql.CollectedField, obj *bug.Comment) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "Comment", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Files, nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]git.Hash) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNHash2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋutilᚋgitᚐHash(ctx, field.Selections, res) +} + +func (ec *executionContext) _CommentConnection_edges(ctx context.Context, field graphql.CollectedField, obj *models.CommentConnection) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "CommentConnection", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Edges, nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]models.CommentEdge) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNCommentEdge2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐCommentEdge(ctx, field.Selections, res) +} + +func (ec *executionContext) _CommentConnection_nodes(ctx context.Context, field graphql.CollectedField, obj *models.CommentConnection) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "CommentConnection", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Nodes, nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]bug.Comment) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNComment2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐComment(ctx, field.Selections, res) +} + +func (ec *executionContext) _CommentConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *models.CommentConnection) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "CommentConnection", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.PageInfo, nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(models.PageInfo) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNPageInfo2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐPageInfo(ctx, field.Selections, res) +} + +func (ec *executionContext) _CommentConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *models.CommentConnection) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "CommentConnection", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.TotalCount, nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNInt2int(ctx, field.Selections, res) +} + +func (ec *executionContext) _CommentEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *models.CommentEdge) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "CommentEdge", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Cursor, nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _CommentEdge_node(ctx context.Context, field graphql.CollectedField, obj *models.CommentEdge) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "CommentEdge", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Node, nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bug.Comment) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNComment2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐComment(ctx, field.Selections, res) +} + +func (ec *executionContext) _CommentHistoryStep_message(ctx context.Context, field graphql.CollectedField, obj *bug.CommentHistoryStep) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "CommentHistoryStep", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Message, nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _CommentHistoryStep_date(ctx context.Context, field graphql.CollectedField, obj *bug.CommentHistoryStep) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "CommentHistoryStep", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.CommentHistoryStep().Date(rctx, obj) + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*time.Time) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNTime2ᚖtimeᚐTime(ctx, field.Selections, res) +} + +func (ec *executionContext) _CreateOperation_hash(ctx context.Context, field graphql.CollectedField, obj *bug.CreateOperation) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "CreateOperation", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Hash() + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(git.Hash) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNHash2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋutilᚋgitᚐHash(ctx, field.Selections, res) +} + +func (ec *executionContext) _CreateOperation_author(ctx context.Context, field graphql.CollectedField, obj *bug.CreateOperation) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "CreateOperation", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Author, nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(identity.Interface) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNIdentity2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋidentityᚐInterface(ctx, field.Selections, res) +} + +func (ec *executionContext) _CreateOperation_date(ctx context.Context, field graphql.CollectedField, obj *bug.CreateOperation) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "CreateOperation", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.CreateOperation().Date(rctx, obj) + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*time.Time) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNTime2ᚖtimeᚐTime(ctx, field.Selections, res) +} + +func (ec *executionContext) _CreateOperation_title(ctx context.Context, field graphql.CollectedField, obj *bug.CreateOperation) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "CreateOperation", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Title, nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _CreateOperation_message(ctx context.Context, field graphql.CollectedField, obj *bug.CreateOperation) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "CreateOperation", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Message, nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _CreateOperation_files(ctx context.Context, field graphql.CollectedField, obj *bug.CreateOperation) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "CreateOperation", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Files, nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]git.Hash) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNHash2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋutilᚋgitᚐHash(ctx, field.Selections, res) +} + +func (ec *executionContext) _CreateTimelineItem_hash(ctx context.Context, field graphql.CollectedField, obj *bug.CreateTimelineItem) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "CreateTimelineItem", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Hash(), nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(git.Hash) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNHash2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋutilᚋgitᚐHash(ctx, field.Selections, res) +} + +func (ec *executionContext) _CreateTimelineItem_author(ctx context.Context, field graphql.CollectedField, obj *bug.CreateTimelineItem) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "CreateTimelineItem", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Author, nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") } + return graphql.Null + } + res := resTmp.(identity.Interface) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNIdentity2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋidentityᚐInterface(ctx, field.Selections, res) +} - return e.complexity.TimelineItemConnection.TotalCount(childComplexity), true - - case "TimelineItemEdge.cursor": - if e.complexity.TimelineItemEdge.Cursor == nil { - break +func (ec *executionContext) _CreateTimelineItem_message(ctx context.Context, field graphql.CollectedField, obj *bug.CreateTimelineItem) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "CreateTimelineItem", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Message, nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") } + return graphql.Null + } + res := resTmp.(string) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNString2string(ctx, field.Selections, res) +} - return e.complexity.TimelineItemEdge.Cursor(childComplexity), true - - case "TimelineItemEdge.node": - if e.complexity.TimelineItemEdge.Node == nil { - break +func (ec *executionContext) _CreateTimelineItem_messageIsEmpty(ctx context.Context, field graphql.CollectedField, obj *bug.CreateTimelineItem) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "CreateTimelineItem", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.MessageIsEmpty(), nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") } - - return e.complexity.TimelineItemEdge.Node(childComplexity), true - + return graphql.Null } - return 0, false + res := resTmp.(bool) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (e *executableSchema) Query(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - ec := executionContext{graphql.GetRequestContext(ctx), e} - - buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte { - data := ec._Query(ctx, op.SelectionSet) - var buf bytes.Buffer - data.MarshalGQL(&buf) - return buf.Bytes() +func (ec *executionContext) _CreateTimelineItem_files(ctx context.Context, field graphql.CollectedField, obj *bug.CreateTimelineItem) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "CreateTimelineItem", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Files, nil }) - - return &graphql.Response{ - Data: buf, - Errors: ec.Errors, - Extensions: ec.Extensions} + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]git.Hash) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNHash2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋutilᚋgitᚐHash(ctx, field.Selections, res) } -func (e *executableSchema) Mutation(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - ec := executionContext{graphql.GetRequestContext(ctx), e} - - buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte { - data := ec._Mutation(ctx, op.SelectionSet) - var buf bytes.Buffer - data.MarshalGQL(&buf) - return buf.Bytes() +func (ec *executionContext) _CreateTimelineItem_createdAt(ctx context.Context, field graphql.CollectedField, obj *bug.CreateTimelineItem) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "CreateTimelineItem", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.CreateTimelineItem().CreatedAt(rctx, obj) }) - - return &graphql.Response{ - Data: buf, - Errors: ec.Errors, - Extensions: ec.Extensions, + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null } + res := resTmp.(*time.Time) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNTime2ᚖtimeᚐTime(ctx, field.Selections, res) } -func (e *executableSchema) Subscription(ctx context.Context, op *ast.OperationDefinition) func() *graphql.Response { - return graphql.OneShot(graphql.ErrorResponse(ctx, "subscriptions are not supported")) +func (ec *executionContext) _CreateTimelineItem_lastEdit(ctx context.Context, field graphql.CollectedField, obj *bug.CreateTimelineItem) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "CreateTimelineItem", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.CreateTimelineItem().LastEdit(rctx, obj) + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*time.Time) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNTime2ᚖtimeᚐTime(ctx, field.Selections, res) } -type executionContext struct { - *graphql.RequestContext - *executableSchema +func (ec *executionContext) _CreateTimelineItem_edited(ctx context.Context, field graphql.CollectedField, obj *bug.CreateTimelineItem) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "CreateTimelineItem", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Edited(), nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -var addCommentOperationImplementors = []string{"AddCommentOperation", "Operation", "Authored"} - -// nolint: gocyclo, errcheck, gas, goconst -func (ec *executionContext) _AddCommentOperation(ctx context.Context, sel ast.SelectionSet, obj *bug.AddCommentOperation) graphql.Marshaler { - fields := graphql.CollectFields(ctx, sel, addCommentOperationImplementors) - - var wg sync.WaitGroup - out := graphql.NewOrderedMap(len(fields)) - invalid := false - for i, field := range fields { - out.Keys[i] = field.Alias - - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("AddCommentOperation") - case "hash": - out.Values[i] = ec._AddCommentOperation_hash(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "author": - out.Values[i] = ec._AddCommentOperation_author(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "date": - wg.Add(1) - go func(i int, field graphql.CollectedField) { - out.Values[i] = ec._AddCommentOperation_date(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - wg.Done() - }(i, field) - case "message": - out.Values[i] = ec._AddCommentOperation_message(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "files": - out.Values[i] = ec._AddCommentOperation_files(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - default: - panic("unknown field " + strconv.Quote(field.Name)) - } +func (ec *executionContext) _CreateTimelineItem_history(ctx context.Context, field graphql.CollectedField, obj *bug.CreateTimelineItem) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "CreateTimelineItem", + Field: field, + Args: nil, + IsMethod: false, } - wg.Wait() - if invalid { + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.History, nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - return out + res := resTmp.([]bug.CommentHistoryStep) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNCommentHistoryStep2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐCommentHistoryStep(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _AddCommentOperation_hash(ctx context.Context, field graphql.CollectedField, obj *bug.AddCommentOperation) graphql.Marshaler { +func (ec *executionContext) _EditCommentOperation_hash(ctx context.Context, field graphql.CollectedField, obj *bug.EditCommentOperation) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "AddCommentOperation", - Args: nil, - Field: field, + Object: "EditCommentOperation", + Field: field, + Args: nil, + IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) @@ -2396,17 +4147,17 @@ func (ec *executionContext) _AddCommentOperation_hash(ctx context.Context, field res := resTmp.(git.Hash) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return res + return ec.marshalNHash2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋutilᚋgitᚐHash(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _AddCommentOperation_author(ctx context.Context, field graphql.CollectedField, obj *bug.AddCommentOperation) graphql.Marshaler { +func (ec *executionContext) _EditCommentOperation_author(ctx context.Context, field graphql.CollectedField, obj *bug.EditCommentOperation) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "AddCommentOperation", - Args: nil, - Field: field, + Object: "EditCommentOperation", + Field: field, + Args: nil, + IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) @@ -2423,24 +4174,50 @@ func (ec *executionContext) _AddCommentOperation_author(ctx context.Context, fie res := resTmp.(identity.Interface) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNIdentity2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋidentityᚐInterface(ctx, field.Selections, res) +} - return ec._Identity(ctx, field.Selections, &res) +func (ec *executionContext) _EditCommentOperation_date(ctx context.Context, field graphql.CollectedField, obj *bug.EditCommentOperation) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "EditCommentOperation", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.EditCommentOperation().Date(rctx, obj) + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*time.Time) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNTime2ᚖtimeᚐTime(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _AddCommentOperation_date(ctx context.Context, field graphql.CollectedField, obj *bug.AddCommentOperation) graphql.Marshaler { +func (ec *executionContext) _EditCommentOperation_target(ctx context.Context, field graphql.CollectedField, obj *bug.EditCommentOperation) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "AddCommentOperation", - Args: nil, - Field: field, + Object: "EditCommentOperation", + Field: field, + Args: nil, + IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.AddCommentOperation().Date(rctx, obj) + return obj.Target, nil }) if resTmp == nil { if !ec.HasError(rctx) { @@ -2448,20 +4225,20 @@ func (ec *executionContext) _AddCommentOperation_date(ctx context.Context, field } return graphql.Null } - res := resTmp.(time.Time) + res := resTmp.(git.Hash) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalTime(res) + return ec.marshalNHash2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋutilᚋgitᚐHash(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _AddCommentOperation_message(ctx context.Context, field graphql.CollectedField, obj *bug.AddCommentOperation) graphql.Marshaler { +func (ec *executionContext) _EditCommentOperation_message(ctx context.Context, field graphql.CollectedField, obj *bug.EditCommentOperation) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "AddCommentOperation", - Args: nil, - Field: field, + Object: "EditCommentOperation", + Field: field, + Args: nil, + IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) @@ -2478,17 +4255,17 @@ func (ec *executionContext) _AddCommentOperation_message(ctx context.Context, fi res := resTmp.(string) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalString(res) + return ec.marshalNString2string(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _AddCommentOperation_files(ctx context.Context, field graphql.CollectedField, obj *bug.AddCommentOperation) graphql.Marshaler { +func (ec *executionContext) _EditCommentOperation_files(ctx context.Context, field graphql.CollectedField, obj *bug.EditCommentOperation) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "AddCommentOperation", - Args: nil, - Field: field, + Object: "EditCommentOperation", + Field: field, + Args: nil, + IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) @@ -2505,111 +4282,23 @@ func (ec *executionContext) _AddCommentOperation_files(ctx context.Context, fiel res := resTmp.([]git.Hash) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - - arr1 := make(graphql.Array, len(res)) - - for idx1 := range res { - arr1[idx1] = func() graphql.Marshaler { - return res[idx1] - }() - } - - return arr1 -} - -var addCommentTimelineItemImplementors = []string{"AddCommentTimelineItem", "TimelineItem"} - -// nolint: gocyclo, errcheck, gas, goconst -func (ec *executionContext) _AddCommentTimelineItem(ctx context.Context, sel ast.SelectionSet, obj *bug.AddCommentTimelineItem) graphql.Marshaler { - fields := graphql.CollectFields(ctx, sel, addCommentTimelineItemImplementors) - - var wg sync.WaitGroup - out := graphql.NewOrderedMap(len(fields)) - invalid := false - for i, field := range fields { - out.Keys[i] = field.Alias - - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("AddCommentTimelineItem") - case "hash": - out.Values[i] = ec._AddCommentTimelineItem_hash(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "author": - out.Values[i] = ec._AddCommentTimelineItem_author(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "message": - out.Values[i] = ec._AddCommentTimelineItem_message(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "messageIsEmpty": - out.Values[i] = ec._AddCommentTimelineItem_messageIsEmpty(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "files": - out.Values[i] = ec._AddCommentTimelineItem_files(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "createdAt": - wg.Add(1) - go func(i int, field graphql.CollectedField) { - out.Values[i] = ec._AddCommentTimelineItem_createdAt(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - wg.Done() - }(i, field) - case "lastEdit": - wg.Add(1) - go func(i int, field graphql.CollectedField) { - out.Values[i] = ec._AddCommentTimelineItem_lastEdit(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - wg.Done() - }(i, field) - case "edited": - out.Values[i] = ec._AddCommentTimelineItem_edited(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "history": - out.Values[i] = ec._AddCommentTimelineItem_history(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - wg.Wait() - if invalid { - return graphql.Null - } - return out + return ec.marshalNHash2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋutilᚋgitᚐHash(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _AddCommentTimelineItem_hash(ctx context.Context, field graphql.CollectedField, obj *bug.AddCommentTimelineItem) graphql.Marshaler { +func (ec *executionContext) _Identity_id(ctx context.Context, field graphql.CollectedField, obj *identity.Interface) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "AddCommentTimelineItem", - Args: nil, - Field: field, + Object: "Identity", + Field: field, + Args: nil, + IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Hash(), nil + return ec.resolvers.Identity().ID(rctx, obj) }) if resTmp == nil { if !ec.HasError(rctx) { @@ -2617,26 +4306,26 @@ func (ec *executionContext) _AddCommentTimelineItem_hash(ctx context.Context, fi } return graphql.Null } - res := resTmp.(git.Hash) + res := resTmp.(string) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return res + return ec.marshalNString2string(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _AddCommentTimelineItem_author(ctx context.Context, field graphql.CollectedField, obj *bug.AddCommentTimelineItem) graphql.Marshaler { +func (ec *executionContext) _Identity_humanId(ctx context.Context, field graphql.CollectedField, obj *identity.Interface) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "AddCommentTimelineItem", - Args: nil, - Field: field, + Object: "Identity", + Field: field, + Args: nil, + IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Author, nil + return ec.resolvers.Identity().HumanID(rctx, obj) }) if resTmp == nil { if !ec.HasError(rctx) { @@ -2644,117 +4333,98 @@ func (ec *executionContext) _AddCommentTimelineItem_author(ctx context.Context, } return graphql.Null } - res := resTmp.(identity.Interface) + res := resTmp.(string) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - - return ec._Identity(ctx, field.Selections, &res) + return ec.marshalNString2string(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _AddCommentTimelineItem_message(ctx context.Context, field graphql.CollectedField, obj *bug.AddCommentTimelineItem) graphql.Marshaler { +func (ec *executionContext) _Identity_name(ctx context.Context, field graphql.CollectedField, obj *identity.Interface) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "AddCommentTimelineItem", - Args: nil, - Field: field, + Object: "Identity", + Field: field, + Args: nil, + IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Message, nil + return ec.resolvers.Identity().Name(rctx, obj) }) if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(string) + res := resTmp.(*string) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalString(res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _AddCommentTimelineItem_messageIsEmpty(ctx context.Context, field graphql.CollectedField, obj *bug.AddCommentTimelineItem) graphql.Marshaler { +func (ec *executionContext) _Identity_email(ctx context.Context, field graphql.CollectedField, obj *identity.Interface) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "AddCommentTimelineItem", - Args: nil, - Field: field, + Object: "Identity", + Field: field, + Args: nil, + IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.MessageIsEmpty(), nil + return ec.resolvers.Identity().Email(rctx, obj) }) if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(bool) + res := resTmp.(*string) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalBoolean(res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _AddCommentTimelineItem_files(ctx context.Context, field graphql.CollectedField, obj *bug.AddCommentTimelineItem) graphql.Marshaler { +func (ec *executionContext) _Identity_login(ctx context.Context, field graphql.CollectedField, obj *identity.Interface) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "AddCommentTimelineItem", - Args: nil, - Field: field, + Object: "Identity", + Field: field, + Args: nil, + IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Files, nil + return ec.resolvers.Identity().Login(rctx, obj) }) if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.([]git.Hash) + res := resTmp.(*string) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - - arr1 := make(graphql.Array, len(res)) - - for idx1 := range res { - arr1[idx1] = func() graphql.Marshaler { - return res[idx1] - }() - } - - return arr1 + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _AddCommentTimelineItem_createdAt(ctx context.Context, field graphql.CollectedField, obj *bug.AddCommentTimelineItem) graphql.Marshaler { +func (ec *executionContext) _Identity_displayName(ctx context.Context, field graphql.CollectedField, obj *identity.Interface) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "AddCommentTimelineItem", - Args: nil, - Field: field, + Object: "Identity", + Field: field, + Args: nil, + IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.AddCommentTimelineItem().CreatedAt(rctx, obj) + return ec.resolvers.Identity().DisplayName(rctx, obj) }) if resTmp == nil { if !ec.HasError(rctx) { @@ -2762,53 +4432,50 @@ func (ec *executionContext) _AddCommentTimelineItem_createdAt(ctx context.Contex } return graphql.Null } - res := resTmp.(time.Time) + res := resTmp.(string) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalTime(res) + return ec.marshalNString2string(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _AddCommentTimelineItem_lastEdit(ctx context.Context, field graphql.CollectedField, obj *bug.AddCommentTimelineItem) graphql.Marshaler { +func (ec *executionContext) _Identity_avatarUrl(ctx context.Context, field graphql.CollectedField, obj *identity.Interface) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "AddCommentTimelineItem", - Args: nil, - Field: field, + Object: "Identity", + Field: field, + Args: nil, + IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.AddCommentTimelineItem().LastEdit(rctx, obj) + return ec.resolvers.Identity().AvatarURL(rctx, obj) }) if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(time.Time) + res := resTmp.(*string) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalTime(res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _AddCommentTimelineItem_edited(ctx context.Context, field graphql.CollectedField, obj *bug.AddCommentTimelineItem) graphql.Marshaler { +func (ec *executionContext) _Identity_isProtected(ctx context.Context, field graphql.CollectedField, obj *identity.Interface) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "AddCommentTimelineItem", - Args: nil, - Field: field, + Object: "Identity", + Field: field, + Args: nil, + IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Edited(), nil + return ec.resolvers.Identity().IsProtected(rctx, obj) }) if resTmp == nil { if !ec.HasError(rctx) { @@ -2819,23 +4486,23 @@ func (ec *executionContext) _AddCommentTimelineItem_edited(ctx context.Context, res := resTmp.(bool) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalBoolean(res) + return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _AddCommentTimelineItem_history(ctx context.Context, field graphql.CollectedField, obj *bug.AddCommentTimelineItem) graphql.Marshaler { +func (ec *executionContext) _IdentityConnection_edges(ctx context.Context, field graphql.CollectedField, obj *models.IdentityConnection) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "AddCommentTimelineItem", - Args: nil, - Field: field, + Object: "IdentityConnection", + Field: field, + Args: nil, + IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.History, nil + return obj.Edges, nil }) if resTmp == nil { if !ec.HasError(rctx) { @@ -2843,178 +4510,53 @@ func (ec *executionContext) _AddCommentTimelineItem_history(ctx context.Context, } return graphql.Null } - res := resTmp.([]bug.CommentHistoryStep) + res := resTmp.([]models.IdentityEdge) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } - - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], - } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() - } - arr1[idx1] = func() graphql.Marshaler { - - return ec._CommentHistoryStep(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } - - } - wg.Wait() - return arr1 + return ec.marshalNIdentityEdge2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐIdentityEdge(ctx, field.Selections, res) } -var bugImplementors = []string{"Bug"} - -// nolint: gocyclo, errcheck, gas, goconst -func (ec *executionContext) _Bug(ctx context.Context, sel ast.SelectionSet, obj *bug.Snapshot) graphql.Marshaler { - fields := graphql.CollectFields(ctx, sel, bugImplementors) - - var wg sync.WaitGroup - out := graphql.NewOrderedMap(len(fields)) - invalid := false - for i, field := range fields { - out.Keys[i] = field.Alias - - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("Bug") - case "id": - out.Values[i] = ec._Bug_id(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "humanId": - out.Values[i] = ec._Bug_humanId(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "status": - wg.Add(1) - go func(i int, field graphql.CollectedField) { - out.Values[i] = ec._Bug_status(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - wg.Done() - }(i, field) - case "title": - out.Values[i] = ec._Bug_title(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "labels": - out.Values[i] = ec._Bug_labels(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "author": - out.Values[i] = ec._Bug_author(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "createdAt": - out.Values[i] = ec._Bug_createdAt(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "lastEdit": - wg.Add(1) - go func(i int, field graphql.CollectedField) { - out.Values[i] = ec._Bug_lastEdit(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - wg.Done() - }(i, field) - case "actors": - wg.Add(1) - go func(i int, field graphql.CollectedField) { - out.Values[i] = ec._Bug_actors(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - wg.Done() - }(i, field) - case "participants": - wg.Add(1) - go func(i int, field graphql.CollectedField) { - out.Values[i] = ec._Bug_participants(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - wg.Done() - }(i, field) - case "comments": - wg.Add(1) - go func(i int, field graphql.CollectedField) { - out.Values[i] = ec._Bug_comments(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - wg.Done() - }(i, field) - case "timeline": - wg.Add(1) - go func(i int, field graphql.CollectedField) { - out.Values[i] = ec._Bug_timeline(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - wg.Done() - }(i, field) - case "operations": - wg.Add(1) - go func(i int, field graphql.CollectedField) { - out.Values[i] = ec._Bug_operations(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - wg.Done() - }(i, field) - default: - panic("unknown field " + strconv.Quote(field.Name)) - } +func (ec *executionContext) _IdentityConnection_nodes(ctx context.Context, field graphql.CollectedField, obj *models.IdentityConnection) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "IdentityConnection", + Field: field, + Args: nil, + IsMethod: false, } - wg.Wait() - if invalid { + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Nodes, nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - return out + res := resTmp.([]identity.Interface) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNIdentity2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋidentityᚐInterface(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _Bug_id(ctx context.Context, field graphql.CollectedField, obj *bug.Snapshot) graphql.Marshaler { +func (ec *executionContext) _IdentityConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *models.IdentityConnection) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "Bug", - Args: nil, - Field: field, + Object: "IdentityConnection", + Field: field, + Args: nil, + IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Id(), nil + return obj.PageInfo, nil }) if resTmp == nil { if !ec.HasError(rctx) { @@ -3022,26 +4564,26 @@ func (ec *executionContext) _Bug_id(ctx context.Context, field graphql.Collected } return graphql.Null } - res := resTmp.(string) + res := resTmp.(models.PageInfo) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalString(res) + return ec.marshalNPageInfo2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐPageInfo(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _Bug_humanId(ctx context.Context, field graphql.CollectedField, obj *bug.Snapshot) graphql.Marshaler { +func (ec *executionContext) _IdentityConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *models.IdentityConnection) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "Bug", - Args: nil, - Field: field, + Object: "IdentityConnection", + Field: field, + Args: nil, + IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.HumanId(), nil + return obj.TotalCount, nil }) if resTmp == nil { if !ec.HasError(rctx) { @@ -3049,26 +4591,26 @@ func (ec *executionContext) _Bug_humanId(ctx context.Context, field graphql.Coll } return graphql.Null } - res := resTmp.(string) + res := resTmp.(int) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalString(res) + return ec.marshalNInt2int(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _Bug_status(ctx context.Context, field graphql.CollectedField, obj *bug.Snapshot) graphql.Marshaler { +func (ec *executionContext) _IdentityEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *models.IdentityEdge) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "Bug", - Args: nil, - Field: field, + Object: "IdentityEdge", + Field: field, + Args: nil, + IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Bug().Status(rctx, obj) + return obj.Cursor, nil }) if resTmp == nil { if !ec.HasError(rctx) { @@ -3076,26 +4618,26 @@ func (ec *executionContext) _Bug_status(ctx context.Context, field graphql.Colle } return graphql.Null } - res := resTmp.(models.Status) + res := resTmp.(string) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return res + return ec.marshalNString2string(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _Bug_title(ctx context.Context, field graphql.CollectedField, obj *bug.Snapshot) graphql.Marshaler { +func (ec *executionContext) _IdentityEdge_node(ctx context.Context, field graphql.CollectedField, obj *models.IdentityEdge) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "Bug", - Args: nil, - Field: field, + Object: "IdentityEdge", + Field: field, + Args: nil, + IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Title, nil + return obj.Node, nil }) if resTmp == nil { if !ec.HasError(rctx) { @@ -3103,26 +4645,26 @@ func (ec *executionContext) _Bug_title(ctx context.Context, field graphql.Collec } return graphql.Null } - res := resTmp.(string) + res := resTmp.(identity.Interface) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalString(res) + return ec.marshalNIdentity2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋidentityᚐInterface(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _Bug_labels(ctx context.Context, field graphql.CollectedField, obj *bug.Snapshot) graphql.Marshaler { +func (ec *executionContext) _LabelChangeOperation_hash(ctx context.Context, field graphql.CollectedField, obj *bug.LabelChangeOperation) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "Bug", - Args: nil, - Field: field, + Object: "LabelChangeOperation", + Field: field, + Args: nil, + IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Labels, nil + return obj.Hash() }) if resTmp == nil { if !ec.HasError(rctx) { @@ -3130,29 +4672,20 @@ func (ec *executionContext) _Bug_labels(ctx context.Context, field graphql.Colle } return graphql.Null } - res := resTmp.([]bug.Label) + res := resTmp.(git.Hash) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - - arr1 := make(graphql.Array, len(res)) - - for idx1 := range res { - arr1[idx1] = func() graphql.Marshaler { - return res[idx1] - }() - } - - return arr1 + return ec.marshalNHash2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋutilᚋgitᚐHash(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _Bug_author(ctx context.Context, field graphql.CollectedField, obj *bug.Snapshot) graphql.Marshaler { +func (ec *executionContext) _LabelChangeOperation_author(ctx context.Context, field graphql.CollectedField, obj *bug.LabelChangeOperation) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "Bug", - Args: nil, - Field: field, + Object: "LabelChangeOperation", + Field: field, + Args: nil, + IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) @@ -3169,24 +4702,23 @@ func (ec *executionContext) _Bug_author(ctx context.Context, field graphql.Colle res := resTmp.(identity.Interface) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - - return ec._Identity(ctx, field.Selections, &res) + return ec.marshalNIdentity2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋidentityᚐInterface(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _Bug_createdAt(ctx context.Context, field graphql.CollectedField, obj *bug.Snapshot) graphql.Marshaler { +func (ec *executionContext) _LabelChangeOperation_date(ctx context.Context, field graphql.CollectedField, obj *bug.LabelChangeOperation) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "Bug", - Args: nil, - Field: field, + Object: "LabelChangeOperation", + Field: field, + Args: nil, + IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.CreatedAt, nil + return ec.resolvers.LabelChangeOperation().Date(rctx, obj) }) if resTmp == nil { if !ec.HasError(rctx) { @@ -3194,26 +4726,26 @@ func (ec *executionContext) _Bug_createdAt(ctx context.Context, field graphql.Co } return graphql.Null } - res := resTmp.(time.Time) + res := resTmp.(*time.Time) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalTime(res) + return ec.marshalNTime2ᚖtimeᚐTime(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _Bug_lastEdit(ctx context.Context, field graphql.CollectedField, obj *bug.Snapshot) graphql.Marshaler { +func (ec *executionContext) _LabelChangeOperation_added(ctx context.Context, field graphql.CollectedField, obj *bug.LabelChangeOperation) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "Bug", - Args: nil, - Field: field, + Object: "LabelChangeOperation", + Field: field, + Args: nil, + IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Bug().LastEdit(rctx, obj) + return obj.Added, nil }) if resTmp == nil { if !ec.HasError(rctx) { @@ -3221,32 +4753,26 @@ func (ec *executionContext) _Bug_lastEdit(ctx context.Context, field graphql.Col } return graphql.Null } - res := resTmp.(time.Time) + res := resTmp.([]bug.Label) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalTime(res) + return ec.marshalNLabel2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐLabel(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _Bug_actors(ctx context.Context, field graphql.CollectedField, obj *bug.Snapshot) graphql.Marshaler { +func (ec *executionContext) _LabelChangeOperation_removed(ctx context.Context, field graphql.CollectedField, obj *bug.LabelChangeOperation) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rawArgs := field.ArgumentMap(ec.Variables) - args, err := field_Bug_actors_args(rawArgs) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } rctx := &graphql.ResolverContext{ - Object: "Bug", - Args: args, - Field: field, + Object: "LabelChangeOperation", + Field: field, + Args: nil, + IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Bug().Actors(rctx, obj, args["after"].(*string), args["before"].(*string), args["first"].(*int), args["last"].(*int)) + return obj.Removed, nil }) if resTmp == nil { if !ec.HasError(rctx) { @@ -3254,33 +4780,26 @@ func (ec *executionContext) _Bug_actors(ctx context.Context, field graphql.Colle } return graphql.Null } - res := resTmp.(models.IdentityConnection) + res := resTmp.([]bug.Label) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - - return ec._IdentityConnection(ctx, field.Selections, &res) + return ec.marshalNLabel2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐLabel(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _Bug_participants(ctx context.Context, field graphql.CollectedField, obj *bug.Snapshot) graphql.Marshaler { +func (ec *executionContext) _LabelChangeTimelineItem_hash(ctx context.Context, field graphql.CollectedField, obj *bug.LabelChangeTimelineItem) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rawArgs := field.ArgumentMap(ec.Variables) - args, err := field_Bug_participants_args(rawArgs) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } rctx := &graphql.ResolverContext{ - Object: "Bug", - Args: args, - Field: field, + Object: "LabelChangeTimelineItem", + Field: field, + Args: nil, + IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Bug().Participants(rctx, obj, args["after"].(*string), args["before"].(*string), args["first"].(*int), args["last"].(*int)) + return obj.Hash(), nil }) if resTmp == nil { if !ec.HasError(rctx) { @@ -3288,33 +4807,26 @@ func (ec *executionContext) _Bug_participants(ctx context.Context, field graphql } return graphql.Null } - res := resTmp.(models.IdentityConnection) + res := resTmp.(git.Hash) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - - return ec._IdentityConnection(ctx, field.Selections, &res) + return ec.marshalNHash2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋutilᚋgitᚐHash(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _Bug_comments(ctx context.Context, field graphql.CollectedField, obj *bug.Snapshot) graphql.Marshaler { +func (ec *executionContext) _LabelChangeTimelineItem_author(ctx context.Context, field graphql.CollectedField, obj *bug.LabelChangeTimelineItem) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rawArgs := field.ArgumentMap(ec.Variables) - args, err := field_Bug_comments_args(rawArgs) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } rctx := &graphql.ResolverContext{ - Object: "Bug", - Args: args, - Field: field, + Object: "LabelChangeTimelineItem", + Field: field, + Args: nil, + IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Bug().Comments(rctx, obj, args["after"].(*string), args["before"].(*string), args["first"].(*int), args["last"].(*int)) + return obj.Author, nil }) if resTmp == nil { if !ec.HasError(rctx) { @@ -3322,33 +4834,26 @@ func (ec *executionContext) _Bug_comments(ctx context.Context, field graphql.Col } return graphql.Null } - res := resTmp.(models.CommentConnection) + res := resTmp.(identity.Interface) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - - return ec._CommentConnection(ctx, field.Selections, &res) + return ec.marshalNIdentity2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋidentityᚐInterface(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _Bug_timeline(ctx context.Context, field graphql.CollectedField, obj *bug.Snapshot) graphql.Marshaler { +func (ec *executionContext) _LabelChangeTimelineItem_date(ctx context.Context, field graphql.CollectedField, obj *bug.LabelChangeTimelineItem) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rawArgs := field.ArgumentMap(ec.Variables) - args, err := field_Bug_timeline_args(rawArgs) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } rctx := &graphql.ResolverContext{ - Object: "Bug", - Args: args, - Field: field, + Object: "LabelChangeTimelineItem", + Field: field, + Args: nil, + IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Bug().Timeline(rctx, obj, args["after"].(*string), args["before"].(*string), args["first"].(*int), args["last"].(*int)) + return ec.resolvers.LabelChangeTimelineItem().Date(rctx, obj) }) if resTmp == nil { if !ec.HasError(rctx) { @@ -3356,33 +4861,26 @@ func (ec *executionContext) _Bug_timeline(ctx context.Context, field graphql.Col } return graphql.Null } - res := resTmp.(models.TimelineItemConnection) + res := resTmp.(*time.Time) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - - return ec._TimelineItemConnection(ctx, field.Selections, &res) + return ec.marshalNTime2ᚖtimeᚐTime(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _Bug_operations(ctx context.Context, field graphql.CollectedField, obj *bug.Snapshot) graphql.Marshaler { +func (ec *executionContext) _LabelChangeTimelineItem_added(ctx context.Context, field graphql.CollectedField, obj *bug.LabelChangeTimelineItem) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rawArgs := field.ArgumentMap(ec.Variables) - args, err := field_Bug_operations_args(rawArgs) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } rctx := &graphql.ResolverContext{ - Object: "Bug", - Args: args, - Field: field, + Object: "LabelChangeTimelineItem", + Field: field, + Args: nil, + IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Bug().Operations(rctx, obj, args["after"].(*string), args["before"].(*string), args["first"].(*int), args["last"].(*int)) + return obj.Added, nil }) if resTmp == nil { if !ec.HasError(rctx) { @@ -3390,72 +4888,26 @@ func (ec *executionContext) _Bug_operations(ctx context.Context, field graphql.C } return graphql.Null } - res := resTmp.(models.OperationConnection) + res := resTmp.([]bug.Label) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - - return ec._OperationConnection(ctx, field.Selections, &res) -} - -var bugConnectionImplementors = []string{"BugConnection"} - -// nolint: gocyclo, errcheck, gas, goconst -func (ec *executionContext) _BugConnection(ctx context.Context, sel ast.SelectionSet, obj *models.BugConnection) graphql.Marshaler { - fields := graphql.CollectFields(ctx, sel, bugConnectionImplementors) - - out := graphql.NewOrderedMap(len(fields)) - invalid := false - for i, field := range fields { - out.Keys[i] = field.Alias - - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("BugConnection") - case "edges": - out.Values[i] = ec._BugConnection_edges(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "nodes": - out.Values[i] = ec._BugConnection_nodes(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "pageInfo": - out.Values[i] = ec._BugConnection_pageInfo(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "totalCount": - out.Values[i] = ec._BugConnection_totalCount(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - - if invalid { - return graphql.Null - } - return out + return ec.marshalNLabel2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐLabel(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _BugConnection_edges(ctx context.Context, field graphql.CollectedField, obj *models.BugConnection) graphql.Marshaler { +func (ec *executionContext) _LabelChangeTimelineItem_removed(ctx context.Context, field graphql.CollectedField, obj *bug.LabelChangeTimelineItem) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "BugConnection", - Args: nil, - Field: field, + Object: "LabelChangeTimelineItem", + Field: field, + Args: nil, + IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Edges, nil + return obj.Removed, nil }) if resTmp == nil { if !ec.HasError(rctx) { @@ -3463,59 +4915,33 @@ func (ec *executionContext) _BugConnection_edges(ctx context.Context, field grap } return graphql.Null } - res := resTmp.([]models.BugEdge) + res := resTmp.([]bug.Label) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } - - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], - } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() - } - arr1[idx1] = func() graphql.Marshaler { - - return ec._BugEdge(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } - - } - wg.Wait() - return arr1 + return ec.marshalNLabel2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐLabel(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _BugConnection_nodes(ctx context.Context, field graphql.CollectedField, obj *models.BugConnection) graphql.Marshaler { +func (ec *executionContext) _Mutation_newBug(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "BugConnection", - Args: nil, - Field: field, + Object: "Mutation", + Field: field, + Args: nil, + IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) + rawArgs := field.ArgumentMap(ec.Variables) + args, err := ec.field_Mutation_newBug_args(ctx, rawArgs) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Nodes, nil + return ec.resolvers.Mutation().NewBug(rctx, args["repoRef"].(*string), args["title"].(string), args["message"].(string), args["files"].([]git.Hash)) }) if resTmp == nil { if !ec.HasError(rctx) { @@ -3523,59 +4949,33 @@ func (ec *executionContext) _BugConnection_nodes(ctx context.Context, field grap } return graphql.Null } - res := resTmp.([]bug.Snapshot) + res := resTmp.(*bug.Snapshot) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } - - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], - } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() - } - arr1[idx1] = func() graphql.Marshaler { - - return ec._Bug(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } - - } - wg.Wait() - return arr1 + return ec.marshalNBug2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐSnapshot(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _BugConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *models.BugConnection) graphql.Marshaler { +func (ec *executionContext) _Mutation_addComment(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "BugConnection", - Args: nil, - Field: field, + Object: "Mutation", + Field: field, + Args: nil, + IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) + rawArgs := field.ArgumentMap(ec.Variables) + args, err := ec.field_Mutation_addComment_args(ctx, rawArgs) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.PageInfo, nil + return ec.resolvers.Mutation().AddComment(rctx, args["repoRef"].(*string), args["prefix"].(string), args["message"].(string), args["files"].([]git.Hash)) }) if resTmp == nil { if !ec.HasError(rctx) { @@ -3583,27 +4983,33 @@ func (ec *executionContext) _BugConnection_pageInfo(ctx context.Context, field g } return graphql.Null } - res := resTmp.(models.PageInfo) + res := resTmp.(*bug.Snapshot) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - - return ec._PageInfo(ctx, field.Selections, &res) + return ec.marshalNBug2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐSnapshot(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _BugConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *models.BugConnection) graphql.Marshaler { +func (ec *executionContext) _Mutation_changeLabels(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "BugConnection", - Args: nil, - Field: field, + Object: "Mutation", + Field: field, + Args: nil, + IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) + rawArgs := field.ArgumentMap(ec.Variables) + args, err := ec.field_Mutation_changeLabels_args(ctx, rawArgs) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.TotalCount, nil + return ec.resolvers.Mutation().ChangeLabels(rctx, args["repoRef"].(*string), args["prefix"].(string), args["added"].([]string), args["removed"].([]string)) }) if resTmp == nil { if !ec.HasError(rctx) { @@ -3611,61 +5017,33 @@ func (ec *executionContext) _BugConnection_totalCount(ctx context.Context, field } return graphql.Null } - res := resTmp.(int) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalInt(res) -} - -var bugEdgeImplementors = []string{"BugEdge"} - -// nolint: gocyclo, errcheck, gas, goconst -func (ec *executionContext) _BugEdge(ctx context.Context, sel ast.SelectionSet, obj *models.BugEdge) graphql.Marshaler { - fields := graphql.CollectFields(ctx, sel, bugEdgeImplementors) - - out := graphql.NewOrderedMap(len(fields)) - invalid := false - for i, field := range fields { - out.Keys[i] = field.Alias - - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("BugEdge") - case "cursor": - out.Values[i] = ec._BugEdge_cursor(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "node": - out.Values[i] = ec._BugEdge_node(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - - if invalid { - return graphql.Null - } - return out + res := resTmp.(*bug.Snapshot) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNBug2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐSnapshot(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _BugEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *models.BugEdge) graphql.Marshaler { +func (ec *executionContext) _Mutation_open(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "BugEdge", - Args: nil, - Field: field, + Object: "Mutation", + Field: field, + Args: nil, + IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) + rawArgs := field.ArgumentMap(ec.Variables) + args, err := ec.field_Mutation_open_args(ctx, rawArgs) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Cursor, nil + return ec.resolvers.Mutation().Open(rctx, args["repoRef"].(*string), args["prefix"].(string)) }) if resTmp == nil { if !ec.HasError(rctx) { @@ -3673,26 +5051,33 @@ func (ec *executionContext) _BugEdge_cursor(ctx context.Context, field graphql.C } return graphql.Null } - res := resTmp.(string) + res := resTmp.(*bug.Snapshot) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalString(res) + return ec.marshalNBug2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐSnapshot(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _BugEdge_node(ctx context.Context, field graphql.CollectedField, obj *models.BugEdge) graphql.Marshaler { +func (ec *executionContext) _Mutation_close(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "BugEdge", - Args: nil, - Field: field, + Object: "Mutation", + Field: field, + Args: nil, + IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) + rawArgs := field.ArgumentMap(ec.Variables) + args, err := ec.field_Mutation_close_args(ctx, rawArgs) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Node, nil + return ec.resolvers.Mutation().Close(rctx, args["repoRef"].(*string), args["prefix"].(string)) }) if resTmp == nil { if !ec.HasError(rctx) { @@ -3700,67 +5085,33 @@ func (ec *executionContext) _BugEdge_node(ctx context.Context, field graphql.Col } return graphql.Null } - res := resTmp.(bug.Snapshot) + res := resTmp.(*bug.Snapshot) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - - return ec._Bug(ctx, field.Selections, &res) -} - -var commentImplementors = []string{"Comment", "Authored"} - -// nolint: gocyclo, errcheck, gas, goconst -func (ec *executionContext) _Comment(ctx context.Context, sel ast.SelectionSet, obj *bug.Comment) graphql.Marshaler { - fields := graphql.CollectFields(ctx, sel, commentImplementors) - - out := graphql.NewOrderedMap(len(fields)) - invalid := false - for i, field := range fields { - out.Keys[i] = field.Alias - - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("Comment") - case "author": - out.Values[i] = ec._Comment_author(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "message": - out.Values[i] = ec._Comment_message(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "files": - out.Values[i] = ec._Comment_files(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - - if invalid { - return graphql.Null - } - return out + return ec.marshalNBug2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐSnapshot(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _Comment_author(ctx context.Context, field graphql.CollectedField, obj *bug.Comment) graphql.Marshaler { +func (ec *executionContext) _Mutation_setTitle(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "Comment", - Args: nil, - Field: field, + Object: "Mutation", + Field: field, + Args: nil, + IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) + rawArgs := field.ArgumentMap(ec.Variables) + args, err := ec.field_Mutation_setTitle_args(ctx, rawArgs) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Author, nil + return ec.resolvers.Mutation().SetTitle(rctx, args["repoRef"].(*string), args["prefix"].(string), args["title"].(string)) }) if resTmp == nil { if !ec.HasError(rctx) { @@ -3768,27 +5119,33 @@ func (ec *executionContext) _Comment_author(ctx context.Context, field graphql.C } return graphql.Null } - res := resTmp.(identity.Interface) + res := resTmp.(*bug.Snapshot) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - - return ec._Identity(ctx, field.Selections, &res) + return ec.marshalNBug2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐSnapshot(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _Comment_message(ctx context.Context, field graphql.CollectedField, obj *bug.Comment) graphql.Marshaler { +func (ec *executionContext) _Mutation_commit(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "Comment", - Args: nil, - Field: field, + Object: "Mutation", + Field: field, + Args: nil, + IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) + rawArgs := field.ArgumentMap(ec.Variables) + args, err := ec.field_Mutation_commit_args(ctx, rawArgs) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Message, nil + return ec.resolvers.Mutation().Commit(rctx, args["repoRef"].(*string), args["prefix"].(string)) }) if resTmp == nil { if !ec.HasError(rctx) { @@ -3796,26 +5153,26 @@ func (ec *executionContext) _Comment_message(ctx context.Context, field graphql. } return graphql.Null } - res := resTmp.(string) + res := resTmp.(*bug.Snapshot) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalString(res) + return ec.marshalNBug2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐSnapshot(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _Comment_files(ctx context.Context, field graphql.CollectedField, obj *bug.Comment) graphql.Marshaler { +func (ec *executionContext) _OperationConnection_edges(ctx context.Context, field graphql.CollectedField, obj *models.OperationConnection) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "Comment", - Args: nil, - Field: field, + Object: "OperationConnection", + Field: field, + Args: nil, + IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Files, nil + return obj.Edges, nil }) if resTmp == nil { if !ec.HasError(rctx) { @@ -3823,80 +5180,26 @@ func (ec *executionContext) _Comment_files(ctx context.Context, field graphql.Co } return graphql.Null } - res := resTmp.([]git.Hash) + res := resTmp.([]models.OperationEdge) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - - arr1 := make(graphql.Array, len(res)) - - for idx1 := range res { - arr1[idx1] = func() graphql.Marshaler { - return res[idx1] - }() - } - - return arr1 -} - -var commentConnectionImplementors = []string{"CommentConnection"} - -// nolint: gocyclo, errcheck, gas, goconst -func (ec *executionContext) _CommentConnection(ctx context.Context, sel ast.SelectionSet, obj *models.CommentConnection) graphql.Marshaler { - fields := graphql.CollectFields(ctx, sel, commentConnectionImplementors) - - out := graphql.NewOrderedMap(len(fields)) - invalid := false - for i, field := range fields { - out.Keys[i] = field.Alias - - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("CommentConnection") - case "edges": - out.Values[i] = ec._CommentConnection_edges(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "nodes": - out.Values[i] = ec._CommentConnection_nodes(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "pageInfo": - out.Values[i] = ec._CommentConnection_pageInfo(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "totalCount": - out.Values[i] = ec._CommentConnection_totalCount(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - - if invalid { - return graphql.Null - } - return out + return ec.marshalNOperationEdge2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐOperationEdge(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _CommentConnection_edges(ctx context.Context, field graphql.CollectedField, obj *models.CommentConnection) graphql.Marshaler { +func (ec *executionContext) _OperationConnection_nodes(ctx context.Context, field graphql.CollectedField, obj *models.OperationConnection) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "CommentConnection", - Args: nil, - Field: field, + Object: "OperationConnection", + Field: field, + Args: nil, + IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Edges, nil + return obj.Nodes, nil }) if resTmp == nil { if !ec.HasError(rctx) { @@ -3904,59 +5207,26 @@ func (ec *executionContext) _CommentConnection_edges(ctx context.Context, field } return graphql.Null } - res := resTmp.([]models.CommentEdge) + res := resTmp.([]bug.Operation) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } - - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], - } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() - } - arr1[idx1] = func() graphql.Marshaler { - - return ec._CommentEdge(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } - - } - wg.Wait() - return arr1 + return ec.marshalNOperation2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐOperation(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _CommentConnection_nodes(ctx context.Context, field graphql.CollectedField, obj *models.CommentConnection) graphql.Marshaler { +func (ec *executionContext) _OperationConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *models.OperationConnection) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "CommentConnection", - Args: nil, - Field: field, + Object: "OperationConnection", + Field: field, + Args: nil, + IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Nodes, nil + return obj.PageInfo, nil }) if resTmp == nil { if !ec.HasError(rctx) { @@ -3964,59 +5234,26 @@ func (ec *executionContext) _CommentConnection_nodes(ctx context.Context, field } return graphql.Null } - res := resTmp.([]bug.Comment) + res := resTmp.(models.PageInfo) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } - - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], - } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() - } - arr1[idx1] = func() graphql.Marshaler { - - return ec._Comment(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } - - } - wg.Wait() - return arr1 + return ec.marshalNPageInfo2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐPageInfo(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _CommentConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *models.CommentConnection) graphql.Marshaler { +func (ec *executionContext) _OperationConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *models.OperationConnection) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "CommentConnection", - Args: nil, - Field: field, + Object: "OperationConnection", + Field: field, + Args: nil, + IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.PageInfo, nil + return obj.TotalCount, nil }) if resTmp == nil { if !ec.HasError(rctx) { @@ -4024,27 +5261,26 @@ func (ec *executionContext) _CommentConnection_pageInfo(ctx context.Context, fie } return graphql.Null } - res := resTmp.(models.PageInfo) + res := resTmp.(int) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - - return ec._PageInfo(ctx, field.Selections, &res) + return ec.marshalNInt2int(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _CommentConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *models.CommentConnection) graphql.Marshaler { +func (ec *executionContext) _OperationEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *models.OperationEdge) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "CommentConnection", - Args: nil, - Field: field, + Object: "OperationEdge", + Field: field, + Args: nil, + IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.TotalCount, nil + return obj.Cursor, nil }) if resTmp == nil { if !ec.HasError(rctx) { @@ -4052,61 +5288,53 @@ func (ec *executionContext) _CommentConnection_totalCount(ctx context.Context, f } return graphql.Null } - res := resTmp.(int) + res := resTmp.(string) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalInt(res) + return ec.marshalNString2string(ctx, field.Selections, res) } -var commentEdgeImplementors = []string{"CommentEdge"} - -// nolint: gocyclo, errcheck, gas, goconst -func (ec *executionContext) _CommentEdge(ctx context.Context, sel ast.SelectionSet, obj *models.CommentEdge) graphql.Marshaler { - fields := graphql.CollectFields(ctx, sel, commentEdgeImplementors) - - out := graphql.NewOrderedMap(len(fields)) - invalid := false - for i, field := range fields { - out.Keys[i] = field.Alias - - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("CommentEdge") - case "cursor": - out.Values[i] = ec._CommentEdge_cursor(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "node": - out.Values[i] = ec._CommentEdge_node(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - default: - panic("unknown field " + strconv.Quote(field.Name)) - } +func (ec *executionContext) _OperationEdge_node(ctx context.Context, field graphql.CollectedField, obj *models.OperationEdge) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "OperationEdge", + Field: field, + Args: nil, + IsMethod: false, } - - if invalid { + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Node, nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - return out + res := resTmp.(bug.Operation) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNOperation2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐOperation(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _CommentEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *models.CommentEdge) graphql.Marshaler { +func (ec *executionContext) _PageInfo_hasNextPage(ctx context.Context, field graphql.CollectedField, obj *models.PageInfo) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "CommentEdge", - Args: nil, - Field: field, + Object: "PageInfo", + Field: field, + Args: nil, + IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Cursor, nil + return obj.HasNextPage, nil }) if resTmp == nil { if !ec.HasError(rctx) { @@ -4114,26 +5342,26 @@ func (ec *executionContext) _CommentEdge_cursor(ctx context.Context, field graph } return graphql.Null } - res := resTmp.(string) + res := resTmp.(bool) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalString(res) + return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _CommentEdge_node(ctx context.Context, field graphql.CollectedField, obj *models.CommentEdge) graphql.Marshaler { +func (ec *executionContext) _PageInfo_hasPreviousPage(ctx context.Context, field graphql.CollectedField, obj *models.PageInfo) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "CommentEdge", - Args: nil, - Field: field, + Object: "PageInfo", + Field: field, + Args: nil, + IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Node, nil + return obj.HasPreviousPage, nil }) if resTmp == nil { if !ec.HasError(rctx) { @@ -4141,67 +5369,26 @@ func (ec *executionContext) _CommentEdge_node(ctx context.Context, field graphql } return graphql.Null } - res := resTmp.(bug.Comment) + res := resTmp.(bool) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - - return ec._Comment(ctx, field.Selections, &res) -} - -var commentHistoryStepImplementors = []string{"CommentHistoryStep"} - -// nolint: gocyclo, errcheck, gas, goconst -func (ec *executionContext) _CommentHistoryStep(ctx context.Context, sel ast.SelectionSet, obj *bug.CommentHistoryStep) graphql.Marshaler { - fields := graphql.CollectFields(ctx, sel, commentHistoryStepImplementors) - - var wg sync.WaitGroup - out := graphql.NewOrderedMap(len(fields)) - invalid := false - for i, field := range fields { - out.Keys[i] = field.Alias - - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("CommentHistoryStep") - case "message": - out.Values[i] = ec._CommentHistoryStep_message(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "date": - wg.Add(1) - go func(i int, field graphql.CollectedField) { - out.Values[i] = ec._CommentHistoryStep_date(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - wg.Done() - }(i, field) - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - wg.Wait() - if invalid { - return graphql.Null - } - return out + return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _CommentHistoryStep_message(ctx context.Context, field graphql.CollectedField, obj *bug.CommentHistoryStep) graphql.Marshaler { +func (ec *executionContext) _PageInfo_startCursor(ctx context.Context, field graphql.CollectedField, obj *models.PageInfo) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "CommentHistoryStep", - Args: nil, - Field: field, + Object: "PageInfo", + Field: field, + Args: nil, + IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Message, nil + return obj.StartCursor, nil }) if resTmp == nil { if !ec.HasError(rctx) { @@ -4212,23 +5399,23 @@ func (ec *executionContext) _CommentHistoryStep_message(ctx context.Context, fie res := resTmp.(string) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalString(res) + return ec.marshalNString2string(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _CommentHistoryStep_date(ctx context.Context, field graphql.CollectedField, obj *bug.CommentHistoryStep) graphql.Marshaler { +func (ec *executionContext) _PageInfo_endCursor(ctx context.Context, field graphql.CollectedField, obj *models.PageInfo) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "CommentHistoryStep", - Args: nil, - Field: field, + Object: "PageInfo", + Field: field, + Args: nil, + IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.CommentHistoryStep().Date(rctx, obj) + return obj.EndCursor, nil }) if resTmp == nil { if !ec.HasError(rctx) { @@ -4236,168 +5423,143 @@ func (ec *executionContext) _CommentHistoryStep_date(ctx context.Context, field } return graphql.Null } - res := resTmp.(time.Time) + res := resTmp.(string) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalTime(res) + return ec.marshalNString2string(ctx, field.Selections, res) } -var createOperationImplementors = []string{"CreateOperation", "Operation", "Authored"} - -// nolint: gocyclo, errcheck, gas, goconst -func (ec *executionContext) _CreateOperation(ctx context.Context, sel ast.SelectionSet, obj *bug.CreateOperation) graphql.Marshaler { - fields := graphql.CollectFields(ctx, sel, createOperationImplementors) - - var wg sync.WaitGroup - out := graphql.NewOrderedMap(len(fields)) - invalid := false - for i, field := range fields { - out.Keys[i] = field.Alias - - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("CreateOperation") - case "hash": - out.Values[i] = ec._CreateOperation_hash(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "author": - out.Values[i] = ec._CreateOperation_author(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "date": - wg.Add(1) - go func(i int, field graphql.CollectedField) { - out.Values[i] = ec._CreateOperation_date(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - wg.Done() - }(i, field) - case "title": - out.Values[i] = ec._CreateOperation_title(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "message": - out.Values[i] = ec._CreateOperation_message(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "files": - out.Values[i] = ec._CreateOperation_files(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - default: - panic("unknown field " + strconv.Quote(field.Name)) - } +func (ec *executionContext) _Query_defaultRepository(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, } - wg.Wait() - if invalid { + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().DefaultRepository(rctx) + }) + if resTmp == nil { return graphql.Null } - return out + res := resTmp.(*models.Repository) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalORepository2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐRepository(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _CreateOperation_hash(ctx context.Context, field graphql.CollectedField, obj *bug.CreateOperation) graphql.Marshaler { +func (ec *executionContext) _Query_repository(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "CreateOperation", - Args: nil, - Field: field, + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) + rawArgs := field.ArgumentMap(ec.Variables) + args, err := ec.field_Query_repository_args(ctx, rawArgs) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Hash() + return ec.resolvers.Query().Repository(rctx, args["id"].(string)) }) if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(git.Hash) + res := resTmp.(*models.Repository) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return res + return ec.marshalORepository2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐRepository(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _CreateOperation_author(ctx context.Context, field graphql.CollectedField, obj *bug.CreateOperation) graphql.Marshaler { +func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "CreateOperation", - Args: nil, - Field: field, + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) + rawArgs := field.ArgumentMap(ec.Variables) + args, err := ec.field_Query___type_args(ctx, rawArgs) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Author, nil + return ec.introspectType(args["name"].(string)) }) if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(identity.Interface) + res := resTmp.(*introspection.Type) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - - return ec._Identity(ctx, field.Selections, &res) + return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _CreateOperation_date(ctx context.Context, field graphql.CollectedField, obj *bug.CreateOperation) graphql.Marshaler { +func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "CreateOperation", - Args: nil, - Field: field, + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.CreateOperation().Date(rctx, obj) + return ec.introspectSchema() }) if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(time.Time) + res := resTmp.(*introspection.Schema) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalTime(res) + return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _CreateOperation_title(ctx context.Context, field graphql.CollectedField, obj *bug.CreateOperation) graphql.Marshaler { +func (ec *executionContext) _Repository_allBugs(ctx context.Context, field graphql.CollectedField, obj *models.Repository) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "CreateOperation", - Args: nil, - Field: field, + Object: "Repository", + Field: field, + Args: nil, + IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) + rawArgs := field.ArgumentMap(ec.Variables) + args, err := ec.field_Repository_allBugs_args(ctx, rawArgs) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Title, nil + return ec.resolvers.Repository().AllBugs(rctx, obj, args["after"].(*string), args["before"].(*string), args["first"].(*int), args["last"].(*int), args["query"].(*string)) }) if resTmp == nil { if !ec.HasError(rctx) { @@ -4405,53 +5567,64 @@ func (ec *executionContext) _CreateOperation_title(ctx context.Context, field gr } return graphql.Null } - res := resTmp.(string) + res := resTmp.(*models.BugConnection) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalString(res) + return ec.marshalNBugConnection2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐBugConnection(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _CreateOperation_message(ctx context.Context, field graphql.CollectedField, obj *bug.CreateOperation) graphql.Marshaler { +func (ec *executionContext) _Repository_bug(ctx context.Context, field graphql.CollectedField, obj *models.Repository) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "CreateOperation", - Args: nil, - Field: field, + Object: "Repository", + Field: field, + Args: nil, + IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) + rawArgs := field.ArgumentMap(ec.Variables) + args, err := ec.field_Repository_bug_args(ctx, rawArgs) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Message, nil + return ec.resolvers.Repository().Bug(rctx, obj, args["prefix"].(string)) }) if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(string) + res := resTmp.(*bug.Snapshot) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalString(res) + return ec.marshalOBug2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐSnapshot(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _CreateOperation_files(ctx context.Context, field graphql.CollectedField, obj *bug.CreateOperation) graphql.Marshaler { +func (ec *executionContext) _Repository_allIdentities(ctx context.Context, field graphql.CollectedField, obj *models.Repository) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "CreateOperation", - Args: nil, - Field: field, + Object: "Repository", + Field: field, + Args: nil, + IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) + rawArgs := field.ArgumentMap(ec.Variables) + args, err := ec.field_Repository_allIdentities_args(ctx, rawArgs) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Files, nil + return ec.resolvers.Repository().AllIdentities(rctx, obj, args["after"].(*string), args["before"].(*string), args["first"].(*int), args["last"].(*int)) }) if resTmp == nil { if !ec.HasError(rctx) { @@ -4459,114 +5632,81 @@ func (ec *executionContext) _CreateOperation_files(ctx context.Context, field gr } return graphql.Null } - res := resTmp.([]git.Hash) + res := resTmp.(*models.IdentityConnection) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - - arr1 := make(graphql.Array, len(res)) - - for idx1 := range res { - arr1[idx1] = func() graphql.Marshaler { - return res[idx1] - }() - } - - return arr1 + return ec.marshalNIdentityConnection2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐIdentityConnection(ctx, field.Selections, res) } - -var createTimelineItemImplementors = []string{"CreateTimelineItem", "TimelineItem"} - -// nolint: gocyclo, errcheck, gas, goconst -func (ec *executionContext) _CreateTimelineItem(ctx context.Context, sel ast.SelectionSet, obj *bug.CreateTimelineItem) graphql.Marshaler { - fields := graphql.CollectFields(ctx, sel, createTimelineItemImplementors) - - var wg sync.WaitGroup - out := graphql.NewOrderedMap(len(fields)) - invalid := false - for i, field := range fields { - out.Keys[i] = field.Alias - - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("CreateTimelineItem") - case "hash": - out.Values[i] = ec._CreateTimelineItem_hash(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "author": - out.Values[i] = ec._CreateTimelineItem_author(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "message": - out.Values[i] = ec._CreateTimelineItem_message(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "messageIsEmpty": - out.Values[i] = ec._CreateTimelineItem_messageIsEmpty(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "files": - out.Values[i] = ec._CreateTimelineItem_files(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "createdAt": - wg.Add(1) - go func(i int, field graphql.CollectedField) { - out.Values[i] = ec._CreateTimelineItem_createdAt(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - wg.Done() - }(i, field) - case "lastEdit": - wg.Add(1) - go func(i int, field graphql.CollectedField) { - out.Values[i] = ec._CreateTimelineItem_lastEdit(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - wg.Done() - }(i, field) - case "edited": - out.Values[i] = ec._CreateTimelineItem_edited(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "history": - out.Values[i] = ec._CreateTimelineItem_history(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - default: - panic("unknown field " + strconv.Quote(field.Name)) - } + +func (ec *executionContext) _Repository_identity(ctx context.Context, field graphql.CollectedField, obj *models.Repository) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "Repository", + Field: field, + Args: nil, + IsMethod: true, } - wg.Wait() - if invalid { + ctx = graphql.WithResolverContext(ctx, rctx) + rawArgs := field.ArgumentMap(ec.Variables) + args, err := ec.field_Repository_identity_args(ctx, rawArgs) + if err != nil { + ec.Error(ctx, err) return graphql.Null } - return out + rctx.Args = args + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Repository().Identity(rctx, obj, args["prefix"].(string)) + }) + if resTmp == nil { + return graphql.Null + } + res := resTmp.(identity.Interface) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalOIdentity2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋidentityᚐInterface(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _CreateTimelineItem_hash(ctx context.Context, field graphql.CollectedField, obj *bug.CreateTimelineItem) graphql.Marshaler { +func (ec *executionContext) _Repository_userIdentity(ctx context.Context, field graphql.CollectedField, obj *models.Repository) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "CreateTimelineItem", - Args: nil, - Field: field, + Object: "Repository", + Field: field, + Args: nil, + IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Hash(), nil + return ec.resolvers.Repository().UserIdentity(rctx, obj) + }) + if resTmp == nil { + return graphql.Null + } + res := resTmp.(identity.Interface) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalOIdentity2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋidentityᚐInterface(ctx, field.Selections, res) +} + +func (ec *executionContext) _SetStatusOperation_hash(ctx context.Context, field graphql.CollectedField, obj *bug.SetStatusOperation) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "SetStatusOperation", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Hash() }) if resTmp == nil { if !ec.HasError(rctx) { @@ -4577,17 +5717,17 @@ func (ec *executionContext) _CreateTimelineItem_hash(ctx context.Context, field res := resTmp.(git.Hash) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return res + return ec.marshalNHash2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋutilᚋgitᚐHash(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _CreateTimelineItem_author(ctx context.Context, field graphql.CollectedField, obj *bug.CreateTimelineItem) graphql.Marshaler { +func (ec *executionContext) _SetStatusOperation_author(ctx context.Context, field graphql.CollectedField, obj *bug.SetStatusOperation) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "CreateTimelineItem", - Args: nil, - Field: field, + Object: "SetStatusOperation", + Field: field, + Args: nil, + IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) @@ -4604,24 +5744,23 @@ func (ec *executionContext) _CreateTimelineItem_author(ctx context.Context, fiel res := resTmp.(identity.Interface) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - - return ec._Identity(ctx, field.Selections, &res) + return ec.marshalNIdentity2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋidentityᚐInterface(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _CreateTimelineItem_message(ctx context.Context, field graphql.CollectedField, obj *bug.CreateTimelineItem) graphql.Marshaler { +func (ec *executionContext) _SetStatusOperation_date(ctx context.Context, field graphql.CollectedField, obj *bug.SetStatusOperation) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "CreateTimelineItem", - Args: nil, - Field: field, + Object: "SetStatusOperation", + Field: field, + Args: nil, + IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Message, nil + return ec.resolvers.SetStatusOperation().Date(rctx, obj) }) if resTmp == nil { if !ec.HasError(rctx) { @@ -4629,26 +5768,26 @@ func (ec *executionContext) _CreateTimelineItem_message(ctx context.Context, fie } return graphql.Null } - res := resTmp.(string) + res := resTmp.(*time.Time) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalString(res) + return ec.marshalNTime2ᚖtimeᚐTime(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _CreateTimelineItem_messageIsEmpty(ctx context.Context, field graphql.CollectedField, obj *bug.CreateTimelineItem) graphql.Marshaler { +func (ec *executionContext) _SetStatusOperation_status(ctx context.Context, field graphql.CollectedField, obj *bug.SetStatusOperation) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "CreateTimelineItem", - Args: nil, - Field: field, + Object: "SetStatusOperation", + Field: field, + Args: nil, + IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.MessageIsEmpty(), nil + return ec.resolvers.SetStatusOperation().Status(rctx, obj) }) if resTmp == nil { if !ec.HasError(rctx) { @@ -4656,26 +5795,26 @@ func (ec *executionContext) _CreateTimelineItem_messageIsEmpty(ctx context.Conte } return graphql.Null } - res := resTmp.(bool) + res := resTmp.(models.Status) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalBoolean(res) + return ec.marshalNStatus2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐStatus(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _CreateTimelineItem_files(ctx context.Context, field graphql.CollectedField, obj *bug.CreateTimelineItem) graphql.Marshaler { +func (ec *executionContext) _SetStatusTimelineItem_hash(ctx context.Context, field graphql.CollectedField, obj *bug.SetStatusTimelineItem) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "CreateTimelineItem", - Args: nil, - Field: field, + Object: "SetStatusTimelineItem", + Field: field, + Args: nil, + IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Files, nil + return obj.Hash(), nil }) if resTmp == nil { if !ec.HasError(rctx) { @@ -4683,35 +5822,26 @@ func (ec *executionContext) _CreateTimelineItem_files(ctx context.Context, field } return graphql.Null } - res := resTmp.([]git.Hash) + res := resTmp.(git.Hash) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - - arr1 := make(graphql.Array, len(res)) - - for idx1 := range res { - arr1[idx1] = func() graphql.Marshaler { - return res[idx1] - }() - } - - return arr1 + return ec.marshalNHash2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋutilᚋgitᚐHash(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _CreateTimelineItem_createdAt(ctx context.Context, field graphql.CollectedField, obj *bug.CreateTimelineItem) graphql.Marshaler { +func (ec *executionContext) _SetStatusTimelineItem_author(ctx context.Context, field graphql.CollectedField, obj *bug.SetStatusTimelineItem) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "CreateTimelineItem", - Args: nil, - Field: field, + Object: "SetStatusTimelineItem", + Field: field, + Args: nil, + IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.CreateTimelineItem().CreatedAt(rctx, obj) + return obj.Author, nil }) if resTmp == nil { if !ec.HasError(rctx) { @@ -4719,26 +5849,26 @@ func (ec *executionContext) _CreateTimelineItem_createdAt(ctx context.Context, f } return graphql.Null } - res := resTmp.(time.Time) + res := resTmp.(identity.Interface) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalTime(res) + return ec.marshalNIdentity2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋidentityᚐInterface(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _CreateTimelineItem_lastEdit(ctx context.Context, field graphql.CollectedField, obj *bug.CreateTimelineItem) graphql.Marshaler { +func (ec *executionContext) _SetStatusTimelineItem_date(ctx context.Context, field graphql.CollectedField, obj *bug.SetStatusTimelineItem) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "CreateTimelineItem", - Args: nil, - Field: field, + Object: "SetStatusTimelineItem", + Field: field, + Args: nil, + IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.CreateTimelineItem().LastEdit(rctx, obj) + return ec.resolvers.SetStatusTimelineItem().Date(rctx, obj) }) if resTmp == nil { if !ec.HasError(rctx) { @@ -4746,26 +5876,26 @@ func (ec *executionContext) _CreateTimelineItem_lastEdit(ctx context.Context, fi } return graphql.Null } - res := resTmp.(time.Time) + res := resTmp.(*time.Time) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalTime(res) + return ec.marshalNTime2ᚖtimeᚐTime(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _CreateTimelineItem_edited(ctx context.Context, field graphql.CollectedField, obj *bug.CreateTimelineItem) graphql.Marshaler { +func (ec *executionContext) _SetStatusTimelineItem_status(ctx context.Context, field graphql.CollectedField, obj *bug.SetStatusTimelineItem) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "CreateTimelineItem", - Args: nil, - Field: field, + Object: "SetStatusTimelineItem", + Field: field, + Args: nil, + IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Edited(), nil + return ec.resolvers.SetStatusTimelineItem().Status(rctx, obj) }) if resTmp == nil { if !ec.HasError(rctx) { @@ -4773,26 +5903,26 @@ func (ec *executionContext) _CreateTimelineItem_edited(ctx context.Context, fiel } return graphql.Null } - res := resTmp.(bool) + res := resTmp.(models.Status) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalBoolean(res) + return ec.marshalNStatus2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐStatus(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _CreateTimelineItem_history(ctx context.Context, field graphql.CollectedField, obj *bug.CreateTimelineItem) graphql.Marshaler { +func (ec *executionContext) _SetTitleOperation_hash(ctx context.Context, field graphql.CollectedField, obj *bug.SetTitleOperation) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "CreateTimelineItem", - Args: nil, - Field: field, + Object: "SetTitleOperation", + Field: field, + Args: nil, + IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.History, nil + return obj.Hash() }) if resTmp == nil { if !ec.HasError(rctx) { @@ -4800,119 +5930,53 @@ func (ec *executionContext) _CreateTimelineItem_history(ctx context.Context, fie } return graphql.Null } - res := resTmp.([]bug.CommentHistoryStep) + res := resTmp.(git.Hash) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } - - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], - } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() - } - arr1[idx1] = func() graphql.Marshaler { - - return ec._CommentHistoryStep(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } - - } - wg.Wait() - return arr1 + return ec.marshalNHash2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋutilᚋgitᚐHash(ctx, field.Selections, res) } -var editCommentOperationImplementors = []string{"EditCommentOperation", "Operation", "Authored"} - -// nolint: gocyclo, errcheck, gas, goconst -func (ec *executionContext) _EditCommentOperation(ctx context.Context, sel ast.SelectionSet, obj *bug.EditCommentOperation) graphql.Marshaler { - fields := graphql.CollectFields(ctx, sel, editCommentOperationImplementors) - - var wg sync.WaitGroup - out := graphql.NewOrderedMap(len(fields)) - invalid := false - for i, field := range fields { - out.Keys[i] = field.Alias - - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("EditCommentOperation") - case "hash": - out.Values[i] = ec._EditCommentOperation_hash(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "author": - out.Values[i] = ec._EditCommentOperation_author(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "date": - wg.Add(1) - go func(i int, field graphql.CollectedField) { - out.Values[i] = ec._EditCommentOperation_date(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - wg.Done() - }(i, field) - case "target": - out.Values[i] = ec._EditCommentOperation_target(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "message": - out.Values[i] = ec._EditCommentOperation_message(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "files": - out.Values[i] = ec._EditCommentOperation_files(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - default: - panic("unknown field " + strconv.Quote(field.Name)) - } +func (ec *executionContext) _SetTitleOperation_author(ctx context.Context, field graphql.CollectedField, obj *bug.SetTitleOperation) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "SetTitleOperation", + Field: field, + Args: nil, + IsMethod: false, } - wg.Wait() - if invalid { + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Author, nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - return out + res := resTmp.(identity.Interface) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNIdentity2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋidentityᚐInterface(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _EditCommentOperation_hash(ctx context.Context, field graphql.CollectedField, obj *bug.EditCommentOperation) graphql.Marshaler { +func (ec *executionContext) _SetTitleOperation_date(ctx context.Context, field graphql.CollectedField, obj *bug.SetTitleOperation) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "EditCommentOperation", - Args: nil, - Field: field, + Object: "SetTitleOperation", + Field: field, + Args: nil, + IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Hash() + return ec.resolvers.SetTitleOperation().Date(rctx, obj) }) if resTmp == nil { if !ec.HasError(rctx) { @@ -4920,26 +5984,26 @@ func (ec *executionContext) _EditCommentOperation_hash(ctx context.Context, fiel } return graphql.Null } - res := resTmp.(git.Hash) + res := resTmp.(*time.Time) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return res + return ec.marshalNTime2ᚖtimeᚐTime(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _EditCommentOperation_author(ctx context.Context, field graphql.CollectedField, obj *bug.EditCommentOperation) graphql.Marshaler { +func (ec *executionContext) _SetTitleOperation_title(ctx context.Context, field graphql.CollectedField, obj *bug.SetTitleOperation) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "EditCommentOperation", - Args: nil, - Field: field, + Object: "SetTitleOperation", + Field: field, + Args: nil, + IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Author, nil + return obj.Title, nil }) if resTmp == nil { if !ec.HasError(rctx) { @@ -4947,27 +6011,26 @@ func (ec *executionContext) _EditCommentOperation_author(ctx context.Context, fi } return graphql.Null } - res := resTmp.(identity.Interface) + res := resTmp.(string) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - - return ec._Identity(ctx, field.Selections, &res) + return ec.marshalNString2string(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _EditCommentOperation_date(ctx context.Context, field graphql.CollectedField, obj *bug.EditCommentOperation) graphql.Marshaler { +func (ec *executionContext) _SetTitleOperation_was(ctx context.Context, field graphql.CollectedField, obj *bug.SetTitleOperation) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "EditCommentOperation", - Args: nil, - Field: field, + Object: "SetTitleOperation", + Field: field, + Args: nil, + IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.EditCommentOperation().Date(rctx, obj) + return obj.Was, nil }) if resTmp == nil { if !ec.HasError(rctx) { @@ -4975,26 +6038,26 @@ func (ec *executionContext) _EditCommentOperation_date(ctx context.Context, fiel } return graphql.Null } - res := resTmp.(time.Time) + res := resTmp.(string) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalTime(res) + return ec.marshalNString2string(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _EditCommentOperation_target(ctx context.Context, field graphql.CollectedField, obj *bug.EditCommentOperation) graphql.Marshaler { +func (ec *executionContext) _SetTitleTimelineItem_hash(ctx context.Context, field graphql.CollectedField, obj *bug.SetTitleTimelineItem) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "EditCommentOperation", - Args: nil, - Field: field, + Object: "SetTitleTimelineItem", + Field: field, + Args: nil, + IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Target, nil + return obj.Hash(), nil }) if resTmp == nil { if !ec.HasError(rctx) { @@ -5005,23 +6068,23 @@ func (ec *executionContext) _EditCommentOperation_target(ctx context.Context, fi res := resTmp.(git.Hash) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return res + return ec.marshalNHash2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋutilᚋgitᚐHash(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _EditCommentOperation_message(ctx context.Context, field graphql.CollectedField, obj *bug.EditCommentOperation) graphql.Marshaler { +func (ec *executionContext) _SetTitleTimelineItem_author(ctx context.Context, field graphql.CollectedField, obj *bug.SetTitleTimelineItem) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "EditCommentOperation", - Args: nil, - Field: field, + Object: "SetTitleTimelineItem", + Field: field, + Args: nil, + IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Message, nil + return obj.Author, nil }) if resTmp == nil { if !ec.HasError(rctx) { @@ -5029,26 +6092,26 @@ func (ec *executionContext) _EditCommentOperation_message(ctx context.Context, f } return graphql.Null } - res := resTmp.(string) + res := resTmp.(identity.Interface) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalString(res) + return ec.marshalNIdentity2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋidentityᚐInterface(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _EditCommentOperation_files(ctx context.Context, field graphql.CollectedField, obj *bug.EditCommentOperation) graphql.Marshaler { +func (ec *executionContext) _SetTitleTimelineItem_date(ctx context.Context, field graphql.CollectedField, obj *bug.SetTitleTimelineItem) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "EditCommentOperation", - Args: nil, - Field: field, + Object: "SetTitleTimelineItem", + Field: field, + Args: nil, + IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Files, nil + return ec.resolvers.SetTitleTimelineItem().Date(rctx, obj) }) if resTmp == nil { if !ec.HasError(rctx) { @@ -5056,121 +6119,53 @@ func (ec *executionContext) _EditCommentOperation_files(ctx context.Context, fie } return graphql.Null } - res := resTmp.([]git.Hash) + res := resTmp.(*time.Time) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - - arr1 := make(graphql.Array, len(res)) - - for idx1 := range res { - arr1[idx1] = func() graphql.Marshaler { - return res[idx1] - }() - } - - return arr1 + return ec.marshalNTime2ᚖtimeᚐTime(ctx, field.Selections, res) } -var identityImplementors = []string{"Identity"} - -// nolint: gocyclo, errcheck, gas, goconst -func (ec *executionContext) _Identity(ctx context.Context, sel ast.SelectionSet, obj *identity.Interface) graphql.Marshaler { - fields := graphql.CollectFields(ctx, sel, identityImplementors) - - var wg sync.WaitGroup - out := graphql.NewOrderedMap(len(fields)) - invalid := false - for i, field := range fields { - out.Keys[i] = field.Alias - - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("Identity") - case "id": - wg.Add(1) - go func(i int, field graphql.CollectedField) { - out.Values[i] = ec._Identity_id(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - wg.Done() - }(i, field) - case "humanId": - wg.Add(1) - go func(i int, field graphql.CollectedField) { - out.Values[i] = ec._Identity_humanId(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - wg.Done() - }(i, field) - case "name": - wg.Add(1) - go func(i int, field graphql.CollectedField) { - out.Values[i] = ec._Identity_name(ctx, field, obj) - wg.Done() - }(i, field) - case "email": - wg.Add(1) - go func(i int, field graphql.CollectedField) { - out.Values[i] = ec._Identity_email(ctx, field, obj) - wg.Done() - }(i, field) - case "login": - wg.Add(1) - go func(i int, field graphql.CollectedField) { - out.Values[i] = ec._Identity_login(ctx, field, obj) - wg.Done() - }(i, field) - case "displayName": - wg.Add(1) - go func(i int, field graphql.CollectedField) { - out.Values[i] = ec._Identity_displayName(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - wg.Done() - }(i, field) - case "avatarUrl": - wg.Add(1) - go func(i int, field graphql.CollectedField) { - out.Values[i] = ec._Identity_avatarUrl(ctx, field, obj) - wg.Done() - }(i, field) - case "isProtected": - wg.Add(1) - go func(i int, field graphql.CollectedField) { - out.Values[i] = ec._Identity_isProtected(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - wg.Done() - }(i, field) - default: - panic("unknown field " + strconv.Quote(field.Name)) +func (ec *executionContext) _SetTitleTimelineItem_title(ctx context.Context, field graphql.CollectedField, obj *bug.SetTitleTimelineItem) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "SetTitleTimelineItem", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Title, nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") } - } - wg.Wait() - if invalid { return graphql.Null } - return out + res := resTmp.(string) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNString2string(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _Identity_id(ctx context.Context, field graphql.CollectedField, obj *identity.Interface) graphql.Marshaler { +func (ec *executionContext) _SetTitleTimelineItem_was(ctx context.Context, field graphql.CollectedField, obj *bug.SetTitleTimelineItem) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "Identity", - Args: nil, - Field: field, + Object: "SetTitleTimelineItem", + Field: field, + Args: nil, + IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Identity().ID(rctx, obj) + return obj.Was, nil }) if resTmp == nil { if !ec.HasError(rctx) { @@ -5181,23 +6176,23 @@ func (ec *executionContext) _Identity_id(ctx context.Context, field graphql.Coll res := resTmp.(string) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalString(res) + return ec.marshalNString2string(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _Identity_humanId(ctx context.Context, field graphql.CollectedField, obj *identity.Interface) graphql.Marshaler { +func (ec *executionContext) _TimelineItemConnection_edges(ctx context.Context, field graphql.CollectedField, obj *models.TimelineItemConnection) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "Identity", - Args: nil, - Field: field, + Object: "TimelineItemConnection", + Field: field, + Args: nil, + IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Identity().HumanID(rctx, obj) + return obj.Edges, nil }) if resTmp == nil { if !ec.HasError(rctx) { @@ -5205,110 +6200,107 @@ func (ec *executionContext) _Identity_humanId(ctx context.Context, field graphql } return graphql.Null } - res := resTmp.(string) + res := resTmp.([]models.TimelineItemEdge) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalString(res) + return ec.marshalNTimelineItemEdge2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐTimelineItemEdge(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _Identity_name(ctx context.Context, field graphql.CollectedField, obj *identity.Interface) graphql.Marshaler { +func (ec *executionContext) _TimelineItemConnection_nodes(ctx context.Context, field graphql.CollectedField, obj *models.TimelineItemConnection) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "Identity", - Args: nil, - Field: field, + Object: "TimelineItemConnection", + Field: field, + Args: nil, + IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Identity().Name(rctx, obj) + return obj.Nodes, nil }) if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*string) + res := resTmp.([]bug.TimelineItem) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - - if res == nil { - return graphql.Null - } - return graphql.MarshalString(*res) + return ec.marshalNTimelineItem2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐTimelineItem(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _Identity_email(ctx context.Context, field graphql.CollectedField, obj *identity.Interface) graphql.Marshaler { +func (ec *executionContext) _TimelineItemConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *models.TimelineItemConnection) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "Identity", - Args: nil, - Field: field, + Object: "TimelineItemConnection", + Field: field, + Args: nil, + IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Identity().Email(rctx, obj) + return obj.PageInfo, nil }) if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*string) + res := resTmp.(models.PageInfo) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - - if res == nil { - return graphql.Null - } - return graphql.MarshalString(*res) + return ec.marshalNPageInfo2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐPageInfo(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _Identity_login(ctx context.Context, field graphql.CollectedField, obj *identity.Interface) graphql.Marshaler { +func (ec *executionContext) _TimelineItemConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *models.TimelineItemConnection) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "Identity", - Args: nil, - Field: field, + Object: "TimelineItemConnection", + Field: field, + Args: nil, + IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Identity().Login(rctx, obj) + return obj.TotalCount, nil }) if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*string) + res := resTmp.(int) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - - if res == nil { - return graphql.Null - } - return graphql.MarshalString(*res) + return ec.marshalNInt2int(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _Identity_displayName(ctx context.Context, field graphql.CollectedField, obj *identity.Interface) graphql.Marshaler { +func (ec *executionContext) _TimelineItemEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *models.TimelineItemEdge) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "Identity", - Args: nil, - Field: field, + Object: "TimelineItemEdge", + Field: field, + Args: nil, + IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Identity().DisplayName(rctx, obj) + return obj.Cursor, nil }) if resTmp == nil { if !ec.HasError(rctx) { @@ -5319,51 +6311,50 @@ func (ec *executionContext) _Identity_displayName(ctx context.Context, field gra res := resTmp.(string) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalString(res) + return ec.marshalNString2string(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _Identity_avatarUrl(ctx context.Context, field graphql.CollectedField, obj *identity.Interface) graphql.Marshaler { +func (ec *executionContext) _TimelineItemEdge_node(ctx context.Context, field graphql.CollectedField, obj *models.TimelineItemEdge) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "Identity", - Args: nil, - Field: field, + Object: "TimelineItemEdge", + Field: field, + Args: nil, + IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Identity().AvatarURL(rctx, obj) + return obj.Node, nil }) if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*string) + res := resTmp.(bug.TimelineItem) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - - if res == nil { - return graphql.Null - } - return graphql.MarshalString(*res) + return ec.marshalNTimelineItem2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐTimelineItem(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _Identity_isProtected(ctx context.Context, field graphql.CollectedField, obj *identity.Interface) graphql.Marshaler { +func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "Identity", - Args: nil, - Field: field, + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Identity().IsProtected(rctx, obj) + return obj.Name, nil }) if resTmp == nil { if !ec.HasError(rctx) { @@ -5371,71 +6362,50 @@ func (ec *executionContext) _Identity_isProtected(ctx context.Context, field gra } return graphql.Null } - res := resTmp.(bool) + res := resTmp.(string) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalBoolean(res) + return ec.marshalNString2string(ctx, field.Selections, res) } -var identityConnectionImplementors = []string{"IdentityConnection"} - -// nolint: gocyclo, errcheck, gas, goconst -func (ec *executionContext) _IdentityConnection(ctx context.Context, sel ast.SelectionSet, obj *models.IdentityConnection) graphql.Marshaler { - fields := graphql.CollectFields(ctx, sel, identityConnectionImplementors) - - out := graphql.NewOrderedMap(len(fields)) - invalid := false - for i, field := range fields { - out.Keys[i] = field.Alias - - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("IdentityConnection") - case "edges": - out.Values[i] = ec._IdentityConnection_edges(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "nodes": - out.Values[i] = ec._IdentityConnection_nodes(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "pageInfo": - out.Values[i] = ec._IdentityConnection_pageInfo(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "totalCount": - out.Values[i] = ec._IdentityConnection_totalCount(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - default: - panic("unknown field " + strconv.Quote(field.Name)) - } +func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, } - - if invalid { + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Description, nil + }) + if resTmp == nil { return graphql.Null } - return out + res := resTmp.(string) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalOString2string(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _IdentityConnection_edges(ctx context.Context, field graphql.CollectedField, obj *models.IdentityConnection) graphql.Marshaler { +func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "IdentityConnection", - Args: nil, - Field: field, + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Edges, nil + return obj.Locations, nil }) if resTmp == nil { if !ec.HasError(rctx) { @@ -5443,59 +6413,26 @@ func (ec *executionContext) _IdentityConnection_edges(ctx context.Context, field } return graphql.Null } - res := resTmp.([]models.IdentityEdge) + res := resTmp.([]string) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } - - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], - } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() - } - arr1[idx1] = func() graphql.Marshaler { - - return ec._IdentityEdge(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } - - } - wg.Wait() - return arr1 + return ec.marshalN__DirectiveLocation2ᚕstring(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _IdentityConnection_nodes(ctx context.Context, field graphql.CollectedField, obj *models.IdentityConnection) graphql.Marshaler { +func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "IdentityConnection", - Args: nil, - Field: field, + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Nodes, nil + return obj.Args, nil }) if resTmp == nil { if !ec.HasError(rctx) { @@ -5503,59 +6440,26 @@ func (ec *executionContext) _IdentityConnection_nodes(ctx context.Context, field } return graphql.Null } - res := resTmp.([]identity.Interface) + res := resTmp.([]introspection.InputValue) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } - - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], - } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() - } - arr1[idx1] = func() graphql.Marshaler { - - return ec._Identity(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } - - } - wg.Wait() - return arr1 + return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _IdentityConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *models.IdentityConnection) graphql.Marshaler { +func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "IdentityConnection", - Args: nil, - Field: field, + Object: "__EnumValue", + Field: field, + Args: nil, + IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.PageInfo, nil + return obj.Name, nil }) if resTmp == nil { if !ec.HasError(rctx) { @@ -5563,27 +6467,50 @@ func (ec *executionContext) _IdentityConnection_pageInfo(ctx context.Context, fi } return graphql.Null } - res := resTmp.(models.PageInfo) + res := resTmp.(string) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNString2string(ctx, field.Selections, res) +} - return ec._PageInfo(ctx, field.Selections, &res) +func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "__EnumValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Description, nil + }) + if resTmp == nil { + return graphql.Null + } + res := resTmp.(string) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalOString2string(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _IdentityConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *models.IdentityConnection) graphql.Marshaler { +func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "IdentityConnection", - Args: nil, - Field: field, + Object: "__EnumValue", + Field: field, + Args: nil, + IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.TotalCount, nil + return obj.IsDeprecated(), nil }) if resTmp == nil { if !ec.HasError(rctx) { @@ -5591,61 +6518,50 @@ func (ec *executionContext) _IdentityConnection_totalCount(ctx context.Context, } return graphql.Null } - res := resTmp.(int) + res := resTmp.(bool) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalInt(res) + return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -var identityEdgeImplementors = []string{"IdentityEdge"} - -// nolint: gocyclo, errcheck, gas, goconst -func (ec *executionContext) _IdentityEdge(ctx context.Context, sel ast.SelectionSet, obj *models.IdentityEdge) graphql.Marshaler { - fields := graphql.CollectFields(ctx, sel, identityEdgeImplementors) - - out := graphql.NewOrderedMap(len(fields)) - invalid := false - for i, field := range fields { - out.Keys[i] = field.Alias - - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("IdentityEdge") - case "cursor": - out.Values[i] = ec._IdentityEdge_cursor(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "node": - out.Values[i] = ec._IdentityEdge_node(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - default: - panic("unknown field " + strconv.Quote(field.Name)) - } +func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "__EnumValue", + Field: field, + Args: nil, + IsMethod: true, } - - if invalid { + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.DeprecationReason(), nil + }) + if resTmp == nil { return graphql.Null } - return out + res := resTmp.(*string) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _IdentityEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *models.IdentityEdge) graphql.Marshaler { +func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "IdentityEdge", - Args: nil, - Field: field, + Object: "__Field", + Field: field, + Args: nil, + IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Cursor, nil + return obj.Name, nil }) if resTmp == nil { if !ec.HasError(rctx) { @@ -5656,106 +6572,47 @@ func (ec *executionContext) _IdentityEdge_cursor(ctx context.Context, field grap res := resTmp.(string) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalString(res) + return ec.marshalNString2string(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _IdentityEdge_node(ctx context.Context, field graphql.CollectedField, obj *models.IdentityEdge) graphql.Marshaler { +func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "IdentityEdge", - Args: nil, - Field: field, + Object: "__Field", + Field: field, + Args: nil, + IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Node, nil + return obj.Description, nil }) if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(identity.Interface) + res := resTmp.(string) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - - return ec._Identity(ctx, field.Selections, &res) -} - -var labelChangeOperationImplementors = []string{"LabelChangeOperation", "Operation", "Authored"} - -// nolint: gocyclo, errcheck, gas, goconst -func (ec *executionContext) _LabelChangeOperation(ctx context.Context, sel ast.SelectionSet, obj *bug.LabelChangeOperation) graphql.Marshaler { - fields := graphql.CollectFields(ctx, sel, labelChangeOperationImplementors) - - var wg sync.WaitGroup - out := graphql.NewOrderedMap(len(fields)) - invalid := false - for i, field := range fields { - out.Keys[i] = field.Alias - - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("LabelChangeOperation") - case "hash": - out.Values[i] = ec._LabelChangeOperation_hash(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "author": - out.Values[i] = ec._LabelChangeOperation_author(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "date": - wg.Add(1) - go func(i int, field graphql.CollectedField) { - out.Values[i] = ec._LabelChangeOperation_date(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - wg.Done() - }(i, field) - case "added": - out.Values[i] = ec._LabelChangeOperation_added(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "removed": - out.Values[i] = ec._LabelChangeOperation_removed(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - wg.Wait() - if invalid { - return graphql.Null - } - return out + return ec.marshalOString2string(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _LabelChangeOperation_hash(ctx context.Context, field graphql.CollectedField, obj *bug.LabelChangeOperation) graphql.Marshaler { +func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "LabelChangeOperation", - Args: nil, - Field: field, + Object: "__Field", + Field: field, + Args: nil, + IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Hash() + return obj.Args, nil }) if resTmp == nil { if !ec.HasError(rctx) { @@ -5763,26 +6620,26 @@ func (ec *executionContext) _LabelChangeOperation_hash(ctx context.Context, fiel } return graphql.Null } - res := resTmp.(git.Hash) + res := resTmp.([]introspection.InputValue) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return res + return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _LabelChangeOperation_author(ctx context.Context, field graphql.CollectedField, obj *bug.LabelChangeOperation) graphql.Marshaler { +func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "LabelChangeOperation", - Args: nil, - Field: field, + Object: "__Field", + Field: field, + Args: nil, + IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Author, nil + return obj.Type, nil }) if resTmp == nil { if !ec.HasError(rctx) { @@ -5790,27 +6647,26 @@ func (ec *executionContext) _LabelChangeOperation_author(ctx context.Context, fi } return graphql.Null } - res := resTmp.(identity.Interface) + res := resTmp.(*introspection.Type) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - - return ec._Identity(ctx, field.Selections, &res) + return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _LabelChangeOperation_date(ctx context.Context, field graphql.CollectedField, obj *bug.LabelChangeOperation) graphql.Marshaler { +func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "LabelChangeOperation", - Args: nil, - Field: field, + Object: "__Field", + Field: field, + Args: nil, + IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.LabelChangeOperation().Date(rctx, obj) + return obj.IsDeprecated(), nil }) if resTmp == nil { if !ec.HasError(rctx) { @@ -5818,62 +6674,50 @@ func (ec *executionContext) _LabelChangeOperation_date(ctx context.Context, fiel } return graphql.Null } - res := resTmp.(time.Time) + res := resTmp.(bool) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalTime(res) + return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _LabelChangeOperation_added(ctx context.Context, field graphql.CollectedField, obj *bug.LabelChangeOperation) graphql.Marshaler { +func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "LabelChangeOperation", - Args: nil, - Field: field, + Object: "__Field", + Field: field, + Args: nil, + IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Added, nil + return obj.DeprecationReason(), nil }) if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.([]bug.Label) + res := resTmp.(*string) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - - arr1 := make(graphql.Array, len(res)) - - for idx1 := range res { - arr1[idx1] = func() graphql.Marshaler { - return res[idx1] - }() - } - - return arr1 + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _LabelChangeOperation_removed(ctx context.Context, field graphql.CollectedField, obj *bug.LabelChangeOperation) graphql.Marshaler { +func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "LabelChangeOperation", - Args: nil, - Field: field, + Object: "__InputValue", + Field: field, + Args: nil, + IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Removed, nil + return obj.Name, nil }) if resTmp == nil { if !ec.HasError(rctx) { @@ -5881,117 +6725,50 @@ func (ec *executionContext) _LabelChangeOperation_removed(ctx context.Context, f } return graphql.Null } - res := resTmp.([]bug.Label) + res := resTmp.(string) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - - arr1 := make(graphql.Array, len(res)) - - for idx1 := range res { - arr1[idx1] = func() graphql.Marshaler { - return res[idx1] - }() - } - - return arr1 -} - -var labelChangeTimelineItemImplementors = []string{"LabelChangeTimelineItem", "TimelineItem"} - -// nolint: gocyclo, errcheck, gas, goconst -func (ec *executionContext) _LabelChangeTimelineItem(ctx context.Context, sel ast.SelectionSet, obj *bug.LabelChangeTimelineItem) graphql.Marshaler { - fields := graphql.CollectFields(ctx, sel, labelChangeTimelineItemImplementors) - - var wg sync.WaitGroup - out := graphql.NewOrderedMap(len(fields)) - invalid := false - for i, field := range fields { - out.Keys[i] = field.Alias - - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("LabelChangeTimelineItem") - case "hash": - out.Values[i] = ec._LabelChangeTimelineItem_hash(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "author": - out.Values[i] = ec._LabelChangeTimelineItem_author(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "date": - wg.Add(1) - go func(i int, field graphql.CollectedField) { - out.Values[i] = ec._LabelChangeTimelineItem_date(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - wg.Done() - }(i, field) - case "added": - out.Values[i] = ec._LabelChangeTimelineItem_added(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "removed": - out.Values[i] = ec._LabelChangeTimelineItem_removed(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - wg.Wait() - if invalid { - return graphql.Null - } - return out + return ec.marshalNString2string(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _LabelChangeTimelineItem_hash(ctx context.Context, field graphql.CollectedField, obj *bug.LabelChangeTimelineItem) graphql.Marshaler { +func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "LabelChangeTimelineItem", - Args: nil, - Field: field, + Object: "__InputValue", + Field: field, + Args: nil, + IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Hash(), nil + return obj.Description, nil }) if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(git.Hash) + res := resTmp.(string) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return res + return ec.marshalOString2string(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _LabelChangeTimelineItem_author(ctx context.Context, field graphql.CollectedField, obj *bug.LabelChangeTimelineItem) graphql.Marshaler { +func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "LabelChangeTimelineItem", - Args: nil, - Field: field, + Object: "__InputValue", + Field: field, + Args: nil, + IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Author, nil + return obj.Type, nil }) if resTmp == nil { if !ec.HasError(rctx) { @@ -5999,54 +6776,50 @@ func (ec *executionContext) _LabelChangeTimelineItem_author(ctx context.Context, } return graphql.Null } - res := resTmp.(identity.Interface) + res := resTmp.(*introspection.Type) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - - return ec._Identity(ctx, field.Selections, &res) + return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _LabelChangeTimelineItem_date(ctx context.Context, field graphql.CollectedField, obj *bug.LabelChangeTimelineItem) graphql.Marshaler { +func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "LabelChangeTimelineItem", - Args: nil, - Field: field, + Object: "__InputValue", + Field: field, + Args: nil, + IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.LabelChangeTimelineItem().Date(rctx, obj) + return obj.DefaultValue, nil }) if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(time.Time) + res := resTmp.(*string) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalTime(res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _LabelChangeTimelineItem_added(ctx context.Context, field graphql.CollectedField, obj *bug.LabelChangeTimelineItem) graphql.Marshaler { +func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "LabelChangeTimelineItem", - Args: nil, - Field: field, + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Added, nil + return obj.Types(), nil }) if resTmp == nil { if !ec.HasError(rctx) { @@ -6054,141 +6827,101 @@ func (ec *executionContext) _LabelChangeTimelineItem_added(ctx context.Context, } return graphql.Null } - res := resTmp.([]bug.Label) + res := resTmp.([]introspection.Type) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - - arr1 := make(graphql.Array, len(res)) - - for idx1 := range res { - arr1[idx1] = func() graphql.Marshaler { - return res[idx1] - }() - } - - return arr1 + return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _LabelChangeTimelineItem_removed(ctx context.Context, field graphql.CollectedField, obj *bug.LabelChangeTimelineItem) graphql.Marshaler { +func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "LabelChangeTimelineItem", - Args: nil, - Field: field, + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Removed, nil - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.([]bug.Label) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - - arr1 := make(graphql.Array, len(res)) - - for idx1 := range res { - arr1[idx1] = func() graphql.Marshaler { - return res[idx1] - }() - } - - return arr1 -} - -var mutationImplementors = []string{"Mutation"} - -// nolint: gocyclo, errcheck, gas, goconst -func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { - fields := graphql.CollectFields(ctx, sel, mutationImplementors) - - ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ - Object: "Mutation", + return obj.QueryType(), nil }) - - out := graphql.NewOrderedMap(len(fields)) - invalid := false - for i, field := range fields { - out.Keys[i] = field.Alias - - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("Mutation") - case "newBug": - out.Values[i] = ec._Mutation_newBug(ctx, field) - if out.Values[i] == graphql.Null { - invalid = true - } - case "addComment": - out.Values[i] = ec._Mutation_addComment(ctx, field) - if out.Values[i] == graphql.Null { - invalid = true - } - case "changeLabels": - out.Values[i] = ec._Mutation_changeLabels(ctx, field) - if out.Values[i] == graphql.Null { - invalid = true - } - case "open": - out.Values[i] = ec._Mutation_open(ctx, field) - if out.Values[i] == graphql.Null { - invalid = true - } - case "close": - out.Values[i] = ec._Mutation_close(ctx, field) - if out.Values[i] == graphql.Null { - invalid = true - } - case "setTitle": - out.Values[i] = ec._Mutation_setTitle(ctx, field) - if out.Values[i] == graphql.Null { - invalid = true - } - case "commit": - out.Values[i] = ec._Mutation_commit(ctx, field) - if out.Values[i] == graphql.Null { - invalid = true - } - default: - panic("unknown field " + strconv.Quote(field.Name)) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") } + return graphql.Null } + res := resTmp.(*introspection.Type) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) +} - if invalid { +func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.MutationType(), nil + }) + if resTmp == nil { return graphql.Null } - return out + res := resTmp.(*introspection.Type) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _Mutation_newBug(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rawArgs := field.ArgumentMap(ec.Variables) - args, err := field_Mutation_newBug_args(rawArgs) - if err != nil { - ec.Error(ctx, err) + rctx := &graphql.ResolverContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.SubscriptionType(), nil + }) + if resTmp == nil { return graphql.Null } + res := resTmp.(*introspection.Type) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) +} + +func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "Mutation", - Args: args, - Field: field, + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().NewBug(rctx, args["repoRef"].(*string), args["title"].(string), args["message"].(string), args["files"].([]git.Hash)) + return obj.Directives(), nil }) if resTmp == nil { if !ec.HasError(rctx) { @@ -6196,33 +6929,26 @@ func (ec *executionContext) _Mutation_newBug(ctx context.Context, field graphql. } return graphql.Null } - res := resTmp.(bug.Snapshot) + res := resTmp.([]introspection.Directive) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - - return ec._Bug(ctx, field.Selections, &res) + return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _Mutation_addComment(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rawArgs := field.ArgumentMap(ec.Variables) - args, err := field_Mutation_addComment_args(rawArgs) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } rctx := &graphql.ResolverContext{ - Object: "Mutation", - Args: args, - Field: field, + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().AddComment(rctx, args["repoRef"].(*string), args["prefix"].(string), args["message"].(string), args["files"].([]git.Hash)) + return obj.Kind(), nil }) if resTmp == nil { if !ec.HasError(rctx) { @@ -6230,214 +6956,343 @@ func (ec *executionContext) _Mutation_addComment(ctx context.Context, field grap } return graphql.Null } - res := resTmp.(bug.Snapshot) + res := resTmp.(string) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - - return ec._Bug(ctx, field.Selections, &res) + return ec.marshalN__TypeKind2string(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _Mutation_changeLabels(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rawArgs := field.ArgumentMap(ec.Variables) - args, err := field_Mutation_changeLabels_args(rawArgs) - if err != nil { - ec.Error(ctx, err) + rctx := &graphql.ResolverContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name(), nil + }) + if resTmp == nil { return graphql.Null } + res := resTmp.(*string) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "Mutation", - Args: args, - Field: field, + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().ChangeLabels(rctx, args["repoRef"].(*string), args["prefix"].(string), args["added"].([]string), args["removed"].([]string)) + return obj.Description(), nil }) if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(bug.Snapshot) + res := resTmp.(string) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - - return ec._Bug(ctx, field.Selections, &res) + return ec.marshalOString2string(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _Mutation_open(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) - args, err := field_Mutation_open_args(rawArgs) + args, err := ec.field___Type_fields_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } + rctx.Args = args + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Fields(args["includeDeprecated"].(bool)), nil + }) + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]introspection.Field) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx, field.Selections, res) +} + +func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "Mutation", - Args: args, - Field: field, + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().Open(rctx, args["repoRef"].(*string), args["prefix"].(string)) + return obj.Interfaces(), nil }) if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(bug.Snapshot) + res := resTmp.([]introspection.Type) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - - return ec._Bug(ctx, field.Selections, &res) + return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _Mutation_close(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rawArgs := field.ArgumentMap(ec.Variables) - args, err := field_Mutation_close_args(rawArgs) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } rctx := &graphql.ResolverContext{ - Object: "Mutation", - Args: args, - Field: field, + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().Close(rctx, args["repoRef"].(*string), args["prefix"].(string)) + return obj.PossibleTypes(), nil }) if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(bug.Snapshot) + res := resTmp.([]introspection.Type) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - - return ec._Bug(ctx, field.Selections, &res) + return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _Mutation_setTitle(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) - args, err := field_Mutation_setTitle_args(rawArgs) + args, err := ec.field___Type_enumValues_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } + rctx.Args = args + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.EnumValues(args["includeDeprecated"].(bool)), nil + }) + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]introspection.EnumValue) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx, field.Selections, res) +} + +func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ - Object: "Mutation", - Args: args, - Field: field, + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().SetTitle(rctx, args["repoRef"].(*string), args["prefix"].(string), args["title"].(string)) + return obj.InputFields(), nil }) if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(bug.Snapshot) + res := resTmp.([]introspection.InputValue) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - - return ec._Bug(ctx, field.Selections, &res) + return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } -// nolint: vetshadow -func (ec *executionContext) _Mutation_commit(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rawArgs := field.ArgumentMap(ec.Variables) - args, err := field_Mutation_commit_args(rawArgs) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } rctx := &graphql.ResolverContext{ - Object: "Mutation", - Args: args, - Field: field, + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().Commit(rctx, args["repoRef"].(*string), args["prefix"].(string)) + return obj.OfType(), nil }) if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(bug.Snapshot) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - - return ec._Bug(ctx, field.Selections, &res) + res := resTmp.(*introspection.Type) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) +} + +// endregion **************************** field.gotpl ***************************** + +// region **************************** input.gotpl ***************************** + +// endregion **************************** input.gotpl ***************************** + +// region ************************** interface.gotpl *************************** + +func (ec *executionContext) _Authored(ctx context.Context, sel ast.SelectionSet, obj *models.Authored) graphql.Marshaler { + switch obj := (*obj).(type) { + case nil: + return graphql.Null + case bug.Comment: + return ec._Comment(ctx, sel, &obj) + case *bug.Comment: + return ec._Comment(ctx, sel, obj) + case *bug.CreateOperation: + return ec._CreateOperation(ctx, sel, obj) + case *bug.SetTitleOperation: + return ec._SetTitleOperation(ctx, sel, obj) + case *bug.AddCommentOperation: + return ec._AddCommentOperation(ctx, sel, obj) + case *bug.EditCommentOperation: + return ec._EditCommentOperation(ctx, sel, obj) + case *bug.SetStatusOperation: + return ec._SetStatusOperation(ctx, sel, obj) + case *bug.LabelChangeOperation: + return ec._LabelChangeOperation(ctx, sel, obj) + default: + panic(fmt.Errorf("unexpected type %T", obj)) + } +} + +func (ec *executionContext) _Operation(ctx context.Context, sel ast.SelectionSet, obj *bug.Operation) graphql.Marshaler { + switch obj := (*obj).(type) { + case nil: + return graphql.Null + case *bug.CreateOperation: + return ec._CreateOperation(ctx, sel, obj) + case *bug.SetTitleOperation: + return ec._SetTitleOperation(ctx, sel, obj) + case *bug.AddCommentOperation: + return ec._AddCommentOperation(ctx, sel, obj) + case *bug.EditCommentOperation: + return ec._EditCommentOperation(ctx, sel, obj) + case *bug.SetStatusOperation: + return ec._SetStatusOperation(ctx, sel, obj) + case *bug.LabelChangeOperation: + return ec._LabelChangeOperation(ctx, sel, obj) + default: + panic(fmt.Errorf("unexpected type %T", obj)) + } +} + +func (ec *executionContext) _TimelineItem(ctx context.Context, sel ast.SelectionSet, obj *bug.TimelineItem) graphql.Marshaler { + switch obj := (*obj).(type) { + case nil: + return graphql.Null + case *bug.CreateTimelineItem: + return ec._CreateTimelineItem(ctx, sel, obj) + case *bug.AddCommentTimelineItem: + return ec._AddCommentTimelineItem(ctx, sel, obj) + case bug.LabelChangeTimelineItem: + return ec._LabelChangeTimelineItem(ctx, sel, &obj) + case *bug.LabelChangeTimelineItem: + return ec._LabelChangeTimelineItem(ctx, sel, obj) + case bug.SetStatusTimelineItem: + return ec._SetStatusTimelineItem(ctx, sel, &obj) + case *bug.SetStatusTimelineItem: + return ec._SetStatusTimelineItem(ctx, sel, obj) + case bug.SetTitleTimelineItem: + return ec._SetTitleTimelineItem(ctx, sel, &obj) + case *bug.SetTitleTimelineItem: + return ec._SetTitleTimelineItem(ctx, sel, obj) + default: + panic(fmt.Errorf("unexpected type %T", obj)) + } } -var operationConnectionImplementors = []string{"OperationConnection"} +// endregion ************************** interface.gotpl *************************** -// nolint: gocyclo, errcheck, gas, goconst -func (ec *executionContext) _OperationConnection(ctx context.Context, sel ast.SelectionSet, obj *models.OperationConnection) graphql.Marshaler { - fields := graphql.CollectFields(ctx, sel, operationConnectionImplementors) +// region **************************** object.gotpl **************************** + +var addCommentOperationImplementors = []string{"AddCommentOperation", "Operation", "Authored"} + +func (ec *executionContext) _AddCommentOperation(ctx context.Context, sel ast.SelectionSet, obj *bug.AddCommentOperation) graphql.Marshaler { + fields := graphql.CollectFields(ctx, sel, addCommentOperationImplementors) - out := graphql.NewOrderedMap(len(fields)) + out := graphql.NewFieldSet(fields) invalid := false for i, field := range fields { - out.Keys[i] = field.Alias - switch field.Name { case "__typename": - out.Values[i] = graphql.MarshalString("OperationConnection") - case "edges": - out.Values[i] = ec._OperationConnection_edges(ctx, field, obj) + out.Values[i] = graphql.MarshalString("AddCommentOperation") + case "hash": + out.Values[i] = ec._AddCommentOperation_hash(ctx, field, obj) if out.Values[i] == graphql.Null { invalid = true } - case "nodes": - out.Values[i] = ec._OperationConnection_nodes(ctx, field, obj) + case "author": + out.Values[i] = ec._AddCommentOperation_author(ctx, field, obj) if out.Values[i] == graphql.Null { invalid = true } - case "pageInfo": - out.Values[i] = ec._OperationConnection_pageInfo(ctx, field, obj) + case "date": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._AddCommentOperation_date(ctx, field, obj) + if res == graphql.Null { + invalid = true + } + return res + }) + case "message": + out.Values[i] = ec._AddCommentOperation_message(ctx, field, obj) if out.Values[i] == graphql.Null { invalid = true } - case "totalCount": - out.Values[i] = ec._OperationConnection_totalCount(ctx, field, obj) + case "files": + out.Values[i] = ec._AddCommentOperation_files(ctx, field, obj) if out.Values[i] == graphql.Null { invalid = true } @@ -6445,209 +7300,276 @@ func (ec *executionContext) _OperationConnection(ctx context.Context, sel ast.Se panic("unknown field " + strconv.Quote(field.Name)) } } - + out.Dispatch() if invalid { return graphql.Null } return out } -// nolint: vetshadow -func (ec *executionContext) _OperationConnection_edges(ctx context.Context, field graphql.CollectedField, obj *models.OperationConnection) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "OperationConnection", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Edges, nil - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.([]models.OperationEdge) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup +var addCommentTimelineItemImplementors = []string{"AddCommentTimelineItem", "TimelineItem"} - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } +func (ec *executionContext) _AddCommentTimelineItem(ctx context.Context, sel ast.SelectionSet, obj *bug.AddCommentTimelineItem) graphql.Marshaler { + fields := graphql.CollectFields(ctx, sel, addCommentTimelineItemImplementors) - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], - } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + out := graphql.NewFieldSet(fields) + invalid := false + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("AddCommentTimelineItem") + case "hash": + out.Values[i] = ec._AddCommentTimelineItem_hash(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true } - arr1[idx1] = func() graphql.Marshaler { - - return ec._OperationEdge(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) + case "author": + out.Values[i] = ec._AddCommentTimelineItem_author(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "message": + out.Values[i] = ec._AddCommentTimelineItem_message(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "messageIsEmpty": + out.Values[i] = ec._AddCommentTimelineItem_messageIsEmpty(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "files": + out.Values[i] = ec._AddCommentTimelineItem_files(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "createdAt": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._AddCommentTimelineItem_createdAt(ctx, field, obj) + if res == graphql.Null { + invalid = true + } + return res + }) + case "lastEdit": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._AddCommentTimelineItem_lastEdit(ctx, field, obj) + if res == graphql.Null { + invalid = true + } + return res + }) + case "edited": + out.Values[i] = ec._AddCommentTimelineItem_edited(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "history": + out.Values[i] = ec._AddCommentTimelineItem_history(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + default: + panic("unknown field " + strconv.Quote(field.Name)) } - - } - wg.Wait() - return arr1 -} - -// nolint: vetshadow -func (ec *executionContext) _OperationConnection_nodes(ctx context.Context, field graphql.CollectedField, obj *models.OperationConnection) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "OperationConnection", - Args: nil, - Field: field, } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Nodes, nil - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } + out.Dispatch() + if invalid { return graphql.Null } - res := resTmp.([]bug.Operation) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) + return out +} - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup +var bugImplementors = []string{"Bug"} - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } +func (ec *executionContext) _Bug(ctx context.Context, sel ast.SelectionSet, obj *bug.Snapshot) graphql.Marshaler { + fields := graphql.CollectFields(ctx, sel, bugImplementors) - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], - } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + out := graphql.NewFieldSet(fields) + invalid := false + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Bug") + case "id": + out.Values[i] = ec._Bug_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true } - arr1[idx1] = func() graphql.Marshaler { - - return ec._Operation(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } - - } - wg.Wait() - return arr1 -} - -// nolint: vetshadow -func (ec *executionContext) _OperationConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *models.OperationConnection) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "OperationConnection", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.PageInfo, nil - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") + case "humanId": + out.Values[i] = ec._Bug_humanId(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "status": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Bug_status(ctx, field, obj) + if res == graphql.Null { + invalid = true + } + return res + }) + case "title": + out.Values[i] = ec._Bug_title(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "labels": + out.Values[i] = ec._Bug_labels(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "author": + out.Values[i] = ec._Bug_author(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "createdAt": + out.Values[i] = ec._Bug_createdAt(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "lastEdit": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Bug_lastEdit(ctx, field, obj) + if res == graphql.Null { + invalid = true + } + return res + }) + case "actors": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Bug_actors(ctx, field, obj) + if res == graphql.Null { + invalid = true + } + return res + }) + case "participants": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Bug_participants(ctx, field, obj) + if res == graphql.Null { + invalid = true + } + return res + }) + case "comments": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Bug_comments(ctx, field, obj) + if res == graphql.Null { + invalid = true + } + return res + }) + case "timeline": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Bug_timeline(ctx, field, obj) + if res == graphql.Null { + invalid = true + } + return res + }) + case "operations": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Bug_operations(ctx, field, obj) + if res == graphql.Null { + invalid = true + } + return res + }) + default: + panic("unknown field " + strconv.Quote(field.Name)) } - return graphql.Null - } - res := resTmp.(models.PageInfo) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - - return ec._PageInfo(ctx, field.Selections, &res) -} - -// nolint: vetshadow -func (ec *executionContext) _OperationConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *models.OperationConnection) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "OperationConnection", - Args: nil, - Field: field, } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.TotalCount, nil - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } + out.Dispatch() + if invalid { return graphql.Null } - res := resTmp.(int) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalInt(res) + return out } -var operationEdgeImplementors = []string{"OperationEdge"} +var bugConnectionImplementors = []string{"BugConnection"} -// nolint: gocyclo, errcheck, gas, goconst -func (ec *executionContext) _OperationEdge(ctx context.Context, sel ast.SelectionSet, obj *models.OperationEdge) graphql.Marshaler { - fields := graphql.CollectFields(ctx, sel, operationEdgeImplementors) +func (ec *executionContext) _BugConnection(ctx context.Context, sel ast.SelectionSet, obj *models.BugConnection) graphql.Marshaler { + fields := graphql.CollectFields(ctx, sel, bugConnectionImplementors) - out := graphql.NewOrderedMap(len(fields)) + out := graphql.NewFieldSet(fields) invalid := false for i, field := range fields { - out.Keys[i] = field.Alias - switch field.Name { case "__typename": - out.Values[i] = graphql.MarshalString("OperationEdge") - case "cursor": - out.Values[i] = ec._OperationEdge_cursor(ctx, field, obj) + out.Values[i] = graphql.MarshalString("BugConnection") + case "edges": + out.Values[i] = ec._BugConnection_edges(ctx, field, obj) if out.Values[i] == graphql.Null { invalid = true } - case "node": - out.Values[i] = ec._OperationEdge_node(ctx, field, obj) + case "nodes": + out.Values[i] = ec._BugConnection_nodes(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "pageInfo": + out.Values[i] = ec._BugConnection_pageInfo(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "totalCount": + out.Values[i] = ec._BugConnection_totalCount(ctx, field, obj) if out.Values[i] == graphql.Null { invalid = true } @@ -6655,99 +7577,68 @@ func (ec *executionContext) _OperationEdge(ctx context.Context, sel ast.Selectio panic("unknown field " + strconv.Quote(field.Name)) } } - + out.Dispatch() if invalid { return graphql.Null } return out } -// nolint: vetshadow -func (ec *executionContext) _OperationEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *models.OperationEdge) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "OperationEdge", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Cursor, nil - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalString(res) -} +var bugEdgeImplementors = []string{"BugEdge"} -// nolint: vetshadow -func (ec *executionContext) _OperationEdge_node(ctx context.Context, field graphql.CollectedField, obj *models.OperationEdge) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "OperationEdge", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Node, nil - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") +func (ec *executionContext) _BugEdge(ctx context.Context, sel ast.SelectionSet, obj *models.BugEdge) graphql.Marshaler { + fields := graphql.CollectFields(ctx, sel, bugEdgeImplementors) + + out := graphql.NewFieldSet(fields) + invalid := false + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("BugEdge") + case "cursor": + out.Values[i] = ec._BugEdge_cursor(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "node": + out.Values[i] = ec._BugEdge_node(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + default: + panic("unknown field " + strconv.Quote(field.Name)) } + } + out.Dispatch() + if invalid { return graphql.Null } - res := resTmp.(bug.Operation) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - - return ec._Operation(ctx, field.Selections, &res) + return out } -var pageInfoImplementors = []string{"PageInfo"} +var commentImplementors = []string{"Comment", "Authored"} -// nolint: gocyclo, errcheck, gas, goconst -func (ec *executionContext) _PageInfo(ctx context.Context, sel ast.SelectionSet, obj *models.PageInfo) graphql.Marshaler { - fields := graphql.CollectFields(ctx, sel, pageInfoImplementors) +func (ec *executionContext) _Comment(ctx context.Context, sel ast.SelectionSet, obj *bug.Comment) graphql.Marshaler { + fields := graphql.CollectFields(ctx, sel, commentImplementors) - out := graphql.NewOrderedMap(len(fields)) + out := graphql.NewFieldSet(fields) invalid := false for i, field := range fields { - out.Keys[i] = field.Alias - switch field.Name { case "__typename": - out.Values[i] = graphql.MarshalString("PageInfo") - case "hasNextPage": - out.Values[i] = ec._PageInfo_hasNextPage(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "hasPreviousPage": - out.Values[i] = ec._PageInfo_hasPreviousPage(ctx, field, obj) + out.Values[i] = graphql.MarshalString("Comment") + case "author": + out.Values[i] = ec._Comment_author(ctx, field, obj) if out.Values[i] == graphql.Null { invalid = true } - case "startCursor": - out.Values[i] = ec._PageInfo_startCursor(ctx, field, obj) + case "message": + out.Values[i] = ec._Comment_message(ctx, field, obj) if out.Values[i] == graphql.Null { invalid = true } - case "endCursor": - out.Values[i] = ec._PageInfo_endCursor(ctx, field, obj) + case "files": + out.Values[i] = ec._Comment_files(ctx, field, obj) if out.Values[i] == graphql.Null { invalid = true } @@ -6755,891 +7646,806 @@ func (ec *executionContext) _PageInfo(ctx context.Context, sel ast.SelectionSet, panic("unknown field " + strconv.Quote(field.Name)) } } - + out.Dispatch() if invalid { return graphql.Null } return out } -// nolint: vetshadow -func (ec *executionContext) _PageInfo_hasNextPage(ctx context.Context, field graphql.CollectedField, obj *models.PageInfo) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "PageInfo", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.HasNextPage, nil - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(bool) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalBoolean(res) -} - -// nolint: vetshadow -func (ec *executionContext) _PageInfo_hasPreviousPage(ctx context.Context, field graphql.CollectedField, obj *models.PageInfo) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "PageInfo", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.HasPreviousPage, nil - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(bool) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalBoolean(res) -} +var commentConnectionImplementors = []string{"CommentConnection"} -// nolint: vetshadow -func (ec *executionContext) _PageInfo_startCursor(ctx context.Context, field graphql.CollectedField, obj *models.PageInfo) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "PageInfo", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.StartCursor, nil - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalString(res) -} +func (ec *executionContext) _CommentConnection(ctx context.Context, sel ast.SelectionSet, obj *models.CommentConnection) graphql.Marshaler { + fields := graphql.CollectFields(ctx, sel, commentConnectionImplementors) -// nolint: vetshadow -func (ec *executionContext) _PageInfo_endCursor(ctx context.Context, field graphql.CollectedField, obj *models.PageInfo) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "PageInfo", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.EndCursor, nil - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") + out := graphql.NewFieldSet(fields) + invalid := false + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("CommentConnection") + case "edges": + out.Values[i] = ec._CommentConnection_edges(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "nodes": + out.Values[i] = ec._CommentConnection_nodes(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "pageInfo": + out.Values[i] = ec._CommentConnection_pageInfo(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "totalCount": + out.Values[i] = ec._CommentConnection_totalCount(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + default: + panic("unknown field " + strconv.Quote(field.Name)) } + } + out.Dispatch() + if invalid { return graphql.Null } - res := resTmp.(string) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalString(res) + return out } -var queryImplementors = []string{"Query"} - -// nolint: gocyclo, errcheck, gas, goconst -func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { - fields := graphql.CollectFields(ctx, sel, queryImplementors) +var commentEdgeImplementors = []string{"CommentEdge"} - ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ - Object: "Query", - }) +func (ec *executionContext) _CommentEdge(ctx context.Context, sel ast.SelectionSet, obj *models.CommentEdge) graphql.Marshaler { + fields := graphql.CollectFields(ctx, sel, commentEdgeImplementors) - var wg sync.WaitGroup - out := graphql.NewOrderedMap(len(fields)) + out := graphql.NewFieldSet(fields) invalid := false for i, field := range fields { - out.Keys[i] = field.Alias - switch field.Name { case "__typename": - out.Values[i] = graphql.MarshalString("Query") - case "defaultRepository": - wg.Add(1) - go func(i int, field graphql.CollectedField) { - out.Values[i] = ec._Query_defaultRepository(ctx, field) - wg.Done() - }(i, field) - case "repository": - wg.Add(1) - go func(i int, field graphql.CollectedField) { - out.Values[i] = ec._Query_repository(ctx, field) - wg.Done() - }(i, field) - case "__type": - out.Values[i] = ec._Query___type(ctx, field) - case "__schema": - out.Values[i] = ec._Query___schema(ctx, field) + out.Values[i] = graphql.MarshalString("CommentEdge") + case "cursor": + out.Values[i] = ec._CommentEdge_cursor(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "node": + out.Values[i] = ec._CommentEdge_node(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } default: panic("unknown field " + strconv.Quote(field.Name)) } } - wg.Wait() + out.Dispatch() if invalid { return graphql.Null } return out } -// nolint: vetshadow -func (ec *executionContext) _Query_defaultRepository(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "Query", - Args: nil, - Field: field, +var commentHistoryStepImplementors = []string{"CommentHistoryStep"} + +func (ec *executionContext) _CommentHistoryStep(ctx context.Context, sel ast.SelectionSet, obj *bug.CommentHistoryStep) graphql.Marshaler { + fields := graphql.CollectFields(ctx, sel, commentHistoryStepImplementors) + + out := graphql.NewFieldSet(fields) + invalid := false + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("CommentHistoryStep") + case "message": + out.Values[i] = ec._CommentHistoryStep_message(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "date": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._CommentHistoryStep_date(ctx, field, obj) + if res == graphql.Null { + invalid = true + } + return res + }) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().DefaultRepository(rctx) - }) - if resTmp == nil { + out.Dispatch() + if invalid { return graphql.Null } - res := resTmp.(*models.Repository) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) + return out +} - if res == nil { - return graphql.Null - } +var createOperationImplementors = []string{"CreateOperation", "Operation", "Authored"} - return ec._Repository(ctx, field.Selections, res) -} +func (ec *executionContext) _CreateOperation(ctx context.Context, sel ast.SelectionSet, obj *bug.CreateOperation) graphql.Marshaler { + fields := graphql.CollectFields(ctx, sel, createOperationImplementors) -// nolint: vetshadow -func (ec *executionContext) _Query_repository(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rawArgs := field.ArgumentMap(ec.Variables) - args, err := field_Query_repository_args(rawArgs) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - rctx := &graphql.ResolverContext{ - Object: "Query", - Args: args, - Field: field, + out := graphql.NewFieldSet(fields) + invalid := false + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("CreateOperation") + case "hash": + out.Values[i] = ec._CreateOperation_hash(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "author": + out.Values[i] = ec._CreateOperation_author(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "date": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._CreateOperation_date(ctx, field, obj) + if res == graphql.Null { + invalid = true + } + return res + }) + case "title": + out.Values[i] = ec._CreateOperation_title(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "message": + out.Values[i] = ec._CreateOperation_message(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "files": + out.Values[i] = ec._CreateOperation_files(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().Repository(rctx, args["id"].(string)) - }) - if resTmp == nil { + out.Dispatch() + if invalid { return graphql.Null } - res := resTmp.(*models.Repository) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) + return out +} - if res == nil { - return graphql.Null - } +var createTimelineItemImplementors = []string{"CreateTimelineItem", "TimelineItem"} - return ec._Repository(ctx, field.Selections, res) -} +func (ec *executionContext) _CreateTimelineItem(ctx context.Context, sel ast.SelectionSet, obj *bug.CreateTimelineItem) graphql.Marshaler { + fields := graphql.CollectFields(ctx, sel, createTimelineItemImplementors) -// nolint: vetshadow -func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rawArgs := field.ArgumentMap(ec.Variables) - args, err := field_Query___type_args(rawArgs) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - rctx := &graphql.ResolverContext{ - Object: "Query", - Args: args, - Field: field, + out := graphql.NewFieldSet(fields) + invalid := false + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("CreateTimelineItem") + case "hash": + out.Values[i] = ec._CreateTimelineItem_hash(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "author": + out.Values[i] = ec._CreateTimelineItem_author(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "message": + out.Values[i] = ec._CreateTimelineItem_message(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "messageIsEmpty": + out.Values[i] = ec._CreateTimelineItem_messageIsEmpty(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "files": + out.Values[i] = ec._CreateTimelineItem_files(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "createdAt": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._CreateTimelineItem_createdAt(ctx, field, obj) + if res == graphql.Null { + invalid = true + } + return res + }) + case "lastEdit": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._CreateTimelineItem_lastEdit(ctx, field, obj) + if res == graphql.Null { + invalid = true + } + return res + }) + case "edited": + out.Values[i] = ec._CreateTimelineItem_edited(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "history": + out.Values[i] = ec._CreateTimelineItem_history(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.introspectType(args["name"].(string)) - }) - if resTmp == nil { + out.Dispatch() + if invalid { return graphql.Null } - res := resTmp.(*introspection.Type) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) + return out +} - if res == nil { - return graphql.Null - } +var editCommentOperationImplementors = []string{"EditCommentOperation", "Operation", "Authored"} - return ec.___Type(ctx, field.Selections, res) -} +func (ec *executionContext) _EditCommentOperation(ctx context.Context, sel ast.SelectionSet, obj *bug.EditCommentOperation) graphql.Marshaler { + fields := graphql.CollectFields(ctx, sel, editCommentOperationImplementors) -// nolint: vetshadow -func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "Query", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.introspectSchema() - }) - if resTmp == nil { - return graphql.Null + out := graphql.NewFieldSet(fields) + invalid := false + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("EditCommentOperation") + case "hash": + out.Values[i] = ec._EditCommentOperation_hash(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "author": + out.Values[i] = ec._EditCommentOperation_author(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "date": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._EditCommentOperation_date(ctx, field, obj) + if res == graphql.Null { + invalid = true + } + return res + }) + case "target": + out.Values[i] = ec._EditCommentOperation_target(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "message": + out.Values[i] = ec._EditCommentOperation_message(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "files": + out.Values[i] = ec._EditCommentOperation_files(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } } - res := resTmp.(*introspection.Schema) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - - if res == nil { + out.Dispatch() + if invalid { return graphql.Null } - - return ec.___Schema(ctx, field.Selections, res) + return out } -var repositoryImplementors = []string{"Repository"} +var identityImplementors = []string{"Identity"} -// nolint: gocyclo, errcheck, gas, goconst -func (ec *executionContext) _Repository(ctx context.Context, sel ast.SelectionSet, obj *models.Repository) graphql.Marshaler { - fields := graphql.CollectFields(ctx, sel, repositoryImplementors) +func (ec *executionContext) _Identity(ctx context.Context, sel ast.SelectionSet, obj *identity.Interface) graphql.Marshaler { + fields := graphql.CollectFields(ctx, sel, identityImplementors) - var wg sync.WaitGroup - out := graphql.NewOrderedMap(len(fields)) + out := graphql.NewFieldSet(fields) invalid := false for i, field := range fields { - out.Keys[i] = field.Alias - switch field.Name { case "__typename": - out.Values[i] = graphql.MarshalString("Repository") - case "allBugs": - wg.Add(1) - go func(i int, field graphql.CollectedField) { - out.Values[i] = ec._Repository_allBugs(ctx, field, obj) - if out.Values[i] == graphql.Null { + out.Values[i] = graphql.MarshalString("Identity") + case "id": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Identity_id(ctx, field, obj) + if res == graphql.Null { invalid = true } - wg.Done() - }(i, field) - case "bug": - wg.Add(1) - go func(i int, field graphql.CollectedField) { - out.Values[i] = ec._Repository_bug(ctx, field, obj) - wg.Done() - }(i, field) - case "allIdentities": - wg.Add(1) - go func(i int, field graphql.CollectedField) { - out.Values[i] = ec._Repository_allIdentities(ctx, field, obj) - if out.Values[i] == graphql.Null { + return res + }) + case "humanId": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Identity_humanId(ctx, field, obj) + if res == graphql.Null { invalid = true } - wg.Done() - }(i, field) - case "identity": - wg.Add(1) - go func(i int, field graphql.CollectedField) { - out.Values[i] = ec._Repository_identity(ctx, field, obj) - wg.Done() - }(i, field) - case "userIdentity": - wg.Add(1) - go func(i int, field graphql.CollectedField) { - out.Values[i] = ec._Repository_userIdentity(ctx, field, obj) - wg.Done() - }(i, field) + return res + }) + case "name": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Identity_name(ctx, field, obj) + return res + }) + case "email": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Identity_email(ctx, field, obj) + return res + }) + case "login": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Identity_login(ctx, field, obj) + return res + }) + case "displayName": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Identity_displayName(ctx, field, obj) + if res == graphql.Null { + invalid = true + } + return res + }) + case "avatarUrl": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Identity_avatarUrl(ctx, field, obj) + return res + }) + case "isProtected": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Identity_isProtected(ctx, field, obj) + if res == graphql.Null { + invalid = true + } + return res + }) default: panic("unknown field " + strconv.Quote(field.Name)) } } - wg.Wait() + out.Dispatch() if invalid { return graphql.Null } return out } -// nolint: vetshadow -func (ec *executionContext) _Repository_allBugs(ctx context.Context, field graphql.CollectedField, obj *models.Repository) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rawArgs := field.ArgumentMap(ec.Variables) - args, err := field_Repository_allBugs_args(rawArgs) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - rctx := &graphql.ResolverContext{ - Object: "Repository", - Args: args, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Repository().AllBugs(rctx, obj, args["after"].(*string), args["before"].(*string), args["first"].(*int), args["last"].(*int), args["query"].(*string)) - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(models.BugConnection) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) +var identityConnectionImplementors = []string{"IdentityConnection"} - return ec._BugConnection(ctx, field.Selections, &res) -} +func (ec *executionContext) _IdentityConnection(ctx context.Context, sel ast.SelectionSet, obj *models.IdentityConnection) graphql.Marshaler { + fields := graphql.CollectFields(ctx, sel, identityConnectionImplementors) -// nolint: vetshadow -func (ec *executionContext) _Repository_bug(ctx context.Context, field graphql.CollectedField, obj *models.Repository) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rawArgs := field.ArgumentMap(ec.Variables) - args, err := field_Repository_bug_args(rawArgs) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - rctx := &graphql.ResolverContext{ - Object: "Repository", - Args: args, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Repository().Bug(rctx, obj, args["prefix"].(string)) - }) - if resTmp == nil { - return graphql.Null + out := graphql.NewFieldSet(fields) + invalid := false + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("IdentityConnection") + case "edges": + out.Values[i] = ec._IdentityConnection_edges(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "nodes": + out.Values[i] = ec._IdentityConnection_nodes(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "pageInfo": + out.Values[i] = ec._IdentityConnection_pageInfo(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "totalCount": + out.Values[i] = ec._IdentityConnection_totalCount(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } } - res := resTmp.(*bug.Snapshot) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - - if res == nil { + out.Dispatch() + if invalid { return graphql.Null } - - return ec._Bug(ctx, field.Selections, res) + return out } -// nolint: vetshadow -func (ec *executionContext) _Repository_allIdentities(ctx context.Context, field graphql.CollectedField, obj *models.Repository) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rawArgs := field.ArgumentMap(ec.Variables) - args, err := field_Repository_allIdentities_args(rawArgs) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - rctx := &graphql.ResolverContext{ - Object: "Repository", - Args: args, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Repository().AllIdentities(rctx, obj, args["after"].(*string), args["before"].(*string), args["first"].(*int), args["last"].(*int)) - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(models.IdentityConnection) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) +var identityEdgeImplementors = []string{"IdentityEdge"} - return ec._IdentityConnection(ctx, field.Selections, &res) -} +func (ec *executionContext) _IdentityEdge(ctx context.Context, sel ast.SelectionSet, obj *models.IdentityEdge) graphql.Marshaler { + fields := graphql.CollectFields(ctx, sel, identityEdgeImplementors) -// nolint: vetshadow -func (ec *executionContext) _Repository_identity(ctx context.Context, field graphql.CollectedField, obj *models.Repository) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rawArgs := field.ArgumentMap(ec.Variables) - args, err := field_Repository_identity_args(rawArgs) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - rctx := &graphql.ResolverContext{ - Object: "Repository", - Args: args, - Field: field, + out := graphql.NewFieldSet(fields) + invalid := false + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("IdentityEdge") + case "cursor": + out.Values[i] = ec._IdentityEdge_cursor(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "node": + out.Values[i] = ec._IdentityEdge_node(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Repository().Identity(rctx, obj, args["prefix"].(string)) - }) - if resTmp == nil { + out.Dispatch() + if invalid { return graphql.Null } - res := resTmp.(*identity.Interface) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) + return out +} - if res == nil { - return graphql.Null - } +var labelChangeOperationImplementors = []string{"LabelChangeOperation", "Operation", "Authored"} - return ec._Identity(ctx, field.Selections, res) -} +func (ec *executionContext) _LabelChangeOperation(ctx context.Context, sel ast.SelectionSet, obj *bug.LabelChangeOperation) graphql.Marshaler { + fields := graphql.CollectFields(ctx, sel, labelChangeOperationImplementors) -// nolint: vetshadow -func (ec *executionContext) _Repository_userIdentity(ctx context.Context, field graphql.CollectedField, obj *models.Repository) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "Repository", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Repository().UserIdentity(rctx, obj) - }) - if resTmp == nil { - return graphql.Null + out := graphql.NewFieldSet(fields) + invalid := false + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("LabelChangeOperation") + case "hash": + out.Values[i] = ec._LabelChangeOperation_hash(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "author": + out.Values[i] = ec._LabelChangeOperation_author(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "date": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._LabelChangeOperation_date(ctx, field, obj) + if res == graphql.Null { + invalid = true + } + return res + }) + case "added": + out.Values[i] = ec._LabelChangeOperation_added(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "removed": + out.Values[i] = ec._LabelChangeOperation_removed(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } } - res := resTmp.(*identity.Interface) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - - if res == nil { + out.Dispatch() + if invalid { return graphql.Null } - - return ec._Identity(ctx, field.Selections, res) + return out } -var setStatusOperationImplementors = []string{"SetStatusOperation", "Operation", "Authored"} +var labelChangeTimelineItemImplementors = []string{"LabelChangeTimelineItem", "TimelineItem"} -// nolint: gocyclo, errcheck, gas, goconst -func (ec *executionContext) _SetStatusOperation(ctx context.Context, sel ast.SelectionSet, obj *bug.SetStatusOperation) graphql.Marshaler { - fields := graphql.CollectFields(ctx, sel, setStatusOperationImplementors) +func (ec *executionContext) _LabelChangeTimelineItem(ctx context.Context, sel ast.SelectionSet, obj *bug.LabelChangeTimelineItem) graphql.Marshaler { + fields := graphql.CollectFields(ctx, sel, labelChangeTimelineItemImplementors) - var wg sync.WaitGroup - out := graphql.NewOrderedMap(len(fields)) + out := graphql.NewFieldSet(fields) invalid := false for i, field := range fields { - out.Keys[i] = field.Alias - switch field.Name { case "__typename": - out.Values[i] = graphql.MarshalString("SetStatusOperation") + out.Values[i] = graphql.MarshalString("LabelChangeTimelineItem") case "hash": - out.Values[i] = ec._SetStatusOperation_hash(ctx, field, obj) + out.Values[i] = ec._LabelChangeTimelineItem_hash(ctx, field, obj) if out.Values[i] == graphql.Null { invalid = true } case "author": - out.Values[i] = ec._SetStatusOperation_author(ctx, field, obj) + out.Values[i] = ec._LabelChangeTimelineItem_author(ctx, field, obj) if out.Values[i] == graphql.Null { invalid = true } case "date": - wg.Add(1) - go func(i int, field graphql.CollectedField) { - out.Values[i] = ec._SetStatusOperation_date(ctx, field, obj) - if out.Values[i] == graphql.Null { + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._LabelChangeTimelineItem_date(ctx, field, obj) + if res == graphql.Null { invalid = true } - wg.Done() - }(i, field) - case "status": - wg.Add(1) - go func(i int, field graphql.CollectedField) { - out.Values[i] = ec._SetStatusOperation_status(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - wg.Done() - }(i, field) + return res + }) + case "added": + out.Values[i] = ec._LabelChangeTimelineItem_added(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "removed": + out.Values[i] = ec._LabelChangeTimelineItem_removed(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } default: panic("unknown field " + strconv.Quote(field.Name)) } } - wg.Wait() + out.Dispatch() if invalid { return graphql.Null } return out } -// nolint: vetshadow -func (ec *executionContext) _SetStatusOperation_hash(ctx context.Context, field graphql.CollectedField, obj *bug.SetStatusOperation) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "SetStatusOperation", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Hash() - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(git.Hash) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - return res -} - -// nolint: vetshadow -func (ec *executionContext) _SetStatusOperation_author(ctx context.Context, field graphql.CollectedField, obj *bug.SetStatusOperation) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "SetStatusOperation", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Author, nil - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(identity.Interface) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - - return ec._Identity(ctx, field.Selections, &res) -} +var mutationImplementors = []string{"Mutation"} -// nolint: vetshadow -func (ec *executionContext) _SetStatusOperation_date(ctx context.Context, field graphql.CollectedField, obj *bug.SetStatusOperation) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "SetStatusOperation", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.SetStatusOperation().Date(rctx, obj) - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(time.Time) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalTime(res) -} +func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { + fields := graphql.CollectFields(ctx, sel, mutationImplementors) -// nolint: vetshadow -func (ec *executionContext) _SetStatusOperation_status(ctx context.Context, field graphql.CollectedField, obj *bug.SetStatusOperation) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "SetStatusOperation", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.SetStatusOperation().Status(rctx, obj) + ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ + Object: "Mutation", }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(models.Status) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - return res -} - -var setStatusTimelineItemImplementors = []string{"SetStatusTimelineItem", "TimelineItem"} -// nolint: gocyclo, errcheck, gas, goconst -func (ec *executionContext) _SetStatusTimelineItem(ctx context.Context, sel ast.SelectionSet, obj *bug.SetStatusTimelineItem) graphql.Marshaler { - fields := graphql.CollectFields(ctx, sel, setStatusTimelineItemImplementors) - - var wg sync.WaitGroup - out := graphql.NewOrderedMap(len(fields)) + out := graphql.NewFieldSet(fields) invalid := false for i, field := range fields { - out.Keys[i] = field.Alias - switch field.Name { case "__typename": - out.Values[i] = graphql.MarshalString("SetStatusTimelineItem") - case "hash": - out.Values[i] = ec._SetStatusTimelineItem_hash(ctx, field, obj) + out.Values[i] = graphql.MarshalString("Mutation") + case "newBug": + out.Values[i] = ec._Mutation_newBug(ctx, field) if out.Values[i] == graphql.Null { invalid = true } - case "author": - out.Values[i] = ec._SetStatusTimelineItem_author(ctx, field, obj) + case "addComment": + out.Values[i] = ec._Mutation_addComment(ctx, field) + if out.Values[i] == graphql.Null { + invalid = true + } + case "changeLabels": + out.Values[i] = ec._Mutation_changeLabels(ctx, field) + if out.Values[i] == graphql.Null { + invalid = true + } + case "open": + out.Values[i] = ec._Mutation_open(ctx, field) + if out.Values[i] == graphql.Null { + invalid = true + } + case "close": + out.Values[i] = ec._Mutation_close(ctx, field) + if out.Values[i] == graphql.Null { + invalid = true + } + case "setTitle": + out.Values[i] = ec._Mutation_setTitle(ctx, field) + if out.Values[i] == graphql.Null { + invalid = true + } + case "commit": + out.Values[i] = ec._Mutation_commit(ctx, field) if out.Values[i] == graphql.Null { invalid = true } - case "date": - wg.Add(1) - go func(i int, field graphql.CollectedField) { - out.Values[i] = ec._SetStatusTimelineItem_date(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - wg.Done() - }(i, field) - case "status": - wg.Add(1) - go func(i int, field graphql.CollectedField) { - out.Values[i] = ec._SetStatusTimelineItem_status(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - wg.Done() - }(i, field) default: panic("unknown field " + strconv.Quote(field.Name)) } } - wg.Wait() + out.Dispatch() if invalid { return graphql.Null } return out } -// nolint: vetshadow -func (ec *executionContext) _SetStatusTimelineItem_hash(ctx context.Context, field graphql.CollectedField, obj *bug.SetStatusTimelineItem) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "SetStatusTimelineItem", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Hash(), nil - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(git.Hash) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - return res -} - -// nolint: vetshadow -func (ec *executionContext) _SetStatusTimelineItem_author(ctx context.Context, field graphql.CollectedField, obj *bug.SetStatusTimelineItem) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "SetStatusTimelineItem", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Author, nil - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(identity.Interface) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) +var operationConnectionImplementors = []string{"OperationConnection"} - return ec._Identity(ctx, field.Selections, &res) -} +func (ec *executionContext) _OperationConnection(ctx context.Context, sel ast.SelectionSet, obj *models.OperationConnection) graphql.Marshaler { + fields := graphql.CollectFields(ctx, sel, operationConnectionImplementors) -// nolint: vetshadow -func (ec *executionContext) _SetStatusTimelineItem_date(ctx context.Context, field graphql.CollectedField, obj *bug.SetStatusTimelineItem) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "SetStatusTimelineItem", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.SetStatusTimelineItem().Date(rctx, obj) - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") + out := graphql.NewFieldSet(fields) + invalid := false + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("OperationConnection") + case "edges": + out.Values[i] = ec._OperationConnection_edges(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "nodes": + out.Values[i] = ec._OperationConnection_nodes(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "pageInfo": + out.Values[i] = ec._OperationConnection_pageInfo(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "totalCount": + out.Values[i] = ec._OperationConnection_totalCount(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + default: + panic("unknown field " + strconv.Quote(field.Name)) } + } + out.Dispatch() + if invalid { return graphql.Null } - res := resTmp.(time.Time) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalTime(res) + return out } -// nolint: vetshadow -func (ec *executionContext) _SetStatusTimelineItem_status(ctx context.Context, field graphql.CollectedField, obj *bug.SetStatusTimelineItem) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "SetStatusTimelineItem", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.SetStatusTimelineItem().Status(rctx, obj) - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") +var operationEdgeImplementors = []string{"OperationEdge"} + +func (ec *executionContext) _OperationEdge(ctx context.Context, sel ast.SelectionSet, obj *models.OperationEdge) graphql.Marshaler { + fields := graphql.CollectFields(ctx, sel, operationEdgeImplementors) + + out := graphql.NewFieldSet(fields) + invalid := false + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("OperationEdge") + case "cursor": + out.Values[i] = ec._OperationEdge_cursor(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "node": + out.Values[i] = ec._OperationEdge_node(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + default: + panic("unknown field " + strconv.Quote(field.Name)) } + } + out.Dispatch() + if invalid { return graphql.Null } - res := resTmp.(models.Status) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - return res + return out } -var setTitleOperationImplementors = []string{"SetTitleOperation", "Operation", "Authored"} +var pageInfoImplementors = []string{"PageInfo"} -// nolint: gocyclo, errcheck, gas, goconst -func (ec *executionContext) _SetTitleOperation(ctx context.Context, sel ast.SelectionSet, obj *bug.SetTitleOperation) graphql.Marshaler { - fields := graphql.CollectFields(ctx, sel, setTitleOperationImplementors) +func (ec *executionContext) _PageInfo(ctx context.Context, sel ast.SelectionSet, obj *models.PageInfo) graphql.Marshaler { + fields := graphql.CollectFields(ctx, sel, pageInfoImplementors) - var wg sync.WaitGroup - out := graphql.NewOrderedMap(len(fields)) + out := graphql.NewFieldSet(fields) invalid := false for i, field := range fields { - out.Keys[i] = field.Alias - switch field.Name { case "__typename": - out.Values[i] = graphql.MarshalString("SetTitleOperation") - case "hash": - out.Values[i] = ec._SetTitleOperation_hash(ctx, field, obj) + out.Values[i] = graphql.MarshalString("PageInfo") + case "hasNextPage": + out.Values[i] = ec._PageInfo_hasNextPage(ctx, field, obj) if out.Values[i] == graphql.Null { invalid = true } - case "author": - out.Values[i] = ec._SetTitleOperation_author(ctx, field, obj) + case "hasPreviousPage": + out.Values[i] = ec._PageInfo_hasPreviousPage(ctx, field, obj) if out.Values[i] == graphql.Null { invalid = true } - case "date": - wg.Add(1) - go func(i int, field graphql.CollectedField) { - out.Values[i] = ec._SetTitleOperation_date(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - wg.Done() - }(i, field) - case "title": - out.Values[i] = ec._SetTitleOperation_title(ctx, field, obj) + case "startCursor": + out.Values[i] = ec._PageInfo_startCursor(ctx, field, obj) if out.Values[i] == graphql.Null { invalid = true } - case "was": - out.Values[i] = ec._SetTitleOperation_was(ctx, field, obj) + case "endCursor": + out.Values[i] = ec._PageInfo_endCursor(ctx, field, obj) if out.Values[i] == graphql.Null { invalid = true } @@ -7647,371 +8453,310 @@ func (ec *executionContext) _SetTitleOperation(ctx context.Context, sel ast.Sele panic("unknown field " + strconv.Quote(field.Name)) } } - wg.Wait() + out.Dispatch() if invalid { return graphql.Null } return out } -// nolint: vetshadow -func (ec *executionContext) _SetTitleOperation_hash(ctx context.Context, field graphql.CollectedField, obj *bug.SetTitleOperation) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "SetTitleOperation", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Hash() +var queryImplementors = []string{"Query"} + +func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { + fields := graphql.CollectFields(ctx, sel, queryImplementors) + + ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ + Object: "Query", }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") + + out := graphql.NewFieldSet(fields) + invalid := false + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Query") + case "defaultRepository": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_defaultRepository(ctx, field) + return res + }) + case "repository": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_repository(ctx, field) + return res + }) + case "__type": + out.Values[i] = ec._Query___type(ctx, field) + case "__schema": + out.Values[i] = ec._Query___schema(ctx, field) + default: + panic("unknown field " + strconv.Quote(field.Name)) } + } + out.Dispatch() + if invalid { return graphql.Null } - res := resTmp.(git.Hash) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - return res + return out } -// nolint: vetshadow -func (ec *executionContext) _SetTitleOperation_author(ctx context.Context, field graphql.CollectedField, obj *bug.SetTitleOperation) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "SetTitleOperation", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Author, nil - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(identity.Interface) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) +var repositoryImplementors = []string{"Repository"} - return ec._Identity(ctx, field.Selections, &res) -} +func (ec *executionContext) _Repository(ctx context.Context, sel ast.SelectionSet, obj *models.Repository) graphql.Marshaler { + fields := graphql.CollectFields(ctx, sel, repositoryImplementors) -// nolint: vetshadow -func (ec *executionContext) _SetTitleOperation_date(ctx context.Context, field graphql.CollectedField, obj *bug.SetTitleOperation) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "SetTitleOperation", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.SetTitleOperation().Date(rctx, obj) - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") + out := graphql.NewFieldSet(fields) + invalid := false + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Repository") + case "allBugs": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Repository_allBugs(ctx, field, obj) + if res == graphql.Null { + invalid = true + } + return res + }) + case "bug": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Repository_bug(ctx, field, obj) + return res + }) + case "allIdentities": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Repository_allIdentities(ctx, field, obj) + if res == graphql.Null { + invalid = true + } + return res + }) + case "identity": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Repository_identity(ctx, field, obj) + return res + }) + case "userIdentity": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Repository_userIdentity(ctx, field, obj) + return res + }) + default: + panic("unknown field " + strconv.Quote(field.Name)) } - return graphql.Null - } - res := resTmp.(time.Time) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalTime(res) -} - -// nolint: vetshadow -func (ec *executionContext) _SetTitleOperation_title(ctx context.Context, field graphql.CollectedField, obj *bug.SetTitleOperation) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "SetTitleOperation", - Args: nil, - Field: field, } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Title, nil - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } + out.Dispatch() + if invalid { return graphql.Null } - res := resTmp.(string) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalString(res) + return out } -// nolint: vetshadow -func (ec *executionContext) _SetTitleOperation_was(ctx context.Context, field graphql.CollectedField, obj *bug.SetTitleOperation) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "SetTitleOperation", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Was, nil - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") +var setStatusOperationImplementors = []string{"SetStatusOperation", "Operation", "Authored"} + +func (ec *executionContext) _SetStatusOperation(ctx context.Context, sel ast.SelectionSet, obj *bug.SetStatusOperation) graphql.Marshaler { + fields := graphql.CollectFields(ctx, sel, setStatusOperationImplementors) + + out := graphql.NewFieldSet(fields) + invalid := false + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("SetStatusOperation") + case "hash": + out.Values[i] = ec._SetStatusOperation_hash(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "author": + out.Values[i] = ec._SetStatusOperation_author(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "date": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._SetStatusOperation_date(ctx, field, obj) + if res == graphql.Null { + invalid = true + } + return res + }) + case "status": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._SetStatusOperation_status(ctx, field, obj) + if res == graphql.Null { + invalid = true + } + return res + }) + default: + panic("unknown field " + strconv.Quote(field.Name)) } + } + out.Dispatch() + if invalid { return graphql.Null } - res := resTmp.(string) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalString(res) + return out } -var setTitleTimelineItemImplementors = []string{"SetTitleTimelineItem", "TimelineItem"} +var setStatusTimelineItemImplementors = []string{"SetStatusTimelineItem", "TimelineItem"} -// nolint: gocyclo, errcheck, gas, goconst -func (ec *executionContext) _SetTitleTimelineItem(ctx context.Context, sel ast.SelectionSet, obj *bug.SetTitleTimelineItem) graphql.Marshaler { - fields := graphql.CollectFields(ctx, sel, setTitleTimelineItemImplementors) +func (ec *executionContext) _SetStatusTimelineItem(ctx context.Context, sel ast.SelectionSet, obj *bug.SetStatusTimelineItem) graphql.Marshaler { + fields := graphql.CollectFields(ctx, sel, setStatusTimelineItemImplementors) - var wg sync.WaitGroup - out := graphql.NewOrderedMap(len(fields)) + out := graphql.NewFieldSet(fields) invalid := false for i, field := range fields { - out.Keys[i] = field.Alias - switch field.Name { case "__typename": - out.Values[i] = graphql.MarshalString("SetTitleTimelineItem") + out.Values[i] = graphql.MarshalString("SetStatusTimelineItem") case "hash": - out.Values[i] = ec._SetTitleTimelineItem_hash(ctx, field, obj) + out.Values[i] = ec._SetStatusTimelineItem_hash(ctx, field, obj) if out.Values[i] == graphql.Null { invalid = true } case "author": - out.Values[i] = ec._SetTitleTimelineItem_author(ctx, field, obj) + out.Values[i] = ec._SetStatusTimelineItem_author(ctx, field, obj) if out.Values[i] == graphql.Null { invalid = true } case "date": - wg.Add(1) - go func(i int, field graphql.CollectedField) { - out.Values[i] = ec._SetTitleTimelineItem_date(ctx, field, obj) - if out.Values[i] == graphql.Null { + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._SetStatusTimelineItem_date(ctx, field, obj) + if res == graphql.Null { invalid = true } - wg.Done() - }(i, field) - case "title": - out.Values[i] = ec._SetTitleTimelineItem_title(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "was": - out.Values[i] = ec._SetTitleTimelineItem_was(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } + return res + }) + case "status": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._SetStatusTimelineItem_status(ctx, field, obj) + if res == graphql.Null { + invalid = true + } + return res + }) default: panic("unknown field " + strconv.Quote(field.Name)) } } - wg.Wait() + out.Dispatch() if invalid { return graphql.Null } return out } -// nolint: vetshadow -func (ec *executionContext) _SetTitleTimelineItem_hash(ctx context.Context, field graphql.CollectedField, obj *bug.SetTitleTimelineItem) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "SetTitleTimelineItem", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Hash(), nil - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(git.Hash) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - return res -} - -// nolint: vetshadow -func (ec *executionContext) _SetTitleTimelineItem_author(ctx context.Context, field graphql.CollectedField, obj *bug.SetTitleTimelineItem) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "SetTitleTimelineItem", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Author, nil - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(identity.Interface) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - - return ec._Identity(ctx, field.Selections, &res) -} - -// nolint: vetshadow -func (ec *executionContext) _SetTitleTimelineItem_date(ctx context.Context, field graphql.CollectedField, obj *bug.SetTitleTimelineItem) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "SetTitleTimelineItem", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.SetTitleTimelineItem().Date(rctx, obj) - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(time.Time) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalTime(res) -} - -// nolint: vetshadow -func (ec *executionContext) _SetTitleTimelineItem_title(ctx context.Context, field graphql.CollectedField, obj *bug.SetTitleTimelineItem) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "SetTitleTimelineItem", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Title, nil - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalString(res) -} - -// nolint: vetshadow -func (ec *executionContext) _SetTitleTimelineItem_was(ctx context.Context, field graphql.CollectedField, obj *bug.SetTitleTimelineItem) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "SetTitleTimelineItem", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Was, nil - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalString(res) -} - -var timelineItemConnectionImplementors = []string{"TimelineItemConnection"} +var setTitleOperationImplementors = []string{"SetTitleOperation", "Operation", "Authored"} -// nolint: gocyclo, errcheck, gas, goconst -func (ec *executionContext) _TimelineItemConnection(ctx context.Context, sel ast.SelectionSet, obj *models.TimelineItemConnection) graphql.Marshaler { - fields := graphql.CollectFields(ctx, sel, timelineItemConnectionImplementors) +func (ec *executionContext) _SetTitleOperation(ctx context.Context, sel ast.SelectionSet, obj *bug.SetTitleOperation) graphql.Marshaler { + fields := graphql.CollectFields(ctx, sel, setTitleOperationImplementors) - out := graphql.NewOrderedMap(len(fields)) + out := graphql.NewFieldSet(fields) invalid := false for i, field := range fields { - out.Keys[i] = field.Alias - switch field.Name { case "__typename": - out.Values[i] = graphql.MarshalString("TimelineItemConnection") - case "edges": - out.Values[i] = ec._TimelineItemConnection_edges(ctx, field, obj) + out.Values[i] = graphql.MarshalString("SetTitleOperation") + case "hash": + out.Values[i] = ec._SetTitleOperation_hash(ctx, field, obj) if out.Values[i] == graphql.Null { invalid = true } - case "nodes": - out.Values[i] = ec._TimelineItemConnection_nodes(ctx, field, obj) + case "author": + out.Values[i] = ec._SetTitleOperation_author(ctx, field, obj) if out.Values[i] == graphql.Null { invalid = true } - case "pageInfo": - out.Values[i] = ec._TimelineItemConnection_pageInfo(ctx, field, obj) + case "date": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._SetTitleOperation_date(ctx, field, obj) + if res == graphql.Null { + invalid = true + } + return res + }) + case "title": + out.Values[i] = ec._SetTitleOperation_title(ctx, field, obj) if out.Values[i] == graphql.Null { invalid = true } - case "totalCount": - out.Values[i] = ec._TimelineItemConnection_totalCount(ctx, field, obj) + case "was": + out.Values[i] = ec._SetTitleOperation_was(ctx, field, obj) if out.Values[i] == graphql.Null { invalid = true } @@ -8019,199 +8764,119 @@ func (ec *executionContext) _TimelineItemConnection(ctx context.Context, sel ast panic("unknown field " + strconv.Quote(field.Name)) } } - + out.Dispatch() if invalid { return graphql.Null } return out } -// nolint: vetshadow -func (ec *executionContext) _TimelineItemConnection_edges(ctx context.Context, field graphql.CollectedField, obj *models.TimelineItemConnection) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "TimelineItemConnection", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Edges, nil - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.([]models.TimelineItemEdge) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup +var setTitleTimelineItemImplementors = []string{"SetTitleTimelineItem", "TimelineItem"} - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } +func (ec *executionContext) _SetTitleTimelineItem(ctx context.Context, sel ast.SelectionSet, obj *bug.SetTitleTimelineItem) graphql.Marshaler { + fields := graphql.CollectFields(ctx, sel, setTitleTimelineItemImplementors) - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], - } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + out := graphql.NewFieldSet(fields) + invalid := false + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("SetTitleTimelineItem") + case "hash": + out.Values[i] = ec._SetTitleTimelineItem_hash(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true } - arr1[idx1] = func() graphql.Marshaler { - - return ec._TimelineItemEdge(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } - - } - wg.Wait() - return arr1 -} - -// nolint: vetshadow -func (ec *executionContext) _TimelineItemConnection_nodes(ctx context.Context, field graphql.CollectedField, obj *models.TimelineItemConnection) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "TimelineItemConnection", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Nodes, nil - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.([]bug.TimelineItem) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } - - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], - } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + case "author": + out.Values[i] = ec._SetTitleTimelineItem_author(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "date": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._SetTitleTimelineItem_date(ctx, field, obj) + if res == graphql.Null { + invalid = true + } + return res + }) + case "title": + out.Values[i] = ec._SetTitleTimelineItem_title(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true } - arr1[idx1] = func() graphql.Marshaler { - - return ec._TimelineItem(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) + case "was": + out.Values[i] = ec._SetTitleTimelineItem_was(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + default: + panic("unknown field " + strconv.Quote(field.Name)) } - } - wg.Wait() - return arr1 -} - -// nolint: vetshadow -func (ec *executionContext) _TimelineItemConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *models.TimelineItemConnection) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "TimelineItemConnection", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.PageInfo, nil - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } + out.Dispatch() + if invalid { return graphql.Null } - res := resTmp.(models.PageInfo) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - - return ec._PageInfo(ctx, field.Selections, &res) + return out } -// nolint: vetshadow -func (ec *executionContext) _TimelineItemConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *models.TimelineItemConnection) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "TimelineItemConnection", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.TotalCount, nil - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") +var timelineItemConnectionImplementors = []string{"TimelineItemConnection"} + +func (ec *executionContext) _TimelineItemConnection(ctx context.Context, sel ast.SelectionSet, obj *models.TimelineItemConnection) graphql.Marshaler { + fields := graphql.CollectFields(ctx, sel, timelineItemConnectionImplementors) + + out := graphql.NewFieldSet(fields) + invalid := false + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("TimelineItemConnection") + case "edges": + out.Values[i] = ec._TimelineItemConnection_edges(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "nodes": + out.Values[i] = ec._TimelineItemConnection_nodes(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "pageInfo": + out.Values[i] = ec._TimelineItemConnection_pageInfo(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "totalCount": + out.Values[i] = ec._TimelineItemConnection_totalCount(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + default: + panic("unknown field " + strconv.Quote(field.Name)) } + } + out.Dispatch() + if invalid { return graphql.Null } - res := resTmp.(int) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalInt(res) + return out } var timelineItemEdgeImplementors = []string{"TimelineItemEdge"} -// nolint: gocyclo, errcheck, gas, goconst func (ec *executionContext) _TimelineItemEdge(ctx context.Context, sel ast.SelectionSet, obj *models.TimelineItemEdge) graphql.Marshaler { fields := graphql.CollectFields(ctx, sel, timelineItemEdgeImplementors) - out := graphql.NewOrderedMap(len(fields)) + out := graphql.NewFieldSet(fields) invalid := false for i, field := range fields { - out.Keys[i] = field.Alias - switch field.Name { case "__typename": out.Values[i] = graphql.MarshalString("TimelineItemEdge") @@ -8229,79 +8894,21 @@ func (ec *executionContext) _TimelineItemEdge(ctx context.Context, sel ast.Selec panic("unknown field " + strconv.Quote(field.Name)) } } - + out.Dispatch() if invalid { return graphql.Null } return out } -// nolint: vetshadow -func (ec *executionContext) _TimelineItemEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *models.TimelineItemEdge) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "TimelineItemEdge", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Cursor, nil - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalString(res) -} - -// nolint: vetshadow -func (ec *executionContext) _TimelineItemEdge_node(ctx context.Context, field graphql.CollectedField, obj *models.TimelineItemEdge) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "TimelineItemEdge", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Node, nil - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(bug.TimelineItem) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - - return ec._TimelineItem(ctx, field.Selections, &res) -} - var __DirectiveImplementors = []string{"__Directive"} -// nolint: gocyclo, errcheck, gas, goconst func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionSet, obj *introspection.Directive) graphql.Marshaler { fields := graphql.CollectFields(ctx, sel, __DirectiveImplementors) - out := graphql.NewOrderedMap(len(fields)) + out := graphql.NewFieldSet(fields) invalid := false for i, field := range fields { - out.Keys[i] = field.Alias - switch field.Name { case "__typename": out.Values[i] = graphql.MarshalString("__Directive") @@ -8321,176 +8928,26 @@ func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionS out.Values[i] = ec.___Directive_args(ctx, field, obj) if out.Values[i] == graphql.Null { invalid = true - } - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - - if invalid { - return graphql.Null - } - return out -} - -// nolint: vetshadow -func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "__Directive", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Name, nil - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalString(res) -} - -// nolint: vetshadow -func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "__Directive", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Description, nil - }) - if resTmp == nil { - return graphql.Null - } - res := resTmp.(string) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalString(res) -} - -// nolint: vetshadow -func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "__Directive", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Locations, nil - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.([]string) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - - arr1 := make(graphql.Array, len(res)) - - for idx1 := range res { - arr1[idx1] = func() graphql.Marshaler { - return graphql.MarshalString(res[idx1]) - }() - } - - return arr1 -} - -// nolint: vetshadow -func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "__Directive", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Args, nil - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.([]introspection.InputValue) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } - - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], - } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() - } - arr1[idx1] = func() graphql.Marshaler { - - return ec.___InputValue(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) + } + default: + panic("unknown field " + strconv.Quote(field.Name)) } - } - wg.Wait() - return arr1 + out.Dispatch() + if invalid { + return graphql.Null + } + return out } var __EnumValueImplementors = []string{"__EnumValue"} -// nolint: gocyclo, errcheck, gas, goconst func (ec *executionContext) ___EnumValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.EnumValue) graphql.Marshaler { fields := graphql.CollectFields(ctx, sel, __EnumValueImplementors) - out := graphql.NewOrderedMap(len(fields)) + out := graphql.NewFieldSet(fields) invalid := false for i, field := range fields { - out.Keys[i] = field.Alias - switch field.Name { case "__typename": out.Values[i] = graphql.MarshalString("__EnumValue") @@ -8512,130 +8969,21 @@ func (ec *executionContext) ___EnumValue(ctx context.Context, sel ast.SelectionS panic("unknown field " + strconv.Quote(field.Name)) } } - + out.Dispatch() if invalid { return graphql.Null } return out } -// nolint: vetshadow -func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "__EnumValue", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Name, nil - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalString(res) -} - -// nolint: vetshadow -func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "__EnumValue", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Description, nil - }) - if resTmp == nil { - return graphql.Null - } - res := resTmp.(string) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalString(res) -} - -// nolint: vetshadow -func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "__EnumValue", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.IsDeprecated(), nil - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(bool) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalBoolean(res) -} - -// nolint: vetshadow -func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "__EnumValue", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.DeprecationReason(), nil - }) - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - - if res == nil { - return graphql.Null - } - return graphql.MarshalString(*res) -} - var __FieldImplementors = []string{"__Field"} -// nolint: gocyclo, errcheck, gas, goconst func (ec *executionContext) ___Field(ctx context.Context, sel ast.SelectionSet, obj *introspection.Field) graphql.Marshaler { fields := graphql.CollectFields(ctx, sel, __FieldImplementors) - out := graphql.NewOrderedMap(len(fields)) + out := graphql.NewFieldSet(fields) invalid := false for i, field := range fields { - out.Keys[i] = field.Alias - switch field.Name { case "__typename": out.Values[i] = graphql.MarshalString("__Field") @@ -8667,225 +9015,21 @@ func (ec *executionContext) ___Field(ctx context.Context, sel ast.SelectionSet, panic("unknown field " + strconv.Quote(field.Name)) } } - + out.Dispatch() if invalid { return graphql.Null } return out } -// nolint: vetshadow -func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "__Field", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Name, nil - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalString(res) -} - -// nolint: vetshadow -func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "__Field", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Description, nil - }) - if resTmp == nil { - return graphql.Null - } - res := resTmp.(string) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalString(res) -} - -// nolint: vetshadow -func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "__Field", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Args, nil - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.([]introspection.InputValue) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } - - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], - } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() - } - arr1[idx1] = func() graphql.Marshaler { - - return ec.___InputValue(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } - - } - wg.Wait() - return arr1 -} - -// nolint: vetshadow -func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "__Field", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Type, nil - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(*introspection.Type) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - - if res == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - - return ec.___Type(ctx, field.Selections, res) -} - -// nolint: vetshadow -func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "__Field", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.IsDeprecated(), nil - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(bool) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalBoolean(res) -} - -// nolint: vetshadow -func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "__Field", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.DeprecationReason(), nil - }) - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - - if res == nil { - return graphql.Null - } - return graphql.MarshalString(*res) -} - var __InputValueImplementors = []string{"__InputValue"} -// nolint: gocyclo, errcheck, gas, goconst func (ec *executionContext) ___InputValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.InputValue) graphql.Marshaler { fields := graphql.CollectFields(ctx, sel, __InputValueImplementors) - out := graphql.NewOrderedMap(len(fields)) + out := graphql.NewFieldSet(fields) invalid := false for i, field := range fields { - out.Keys[i] = field.Alias - switch field.Name { case "__typename": out.Values[i] = graphql.MarshalString("__InputValue") @@ -8907,138 +9051,21 @@ func (ec *executionContext) ___InputValue(ctx context.Context, sel ast.Selection panic("unknown field " + strconv.Quote(field.Name)) } } - + out.Dispatch() if invalid { return graphql.Null } return out } -// nolint: vetshadow -func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "__InputValue", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Name, nil - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalString(res) -} - -// nolint: vetshadow -func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "__InputValue", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Description, nil - }) - if resTmp == nil { - return graphql.Null - } - res := resTmp.(string) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalString(res) -} - -// nolint: vetshadow -func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "__InputValue", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Type, nil - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(*introspection.Type) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - - if res == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - - return ec.___Type(ctx, field.Selections, res) -} - -// nolint: vetshadow -func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "__InputValue", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.DefaultValue, nil - }) - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - - if res == nil { - return graphql.Null - } - return graphql.MarshalString(*res) -} - var __SchemaImplementors = []string{"__Schema"} -// nolint: gocyclo, errcheck, gas, goconst func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet, obj *introspection.Schema) graphql.Marshaler { fields := graphql.CollectFields(ctx, sel, __SchemaImplementors) - out := graphql.NewOrderedMap(len(fields)) + out := graphql.NewFieldSet(fields) invalid := false for i, field := range fields { - out.Keys[i] = field.Alias - switch field.Name { case "__typename": out.Values[i] = graphql.MarshalString("__Schema") @@ -9065,237 +9092,21 @@ func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet, panic("unknown field " + strconv.Quote(field.Name)) } } - + out.Dispatch() if invalid { return graphql.Null } return out } -// nolint: vetshadow -func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "__Schema", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Types(), nil - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.([]introspection.Type) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } - - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], - } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() - } - arr1[idx1] = func() graphql.Marshaler { - - return ec.___Type(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } - - } - wg.Wait() - return arr1 -} - -// nolint: vetshadow -func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "__Schema", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.QueryType(), nil - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(*introspection.Type) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - - if res == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - - return ec.___Type(ctx, field.Selections, res) -} - -// nolint: vetshadow -func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "__Schema", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.MutationType(), nil - }) - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*introspection.Type) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - - if res == nil { - return graphql.Null - } - - return ec.___Type(ctx, field.Selections, res) -} - -// nolint: vetshadow -func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "__Schema", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.SubscriptionType(), nil - }) - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*introspection.Type) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - - if res == nil { - return graphql.Null - } - - return ec.___Type(ctx, field.Selections, res) -} - -// nolint: vetshadow -func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "__Schema", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Directives(), nil - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.([]introspection.Directive) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } - - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], - } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() - } - arr1[idx1] = func() graphql.Marshaler { - - return ec.___Directive(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } - - } - wg.Wait() - return arr1 -} - var __TypeImplementors = []string{"__Type"} -// nolint: gocyclo, errcheck, gas, goconst func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, obj *introspection.Type) graphql.Marshaler { fields := graphql.CollectFields(ctx, sel, __TypeImplementors) - out := graphql.NewOrderedMap(len(fields)) + out := graphql.NewFieldSet(fields) invalid := false for i, field := range fields { - out.Keys[i] = field.Alias - switch field.Name { case "__typename": out.Values[i] = graphql.MarshalString("__Type") @@ -9324,930 +9135,1246 @@ func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, o panic("unknown field " + strconv.Quote(field.Name)) } } - + out.Dispatch() if invalid { return graphql.Null } return out } -// nolint: vetshadow -func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "__Type", - Args: nil, - Field: field, +// endregion **************************** object.gotpl **************************** + +// region ***************************** type.gotpl ***************************** + +func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interface{}) (bool, error) { + return graphql.UnmarshalBoolean(v) +} + +func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { + return graphql.MarshalBoolean(v) +} + +func (ec *executionContext) marshalNBug2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐSnapshot(ctx context.Context, sel ast.SelectionSet, v bug.Snapshot) graphql.Marshaler { + return ec._Bug(ctx, sel, &v) +} + +func (ec *executionContext) marshalNBug2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐSnapshot(ctx context.Context, sel ast.SelectionSet, v []bug.Snapshot) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Kind(), nil - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") + for i := range v { + i := i + rctx := &graphql.ResolverContext{ + Index: &i, + Result: &v[i], } - return graphql.Null + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNBug2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐSnapshot(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + } - res := resTmp.(string) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalString(res) + wg.Wait() + return ret } -// nolint: vetshadow -func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "__Type", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Name(), nil - }) - if resTmp == nil { +func (ec *executionContext) marshalNBug2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐSnapshot(ctx context.Context, sel ast.SelectionSet, v *bug.Snapshot) graphql.Marshaler { + if v == nil { + if !ec.HasError(graphql.GetResolverContext(ctx)) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*string) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec._Bug(ctx, sel, v) +} - if res == nil { +func (ec *executionContext) marshalNBugConnection2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐBugConnection(ctx context.Context, sel ast.SelectionSet, v models.BugConnection) graphql.Marshaler { + return ec._BugConnection(ctx, sel, &v) +} + +func (ec *executionContext) marshalNBugConnection2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐBugConnection(ctx context.Context, sel ast.SelectionSet, v *models.BugConnection) graphql.Marshaler { + if v == nil { + if !ec.HasError(graphql.GetResolverContext(ctx)) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - return graphql.MarshalString(*res) + return ec._BugConnection(ctx, sel, v) } -// nolint: vetshadow -func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "__Type", - Args: nil, - Field: field, +func (ec *executionContext) marshalNBugEdge2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐBugEdge(ctx context.Context, sel ast.SelectionSet, v models.BugEdge) graphql.Marshaler { + return ec._BugEdge(ctx, sel, &v) +} + +func (ec *executionContext) marshalNBugEdge2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐBugEdge(ctx context.Context, sel ast.SelectionSet, v []models.BugEdge) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Description(), nil - }) - if resTmp == nil { - return graphql.Null + for i := range v { + i := i + rctx := &graphql.ResolverContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNBugEdge2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐBugEdge(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + } - res := resTmp.(string) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - return graphql.MarshalString(res) + wg.Wait() + return ret } -// nolint: vetshadow -func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rawArgs := field.ArgumentMap(ec.Variables) - args, err := field___Type_fields_args(rawArgs) - if err != nil { - ec.Error(ctx, err) - return graphql.Null +func (ec *executionContext) marshalNComment2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐComment(ctx context.Context, sel ast.SelectionSet, v bug.Comment) graphql.Marshaler { + return ec._Comment(ctx, sel, &v) +} + +func (ec *executionContext) marshalNComment2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐComment(ctx context.Context, sel ast.SelectionSet, v []bug.Comment) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) } - rctx := &graphql.ResolverContext{ - Object: "__Type", - Args: args, - Field: field, + for i := range v { + i := i + rctx := &graphql.ResolverContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNComment2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐComment(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Fields(args["includeDeprecated"].(bool)), nil - }) - if resTmp == nil { + wg.Wait() + return ret +} + +func (ec *executionContext) marshalNCommentConnection2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐCommentConnection(ctx context.Context, sel ast.SelectionSet, v models.CommentConnection) graphql.Marshaler { + return ec._CommentConnection(ctx, sel, &v) +} + +func (ec *executionContext) marshalNCommentConnection2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐCommentConnection(ctx context.Context, sel ast.SelectionSet, v *models.CommentConnection) graphql.Marshaler { + if v == nil { + if !ec.HasError(graphql.GetResolverContext(ctx)) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.([]introspection.Field) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec._CommentConnection(ctx, sel, v) +} - arr1 := make(graphql.Array, len(res)) +func (ec *executionContext) marshalNCommentEdge2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐCommentEdge(ctx context.Context, sel ast.SelectionSet, v models.CommentEdge) graphql.Marshaler { + return ec._CommentEdge(ctx, sel, &v) +} + +func (ec *executionContext) marshalNCommentEdge2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐCommentEdge(ctx context.Context, sel ast.SelectionSet, v []models.CommentEdge) graphql.Marshaler { + ret := make(graphql.Array, len(v)) var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + rctx := &graphql.ResolverContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNCommentEdge2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐCommentEdge(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + return ret +} - isLen1 := len(res) == 1 +func (ec *executionContext) marshalNCommentHistoryStep2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐCommentHistoryStep(ctx context.Context, sel ast.SelectionSet, v bug.CommentHistoryStep) graphql.Marshaler { + return ec._CommentHistoryStep(ctx, sel, &v) +} + +func (ec *executionContext) marshalNCommentHistoryStep2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐCommentHistoryStep(ctx context.Context, sel ast.SelectionSet, v []bug.CommentHistoryStep) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 if !isLen1 { - wg.Add(len(res)) + wg.Add(len(v)) + } + for i := range v { + i := i + rctx := &graphql.ResolverContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNCommentHistoryStep2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐCommentHistoryStep(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + return ret +} + +func (ec *executionContext) unmarshalNHash2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋutilᚋgitᚐHash(ctx context.Context, v interface{}) (git.Hash, error) { + var res git.Hash + return res, res.UnmarshalGQL(v) +} + +func (ec *executionContext) marshalNHash2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋutilᚋgitᚐHash(ctx context.Context, sel ast.SelectionSet, v git.Hash) graphql.Marshaler { + return v +} + +func (ec *executionContext) unmarshalNHash2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋutilᚋgitᚐHash(ctx context.Context, v interface{}) ([]git.Hash, error) { + var vSlice []interface{} + if v != nil { + if tmp1, ok := v.([]interface{}); ok { + vSlice = tmp1 + } else { + vSlice = []interface{}{v} + } + } + var err error + res := make([]git.Hash, len(vSlice)) + for i := range vSlice { + res[i], err = ec.unmarshalNHash2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋutilᚋgitᚐHash(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) marshalNHash2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋutilᚋgitᚐHash(ctx context.Context, sel ast.SelectionSet, v []git.Hash) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + for i := range v { + ret[i] = ec.marshalNHash2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋutilᚋgitᚐHash(ctx, sel, v[i]) } - for idx1 := range res { - idx1 := idx1 + return ret +} + +func (ec *executionContext) marshalNIdentity2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋidentityᚐInterface(ctx context.Context, sel ast.SelectionSet, v identity.Interface) graphql.Marshaler { + return ec._Identity(ctx, sel, &v) +} + +func (ec *executionContext) marshalNIdentity2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋidentityᚐInterface(ctx context.Context, sel ast.SelectionSet, v []identity.Interface) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + Index: &i, + Result: &v[i], } ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() if !isLen1 { defer wg.Done() } - arr1[idx1] = func() graphql.Marshaler { + ret[i] = ec.marshalNIdentity2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋidentityᚐInterface(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + return ret +} + +func (ec *executionContext) marshalNIdentityConnection2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐIdentityConnection(ctx context.Context, sel ast.SelectionSet, v models.IdentityConnection) graphql.Marshaler { + return ec._IdentityConnection(ctx, sel, &v) +} + +func (ec *executionContext) marshalNIdentityConnection2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐIdentityConnection(ctx context.Context, sel ast.SelectionSet, v *models.IdentityConnection) graphql.Marshaler { + if v == nil { + if !ec.HasError(graphql.GetResolverContext(ctx)) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + return ec._IdentityConnection(ctx, sel, v) +} + +func (ec *executionContext) marshalNIdentityEdge2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐIdentityEdge(ctx context.Context, sel ast.SelectionSet, v models.IdentityEdge) graphql.Marshaler { + return ec._IdentityEdge(ctx, sel, &v) +} - return ec.___Field(ctx, field.Selections, &res[idx1]) +func (ec *executionContext) marshalNIdentityEdge2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐIdentityEdge(ctx context.Context, sel ast.SelectionSet, v []models.IdentityEdge) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + rctx := &graphql.ResolverContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNIdentityEdge2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐIdentityEdge(ctx, sel, v[i]) } if isLen1 { - f(idx1) + f(i) } else { - go f(idx1) + go f(i) } } wg.Wait() - return arr1 + return ret } -// nolint: vetshadow -func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "__Type", - Args: nil, - Field: field, +func (ec *executionContext) unmarshalNInt2int(ctx context.Context, v interface{}) (int, error) { + return graphql.UnmarshalInt(v) +} + +func (ec *executionContext) marshalNInt2int(ctx context.Context, sel ast.SelectionSet, v int) graphql.Marshaler { + return graphql.MarshalInt(v) +} + +func (ec *executionContext) unmarshalNLabel2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐLabel(ctx context.Context, v interface{}) (bug.Label, error) { + var res bug.Label + return res, res.UnmarshalGQL(v) +} + +func (ec *executionContext) marshalNLabel2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐLabel(ctx context.Context, sel ast.SelectionSet, v bug.Label) graphql.Marshaler { + return v +} + +func (ec *executionContext) unmarshalNLabel2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐLabel(ctx context.Context, v interface{}) ([]bug.Label, error) { + var vSlice []interface{} + if v != nil { + if tmp1, ok := v.([]interface{}); ok { + vSlice = tmp1 + } else { + vSlice = []interface{}{v} + } } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Interfaces(), nil - }) - if resTmp == nil { - return graphql.Null + var err error + res := make([]bug.Label, len(vSlice)) + for i := range vSlice { + res[i], err = ec.unmarshalNLabel2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐLabel(ctx, vSlice[i]) + if err != nil { + return nil, err + } } - res := resTmp.([]introspection.Type) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) + return res, nil +} - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup +func (ec *executionContext) marshalNLabel2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐLabel(ctx context.Context, sel ast.SelectionSet, v []bug.Label) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + for i := range v { + ret[i] = ec.marshalNLabel2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐLabel(ctx, sel, v[i]) + } + + return ret +} - isLen1 := len(res) == 1 +func (ec *executionContext) marshalNOperation2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐOperation(ctx context.Context, sel ast.SelectionSet, v bug.Operation) graphql.Marshaler { + return ec._Operation(ctx, sel, &v) +} + +func (ec *executionContext) marshalNOperation2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐOperation(ctx context.Context, sel ast.SelectionSet, v []bug.Operation) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 if !isLen1 { - wg.Add(len(res)) + wg.Add(len(v)) } - - for idx1 := range res { - idx1 := idx1 + for i := range v { + i := i rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + Index: &i, + Result: &v[i], } ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() if !isLen1 { defer wg.Done() } - arr1[idx1] = func() graphql.Marshaler { - - return ec.___Type(ctx, field.Selections, &res[idx1]) - }() + ret[i] = ec.marshalNOperation2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐOperation(ctx, sel, v[i]) } if isLen1 { - f(idx1) + f(i) } else { - go f(idx1) + go f(i) } } wg.Wait() - return arr1 + return ret } -// nolint: vetshadow -func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "__Type", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.PossibleTypes(), nil - }) - if resTmp == nil { +func (ec *executionContext) marshalNOperationConnection2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐOperationConnection(ctx context.Context, sel ast.SelectionSet, v models.OperationConnection) graphql.Marshaler { + return ec._OperationConnection(ctx, sel, &v) +} + +func (ec *executionContext) marshalNOperationConnection2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐOperationConnection(ctx context.Context, sel ast.SelectionSet, v *models.OperationConnection) graphql.Marshaler { + if v == nil { + if !ec.HasError(graphql.GetResolverContext(ctx)) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.([]introspection.Type) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec._OperationConnection(ctx, sel, v) +} - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup +func (ec *executionContext) marshalNOperationEdge2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐOperationEdge(ctx context.Context, sel ast.SelectionSet, v models.OperationEdge) graphql.Marshaler { + return ec._OperationEdge(ctx, sel, &v) +} - isLen1 := len(res) == 1 +func (ec *executionContext) marshalNOperationEdge2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐOperationEdge(ctx context.Context, sel ast.SelectionSet, v []models.OperationEdge) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 if !isLen1 { - wg.Add(len(res)) + wg.Add(len(v)) } - - for idx1 := range res { - idx1 := idx1 + for i := range v { + i := i rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + Index: &i, + Result: &v[i], } ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() if !isLen1 { defer wg.Done() } - arr1[idx1] = func() graphql.Marshaler { - - return ec.___Type(ctx, field.Selections, &res[idx1]) - }() + ret[i] = ec.marshalNOperationEdge2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐOperationEdge(ctx, sel, v[i]) } if isLen1 { - f(idx1) + f(i) } else { - go f(idx1) + go f(i) } } wg.Wait() - return arr1 + return ret } -// nolint: vetshadow -func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rawArgs := field.ArgumentMap(ec.Variables) - args, err := field___Type_enumValues_args(rawArgs) - if err != nil { - ec.Error(ctx, err) +func (ec *executionContext) marshalNPageInfo2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐPageInfo(ctx context.Context, sel ast.SelectionSet, v models.PageInfo) graphql.Marshaler { + return ec._PageInfo(ctx, sel, &v) +} + +func (ec *executionContext) unmarshalNStatus2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐStatus(ctx context.Context, v interface{}) (models.Status, error) { + var res models.Status + return res, res.UnmarshalGQL(v) +} + +func (ec *executionContext) marshalNStatus2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐStatus(ctx context.Context, sel ast.SelectionSet, v models.Status) graphql.Marshaler { + return v +} + +func (ec *executionContext) unmarshalNString2string(ctx context.Context, v interface{}) (string, error) { + return graphql.UnmarshalString(v) +} + +func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { + return graphql.MarshalString(v) +} + +func (ec *executionContext) unmarshalNTime2timeᚐTime(ctx context.Context, v interface{}) (time.Time, error) { + return graphql.UnmarshalTime(v) +} + +func (ec *executionContext) marshalNTime2timeᚐTime(ctx context.Context, sel ast.SelectionSet, v time.Time) graphql.Marshaler { + if v.IsZero() { + if !ec.HasError(graphql.GetResolverContext(ctx)) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - rctx := &graphql.ResolverContext{ - Object: "__Type", - Args: args, - Field: field, + return graphql.MarshalTime(v) +} + +func (ec *executionContext) unmarshalNTime2ᚖtimeᚐTime(ctx context.Context, v interface{}) (*time.Time, error) { + if v == nil { + return nil, nil } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.EnumValues(args["includeDeprecated"].(bool)), nil - }) - if resTmp == nil { + res, err := ec.unmarshalNTime2timeᚐTime(ctx, v) + return &res, err +} + +func (ec *executionContext) marshalNTime2ᚖtimeᚐTime(ctx context.Context, sel ast.SelectionSet, v *time.Time) graphql.Marshaler { + if v == nil { + if !ec.HasError(graphql.GetResolverContext(ctx)) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.([]introspection.EnumValue) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNTime2timeᚐTime(ctx, sel, *v) +} - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup +func (ec *executionContext) marshalNTimelineItem2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐTimelineItem(ctx context.Context, sel ast.SelectionSet, v bug.TimelineItem) graphql.Marshaler { + return ec._TimelineItem(ctx, sel, &v) +} - isLen1 := len(res) == 1 +func (ec *executionContext) marshalNTimelineItem2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐTimelineItem(ctx context.Context, sel ast.SelectionSet, v []bug.TimelineItem) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 if !isLen1 { - wg.Add(len(res)) + wg.Add(len(v)) } - - for idx1 := range res { - idx1 := idx1 + for i := range v { + i := i rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + Index: &i, + Result: &v[i], } ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() if !isLen1 { defer wg.Done() } - arr1[idx1] = func() graphql.Marshaler { - - return ec.___EnumValue(ctx, field.Selections, &res[idx1]) - }() + ret[i] = ec.marshalNTimelineItem2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐTimelineItem(ctx, sel, v[i]) } if isLen1 { - f(idx1) + f(i) } else { - go f(idx1) + go f(i) } } wg.Wait() - return arr1 + return ret } -// nolint: vetshadow -func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "__Type", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.InputFields(), nil - }) - if resTmp == nil { +func (ec *executionContext) marshalNTimelineItemConnection2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐTimelineItemConnection(ctx context.Context, sel ast.SelectionSet, v models.TimelineItemConnection) graphql.Marshaler { + return ec._TimelineItemConnection(ctx, sel, &v) +} + +func (ec *executionContext) marshalNTimelineItemConnection2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐTimelineItemConnection(ctx context.Context, sel ast.SelectionSet, v *models.TimelineItemConnection) graphql.Marshaler { + if v == nil { + if !ec.HasError(graphql.GetResolverContext(ctx)) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.([]introspection.InputValue) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec._TimelineItemConnection(ctx, sel, v) +} - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup +func (ec *executionContext) marshalNTimelineItemEdge2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐTimelineItemEdge(ctx context.Context, sel ast.SelectionSet, v models.TimelineItemEdge) graphql.Marshaler { + return ec._TimelineItemEdge(ctx, sel, &v) +} - isLen1 := len(res) == 1 +func (ec *executionContext) marshalNTimelineItemEdge2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐTimelineItemEdge(ctx context.Context, sel ast.SelectionSet, v []models.TimelineItemEdge) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 if !isLen1 { - wg.Add(len(res)) + wg.Add(len(v)) } - - for idx1 := range res { - idx1 := idx1 + for i := range v { + i := i rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + Index: &i, + Result: &v[i], } ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() if !isLen1 { defer wg.Done() } - arr1[idx1] = func() graphql.Marshaler { - - return ec.___InputValue(ctx, field.Selections, &res[idx1]) - }() + ret[i] = ec.marshalNTimelineItemEdge2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐTimelineItemEdge(ctx, sel, v[i]) } if isLen1 { - f(idx1) + f(i) } else { - go f(idx1) + go f(i) } } wg.Wait() - return arr1 + return ret } -// nolint: vetshadow -func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { - ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "__Type", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.OfType(), nil - }) - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*introspection.Type) - rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) - - if res == nil { - return graphql.Null - } - - return ec.___Type(ctx, field.Selections, res) +func (ec *executionContext) marshalN__Directive2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx context.Context, sel ast.SelectionSet, v introspection.Directive) graphql.Marshaler { + return ec.___Directive(ctx, sel, &v) } -func (ec *executionContext) _Authored(ctx context.Context, sel ast.SelectionSet, obj *models.Authored) graphql.Marshaler { - switch obj := (*obj).(type) { - case nil: - return graphql.Null - case bug.Comment: - return ec._Comment(ctx, sel, &obj) - case *bug.Comment: - return ec._Comment(ctx, sel, obj) - case *bug.CreateOperation: - return ec._CreateOperation(ctx, sel, obj) - case *bug.SetTitleOperation: - return ec._SetTitleOperation(ctx, sel, obj) - case *bug.AddCommentOperation: - return ec._AddCommentOperation(ctx, sel, obj) - case *bug.EditCommentOperation: - return ec._EditCommentOperation(ctx, sel, obj) - case *bug.SetStatusOperation: - return ec._SetStatusOperation(ctx, sel, obj) - case *bug.LabelChangeOperation: - return ec._LabelChangeOperation(ctx, sel, obj) - default: - panic(fmt.Errorf("unexpected type %T", obj)) +func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx context.Context, sel ast.SelectionSet, v []introspection.Directive) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) } -} + for i := range v { + i := i + rctx := &graphql.ResolverContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalN__Directive2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } -func (ec *executionContext) _Operation(ctx context.Context, sel ast.SelectionSet, obj *bug.Operation) graphql.Marshaler { - switch obj := (*obj).(type) { - case nil: - return graphql.Null - case *bug.CreateOperation: - return ec._CreateOperation(ctx, sel, obj) - case *bug.SetTitleOperation: - return ec._SetTitleOperation(ctx, sel, obj) - case *bug.AddCommentOperation: - return ec._AddCommentOperation(ctx, sel, obj) - case *bug.EditCommentOperation: - return ec._EditCommentOperation(ctx, sel, obj) - case *bug.SetStatusOperation: - return ec._SetStatusOperation(ctx, sel, obj) - case *bug.LabelChangeOperation: - return ec._LabelChangeOperation(ctx, sel, obj) - default: - panic(fmt.Errorf("unexpected type %T", obj)) } + wg.Wait() + return ret } -func (ec *executionContext) _TimelineItem(ctx context.Context, sel ast.SelectionSet, obj *bug.TimelineItem) graphql.Marshaler { - switch obj := (*obj).(type) { - case nil: - return graphql.Null - case *bug.CreateTimelineItem: - return ec._CreateTimelineItem(ctx, sel, obj) - case *bug.AddCommentTimelineItem: - return ec._AddCommentTimelineItem(ctx, sel, obj) - case bug.LabelChangeTimelineItem: - return ec._LabelChangeTimelineItem(ctx, sel, &obj) - case *bug.LabelChangeTimelineItem: - return ec._LabelChangeTimelineItem(ctx, sel, obj) - case bug.SetStatusTimelineItem: - return ec._SetStatusTimelineItem(ctx, sel, &obj) - case *bug.SetStatusTimelineItem: - return ec._SetStatusTimelineItem(ctx, sel, obj) - case bug.SetTitleTimelineItem: - return ec._SetTitleTimelineItem(ctx, sel, &obj) - case *bug.SetTitleTimelineItem: - return ec._SetTitleTimelineItem(ctx, sel, obj) - default: - panic(fmt.Errorf("unexpected type %T", obj)) - } +func (ec *executionContext) unmarshalN__DirectiveLocation2string(ctx context.Context, v interface{}) (string, error) { + return graphql.UnmarshalString(v) } -func (ec *executionContext) FieldMiddleware(ctx context.Context, obj interface{}, next graphql.Resolver) (ret interface{}) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() - res, err := ec.ResolverMiddleware(ctx, next) - if err != nil { - ec.Error(ctx, err) - return nil - } - return res +func (ec *executionContext) marshalN__DirectiveLocation2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { + return graphql.MarshalString(v) } -func (ec *executionContext) introspectSchema() (*introspection.Schema, error) { - if ec.DisableIntrospection { - return nil, errors.New("introspection disabled") +func (ec *executionContext) unmarshalN__DirectiveLocation2ᚕstring(ctx context.Context, v interface{}) ([]string, error) { + var vSlice []interface{} + if v != nil { + if tmp1, ok := v.([]interface{}); ok { + vSlice = tmp1 + } else { + vSlice = []interface{}{v} + } } - return introspection.WrapSchema(parsedSchema), nil -} - -func (ec *executionContext) introspectType(name string) (*introspection.Type, error) { - if ec.DisableIntrospection { - return nil, errors.New("introspection disabled") + var err error + res := make([]string, len(vSlice)) + for i := range vSlice { + res[i], err = ec.unmarshalN__DirectiveLocation2string(ctx, vSlice[i]) + if err != nil { + return nil, err + } } - return introspection.WrapTypeFromDef(parsedSchema, parsedSchema.Types[name]), nil + return res, nil } -var parsedSchema = gqlparser.MustLoadSchema( - &ast.Source{Name: "schema/bug.graphql", Input: `"""Represents a comment on a bug.""" -type Comment implements Authored { - """The author of this comment.""" - author: Identity! - - """The message of this comment.""" - message: String! +func (ec *executionContext) marshalN__DirectiveLocation2ᚕstring(ctx context.Context, sel ast.SelectionSet, v []string) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + rctx := &graphql.ResolverContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalN__DirectiveLocation2string(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } - """All media's hash referenced in this comment""" - files: [Hash!]! + } + wg.Wait() + return ret } -type CommentConnection { - edges: [CommentEdge!]! - nodes: [Comment!]! - pageInfo: PageInfo! - totalCount: Int! +func (ec *executionContext) marshalN__EnumValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx context.Context, sel ast.SelectionSet, v introspection.EnumValue) graphql.Marshaler { + return ec.___EnumValue(ctx, sel, &v) } -type CommentEdge { - cursor: String! - node: Comment! +func (ec *executionContext) marshalN__Field2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx context.Context, sel ast.SelectionSet, v introspection.Field) graphql.Marshaler { + return ec.___Field(ctx, sel, &v) } -enum Status { - OPEN - CLOSED +func (ec *executionContext) marshalN__InputValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx context.Context, sel ast.SelectionSet, v introspection.InputValue) graphql.Marshaler { + return ec.___InputValue(ctx, sel, &v) } -type Bug { - """The identifier for this bug""" - id: String! - """The human version (truncated) identifier for this bug""" - humanId: String! - status: Status! - title: String! - labels: [Label!]! - author: Identity! - createdAt: Time! - lastEdit: Time! - - """The actors of the bug. Actors are Identity that have interacted with the bug.""" - actors( - """Returns the elements in the list that come after the specified cursor.""" - after: String - """Returns the elements in the list that come before the specified cursor.""" - before: String - """Returns the first _n_ elements from the list.""" - first: Int - """Returns the last _n_ elements from the list.""" - last: Int - ): IdentityConnection! +func (ec *executionContext) marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx context.Context, sel ast.SelectionSet, v []introspection.InputValue) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + rctx := &graphql.ResolverContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalN__InputValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } - """The participants of the bug. Participants are Identity that have created or - added a comment on the bug.""" - participants( - """Returns the elements in the list that come after the specified cursor.""" - after: String - """Returns the elements in the list that come before the specified cursor.""" - before: String - """Returns the first _n_ elements from the list.""" - first: Int - """Returns the last _n_ elements from the list.""" - last: Int - ): IdentityConnection! + } + wg.Wait() + return ret +} - comments( - """Returns the elements in the list that come after the specified cursor.""" - after: String - """Returns the elements in the list that come before the specified cursor.""" - before: String - """Returns the first _n_ elements from the list.""" - first: Int - """Returns the last _n_ elements from the list.""" - last: Int - ): CommentConnection! +func (ec *executionContext) marshalN__Type2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v introspection.Type) graphql.Marshaler { + return ec.___Type(ctx, sel, &v) +} - timeline( - """Returns the elements in the list that come after the specified cursor.""" - after: String - """Returns the elements in the list that come before the specified cursor.""" - before: String - """Returns the first _n_ elements from the list.""" - first: Int - """Returns the last _n_ elements from the list.""" - last: Int - ): TimelineItemConnection! +func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v []introspection.Type) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + rctx := &graphql.ResolverContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalN__Type2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } - operations( - """Returns the elements in the list that come after the specified cursor.""" - after: String - """Returns the elements in the list that come before the specified cursor.""" - before: String - """Returns the first _n_ elements from the list.""" - first: Int - """Returns the last _n_ elements from the list.""" - last: Int - ): OperationConnection! + } + wg.Wait() + return ret } -"""The connection type for Bug.""" -type BugConnection { - """A list of edges.""" - edges: [BugEdge!]! - nodes: [Bug!]! - """Information to aid in pagination.""" - pageInfo: PageInfo! - """Identifies the total count of items in the connection.""" - totalCount: Int! +func (ec *executionContext) marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v *introspection.Type) graphql.Marshaler { + if v == nil { + if !ec.HasError(graphql.GetResolverContext(ctx)) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + return ec.___Type(ctx, sel, v) } -"""An edge in a connection.""" -type BugEdge { - """A cursor for use in pagination.""" - cursor: String! - """The item at the end of the edge.""" - node: Bug! +func (ec *executionContext) unmarshalN__TypeKind2string(ctx context.Context, v interface{}) (string, error) { + return graphql.UnmarshalString(v) } -`}, - &ast.Source{Name: "schema/identity.graphql", Input: `"""Represents an identity""" -type Identity { - """The identifier for this identity""" - id: String! - """The human version (truncated) identifier for this identity""" - humanId: String! - """The name of the person, if known.""" - name: String - """The email of the person, if known.""" - email: String - """The login of the person, if known.""" - login: String - """A string containing the either the name of the person, its login or both""" - displayName: String! - """An url to an avatar""" - avatarUrl: String - """isProtected is true if the chain of git commits started to be signed. - If that's the case, only signed commit with a valid key for this identity can be added.""" - isProtected: Boolean! +func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { + return graphql.MarshalString(v) } -type IdentityConnection { - edges: [IdentityEdge!]! - nodes: [Identity!]! - pageInfo: PageInfo! - totalCount: Int! +func (ec *executionContext) unmarshalOBoolean2bool(ctx context.Context, v interface{}) (bool, error) { + return graphql.UnmarshalBoolean(v) } -type IdentityEdge { - cursor: String! - node: Identity! -}`}, - &ast.Source{Name: "schema/operations.graphql", Input: `"""An operation applied to a bug.""" -interface Operation { - """The hash of the operation""" - hash: Hash! - """The operations author.""" - author: Identity! - """The datetime when this operation was issued.""" - date: Time! +func (ec *executionContext) marshalOBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { + return graphql.MarshalBoolean(v) } -# Connection - -"""The connection type for an Operation""" -type OperationConnection { - edges: [OperationEdge!]! - nodes: [Operation!]! - pageInfo: PageInfo! - totalCount: Int! +func (ec *executionContext) unmarshalOBoolean2ᚖbool(ctx context.Context, v interface{}) (*bool, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalOBoolean2bool(ctx, v) + return &res, err } -"""Represent an Operation""" -type OperationEdge { - cursor: String! - node: Operation! +func (ec *executionContext) marshalOBoolean2ᚖbool(ctx context.Context, sel ast.SelectionSet, v *bool) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec.marshalOBoolean2bool(ctx, sel, *v) } -# Operations - -type CreateOperation implements Operation & Authored { - """The hash of the operation""" - hash: Hash! - """The author of this object.""" - author: Identity! - """The datetime when this operation was issued.""" - date: Time! - - title: String! - message: String! - files: [Hash!]! +func (ec *executionContext) marshalOBug2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐSnapshot(ctx context.Context, sel ast.SelectionSet, v bug.Snapshot) graphql.Marshaler { + return ec._Bug(ctx, sel, &v) } -type SetTitleOperation implements Operation & Authored { - """The hash of the operation""" - hash: Hash! - """The author of this object.""" - author: Identity! - """The datetime when this operation was issued.""" - date: Time! - - title: String! - was: String! +func (ec *executionContext) marshalOBug2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐSnapshot(ctx context.Context, sel ast.SelectionSet, v *bug.Snapshot) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._Bug(ctx, sel, v) } -type AddCommentOperation implements Operation & Authored { - """The hash of the operation""" - hash: Hash! - """The author of this object.""" - author: Identity! - """The datetime when this operation was issued.""" - date: Time! - - message: String! - files: [Hash!]! +func (ec *executionContext) unmarshalOHash2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋutilᚋgitᚐHash(ctx context.Context, v interface{}) ([]git.Hash, error) { + var vSlice []interface{} + if v != nil { + if tmp1, ok := v.([]interface{}); ok { + vSlice = tmp1 + } else { + vSlice = []interface{}{v} + } + } + var err error + res := make([]git.Hash, len(vSlice)) + for i := range vSlice { + res[i], err = ec.unmarshalNHash2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋutilᚋgitᚐHash(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil } -type EditCommentOperation implements Operation & Authored { - """The hash of the operation""" - hash: Hash! - """The author of this object.""" - author: Identity! - """The datetime when this operation was issued.""" - date: Time! +func (ec *executionContext) marshalOHash2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋutilᚋgitᚐHash(ctx context.Context, sel ast.SelectionSet, v []git.Hash) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + for i := range v { + ret[i] = ec.marshalNHash2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋutilᚋgitᚐHash(ctx, sel, v[i]) + } - target: Hash! - message: String! - files: [Hash!]! + return ret +} + +func (ec *executionContext) marshalOIdentity2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋidentityᚐInterface(ctx context.Context, sel ast.SelectionSet, v identity.Interface) graphql.Marshaler { + return ec._Identity(ctx, sel, &v) } -type SetStatusOperation implements Operation & Authored { - """The hash of the operation""" - hash: Hash! - """The author of this object.""" - author: Identity! - """The datetime when this operation was issued.""" - date: Time! +func (ec *executionContext) unmarshalOInt2int(ctx context.Context, v interface{}) (int, error) { + return graphql.UnmarshalInt(v) +} - status: Status! +func (ec *executionContext) marshalOInt2int(ctx context.Context, sel ast.SelectionSet, v int) graphql.Marshaler { + return graphql.MarshalInt(v) } -type LabelChangeOperation implements Operation & Authored { - """The hash of the operation""" - hash: Hash! - """The author of this object.""" - author: Identity! - """The datetime when this operation was issued.""" - date: Time! +func (ec *executionContext) unmarshalOInt2ᚖint(ctx context.Context, v interface{}) (*int, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalOInt2int(ctx, v) + return &res, err +} - added: [Label!]! - removed: [Label!]! +func (ec *executionContext) marshalOInt2ᚖint(ctx context.Context, sel ast.SelectionSet, v *int) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec.marshalOInt2int(ctx, sel, *v) } -`}, - &ast.Source{Name: "schema/repository.graphql", Input: ` -type Repository { - """All the bugs""" - allBugs( - """Returns the elements in the list that come after the specified cursor.""" - after: String - """Returns the elements in the list that come before the specified cursor.""" - before: String - """Returns the first _n_ elements from the list.""" - first: Int - """Returns the last _n_ elements from the list.""" - last: Int - """A query to select and order bugs""" - query: String - ): BugConnection! - bug(prefix: String!): Bug +func (ec *executionContext) marshalORepository2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐRepository(ctx context.Context, sel ast.SelectionSet, v models.Repository) graphql.Marshaler { + return ec._Repository(ctx, sel, &v) +} - """All the identities""" - allIdentities( - """Returns the elements in the list that come after the specified cursor.""" - after: String - """Returns the elements in the list that come before the specified cursor.""" - before: String - """Returns the first _n_ elements from the list.""" - first: Int - """Returns the last _n_ elements from the list.""" - last: Int - ): IdentityConnection! +func (ec *executionContext) marshalORepository2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐRepository(ctx context.Context, sel ast.SelectionSet, v *models.Repository) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._Repository(ctx, sel, v) +} - identity(prefix: String!):Identity +func (ec *executionContext) unmarshalOString2string(ctx context.Context, v interface{}) (string, error) { + return graphql.UnmarshalString(v) +} - """The identity created or selected by the user as its own""" - userIdentity:Identity -}`}, - &ast.Source{Name: "schema/root.graphql", Input: `type Query { - defaultRepository: Repository - repository(id: String!): Repository +func (ec *executionContext) marshalOString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { + return graphql.MarshalString(v) } -type Mutation { - newBug(repoRef: String, title: String!, message: String!, files: [Hash!]): Bug! +func (ec *executionContext) unmarshalOString2ᚕstring(ctx context.Context, v interface{}) ([]string, error) { + var vSlice []interface{} + if v != nil { + if tmp1, ok := v.([]interface{}); ok { + vSlice = tmp1 + } else { + vSlice = []interface{}{v} + } + } + var err error + res := make([]string, len(vSlice)) + for i := range vSlice { + res[i], err = ec.unmarshalNString2string(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} - addComment(repoRef: String, prefix: String!, message: String!, files: [Hash!]): Bug! - changeLabels(repoRef: String, prefix: String!, added: [String!], removed: [String!]): Bug! - open(repoRef: String, prefix: String!): Bug! - close(repoRef: String, prefix: String!): Bug! - setTitle(repoRef: String, prefix: String!, title: String!): Bug! +func (ec *executionContext) marshalOString2ᚕstring(ctx context.Context, sel ast.SelectionSet, v []string) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + for i := range v { + ret[i] = ec.marshalNString2string(ctx, sel, v[i]) + } - commit(repoRef: String, prefix: String!): Bug! + return ret } -`}, - &ast.Source{Name: "schema/timeline.graphql", Input: `"""An item in the timeline of events""" -interface TimelineItem { - """The hash of the source operation""" - hash: Hash! + +func (ec *executionContext) unmarshalOString2ᚖstring(ctx context.Context, v interface{}) (*string, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalOString2string(ctx, v) + return &res, err } -"""CommentHistoryStep hold one version of a message in the history""" -type CommentHistoryStep { - message: String! - date: Time! +func (ec *executionContext) marshalOString2ᚖstring(ctx context.Context, sel ast.SelectionSet, v *string) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec.marshalOString2string(ctx, sel, *v) } -# Connection +func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx context.Context, sel ast.SelectionSet, v []introspection.EnumValue) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + rctx := &graphql.ResolverContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalN__EnumValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } -"""The connection type for TimelineItem""" -type TimelineItemConnection { - edges: [TimelineItemEdge!]! - nodes: [TimelineItem!]! - pageInfo: PageInfo! - totalCount: Int! + } + wg.Wait() + return ret } -"""Represent a TimelineItem""" -type TimelineItemEdge { - cursor: String! - node: TimelineItem! +func (ec *executionContext) marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx context.Context, sel ast.SelectionSet, v []introspection.Field) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + rctx := &graphql.ResolverContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalN__Field2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + return ret } -# Items +func (ec *executionContext) marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx context.Context, sel ast.SelectionSet, v []introspection.InputValue) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + rctx := &graphql.ResolverContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalN__InputValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } -"""CreateTimelineItem is a TimelineItem that represent the creation of a bug and its message edition history""" -type CreateTimelineItem implements TimelineItem { - """The hash of the source operation""" - hash: Hash! - author: Identity! - message: String! - messageIsEmpty: Boolean! - files: [Hash!]! - createdAt: Time! - lastEdit: Time! - edited: Boolean! - history: [CommentHistoryStep!]! + } + wg.Wait() + return ret } -"""AddCommentTimelineItem is a TimelineItem that represent a Comment and its edition history""" -type AddCommentTimelineItem implements TimelineItem { - """The hash of the source operation""" - hash: Hash! - author: Identity! - message: String! - messageIsEmpty: Boolean! - files: [Hash!]! - createdAt: Time! - lastEdit: Time! - edited: Boolean! - history: [CommentHistoryStep!]! +func (ec *executionContext) marshalO__Schema2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx context.Context, sel ast.SelectionSet, v introspection.Schema) graphql.Marshaler { + return ec.___Schema(ctx, sel, &v) } -"""LabelChangeTimelineItem is a TimelineItem that represent a change in the labels of a bug""" -type LabelChangeTimelineItem implements TimelineItem { - """The hash of the source operation""" - hash: Hash! - author: Identity! - date: Time! - added: [Label!]! - removed: [Label!]! +func (ec *executionContext) marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx context.Context, sel ast.SelectionSet, v *introspection.Schema) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec.___Schema(ctx, sel, v) } -"""SetStatusTimelineItem is a TimelineItem that represent a change in the status of a bug""" -type SetStatusTimelineItem implements TimelineItem { - """The hash of the source operation""" - hash: Hash! - author: Identity! - date: Time! - status: Status! +func (ec *executionContext) marshalO__Type2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v introspection.Type) graphql.Marshaler { + return ec.___Type(ctx, sel, &v) } -"""LabelChangeTimelineItem is a TimelineItem that represent a change in the title of a bug""" -type SetTitleTimelineItem implements TimelineItem { - """The hash of the source operation""" - hash: Hash! - author: Identity! - date: Time! - title: String! - was: String! +func (ec *executionContext) marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v []introspection.Type) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + rctx := &graphql.ResolverContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalN__Type2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + return ret } -`}, - &ast.Source{Name: "schema/types.graphql", Input: `scalar Time -scalar Label -scalar Hash -"""Information about pagination in a connection.""" -type PageInfo { - """When paginating forwards, are there more items?""" - hasNextPage: Boolean! - """When paginating backwards, are there more items?""" - hasPreviousPage: Boolean! - """When paginating backwards, the cursor to continue.""" - startCursor: String! - """When paginating forwards, the cursor to continue.""" - endCursor: String! +func (ec *executionContext) marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v *introspection.Type) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec.___Type(ctx, sel, v) } -"""An object that has an author.""" -interface Authored { - """The author of this object.""" - author: Identity! -}`}, -) +// endregion ***************************** type.gotpl ***************************** diff --git a/graphql/models/gen_models.go b/graphql/models/gen_models.go index 172fe033407a8eaa03b4bcf51f5ebd0071040cce..64997104ac397b2fdd5bd202c81443a203e7674c 100644 --- a/graphql/models/gen_models.go +++ b/graphql/models/gen_models.go @@ -18,16 +18,21 @@ type Authored interface { // The connection type for Bug. type BugConnection struct { - Edges []BugEdge `json:"edges"` - Nodes []bug.Snapshot `json:"nodes"` - PageInfo PageInfo `json:"pageInfo"` - TotalCount int `json:"totalCount"` + // A list of edges. + Edges []BugEdge `json:"edges"` + Nodes []bug.Snapshot `json:"nodes"` + // Information to aid in pagination. + PageInfo PageInfo `json:"pageInfo"` + // Identifies the total count of items in the connection. + TotalCount int `json:"totalCount"` } // An edge in a connection. type BugEdge struct { - Cursor string `json:"cursor"` - Node bug.Snapshot `json:"node"` + // A cursor for use in pagination. + Cursor string `json:"cursor"` + // The item at the end of the edge. + Node bug.Snapshot `json:"node"` } type CommentConnection struct { @@ -70,10 +75,14 @@ type OperationEdge struct { // Information about pagination in a connection. type PageInfo struct { - HasNextPage bool `json:"hasNextPage"` - HasPreviousPage bool `json:"hasPreviousPage"` - StartCursor string `json:"startCursor"` - EndCursor string `json:"endCursor"` + // When paginating forwards, are there more items? + HasNextPage bool `json:"hasNextPage"` + // When paginating backwards, are there more items? + HasPreviousPage bool `json:"hasPreviousPage"` + // When paginating backwards, the cursor to continue. + StartCursor string `json:"startCursor"` + // When paginating forwards, the cursor to continue. + EndCursor string `json:"endCursor"` } // The connection type for TimelineItem @@ -97,6 +106,11 @@ const ( StatusClosed Status = "CLOSED" ) +var AllStatus = []Status{ + StatusOpen, + StatusClosed, +} + func (e Status) IsValid() bool { switch e { case StatusOpen, StatusClosed: diff --git a/graphql/resolvers/bug.go b/graphql/resolvers/bug.go index ef35853c332c59b7d12d9a9c4b3bc14630237327..2ad2310b117be0286b494645b9d2abe4e72b70c7 100644 --- a/graphql/resolvers/bug.go +++ b/graphql/resolvers/bug.go @@ -19,7 +19,7 @@ func (bugResolver) Status(ctx context.Context, obj *bug.Snapshot) (models.Status return convertStatus(obj.Status) } -func (bugResolver) Comments(ctx context.Context, obj *bug.Snapshot, after *string, before *string, first *int, last *int) (models.CommentConnection, error) { +func (bugResolver) Comments(ctx context.Context, obj *bug.Snapshot, after *string, before *string, first *int, last *int) (*models.CommentConnection, error) { input := models.ConnectionInput{ Before: before, After: after, @@ -34,8 +34,8 @@ func (bugResolver) Comments(ctx context.Context, obj *bug.Snapshot, after *strin } } - conMaker := func(edges []models.CommentEdge, nodes []bug.Comment, info models.PageInfo, totalCount int) (models.CommentConnection, error) { - return models.CommentConnection{ + conMaker := func(edges []models.CommentEdge, nodes []bug.Comment, info models.PageInfo, totalCount int) (*models.CommentConnection, error) { + return &models.CommentConnection{ Edges: edges, Nodes: nodes, PageInfo: info, @@ -46,7 +46,7 @@ func (bugResolver) Comments(ctx context.Context, obj *bug.Snapshot, after *strin return connections.CommentCon(obj.Comments, edger, conMaker, input) } -func (bugResolver) Operations(ctx context.Context, obj *bug.Snapshot, after *string, before *string, first *int, last *int) (models.OperationConnection, error) { +func (bugResolver) Operations(ctx context.Context, obj *bug.Snapshot, after *string, before *string, first *int, last *int) (*models.OperationConnection, error) { input := models.ConnectionInput{ Before: before, After: after, @@ -61,8 +61,8 @@ func (bugResolver) Operations(ctx context.Context, obj *bug.Snapshot, after *str } } - conMaker := func(edges []models.OperationEdge, nodes []bug.Operation, info models.PageInfo, totalCount int) (models.OperationConnection, error) { - return models.OperationConnection{ + conMaker := func(edges []models.OperationEdge, nodes []bug.Operation, info models.PageInfo, totalCount int) (*models.OperationConnection, error) { + return &models.OperationConnection{ Edges: edges, Nodes: nodes, PageInfo: info, @@ -73,7 +73,7 @@ func (bugResolver) Operations(ctx context.Context, obj *bug.Snapshot, after *str return connections.OperationCon(obj.Operations, edger, conMaker, input) } -func (bugResolver) Timeline(ctx context.Context, obj *bug.Snapshot, after *string, before *string, first *int, last *int) (models.TimelineItemConnection, error) { +func (bugResolver) Timeline(ctx context.Context, obj *bug.Snapshot, after *string, before *string, first *int, last *int) (*models.TimelineItemConnection, error) { input := models.ConnectionInput{ Before: before, After: after, @@ -88,8 +88,8 @@ func (bugResolver) Timeline(ctx context.Context, obj *bug.Snapshot, after *strin } } - conMaker := func(edges []models.TimelineItemEdge, nodes []bug.TimelineItem, info models.PageInfo, totalCount int) (models.TimelineItemConnection, error) { - return models.TimelineItemConnection{ + conMaker := func(edges []models.TimelineItemEdge, nodes []bug.TimelineItem, info models.PageInfo, totalCount int) (*models.TimelineItemConnection, error) { + return &models.TimelineItemConnection{ Edges: edges, Nodes: nodes, PageInfo: info, @@ -100,11 +100,12 @@ func (bugResolver) Timeline(ctx context.Context, obj *bug.Snapshot, after *strin return connections.TimelineItemCon(obj.Timeline, edger, conMaker, input) } -func (bugResolver) LastEdit(ctx context.Context, obj *bug.Snapshot) (time.Time, error) { - return obj.LastEditTime(), nil +func (bugResolver) LastEdit(ctx context.Context, obj *bug.Snapshot) (*time.Time, error) { + t := obj.LastEditTime() + return &t, nil } -func (bugResolver) Actors(ctx context.Context, obj *bug.Snapshot, after *string, before *string, first *int, last *int) (models.IdentityConnection, error) { +func (bugResolver) Actors(ctx context.Context, obj *bug.Snapshot, after *string, before *string, first *int, last *int) (*models.IdentityConnection, error) { input := models.ConnectionInput{ Before: before, After: after, @@ -119,8 +120,8 @@ func (bugResolver) Actors(ctx context.Context, obj *bug.Snapshot, after *string, } } - conMaker := func(edges []models.IdentityEdge, nodes []identity.Interface, info models.PageInfo, totalCount int) (models.IdentityConnection, error) { - return models.IdentityConnection{ + conMaker := func(edges []models.IdentityEdge, nodes []identity.Interface, info models.PageInfo, totalCount int) (*models.IdentityConnection, error) { + return &models.IdentityConnection{ Edges: edges, Nodes: nodes, PageInfo: info, @@ -131,7 +132,7 @@ func (bugResolver) Actors(ctx context.Context, obj *bug.Snapshot, after *string, return connections.IdentityCon(obj.Actors, edger, conMaker, input) } -func (bugResolver) Participants(ctx context.Context, obj *bug.Snapshot, after *string, before *string, first *int, last *int) (models.IdentityConnection, error) { +func (bugResolver) Participants(ctx context.Context, obj *bug.Snapshot, after *string, before *string, first *int, last *int) (*models.IdentityConnection, error) { input := models.ConnectionInput{ Before: before, After: after, @@ -146,8 +147,8 @@ func (bugResolver) Participants(ctx context.Context, obj *bug.Snapshot, after *s } } - conMaker := func(edges []models.IdentityEdge, nodes []identity.Interface, info models.PageInfo, totalCount int) (models.IdentityConnection, error) { - return models.IdentityConnection{ + conMaker := func(edges []models.IdentityEdge, nodes []identity.Interface, info models.PageInfo, totalCount int) (*models.IdentityConnection, error) { + return &models.IdentityConnection{ Edges: edges, Nodes: nodes, PageInfo: info, diff --git a/graphql/resolvers/mutation.go b/graphql/resolvers/mutation.go index 73d39da87c16b5adfd161d19be89403c86e3910b..d10d2ea3aa567107174a65854de461966d8c08c3 100644 --- a/graphql/resolvers/mutation.go +++ b/graphql/resolvers/mutation.go @@ -23,144 +23,130 @@ func (r mutationResolver) getRepo(repoRef *string) (*cache.RepoCache, error) { return r.cache.DefaultRepo() } -func (r mutationResolver) NewBug(ctx context.Context, repoRef *string, title string, message string, files []git.Hash) (bug.Snapshot, error) { +func (r mutationResolver) NewBug(ctx context.Context, repoRef *string, title string, message string, files []git.Hash) (*bug.Snapshot, error) { repo, err := r.getRepo(repoRef) if err != nil { - return bug.Snapshot{}, err + return nil, err } b, err := repo.NewBugWithFiles(title, message, files) if err != nil { - return bug.Snapshot{}, err + return nil, err } - snap := b.Snapshot() - - return *snap, nil + return b.Snapshot(), nil } -func (r mutationResolver) Commit(ctx context.Context, repoRef *string, prefix string) (bug.Snapshot, error) { +func (r mutationResolver) Commit(ctx context.Context, repoRef *string, prefix string) (*bug.Snapshot, error) { repo, err := r.getRepo(repoRef) if err != nil { - return bug.Snapshot{}, err + return nil, err } b, err := repo.ResolveBugPrefix(prefix) if err != nil { - return bug.Snapshot{}, err + return nil, err } err = b.Commit() if err != nil { - return bug.Snapshot{}, err + return nil, err } - snap := b.Snapshot() - - return *snap, nil + return b.Snapshot(), nil } -func (r mutationResolver) AddComment(ctx context.Context, repoRef *string, prefix string, message string, files []git.Hash) (bug.Snapshot, error) { +func (r mutationResolver) AddComment(ctx context.Context, repoRef *string, prefix string, message string, files []git.Hash) (*bug.Snapshot, error) { repo, err := r.getRepo(repoRef) if err != nil { - return bug.Snapshot{}, err + return nil, err } b, err := repo.ResolveBugPrefix(prefix) if err != nil { - return bug.Snapshot{}, err + return nil, err } _, err = b.AddCommentWithFiles(message, files) if err != nil { - return bug.Snapshot{}, err + return nil, err } - snap := b.Snapshot() - - return *snap, nil + return b.Snapshot(), nil } -func (r mutationResolver) ChangeLabels(ctx context.Context, repoRef *string, prefix string, added []string, removed []string) (bug.Snapshot, error) { +func (r mutationResolver) ChangeLabels(ctx context.Context, repoRef *string, prefix string, added []string, removed []string) (*bug.Snapshot, error) { repo, err := r.getRepo(repoRef) if err != nil { - return bug.Snapshot{}, err + return nil, err } b, err := repo.ResolveBugPrefix(prefix) if err != nil { - return bug.Snapshot{}, err + return nil, err } _, _, err = b.ChangeLabels(added, removed) if err != nil { - return bug.Snapshot{}, err + return nil, err } - snap := b.Snapshot() - - return *snap, nil + return b.Snapshot(), nil } -func (r mutationResolver) Open(ctx context.Context, repoRef *string, prefix string) (bug.Snapshot, error) { +func (r mutationResolver) Open(ctx context.Context, repoRef *string, prefix string) (*bug.Snapshot, error) { repo, err := r.getRepo(repoRef) if err != nil { - return bug.Snapshot{}, err + return nil, err } b, err := repo.ResolveBugPrefix(prefix) if err != nil { - return bug.Snapshot{}, err + return nil, err } _, err = b.Open() if err != nil { - return bug.Snapshot{}, err + return nil, err } - snap := b.Snapshot() - - return *snap, nil + return b.Snapshot(), nil } -func (r mutationResolver) Close(ctx context.Context, repoRef *string, prefix string) (bug.Snapshot, error) { +func (r mutationResolver) Close(ctx context.Context, repoRef *string, prefix string) (*bug.Snapshot, error) { repo, err := r.getRepo(repoRef) if err != nil { - return bug.Snapshot{}, err + return nil, err } b, err := repo.ResolveBugPrefix(prefix) if err != nil { - return bug.Snapshot{}, err + return nil, err } _, err = b.Close() if err != nil { - return bug.Snapshot{}, err + return nil, err } - snap := b.Snapshot() - - return *snap, nil + return b.Snapshot(), nil } -func (r mutationResolver) SetTitle(ctx context.Context, repoRef *string, prefix string, title string) (bug.Snapshot, error) { +func (r mutationResolver) SetTitle(ctx context.Context, repoRef *string, prefix string, title string) (*bug.Snapshot, error) { repo, err := r.getRepo(repoRef) if err != nil { - return bug.Snapshot{}, err + return nil, err } b, err := repo.ResolveBugPrefix(prefix) if err != nil { - return bug.Snapshot{}, err + return nil, err } _, err = b.SetTitle(title) if err != nil { - return bug.Snapshot{}, err + return nil, err } - snap := b.Snapshot() - - return *snap, nil + return b.Snapshot(), nil } diff --git a/graphql/resolvers/operations.go b/graphql/resolvers/operations.go index c8089ac18bbaf354af81783f602e3fd9235d27d6..90817567d63115250e92cffb8fd823885a5cde60 100644 --- a/graphql/resolvers/operations.go +++ b/graphql/resolvers/operations.go @@ -11,32 +11,37 @@ import ( type createOperationResolver struct{} -func (createOperationResolver) Date(ctx context.Context, obj *bug.CreateOperation) (time.Time, error) { - return obj.Time(), nil +func (createOperationResolver) Date(ctx context.Context, obj *bug.CreateOperation) (*time.Time, error) { + t := obj.Time() + return &t, nil } type addCommentOperationResolver struct{} -func (addCommentOperationResolver) Date(ctx context.Context, obj *bug.AddCommentOperation) (time.Time, error) { - return obj.Time(), nil +func (addCommentOperationResolver) Date(ctx context.Context, obj *bug.AddCommentOperation) (*time.Time, error) { + t := obj.Time() + return &t, nil } type editCommentOperationResolver struct{} -func (editCommentOperationResolver) Date(ctx context.Context, obj *bug.EditCommentOperation) (time.Time, error) { - return obj.Time(), nil +func (editCommentOperationResolver) Date(ctx context.Context, obj *bug.EditCommentOperation) (*time.Time, error) { + t := obj.Time() + return &t, nil } type labelChangeOperation struct{} -func (labelChangeOperation) Date(ctx context.Context, obj *bug.LabelChangeOperation) (time.Time, error) { - return obj.Time(), nil +func (labelChangeOperation) Date(ctx context.Context, obj *bug.LabelChangeOperation) (*time.Time, error) { + t := obj.Time() + return &t, nil } type setStatusOperationResolver struct{} -func (setStatusOperationResolver) Date(ctx context.Context, obj *bug.SetStatusOperation) (time.Time, error) { - return obj.Time(), nil +func (setStatusOperationResolver) Date(ctx context.Context, obj *bug.SetStatusOperation) (*time.Time, error) { + t := obj.Time() + return &t, nil } func (setStatusOperationResolver) Status(ctx context.Context, obj *bug.SetStatusOperation) (models.Status, error) { @@ -45,8 +50,9 @@ func (setStatusOperationResolver) Status(ctx context.Context, obj *bug.SetStatus type setTitleOperationResolver struct{} -func (setTitleOperationResolver) Date(ctx context.Context, obj *bug.SetTitleOperation) (time.Time, error) { - return obj.Time(), nil +func (setTitleOperationResolver) Date(ctx context.Context, obj *bug.SetTitleOperation) (*time.Time, error) { + t := obj.Time() + return &t, nil } func convertStatus(status bug.Status) (models.Status, error) { diff --git a/graphql/resolvers/repo.go b/graphql/resolvers/repo.go index 9003fbf956fab684ee01721f440330e87f48812a..cf10e4aeb690c52758c3ed7948bd44c8c2a623e7 100644 --- a/graphql/resolvers/repo.go +++ b/graphql/resolvers/repo.go @@ -15,7 +15,7 @@ var _ graph.RepositoryResolver = &repoResolver{} type repoResolver struct{} -func (repoResolver) AllBugs(ctx context.Context, obj *models.Repository, after *string, before *string, first *int, last *int, queryStr *string) (models.BugConnection, error) { +func (repoResolver) AllBugs(ctx context.Context, obj *models.Repository, after *string, before *string, first *int, last *int, queryStr *string) (*models.BugConnection, error) { input := models.ConnectionInput{ Before: before, After: after, @@ -27,7 +27,7 @@ func (repoResolver) AllBugs(ctx context.Context, obj *models.Repository, after * if queryStr != nil { query2, err := cache.ParseQuery(*queryStr) if err != nil { - return models.BugConnection{}, err + return nil, err } query = query2 } else { @@ -46,7 +46,7 @@ func (repoResolver) AllBugs(ctx context.Context, obj *models.Repository, after * } // The conMaker will finally load and compile bugs from git to replace the selected edges - conMaker := func(lazyBugEdges []connections.LazyBugEdge, lazyNode []string, info models.PageInfo, totalCount int) (models.BugConnection, error) { + conMaker := func(lazyBugEdges []connections.LazyBugEdge, lazyNode []string, info models.PageInfo, totalCount int) (*models.BugConnection, error) { edges := make([]models.BugEdge, len(lazyBugEdges)) nodes := make([]bug.Snapshot, len(lazyBugEdges)) @@ -54,7 +54,7 @@ func (repoResolver) AllBugs(ctx context.Context, obj *models.Repository, after * b, err := obj.Repo.ResolveBug(lazyBugEdge.Id) if err != nil { - return models.BugConnection{}, err + return nil, err } snap := b.Snapshot() @@ -66,7 +66,7 @@ func (repoResolver) AllBugs(ctx context.Context, obj *models.Repository, after * nodes[i] = *snap } - return models.BugConnection{ + return &models.BugConnection{ Edges: edges, Nodes: nodes, PageInfo: info, @@ -87,7 +87,7 @@ func (repoResolver) Bug(ctx context.Context, obj *models.Repository, prefix stri return b.Snapshot(), nil } -func (repoResolver) AllIdentities(ctx context.Context, obj *models.Repository, after *string, before *string, first *int, last *int) (models.IdentityConnection, error) { +func (repoResolver) AllIdentities(ctx context.Context, obj *models.Repository, after *string, before *string, first *int, last *int) (*models.IdentityConnection, error) { input := models.ConnectionInput{ Before: before, After: after, @@ -107,7 +107,7 @@ func (repoResolver) AllIdentities(ctx context.Context, obj *models.Repository, a } // The conMaker will finally load and compile identities from git to replace the selected edges - conMaker := func(lazyIdentityEdges []connections.LazyIdentityEdge, lazyNode []string, info models.PageInfo, totalCount int) (models.IdentityConnection, error) { + conMaker := func(lazyIdentityEdges []connections.LazyIdentityEdge, lazyNode []string, info models.PageInfo, totalCount int) (*models.IdentityConnection, error) { edges := make([]models.IdentityEdge, len(lazyIdentityEdges)) nodes := make([]identity.Interface, len(lazyIdentityEdges)) @@ -115,7 +115,7 @@ func (repoResolver) AllIdentities(ctx context.Context, obj *models.Repository, a i, err := obj.Repo.ResolveIdentity(lazyIdentityEdge.Id) if err != nil { - return models.IdentityConnection{}, err + return nil, err } ii := identity.Interface(i.Identity) @@ -127,7 +127,7 @@ func (repoResolver) AllIdentities(ctx context.Context, obj *models.Repository, a nodes[k] = ii } - return models.IdentityConnection{ + return &models.IdentityConnection{ Edges: edges, Nodes: nodes, PageInfo: info, @@ -138,26 +138,22 @@ func (repoResolver) AllIdentities(ctx context.Context, obj *models.Repository, a return connections.LazyIdentityCon(source, edger, conMaker, input) } -func (repoResolver) Identity(ctx context.Context, obj *models.Repository, prefix string) (*identity.Interface, error) { +func (repoResolver) Identity(ctx context.Context, obj *models.Repository, prefix string) (identity.Interface, error) { i, err := obj.Repo.ResolveIdentityPrefix(prefix) if err != nil { return nil, err } - ii := identity.Interface(i.Identity) - - return &ii, nil + return i.Identity, nil } -func (repoResolver) UserIdentity(ctx context.Context, obj *models.Repository) (*identity.Interface, error) { +func (repoResolver) UserIdentity(ctx context.Context, obj *models.Repository) (identity.Interface, error) { i, err := obj.Repo.GetUserIdentity() if err != nil { return nil, err } - ii := identity.Interface(i.Identity) - - return &ii, nil + return i.Identity, nil } diff --git a/graphql/resolvers/timeline.go b/graphql/resolvers/timeline.go index 42e0a6430ac8a2ea3868cc4fbbd6f0dc4431acf1..27f799ba2e707f6980b55630b42422c9b09d7d3e 100644 --- a/graphql/resolvers/timeline.go +++ b/graphql/resolvers/timeline.go @@ -10,40 +10,47 @@ import ( type commentHistoryStepResolver struct{} -func (commentHistoryStepResolver) Date(ctx context.Context, obj *bug.CommentHistoryStep) (time.Time, error) { - return obj.UnixTime.Time(), nil +func (commentHistoryStepResolver) Date(ctx context.Context, obj *bug.CommentHistoryStep) (*time.Time, error) { + t := obj.UnixTime.Time() + return &t, nil } type addCommentTimelineItemResolver struct{} -func (addCommentTimelineItemResolver) CreatedAt(ctx context.Context, obj *bug.AddCommentTimelineItem) (time.Time, error) { - return obj.CreatedAt.Time(), nil +func (addCommentTimelineItemResolver) CreatedAt(ctx context.Context, obj *bug.AddCommentTimelineItem) (*time.Time, error) { + t := obj.CreatedAt.Time() + return &t, nil } -func (addCommentTimelineItemResolver) LastEdit(ctx context.Context, obj *bug.AddCommentTimelineItem) (time.Time, error) { - return obj.LastEdit.Time(), nil +func (addCommentTimelineItemResolver) LastEdit(ctx context.Context, obj *bug.AddCommentTimelineItem) (*time.Time, error) { + t := obj.LastEdit.Time() + return &t, nil } type createTimelineItemResolver struct{} -func (createTimelineItemResolver) CreatedAt(ctx context.Context, obj *bug.CreateTimelineItem) (time.Time, error) { - return obj.CreatedAt.Time(), nil +func (createTimelineItemResolver) CreatedAt(ctx context.Context, obj *bug.CreateTimelineItem) (*time.Time, error) { + t := obj.CreatedAt.Time() + return &t, nil } -func (createTimelineItemResolver) LastEdit(ctx context.Context, obj *bug.CreateTimelineItem) (time.Time, error) { - return obj.LastEdit.Time(), nil +func (createTimelineItemResolver) LastEdit(ctx context.Context, obj *bug.CreateTimelineItem) (*time.Time, error) { + t := obj.LastEdit.Time() + return &t, nil } type labelChangeTimelineItem struct{} -func (labelChangeTimelineItem) Date(ctx context.Context, obj *bug.LabelChangeTimelineItem) (time.Time, error) { - return obj.UnixTime.Time(), nil +func (labelChangeTimelineItem) Date(ctx context.Context, obj *bug.LabelChangeTimelineItem) (*time.Time, error) { + t := obj.UnixTime.Time() + return &t, nil } type setStatusTimelineItem struct{} -func (setStatusTimelineItem) Date(ctx context.Context, obj *bug.SetStatusTimelineItem) (time.Time, error) { - return obj.UnixTime.Time(), nil +func (setStatusTimelineItem) Date(ctx context.Context, obj *bug.SetStatusTimelineItem) (*time.Time, error) { + t := obj.UnixTime.Time() + return &t, nil } func (setStatusTimelineItem) Status(ctx context.Context, obj *bug.SetStatusTimelineItem) (models.Status, error) { @@ -52,6 +59,7 @@ func (setStatusTimelineItem) Status(ctx context.Context, obj *bug.SetStatusTimel type setTitleTimelineItem struct{} -func (setTitleTimelineItem) Date(ctx context.Context, obj *bug.SetTitleTimelineItem) (time.Time, error) { - return obj.UnixTime.Time(), nil +func (setTitleTimelineItem) Date(ctx context.Context, obj *bug.SetTitleTimelineItem) (*time.Time, error) { + t := obj.UnixTime.Time() + return &t, nil } diff --git a/vendor/github.com/99designs/gqlgen/api/generate.go b/vendor/github.com/99designs/gqlgen/api/generate.go new file mode 100644 index 0000000000000000000000000000000000000000..3dd083f52f6dae792667b3831a3311d44425e63a --- /dev/null +++ b/vendor/github.com/99designs/gqlgen/api/generate.go @@ -0,0 +1,76 @@ +package api + +import ( + "syscall" + + "github.com/99designs/gqlgen/codegen" + "github.com/99designs/gqlgen/codegen/config" + "github.com/99designs/gqlgen/plugin" + "github.com/99designs/gqlgen/plugin/modelgen" + "github.com/99designs/gqlgen/plugin/resolvergen" + "github.com/pkg/errors" + "golang.org/x/tools/go/packages" +) + +func Generate(cfg *config.Config, option ...Option) error { + _ = syscall.Unlink(cfg.Exec.Filename) + _ = syscall.Unlink(cfg.Model.Filename) + + plugins := []plugin.Plugin{ + modelgen.New(), + resolvergen.New(), + } + + for _, o := range option { + o(cfg, &plugins) + } + + for _, p := range plugins { + if mut, ok := p.(plugin.ConfigMutator); ok { + err := mut.MutateConfig(cfg) + if err != nil { + return errors.Wrap(err, p.Name()) + } + } + } + // Merge again now that the generated models have been injected into the typemap + data, err := codegen.BuildData(cfg) + if err != nil { + return errors.Wrap(err, "merging failed") + } + + if err = codegen.GenerateCode(data); err != nil { + return errors.Wrap(err, "generating core failed") + } + + for _, p := range plugins { + if mut, ok := p.(plugin.CodeGenerator); ok { + err := mut.GenerateCode(data) + if err != nil { + return errors.Wrap(err, p.Name()) + } + } + } + + if err := validate(cfg); err != nil { + return errors.Wrap(err, "validation failed") + } + + return nil +} + +func validate(cfg *config.Config) error { + roots := []string{cfg.Exec.ImportPath()} + if cfg.Model.IsDefined() { + roots = append(roots, cfg.Model.ImportPath()) + } + + if cfg.Resolver.IsDefined() { + roots = append(roots, cfg.Resolver.ImportPath()) + } + _, err := packages.Load(&packages.Config{Mode: packages.LoadTypes | packages.LoadSyntax}, roots...) + if err != nil { + return errors.Wrap(err, "validation failed") + } + return nil +} diff --git a/vendor/github.com/99designs/gqlgen/api/option.go b/vendor/github.com/99designs/gqlgen/api/option.go new file mode 100644 index 0000000000000000000000000000000000000000..f7ba6774bd0c326106f25e43f05bcb11973d3287 --- /dev/null +++ b/vendor/github.com/99designs/gqlgen/api/option.go @@ -0,0 +1,20 @@ +package api + +import ( + "github.com/99designs/gqlgen/codegen/config" + "github.com/99designs/gqlgen/plugin" +) + +type Option func(cfg *config.Config, plugins *[]plugin.Plugin) + +func NoPlugins() Option { + return func(cfg *config.Config, plugins *[]plugin.Plugin) { + *plugins = nil + } +} + +func AddPlugin(p plugin.Plugin) Option { + return func(cfg *config.Config, plugins *[]plugin.Plugin) { + *plugins = append(*plugins, p) + } +} diff --git a/vendor/github.com/99designs/gqlgen/codegen/ambient.go b/vendor/github.com/99designs/gqlgen/cmd/ambient.go similarity index 95% rename from vendor/github.com/99designs/gqlgen/codegen/ambient.go rename to vendor/github.com/99designs/gqlgen/cmd/ambient.go index c9909fcc78db2f18caa9951ec3948fd2d55091b6..7838fdf16d5b44c7012180fdf4a5aea91be28822 100644 --- a/vendor/github.com/99designs/gqlgen/codegen/ambient.go +++ b/vendor/github.com/99designs/gqlgen/cmd/ambient.go @@ -1,4 +1,4 @@ -package codegen +package cmd import ( // Import and ignore the ambient imports listed below so dependency managers diff --git a/vendor/github.com/99designs/gqlgen/cmd/gen.go b/vendor/github.com/99designs/gqlgen/cmd/gen.go index 3842f02b37da3a7d7a7280159d42a1c5bc78ddeb..c69858b44b0b9e2ca8368ebf2a552edf71a70e59 100644 --- a/vendor/github.com/99designs/gqlgen/cmd/gen.go +++ b/vendor/github.com/99designs/gqlgen/cmd/gen.go @@ -2,10 +2,10 @@ package cmd import ( "fmt" - "io/ioutil" "os" - "github.com/99designs/gqlgen/codegen" + "github.com/99designs/gqlgen/api" + "github.com/99designs/gqlgen/codegen/config" "github.com/pkg/errors" "github.com/urfave/cli" ) @@ -18,43 +18,27 @@ var genCmd = cli.Command{ cli.StringFlag{Name: "config, c", Usage: "the config filename"}, }, Action: func(ctx *cli.Context) { - var config *codegen.Config + var cfg *config.Config var err error if configFilename := ctx.String("config"); configFilename != "" { - config, err = codegen.LoadConfig(configFilename) + cfg, err = config.LoadConfig(configFilename) if err != nil { fmt.Fprintln(os.Stderr, err.Error()) os.Exit(1) } } else { - config, err = codegen.LoadConfigFromDefaultLocations() + cfg, err = config.LoadConfigFromDefaultLocations() if os.IsNotExist(errors.Cause(err)) { - config = codegen.DefaultConfig() + cfg = config.DefaultConfig() } else if err != nil { fmt.Fprintln(os.Stderr, err.Error()) - os.Exit(1) - } - } - - for _, filename := range config.SchemaFilename { - var schemaRaw []byte - schemaRaw, err = ioutil.ReadFile(filename) - if err != nil { - fmt.Fprintln(os.Stderr, "unable to open schema: "+err.Error()) - os.Exit(1) + os.Exit(2) } - config.SchemaStr[filename] = string(schemaRaw) - } - - if err = config.Check(); err != nil { - fmt.Fprintln(os.Stderr, "invalid config format: "+err.Error()) - os.Exit(1) } - err = codegen.Generate(*config) - if err != nil { + if err = api.Generate(cfg); err != nil { fmt.Fprintln(os.Stderr, err.Error()) - os.Exit(2) + os.Exit(3) } }, } diff --git a/vendor/github.com/99designs/gqlgen/cmd/init.go b/vendor/github.com/99designs/gqlgen/cmd/init.go index 1e7c18b932787bf1e785af55d64fd7de6cbdf76e..e07bed97086ce5a190fc31c4d238589617698c75 100644 --- a/vendor/github.com/99designs/gqlgen/cmd/init.go +++ b/vendor/github.com/99designs/gqlgen/cmd/init.go @@ -7,10 +7,13 @@ import ( "os" "strings" - "github.com/99designs/gqlgen/codegen" + "github.com/99designs/gqlgen/api" + "github.com/99designs/gqlgen/plugin/servergen" + + "github.com/99designs/gqlgen/codegen/config" "github.com/pkg/errors" "github.com/urfave/cli" - "gopkg.in/yaml.v2" + yaml "gopkg.in/yaml.v2" ) var configComment = ` @@ -68,46 +71,27 @@ var initCmd = cli.Command{ }, } -func GenerateGraphServer(config *codegen.Config, serverFilename string) { - for _, filename := range config.SchemaFilename { - schemaRaw, err := ioutil.ReadFile(filename) - if err != nil { - fmt.Fprintln(os.Stderr, "unable to open schema: "+err.Error()) - os.Exit(1) - } - config.SchemaStr[filename] = string(schemaRaw) - } - - if err := config.Check(); err != nil { - fmt.Fprintln(os.Stderr, "invalid config format: "+err.Error()) - os.Exit(1) - } - - if err := codegen.Generate(*config); err != nil { - fmt.Fprintln(os.Stderr, err.Error()) - os.Exit(1) - } - - if err := codegen.GenerateServer(*config, serverFilename); err != nil { +func GenerateGraphServer(cfg *config.Config, serverFilename string) { + err := api.Generate(cfg, api.AddPlugin(servergen.New(serverFilename))) + if err != nil { fmt.Fprintln(os.Stderr, err.Error()) - os.Exit(1) } fmt.Fprintf(os.Stdout, "Exec \"go run ./%s\" to start GraphQL server\n", serverFilename) } -func initConfig(ctx *cli.Context) *codegen.Config { - var config *codegen.Config +func initConfig(ctx *cli.Context) *config.Config { + var cfg *config.Config var err error configFilename := ctx.String("config") if configFilename != "" { - config, err = codegen.LoadConfig(configFilename) + cfg, err = config.LoadConfig(configFilename) } else { - config, err = codegen.LoadConfigFromDefaultLocations() + cfg, err = config.LoadConfigFromDefaultLocations() } - if config != nil { - fmt.Fprintf(os.Stderr, "init failed: a configuration file already exists at %s\n", config.FilePath) + if cfg != nil { + fmt.Fprintf(os.Stderr, "init failed: a configuration file already exists\n") os.Exit(1) } @@ -119,9 +103,9 @@ func initConfig(ctx *cli.Context) *codegen.Config { if configFilename == "" { configFilename = "gqlgen.yml" } - config = codegen.DefaultConfig() + cfg = config.DefaultConfig() - config.Resolver = codegen.PackageConfig{ + cfg.Resolver = config.PackageConfig{ Filename: "resolver.go", Type: "Resolver", } @@ -129,23 +113,21 @@ func initConfig(ctx *cli.Context) *codegen.Config { var buf bytes.Buffer buf.WriteString(strings.TrimSpace(configComment)) buf.WriteString("\n\n") - { - var b []byte - b, err = yaml.Marshal(config) - if err != nil { - fmt.Fprintln(os.Stderr, "unable to marshal yaml: "+err.Error()) - os.Exit(1) - } - buf.Write(b) + var b []byte + b, err = yaml.Marshal(cfg) + if err != nil { + fmt.Fprintln(os.Stderr, "unable to marshal yaml: "+err.Error()) + os.Exit(1) } + buf.Write(b) err = ioutil.WriteFile(configFilename, buf.Bytes(), 0644) if err != nil { - fmt.Fprintln(os.Stderr, "unable to write config file: "+err.Error()) + fmt.Fprintln(os.Stderr, "unable to write cfg file: "+err.Error()) os.Exit(1) } - return config + return cfg } func initSchema(schemaFilename string) { diff --git a/vendor/github.com/99designs/gqlgen/cmd/root.go b/vendor/github.com/99designs/gqlgen/cmd/root.go index 519c2e1af51d9d0c318742f5ca0ff432bd61b369..dc2970ac890e775b440b75197cacc00b14760406 100644 --- a/vendor/github.com/99designs/gqlgen/cmd/root.go +++ b/vendor/github.com/99designs/gqlgen/cmd/root.go @@ -7,7 +7,6 @@ import ( "os" "github.com/99designs/gqlgen/graphql" - "github.com/99designs/gqlgen/internal/gopath" "github.com/urfave/cli" // Required since otherwise dep will prune away these unused packages before codegen has a chance to run @@ -23,14 +22,6 @@ func Execute() { app.Flags = genCmd.Flags app.Version = graphql.Version app.Before = func(context *cli.Context) error { - pwd, err := os.Getwd() - if err != nil { - return fmt.Errorf("unable to determine current workding dir: %s\n", err.Error()) - } - - if !gopath.Contains(pwd) { - return fmt.Errorf("gqlgen must be run from inside your $GOPATH\n") - } if context.Bool("verbose") { log.SetFlags(0) } else { @@ -47,7 +38,7 @@ func Execute() { } if err := app.Run(os.Args); err != nil { - fmt.Fprintf(os.Stderr, err.Error()) + fmt.Fprint(os.Stderr, err.Error()) os.Exit(1) } } diff --git a/vendor/github.com/99designs/gqlgen/codegen/args.go b/vendor/github.com/99designs/gqlgen/codegen/args.go new file mode 100644 index 0000000000000000000000000000000000000000..d1498bddb1022f6b903969b67a91fb314960378d --- /dev/null +++ b/vendor/github.com/99designs/gqlgen/codegen/args.go @@ -0,0 +1,104 @@ +package codegen + +import ( + "fmt" + "go/types" + "strings" + + "github.com/99designs/gqlgen/codegen/config" + "github.com/99designs/gqlgen/codegen/templates" + "github.com/pkg/errors" + "github.com/vektah/gqlparser/ast" +) + +type ArgSet struct { + Args []*FieldArgument + FuncDecl string +} + +type FieldArgument struct { + *ast.ArgumentDefinition + TypeReference *config.TypeReference + VarName string // The name of the var in go + Object *Object // A link back to the parent object + Default interface{} // The default value + Directives []*Directive + Value interface{} // value set in Data +} + +func (f *FieldArgument) Stream() bool { + return f.Object != nil && f.Object.Stream +} + +func (b *builder) buildArg(obj *Object, arg *ast.ArgumentDefinition) (*FieldArgument, error) { + tr, err := b.Binder.TypeReference(arg.Type, nil) + if err != nil { + return nil, err + } + + argDirs, err := b.getDirectives(arg.Directives) + if err != nil { + return nil, err + } + newArg := FieldArgument{ + ArgumentDefinition: arg, + TypeReference: tr, + Object: obj, + VarName: templates.ToGoPrivate(arg.Name), + Directives: argDirs, + } + + if arg.DefaultValue != nil { + newArg.Default, err = arg.DefaultValue.Value(nil) + if err != nil { + return nil, errors.Errorf("default value is not valid: %s", err.Error()) + } + } + + return &newArg, nil +} + +func (b *builder) bindArgs(field *Field, params *types.Tuple) error { + var newArgs []*FieldArgument + +nextArg: + for j := 0; j < params.Len(); j++ { + param := params.At(j) + for _, oldArg := range field.Args { + if strings.EqualFold(oldArg.Name, param.Name()) { + tr, err := b.Binder.TypeReference(oldArg.Type, param.Type()) + if err != nil { + return err + } + oldArg.TypeReference = tr + + newArgs = append(newArgs, oldArg) + continue nextArg + } + } + + // no matching arg found, abort + return fmt.Errorf("arg %s not in schema", param.Name()) + } + + field.Args = newArgs + return nil +} + +func (a *Data) Args() map[string][]*FieldArgument { + ret := map[string][]*FieldArgument{} + for _, o := range a.Objects { + for _, f := range o.Fields { + if len(f.Args) > 0 { + ret[f.ArgsFunc()] = f.Args + } + } + } + + for _, d := range a.Directives { + if len(d.Args) > 0 { + ret[d.ArgsFunc()] = d.Args + } + } + return ret +} diff --git a/vendor/github.com/99designs/gqlgen/codegen/args.gotpl b/vendor/github.com/99designs/gqlgen/codegen/args.gotpl new file mode 100644 index 0000000000000000000000000000000000000000..4c7212182c866893ae68e50b51a272902a3415bf --- /dev/null +++ b/vendor/github.com/99designs/gqlgen/codegen/args.gotpl @@ -0,0 +1,43 @@ +{{ range $name, $args := .Args }} +func (ec *executionContext) {{ $name }}(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + {{- range $i, $arg := . }} + var arg{{$i}} {{ $arg.TypeReference.GO | ref}} + if tmp, ok := rawArgs[{{$arg.Name|quote}}]; ok { + {{- if $arg.Directives }} + getArg0 := func(ctx context.Context) (interface{}, error) { return ec.{{ $arg.TypeReference.UnmarshalFunc }}(ctx, tmp) } + + {{- range $i, $directive := $arg.Directives }} + getArg{{add $i 1}} := func(ctx context.Context) (res interface{}, err error) { + {{- range $dArg := $directive.Args }} + {{- if and $dArg.TypeReference.IsPtr ( notNil "Value" $dArg ) }} + {{ $dArg.VarName }} := {{ $dArg.Value | dump }} + {{- end }} + {{- end }} + n := getArg{{$i}} + return ec.directives.{{$directive.Name|ucFirst}}({{$directive.ResolveArgs "tmp" "n" }}) + } + {{- end }} + + tmp, err = getArg{{$arg.Directives|len}}(ctx) + if err != nil { + return nil, err + } + if data, ok := tmp.({{ $arg.TypeReference.GO | ref }}) ; ok { + arg{{$i}} = data + } else { + return nil, fmt.Errorf(`unexpected type %T from directive, should be {{ $arg.TypeReference.GO }}`, tmp) + } + {{- else }} + arg{{$i}}, err = ec.{{ $arg.TypeReference.UnmarshalFunc }}(ctx, tmp) + if err != nil { + return nil, err + } + {{- end }} + } + args[{{$arg.Name|quote}}] = arg{{$i}} + {{- end }} + return args, nil +} +{{ end }} diff --git a/vendor/github.com/99designs/gqlgen/codegen/build.go b/vendor/github.com/99designs/gqlgen/codegen/build.go deleted file mode 100644 index 582689a745493c29e096e2060b86a1fe110c6d04..0000000000000000000000000000000000000000 --- a/vendor/github.com/99designs/gqlgen/codegen/build.go +++ /dev/null @@ -1,194 +0,0 @@ -package codegen - -import ( - "fmt" - "go/build" - "go/types" - "os" - - "github.com/pkg/errors" - "golang.org/x/tools/go/loader" -) - -type Build struct { - PackageName string - Objects Objects - Inputs Objects - Interfaces []*Interface - QueryRoot *Object - MutationRoot *Object - SubscriptionRoot *Object - SchemaRaw map[string]string - SchemaFilename SchemaFilenames - Directives []*Directive -} - -type ModelBuild struct { - PackageName string - Models []Model - Enums []Enum -} - -type ResolverBuild struct { - PackageName string - ResolverType string - Objects Objects - ResolverFound bool -} - -type ServerBuild struct { - PackageName string - ExecPackageName string - ResolverPackageName string -} - -// Create a list of models that need to be generated -func (cfg *Config) models() (*ModelBuild, error) { - namedTypes := cfg.buildNamedTypes() - - progLoader := cfg.newLoaderWithoutErrors() - - prog, err := progLoader.Load() - if err != nil { - return nil, errors.Wrap(err, "loading failed") - } - - cfg.bindTypes(namedTypes, cfg.Model.Dir(), prog) - - models, err := cfg.buildModels(namedTypes, prog) - if err != nil { - return nil, err - } - return &ModelBuild{ - PackageName: cfg.Model.Package, - Models: models, - Enums: cfg.buildEnums(namedTypes), - }, nil -} - -// bind a schema together with some code to generate a Build -func (cfg *Config) resolver() (*ResolverBuild, error) { - progLoader := cfg.newLoaderWithoutErrors() - progLoader.Import(cfg.Resolver.ImportPath()) - - prog, err := progLoader.Load() - if err != nil { - return nil, err - } - - destDir := cfg.Resolver.Dir() - - namedTypes := cfg.buildNamedTypes() - - cfg.bindTypes(namedTypes, destDir, prog) - - objects, err := cfg.buildObjects(namedTypes, prog) - if err != nil { - return nil, err - } - - def, _ := findGoType(prog, cfg.Resolver.ImportPath(), cfg.Resolver.Type) - resolverFound := def != nil - - return &ResolverBuild{ - PackageName: cfg.Resolver.Package, - Objects: objects, - ResolverType: cfg.Resolver.Type, - ResolverFound: resolverFound, - }, nil -} - -func (cfg *Config) server(destDir string) *ServerBuild { - return &ServerBuild{ - PackageName: cfg.Resolver.Package, - ExecPackageName: cfg.Exec.ImportPath(), - ResolverPackageName: cfg.Resolver.ImportPath(), - } -} - -// bind a schema together with some code to generate a Build -func (cfg *Config) bind() (*Build, error) { - namedTypes := cfg.buildNamedTypes() - - progLoader := cfg.newLoaderWithoutErrors() - prog, err := progLoader.Load() - if err != nil { - return nil, errors.Wrap(err, "loading failed") - } - - cfg.bindTypes(namedTypes, cfg.Exec.Dir(), prog) - - objects, err := cfg.buildObjects(namedTypes, prog) - if err != nil { - return nil, err - } - - inputs, err := cfg.buildInputs(namedTypes, prog) - if err != nil { - return nil, err - } - directives, err := cfg.buildDirectives(namedTypes) - if err != nil { - return nil, err - } - - b := &Build{ - PackageName: cfg.Exec.Package, - Objects: objects, - Interfaces: cfg.buildInterfaces(namedTypes, prog), - Inputs: inputs, - SchemaRaw: cfg.SchemaStr, - SchemaFilename: cfg.SchemaFilename, - Directives: directives, - } - - if cfg.schema.Query != nil { - b.QueryRoot = b.Objects.ByName(cfg.schema.Query.Name) - } else { - return b, fmt.Errorf("query entry point missing") - } - - if cfg.schema.Mutation != nil { - b.MutationRoot = b.Objects.ByName(cfg.schema.Mutation.Name) - } - - if cfg.schema.Subscription != nil { - b.SubscriptionRoot = b.Objects.ByName(cfg.schema.Subscription.Name) - } - return b, nil -} - -func (cfg *Config) validate() error { - progLoader := cfg.newLoaderWithErrors() - _, err := progLoader.Load() - return err -} - -func (cfg *Config) newLoaderWithErrors() loader.Config { - conf := loader.Config{} - - for _, pkg := range cfg.Models.referencedPackages() { - conf.Import(pkg) - } - return conf -} - -func (cfg *Config) newLoaderWithoutErrors() loader.Config { - conf := cfg.newLoaderWithErrors() - conf.AllowErrors = true - conf.TypeChecker = types.Config{ - Error: func(e error) {}, - } - return conf -} - -func resolvePkg(pkgName string) (string, error) { - cwd, _ := os.Getwd() - - pkg, err := build.Default.Import(pkgName, cwd, build.FindOnly) - if err != nil { - return "", err - } - - return pkg.ImportPath, nil -} diff --git a/vendor/github.com/99designs/gqlgen/codegen/codegen.go b/vendor/github.com/99designs/gqlgen/codegen/codegen.go deleted file mode 100644 index 773e3db7cc4c5b8237cd33b393aeca6b782bc074..0000000000000000000000000000000000000000 --- a/vendor/github.com/99designs/gqlgen/codegen/codegen.go +++ /dev/null @@ -1,179 +0,0 @@ -package codegen - -import ( - "log" - "os" - "path/filepath" - "regexp" - "syscall" - - "github.com/99designs/gqlgen/codegen/templates" - "github.com/pkg/errors" - "github.com/vektah/gqlparser" - "github.com/vektah/gqlparser/ast" - "github.com/vektah/gqlparser/gqlerror" -) - -func Generate(cfg Config) error { - if err := cfg.normalize(); err != nil { - return err - } - - _ = syscall.Unlink(cfg.Exec.Filename) - _ = syscall.Unlink(cfg.Model.Filename) - - modelsBuild, err := cfg.models() - if err != nil { - return errors.Wrap(err, "model plan failed") - } - if len(modelsBuild.Models) > 0 || len(modelsBuild.Enums) > 0 { - if err = templates.RenderToFile("models.gotpl", cfg.Model.Filename, modelsBuild); err != nil { - return err - } - - for _, model := range modelsBuild.Models { - modelCfg := cfg.Models[model.GQLType] - modelCfg.Model = cfg.Model.ImportPath() + "." + model.GoType - cfg.Models[model.GQLType] = modelCfg - } - - for _, enum := range modelsBuild.Enums { - modelCfg := cfg.Models[enum.GQLType] - modelCfg.Model = cfg.Model.ImportPath() + "." + enum.GoType - cfg.Models[enum.GQLType] = modelCfg - } - } - - build, err := cfg.bind() - if err != nil { - return errors.Wrap(err, "exec plan failed") - } - - if err := templates.RenderToFile("generated.gotpl", cfg.Exec.Filename, build); err != nil { - return err - } - - if cfg.Resolver.IsDefined() { - if err := generateResolver(cfg); err != nil { - return errors.Wrap(err, "generating resolver failed") - } - } - - if err := cfg.validate(); err != nil { - return errors.Wrap(err, "validation failed") - } - - return nil -} - -func GenerateServer(cfg Config, filename string) error { - if err := cfg.Exec.normalize(); err != nil { - return errors.Wrap(err, "exec") - } - if err := cfg.Resolver.normalize(); err != nil { - return errors.Wrap(err, "resolver") - } - - serverFilename := abs(filename) - serverBuild := cfg.server(filepath.Dir(serverFilename)) - - if _, err := os.Stat(serverFilename); os.IsNotExist(errors.Cause(err)) { - err = templates.RenderToFile("server.gotpl", serverFilename, serverBuild) - if err != nil { - return errors.Wrap(err, "generate server failed") - } - } else { - log.Printf("Skipped server: %s already exists\n", serverFilename) - } - return nil -} - -func generateResolver(cfg Config) error { - resolverBuild, err := cfg.resolver() - if err != nil { - return errors.Wrap(err, "resolver build failed") - } - filename := cfg.Resolver.Filename - - if resolverBuild.ResolverFound { - log.Printf("Skipped resolver: %s.%s already exists\n", cfg.Resolver.ImportPath(), cfg.Resolver.Type) - return nil - } - - if _, err := os.Stat(filename); os.IsNotExist(errors.Cause(err)) { - if err := templates.RenderToFile("resolver.gotpl", filename, resolverBuild); err != nil { - return err - } - } else { - log.Printf("Skipped resolver: %s already exists\n", filename) - } - - return nil -} - -func (cfg *Config) normalize() error { - if err := cfg.Model.normalize(); err != nil { - return errors.Wrap(err, "model") - } - - if err := cfg.Exec.normalize(); err != nil { - return errors.Wrap(err, "exec") - } - - if cfg.Resolver.IsDefined() { - if err := cfg.Resolver.normalize(); err != nil { - return errors.Wrap(err, "resolver") - } - } - - builtins := TypeMap{ - "__Directive": {Model: "github.com/99designs/gqlgen/graphql/introspection.Directive"}, - "__Type": {Model: "github.com/99designs/gqlgen/graphql/introspection.Type"}, - "__Field": {Model: "github.com/99designs/gqlgen/graphql/introspection.Field"}, - "__EnumValue": {Model: "github.com/99designs/gqlgen/graphql/introspection.EnumValue"}, - "__InputValue": {Model: "github.com/99designs/gqlgen/graphql/introspection.InputValue"}, - "__Schema": {Model: "github.com/99designs/gqlgen/graphql/introspection.Schema"}, - "Int": {Model: "github.com/99designs/gqlgen/graphql.Int"}, - "Float": {Model: "github.com/99designs/gqlgen/graphql.Float"}, - "String": {Model: "github.com/99designs/gqlgen/graphql.String"}, - "Boolean": {Model: "github.com/99designs/gqlgen/graphql.Boolean"}, - "ID": {Model: "github.com/99designs/gqlgen/graphql.ID"}, - "Time": {Model: "github.com/99designs/gqlgen/graphql.Time"}, - "Map": {Model: "github.com/99designs/gqlgen/graphql.Map"}, - } - - if cfg.Models == nil { - cfg.Models = TypeMap{} - } - for typeName, entry := range builtins { - if !cfg.Models.Exists(typeName) { - cfg.Models[typeName] = entry - } - } - - var sources []*ast.Source - for _, filename := range cfg.SchemaFilename { - sources = append(sources, &ast.Source{Name: filename, Input: cfg.SchemaStr[filename]}) - } - - var err *gqlerror.Error - cfg.schema, err = gqlparser.LoadSchema(sources...) - if err != nil { - return err - } - return nil -} - -var invalidPackageNameChar = regexp.MustCompile(`[^\w]`) - -func sanitizePackageName(pkg string) string { - return invalidPackageNameChar.ReplaceAllLiteralString(filepath.Base(pkg), "_") -} - -func abs(path string) string { - absPath, err := filepath.Abs(path) - if err != nil { - panic(err) - } - return filepath.ToSlash(absPath) -} diff --git a/vendor/github.com/99designs/gqlgen/codegen/complexity.go b/vendor/github.com/99designs/gqlgen/codegen/complexity.go new file mode 100644 index 0000000000000000000000000000000000000000..66d21a840e5e4b84c9d000f69cd7cd4879134d8b --- /dev/null +++ b/vendor/github.com/99designs/gqlgen/codegen/complexity.go @@ -0,0 +1,11 @@ +package codegen + +func (o *Object) UniqueFields() map[string]*Field { + m := map[string]*Field{} + + for _, f := range o.Fields { + m[f.GoFieldName] = f + } + + return m +} diff --git a/vendor/github.com/99designs/gqlgen/codegen/config.go b/vendor/github.com/99designs/gqlgen/codegen/config.go deleted file mode 100644 index f9df24fb3f3fc9f5dc7d8baa17ca364b7a4a3aae..0000000000000000000000000000000000000000 --- a/vendor/github.com/99designs/gqlgen/codegen/config.go +++ /dev/null @@ -1,273 +0,0 @@ -package codegen - -import ( - "fmt" - "go/build" - "io/ioutil" - "os" - "path/filepath" - "sort" - "strings" - - "github.com/99designs/gqlgen/internal/gopath" - "github.com/pkg/errors" - "github.com/vektah/gqlparser/ast" - "gopkg.in/yaml.v2" -) - -var cfgFilenames = []string{".gqlgen.yml", "gqlgen.yml", "gqlgen.yaml"} - -// DefaultConfig creates a copy of the default config -func DefaultConfig() *Config { - return &Config{ - SchemaFilename: SchemaFilenames{"schema.graphql"}, - SchemaStr: map[string]string{}, - Model: PackageConfig{Filename: "models_gen.go"}, - Exec: PackageConfig{Filename: "generated.go"}, - } -} - -// LoadConfigFromDefaultLocations looks for a config file in the current directory, and all parent directories -// walking up the tree. The closest config file will be returned. -func LoadConfigFromDefaultLocations() (*Config, error) { - cfgFile, err := findCfg() - if err != nil { - return nil, err - } - - err = os.Chdir(filepath.Dir(cfgFile)) - if err != nil { - return nil, errors.Wrap(err, "unable to enter config dir") - } - return LoadConfig(cfgFile) -} - -// LoadConfig reads the gqlgen.yml config file -func LoadConfig(filename string) (*Config, error) { - config := DefaultConfig() - - b, err := ioutil.ReadFile(filename) - if err != nil { - return nil, errors.Wrap(err, "unable to read config") - } - - if err := yaml.UnmarshalStrict(b, config); err != nil { - return nil, errors.Wrap(err, "unable to parse config") - } - - preGlobbing := config.SchemaFilename - config.SchemaFilename = SchemaFilenames{} - for _, f := range preGlobbing { - matches, err := filepath.Glob(f) - if err != nil { - return nil, errors.Wrapf(err, "failed to glob schema filename %s", f) - } - - for _, m := range matches { - if config.SchemaFilename.Has(m) { - continue - } - config.SchemaFilename = append(config.SchemaFilename, m) - } - } - - config.FilePath = filename - config.SchemaStr = map[string]string{} - - return config, nil -} - -type Config struct { - SchemaFilename SchemaFilenames `yaml:"schema,omitempty"` - SchemaStr map[string]string `yaml:"-"` - Exec PackageConfig `yaml:"exec"` - Model PackageConfig `yaml:"model"` - Resolver PackageConfig `yaml:"resolver,omitempty"` - Models TypeMap `yaml:"models,omitempty"` - StructTag string `yaml:"struct_tag,omitempty"` - - FilePath string `yaml:"-"` - - schema *ast.Schema `yaml:"-"` -} - -type PackageConfig struct { - Filename string `yaml:"filename,omitempty"` - Package string `yaml:"package,omitempty"` - Type string `yaml:"type,omitempty"` -} - -type TypeMapEntry struct { - Model string `yaml:"model"` - Fields map[string]TypeMapField `yaml:"fields,omitempty"` -} - -type TypeMapField struct { - Resolver bool `yaml:"resolver"` - FieldName string `yaml:"fieldName"` -} - -type SchemaFilenames []string - -func (a *SchemaFilenames) UnmarshalYAML(unmarshal func(interface{}) error) error { - var single string - err := unmarshal(&single) - if err == nil { - *a = []string{single} - return nil - } - - var multi []string - err = unmarshal(&multi) - if err != nil { - return err - } - - *a = multi - return nil -} - -func (a SchemaFilenames) Has(file string) bool { - for _, existing := range a { - if existing == file { - return true - } - } - return false -} - -func (c *PackageConfig) normalize() error { - if c.Filename == "" { - return errors.New("Filename is required") - } - c.Filename = abs(c.Filename) - // If Package is not set, first attempt to load the package at the output dir. If that fails - // fallback to just the base dir name of the output filename. - if c.Package == "" { - cwd, _ := os.Getwd() - pkg, _ := build.Default.Import(c.ImportPath(), cwd, 0) - if pkg.Name != "" { - c.Package = pkg.Name - } else { - c.Package = filepath.Base(c.Dir()) - } - } - c.Package = sanitizePackageName(c.Package) - return nil -} - -func (c *PackageConfig) ImportPath() string { - return gopath.MustDir2Import(c.Dir()) -} - -func (c *PackageConfig) Dir() string { - return filepath.Dir(c.Filename) -} - -func (c *PackageConfig) Check() error { - if strings.ContainsAny(c.Package, "./\\") { - return fmt.Errorf("package should be the output package name only, do not include the output filename") - } - if c.Filename != "" && !strings.HasSuffix(c.Filename, ".go") { - return fmt.Errorf("filename should be path to a go source file") - } - return nil -} - -func (c *PackageConfig) IsDefined() bool { - return c.Filename != "" -} - -func (cfg *Config) Check() error { - if err := cfg.Models.Check(); err != nil { - return errors.Wrap(err, "config.models") - } - if err := cfg.Exec.Check(); err != nil { - return errors.Wrap(err, "config.exec") - } - if err := cfg.Model.Check(); err != nil { - return errors.Wrap(err, "config.model") - } - if err := cfg.Resolver.Check(); err != nil { - return errors.Wrap(err, "config.resolver") - } - return nil -} - -type TypeMap map[string]TypeMapEntry - -func (tm TypeMap) Exists(typeName string) bool { - _, ok := tm[typeName] - return ok -} - -func (tm TypeMap) Check() error { - for typeName, entry := range tm { - if strings.LastIndex(entry.Model, ".") < strings.LastIndex(entry.Model, "/") { - return fmt.Errorf("model %s: invalid type specifier \"%s\" - you need to specify a struct to map to", typeName, entry.Model) - } - } - return nil -} - -func (tm TypeMap) referencedPackages() []string { - var pkgs []string - - for _, typ := range tm { - if typ.Model == "map[string]interface{}" { - continue - } - pkg, _ := pkgAndType(typ.Model) - if pkg == "" || inStrSlice(pkgs, pkg) { - continue - } - pkgs = append(pkgs, pkg) - } - - sort.Slice(pkgs, func(i, j int) bool { - return pkgs[i] > pkgs[j] - }) - return pkgs -} - -func inStrSlice(haystack []string, needle string) bool { - for _, v := range haystack { - if needle == v { - return true - } - } - - return false -} - -// findCfg searches for the config file in this directory and all parents up the tree -// looking for the closest match -func findCfg() (string, error) { - dir, err := os.Getwd() - if err != nil { - return "", errors.Wrap(err, "unable to get working dir to findCfg") - } - - cfg := findCfgInDir(dir) - - for cfg == "" && dir != filepath.Dir(dir) { - dir = filepath.Dir(dir) - cfg = findCfgInDir(dir) - } - - if cfg == "" { - return "", os.ErrNotExist - } - - return cfg, nil -} - -func findCfgInDir(dir string) string { - for _, cfgName := range cfgFilenames { - path := filepath.Join(dir, cfgName) - if _, err := os.Stat(path); err == nil { - return path - } - } - return "" -} diff --git a/vendor/github.com/99designs/gqlgen/codegen/config/binder.go b/vendor/github.com/99designs/gqlgen/codegen/config/binder.go new file mode 100644 index 0000000000000000000000000000000000000000..f39563874b4470e6246ebfbffb78749e885c10b7 --- /dev/null +++ b/vendor/github.com/99designs/gqlgen/codegen/config/binder.go @@ -0,0 +1,451 @@ +package config + +import ( + "fmt" + "go/token" + "go/types" + + "github.com/99designs/gqlgen/codegen/templates" + "github.com/99designs/gqlgen/internal/code" + "github.com/pkg/errors" + "github.com/vektah/gqlparser/ast" + "golang.org/x/tools/go/packages" +) + +// Binder connects graphql types to golang types using static analysis +type Binder struct { + pkgs []*packages.Package + schema *ast.Schema + cfg *Config + References []*TypeReference +} + +func (c *Config) NewBinder(s *ast.Schema) (*Binder, error) { + pkgs, err := packages.Load(&packages.Config{Mode: packages.LoadTypes | packages.LoadSyntax}, c.Models.ReferencedPackages()...) + if err != nil { + return nil, err + } + + for _, p := range pkgs { + for _, e := range p.Errors { + if e.Kind == packages.ListError { + return nil, p.Errors[0] + } + } + } + + return &Binder{ + pkgs: pkgs, + schema: s, + cfg: c, + }, nil +} + +func (b *Binder) TypePosition(typ types.Type) token.Position { + named, isNamed := typ.(*types.Named) + if !isNamed { + return token.Position{ + Filename: "unknown", + } + } + + return b.ObjectPosition(named.Obj()) +} + +func (b *Binder) ObjectPosition(typ types.Object) token.Position { + if typ == nil { + return token.Position{ + Filename: "unknown", + } + } + pkg := b.getPkg(typ.Pkg().Path()) + return pkg.Fset.Position(typ.Pos()) +} + +func (b *Binder) FindType(pkgName string, typeName string) (types.Type, error) { + obj, err := b.FindObject(pkgName, typeName) + if err != nil { + return nil, err + } + + if fun, isFunc := obj.(*types.Func); isFunc { + return fun.Type().(*types.Signature).Params().At(0).Type(), nil + } + return obj.Type(), nil +} + +func (b *Binder) getPkg(find string) *packages.Package { + for _, p := range b.pkgs { + if code.NormalizeVendor(find) == code.NormalizeVendor(p.PkgPath) { + return p + } + } + return nil +} + +var MapType = types.NewMap(types.Typ[types.String], types.NewInterfaceType(nil, nil).Complete()) +var InterfaceType = types.NewInterfaceType(nil, nil) + +func (b *Binder) DefaultUserObject(name string) (types.Type, error) { + models := b.cfg.Models[name].Model + if len(models) == 0 { + return nil, fmt.Errorf(name + " not found in typemap") + } + + if models[0] == "map[string]interface{}" { + return MapType, nil + } + + if models[0] == "interface{}" { + return InterfaceType, nil + } + + pkgName, typeName := code.PkgAndType(models[0]) + if pkgName == "" { + return nil, fmt.Errorf("missing package name for %s", name) + } + + obj, err := b.FindObject(pkgName, typeName) + if err != nil { + return nil, err + } + + return obj.Type(), nil +} + +func (b *Binder) FindObject(pkgName string, typeName string) (types.Object, error) { + if pkgName == "" { + return nil, fmt.Errorf("package cannot be nil") + } + fullName := typeName + if pkgName != "" { + fullName = pkgName + "." + typeName + } + + pkg := b.getPkg(pkgName) + if pkg == nil { + return nil, errors.Errorf("required package was not loaded: %s", fullName) + } + + // function based marshalers take precedence + for astNode, def := range pkg.TypesInfo.Defs { + // only look at defs in the top scope + if def == nil || def.Parent() == nil || def.Parent() != pkg.Types.Scope() { + continue + } + + if astNode.Name == "Marshal"+typeName { + return def, nil + } + } + + // then look for types directly + for astNode, def := range pkg.TypesInfo.Defs { + // only look at defs in the top scope + if def == nil || def.Parent() == nil || def.Parent() != pkg.Types.Scope() { + continue + } + + if astNode.Name == typeName { + return def, nil + } + } + + return nil, errors.Errorf("unable to find type %s\n", fullName) +} + +func (b *Binder) PointerTo(ref *TypeReference) *TypeReference { + newRef := &TypeReference{ + GO: types.NewPointer(ref.GO), + GQL: ref.GQL, + CastType: ref.CastType, + Definition: ref.Definition, + Unmarshaler: ref.Unmarshaler, + Marshaler: ref.Marshaler, + IsMarshaler: ref.IsMarshaler, + } + + b.References = append(b.References, newRef) + return newRef +} + +// TypeReference is used by args and field types. The Definition can refer to both input and output types. +type TypeReference struct { + Definition *ast.Definition + GQL *ast.Type + GO types.Type + CastType types.Type // Before calling marshalling functions cast from/to this base type + Marshaler *types.Func // When using external marshalling functions this will point to the Marshal function + Unmarshaler *types.Func // When using external marshalling functions this will point to the Unmarshal function + IsMarshaler bool // Does the type implement graphql.Marshaler and graphql.Unmarshaler +} + +func (ref *TypeReference) Elem() *TypeReference { + if p, isPtr := ref.GO.(*types.Pointer); isPtr { + return &TypeReference{ + GO: p.Elem(), + GQL: ref.GQL, + CastType: ref.CastType, + Definition: ref.Definition, + Unmarshaler: ref.Unmarshaler, + Marshaler: ref.Marshaler, + IsMarshaler: ref.IsMarshaler, + } + } + + if ref.IsSlice() { + return &TypeReference{ + GO: ref.GO.(*types.Slice).Elem(), + GQL: ref.GQL.Elem, + CastType: ref.CastType, + Definition: ref.Definition, + Unmarshaler: ref.Unmarshaler, + Marshaler: ref.Marshaler, + IsMarshaler: ref.IsMarshaler, + } + } + return nil +} + +func (t *TypeReference) IsPtr() bool { + _, isPtr := t.GO.(*types.Pointer) + return isPtr +} + +func (t *TypeReference) IsNilable() bool { + _, isPtr := t.GO.(*types.Pointer) + _, isMap := t.GO.(*types.Map) + _, isInterface := t.GO.(*types.Interface) + return isPtr || isMap || isInterface +} + +func (t *TypeReference) IsSlice() bool { + _, isSlice := t.GO.(*types.Slice) + return t.GQL.Elem != nil && isSlice +} + +func (t *TypeReference) IsNamed() bool { + _, isSlice := t.GO.(*types.Named) + return isSlice +} + +func (t *TypeReference) IsStruct() bool { + _, isStruct := t.GO.Underlying().(*types.Struct) + return isStruct +} + +func (t *TypeReference) IsScalar() bool { + return t.Definition.Kind == ast.Scalar +} + +func (t *TypeReference) HasIsZero() bool { + it := t.GO + if ptr, isPtr := it.(*types.Pointer); isPtr { + it = ptr.Elem() + } + namedType, ok := it.(*types.Named) + if !ok { + return false + } + + for i := 0; i < namedType.NumMethods(); i++ { + switch namedType.Method(i).Name() { + case "IsZero": + return true + } + } + return false +} + +func (t *TypeReference) UniquenessKey() string { + var nullability = "O" + if t.GQL.NonNull { + nullability = "N" + } + + return nullability + t.Definition.Name + "2" + templates.TypeIdentifier(t.GO) +} + +func (t *TypeReference) MarshalFunc() string { + if t.Definition == nil { + panic(errors.New("Definition missing for " + t.GQL.Name())) + } + + if t.Definition.Kind == ast.InputObject { + return "" + } + + return "marshal" + t.UniquenessKey() +} + +func (t *TypeReference) UnmarshalFunc() string { + if t.Definition == nil { + panic(errors.New("Definition missing for " + t.GQL.Name())) + } + + if !t.Definition.IsInputType() { + return "" + } + + return "unmarshal" + t.UniquenessKey() +} + +func (b *Binder) PushRef(ret *TypeReference) { + b.References = append(b.References, ret) +} + +func isMap(t types.Type) bool { + if t == nil { + return true + } + _, ok := t.(*types.Map) + return ok +} + +func isIntf(t types.Type) bool { + if t == nil { + return true + } + _, ok := t.(*types.Interface) + return ok +} + +func (b *Binder) TypeReference(schemaType *ast.Type, bindTarget types.Type) (ret *TypeReference, err error) { + var pkgName, typeName string + def := b.schema.Types[schemaType.Name()] + defer func() { + if err == nil && ret != nil { + b.PushRef(ret) + } + }() + + if len(b.cfg.Models[schemaType.Name()].Model) == 0 { + return nil, fmt.Errorf("%s was not found", schemaType.Name()) + } + + for _, model := range b.cfg.Models[schemaType.Name()].Model { + if model == "map[string]interface{}" { + if !isMap(bindTarget) { + continue + } + return &TypeReference{ + Definition: def, + GQL: schemaType, + GO: MapType, + }, nil + } + + if model == "interface{}" { + if !isIntf(bindTarget) { + continue + } + return &TypeReference{ + Definition: def, + GQL: schemaType, + GO: InterfaceType, + }, nil + } + + pkgName, typeName = code.PkgAndType(model) + if pkgName == "" { + return nil, fmt.Errorf("missing package name for %s", schemaType.Name()) + } + + ref := &TypeReference{ + Definition: def, + GQL: schemaType, + } + + obj, err := b.FindObject(pkgName, typeName) + if err != nil { + return nil, err + } + + if fun, isFunc := obj.(*types.Func); isFunc { + ref.GO = fun.Type().(*types.Signature).Params().At(0).Type() + ref.Marshaler = fun + ref.Unmarshaler = types.NewFunc(0, fun.Pkg(), "Unmarshal"+typeName, nil) + } else if hasMethod(obj.Type(), "MarshalGQL") && hasMethod(obj.Type(), "UnmarshalGQL") { + ref.GO = obj.Type() + ref.IsMarshaler = true + } else if underlying := basicUnderlying(obj.Type()); underlying != nil && underlying.Kind() == types.String { + // Special case for named types wrapping strings. Used by default enum implementations. + + ref.GO = obj.Type() + ref.CastType = underlying + + underlyingRef, err := b.TypeReference(&ast.Type{NamedType: "String"}, nil) + if err != nil { + return nil, err + } + + ref.Marshaler = underlyingRef.Marshaler + ref.Unmarshaler = underlyingRef.Unmarshaler + } else { + ref.GO = obj.Type() + } + + ref.GO = b.CopyModifiersFromAst(schemaType, ref.GO) + + if bindTarget != nil { + if err = code.CompatibleTypes(ref.GO, bindTarget); err != nil { + continue + } + ref.GO = bindTarget + } + + return ref, nil + } + + return nil, fmt.Errorf("%s has type compatible with %s", schemaType.Name(), bindTarget.String()) +} + +func (b *Binder) CopyModifiersFromAst(t *ast.Type, base types.Type) types.Type { + if t.Elem != nil { + return types.NewSlice(b.CopyModifiersFromAst(t.Elem, base)) + } + + var isInterface bool + if named, ok := base.(*types.Named); ok { + _, isInterface = named.Underlying().(*types.Interface) + } + + if !isInterface && !t.NonNull { + return types.NewPointer(base) + } + + return base +} + +func hasMethod(it types.Type, name string) bool { + if ptr, isPtr := it.(*types.Pointer); isPtr { + it = ptr.Elem() + } + namedType, ok := it.(*types.Named) + if !ok { + return false + } + + for i := 0; i < namedType.NumMethods(); i++ { + if namedType.Method(i).Name() == name { + return true + } + } + return false +} + +func basicUnderlying(it types.Type) *types.Basic { + if ptr, isPtr := it.(*types.Pointer); isPtr { + it = ptr.Elem() + } + namedType, ok := it.(*types.Named) + if !ok { + return nil + } + + if basic, ok := namedType.Underlying().(*types.Basic); ok { + return basic + } + + return nil +} diff --git a/vendor/github.com/99designs/gqlgen/codegen/config/config.go b/vendor/github.com/99designs/gqlgen/codegen/config/config.go new file mode 100644 index 0000000000000000000000000000000000000000..0c72420e60255f7d094bef33e4f1bb31918a8a59 --- /dev/null +++ b/vendor/github.com/99designs/gqlgen/codegen/config/config.go @@ -0,0 +1,408 @@ +package config + +import ( + "fmt" + "go/types" + "io/ioutil" + "os" + "path/filepath" + "sort" + "strings" + + "github.com/99designs/gqlgen/internal/code" + "github.com/pkg/errors" + "github.com/vektah/gqlparser" + "github.com/vektah/gqlparser/ast" + yaml "gopkg.in/yaml.v2" +) + +type Config struct { + SchemaFilename StringList `yaml:"schema,omitempty"` + Exec PackageConfig `yaml:"exec"` + Model PackageConfig `yaml:"model"` + Resolver PackageConfig `yaml:"resolver,omitempty"` + Models TypeMap `yaml:"models,omitempty"` + StructTag string `yaml:"struct_tag,omitempty"` +} + +var cfgFilenames = []string{".gqlgen.yml", "gqlgen.yml", "gqlgen.yaml"} + +// DefaultConfig creates a copy of the default config +func DefaultConfig() *Config { + return &Config{ + SchemaFilename: StringList{"schema.graphql"}, + Model: PackageConfig{Filename: "models_gen.go"}, + Exec: PackageConfig{Filename: "generated.go"}, + } +} + +// LoadConfigFromDefaultLocations looks for a config file in the current directory, and all parent directories +// walking up the tree. The closest config file will be returned. +func LoadConfigFromDefaultLocations() (*Config, error) { + cfgFile, err := findCfg() + if err != nil { + return nil, err + } + + err = os.Chdir(filepath.Dir(cfgFile)) + if err != nil { + return nil, errors.Wrap(err, "unable to enter config dir") + } + return LoadConfig(cfgFile) +} + +// LoadConfig reads the gqlgen.yml config file +func LoadConfig(filename string) (*Config, error) { + config := DefaultConfig() + + b, err := ioutil.ReadFile(filename) + if err != nil { + return nil, errors.Wrap(err, "unable to read config") + } + + if err := yaml.UnmarshalStrict(b, config); err != nil { + return nil, errors.Wrap(err, "unable to parse config") + } + + preGlobbing := config.SchemaFilename + config.SchemaFilename = StringList{} + for _, f := range preGlobbing { + matches, err := filepath.Glob(f) + if err != nil { + return nil, errors.Wrapf(err, "failed to glob schema filename %s", f) + } + + for _, m := range matches { + if config.SchemaFilename.Has(m) { + continue + } + config.SchemaFilename = append(config.SchemaFilename, m) + } + } + + return config, nil +} + +type PackageConfig struct { + Filename string `yaml:"filename,omitempty"` + Package string `yaml:"package,omitempty"` + Type string `yaml:"type,omitempty"` +} + +type TypeMapEntry struct { + Model StringList `yaml:"model"` + Fields map[string]TypeMapField `yaml:"fields,omitempty"` +} + +type TypeMapField struct { + Resolver bool `yaml:"resolver"` + FieldName string `yaml:"fieldName"` +} + +type StringList []string + +func (a *StringList) UnmarshalYAML(unmarshal func(interface{}) error) error { + var single string + err := unmarshal(&single) + if err == nil { + *a = []string{single} + return nil + } + + var multi []string + err = unmarshal(&multi) + if err != nil { + return err + } + + *a = multi + return nil +} + +func (a StringList) Has(file string) bool { + for _, existing := range a { + if existing == file { + return true + } + } + return false +} + +func (c *PackageConfig) normalize() error { + if c.Filename == "" { + return errors.New("Filename is required") + } + c.Filename = abs(c.Filename) + // If Package is not set, first attempt to load the package at the output dir. If that fails + // fallback to just the base dir name of the output filename. + if c.Package == "" { + c.Package = code.NameForPackage(c.ImportPath()) + } + + return nil +} + +func (c *PackageConfig) ImportPath() string { + return code.ImportPathForDir(c.Dir()) +} + +func (c *PackageConfig) Dir() string { + return filepath.Dir(c.Filename) +} + +func (c *PackageConfig) Check() error { + if strings.ContainsAny(c.Package, "./\\") { + return fmt.Errorf("package should be the output package name only, do not include the output filename") + } + if c.Filename != "" && !strings.HasSuffix(c.Filename, ".go") { + return fmt.Errorf("filename should be path to a go source file") + } + + return c.normalize() +} + +func (c *PackageConfig) Pkg() *types.Package { + return types.NewPackage(c.ImportPath(), c.Dir()) +} + +func (c *PackageConfig) IsDefined() bool { + return c.Filename != "" +} + +func (c *Config) Check() error { + if err := c.Models.Check(); err != nil { + return errors.Wrap(err, "config.models") + } + if err := c.Exec.Check(); err != nil { + return errors.Wrap(err, "config.exec") + } + if err := c.Model.Check(); err != nil { + return errors.Wrap(err, "config.model") + } + if c.Resolver.IsDefined() { + if err := c.Resolver.Check(); err != nil { + return errors.Wrap(err, "config.resolver") + } + } + + // check packages names against conflict, if present in the same dir + // and check filenames for uniqueness + packageConfigList := []PackageConfig{ + c.Model, + c.Exec, + c.Resolver, + } + filesMap := make(map[string]bool) + pkgConfigsByDir := make(map[string]PackageConfig) + for _, current := range packageConfigList { + _, fileFound := filesMap[current.Filename] + if fileFound { + return fmt.Errorf("filename %s defined more than once", current.Filename) + } + filesMap[current.Filename] = true + previous, inSameDir := pkgConfigsByDir[current.Dir()] + if inSameDir && current.Package != previous.Package { + return fmt.Errorf("filenames %s and %s are in the same directory but have different package definitions", stripPath(current.Filename), stripPath(previous.Filename)) + } + pkgConfigsByDir[current.Dir()] = current + } + + return c.normalize() +} + +func stripPath(path string) string { + return filepath.Base(path) +} + +type TypeMap map[string]TypeMapEntry + +func (tm TypeMap) Exists(typeName string) bool { + _, ok := tm[typeName] + return ok +} + +func (tm TypeMap) UserDefined(typeName string) bool { + m, ok := tm[typeName] + return ok && len(m.Model) > 0 +} + +func (tm TypeMap) Check() error { + for typeName, entry := range tm { + for _, model := range entry.Model { + if strings.LastIndex(model, ".") < strings.LastIndex(model, "/") { + return fmt.Errorf("model %s: invalid type specifier \"%s\" - you need to specify a struct to map to", typeName, entry.Model) + } + } + } + return nil +} + +func (tm TypeMap) ReferencedPackages() []string { + var pkgs []string + + for _, typ := range tm { + for _, model := range typ.Model { + if model == "map[string]interface{}" || model == "interface{}" { + continue + } + pkg, _ := code.PkgAndType(model) + if pkg == "" || inStrSlice(pkgs, pkg) { + continue + } + pkgs = append(pkgs, code.QualifyPackagePath(pkg)) + } + } + + sort.Slice(pkgs, func(i, j int) bool { + return pkgs[i] > pkgs[j] + }) + return pkgs +} + +func (tm TypeMap) Add(Name string, goType string) { + modelCfg := tm[Name] + modelCfg.Model = append(modelCfg.Model, goType) + tm[Name] = modelCfg +} + +func inStrSlice(haystack []string, needle string) bool { + for _, v := range haystack { + if needle == v { + return true + } + } + + return false +} + +// findCfg searches for the config file in this directory and all parents up the tree +// looking for the closest match +func findCfg() (string, error) { + dir, err := os.Getwd() + if err != nil { + return "", errors.Wrap(err, "unable to get working dir to findCfg") + } + + cfg := findCfgInDir(dir) + + for cfg == "" && dir != filepath.Dir(dir) { + dir = filepath.Dir(dir) + cfg = findCfgInDir(dir) + } + + if cfg == "" { + return "", os.ErrNotExist + } + + return cfg, nil +} + +func findCfgInDir(dir string) string { + for _, cfgName := range cfgFilenames { + path := filepath.Join(dir, cfgName) + if _, err := os.Stat(path); err == nil { + return path + } + } + return "" +} + +func (c *Config) normalize() error { + if err := c.Model.normalize(); err != nil { + return errors.Wrap(err, "model") + } + + if err := c.Exec.normalize(); err != nil { + return errors.Wrap(err, "exec") + } + + if c.Resolver.IsDefined() { + if err := c.Resolver.normalize(); err != nil { + return errors.Wrap(err, "resolver") + } + } + + if c.Models == nil { + c.Models = TypeMap{} + } + + return nil +} + +func (c *Config) InjectBuiltins(s *ast.Schema) { + builtins := TypeMap{ + "__Directive": {Model: StringList{"github.com/99designs/gqlgen/graphql/introspection.Directive"}}, + "__DirectiveLocation": {Model: StringList{"github.com/99designs/gqlgen/graphql.String"}}, + "__Type": {Model: StringList{"github.com/99designs/gqlgen/graphql/introspection.Type"}}, + "__TypeKind": {Model: StringList{"github.com/99designs/gqlgen/graphql.String"}}, + "__Field": {Model: StringList{"github.com/99designs/gqlgen/graphql/introspection.Field"}}, + "__EnumValue": {Model: StringList{"github.com/99designs/gqlgen/graphql/introspection.EnumValue"}}, + "__InputValue": {Model: StringList{"github.com/99designs/gqlgen/graphql/introspection.InputValue"}}, + "__Schema": {Model: StringList{"github.com/99designs/gqlgen/graphql/introspection.Schema"}}, + "Float": {Model: StringList{"github.com/99designs/gqlgen/graphql.Float"}}, + "String": {Model: StringList{"github.com/99designs/gqlgen/graphql.String"}}, + "Boolean": {Model: StringList{"github.com/99designs/gqlgen/graphql.Boolean"}}, + "Int": {Model: StringList{ + "github.com/99designs/gqlgen/graphql.Int", + "github.com/99designs/gqlgen/graphql.Int32", + "github.com/99designs/gqlgen/graphql.Int64", + }}, + "ID": { + Model: StringList{ + "github.com/99designs/gqlgen/graphql.ID", + "github.com/99designs/gqlgen/graphql.IntID", + }, + }, + } + + for typeName, entry := range builtins { + if !c.Models.Exists(typeName) { + c.Models[typeName] = entry + } + } + + // These are additional types that are injected if defined in the schema as scalars. + extraBuiltins := TypeMap{ + "Time": {Model: StringList{"github.com/99designs/gqlgen/graphql.Time"}}, + "Map": {Model: StringList{"github.com/99designs/gqlgen/graphql.Map"}}, + } + + for typeName, entry := range extraBuiltins { + if t, ok := s.Types[typeName]; !c.Models.Exists(typeName) && ok && t.Kind == ast.Scalar { + c.Models[typeName] = entry + } + } +} + +func (c *Config) LoadSchema() (*ast.Schema, map[string]string, error) { + schemaStrings := map[string]string{} + + var sources []*ast.Source + + for _, filename := range c.SchemaFilename { + filename = filepath.ToSlash(filename) + var err error + var schemaRaw []byte + schemaRaw, err = ioutil.ReadFile(filename) + if err != nil { + fmt.Fprintln(os.Stderr, "unable to open schema: "+err.Error()) + os.Exit(1) + } + schemaStrings[filename] = string(schemaRaw) + sources = append(sources, &ast.Source{Name: filename, Input: schemaStrings[filename]}) + } + + schema, err := gqlparser.LoadSchema(sources...) + if err != nil { + return nil, nil, err + } + return schema, schemaStrings, nil +} + +func abs(path string) string { + absPath, err := filepath.Abs(path) + if err != nil { + panic(err) + } + return filepath.ToSlash(absPath) +} diff --git a/vendor/github.com/99designs/gqlgen/codegen/data.go b/vendor/github.com/99designs/gqlgen/codegen/data.go new file mode 100644 index 0000000000000000000000000000000000000000..f2ea70b4a4338078e2fca6335e45f3fce4a09e8e --- /dev/null +++ b/vendor/github.com/99designs/gqlgen/codegen/data.go @@ -0,0 +1,168 @@ +package codegen + +import ( + "fmt" + "sort" + + "github.com/99designs/gqlgen/codegen/config" + "github.com/pkg/errors" + "github.com/vektah/gqlparser/ast" +) + +// Data is a unified model of the code to be generated. Plugins may modify this structure to do things like implement +// resolvers or directives automatically (eg grpc, validation) +type Data struct { + Config *config.Config + Schema *ast.Schema + SchemaStr map[string]string + Directives map[string]*Directive + Objects Objects + Inputs Objects + Interfaces map[string]*Interface + ReferencedTypes map[string]*config.TypeReference + ComplexityRoots map[string]*Object + + QueryRoot *Object + MutationRoot *Object + SubscriptionRoot *Object +} + +type builder struct { + Config *config.Config + Schema *ast.Schema + SchemaStr map[string]string + Binder *config.Binder + Directives map[string]*Directive +} + +func BuildData(cfg *config.Config) (*Data, error) { + b := builder{ + Config: cfg, + } + + var err error + b.Schema, b.SchemaStr, err = cfg.LoadSchema() + if err != nil { + return nil, err + } + + err = cfg.Check() + if err != nil { + return nil, err + } + + cfg.InjectBuiltins(b.Schema) + + b.Binder, err = b.Config.NewBinder(b.Schema) + if err != nil { + return nil, err + } + + b.Directives, err = b.buildDirectives() + if err != nil { + return nil, err + } + + dataDirectives := make(map[string]*Directive) + for name, d := range b.Directives { + if !d.Builtin { + dataDirectives[name] = d + } + } + + s := Data{ + Config: cfg, + Directives: dataDirectives, + Schema: b.Schema, + SchemaStr: b.SchemaStr, + Interfaces: map[string]*Interface{}, + } + + for _, schemaType := range b.Schema.Types { + switch schemaType.Kind { + case ast.Object: + obj, err := b.buildObject(schemaType) + if err != nil { + return nil, errors.Wrap(err, "unable to build object definition") + } + + s.Objects = append(s.Objects, obj) + case ast.InputObject: + input, err := b.buildObject(schemaType) + if err != nil { + return nil, errors.Wrap(err, "unable to build input definition") + } + + s.Inputs = append(s.Inputs, input) + + case ast.Union, ast.Interface: + s.Interfaces[schemaType.Name] = b.buildInterface(schemaType) + } + } + + if s.Schema.Query != nil { + s.QueryRoot = s.Objects.ByName(s.Schema.Query.Name) + } else { + return nil, fmt.Errorf("query entry point missing") + } + + if s.Schema.Mutation != nil { + s.MutationRoot = s.Objects.ByName(s.Schema.Mutation.Name) + } + + if s.Schema.Subscription != nil { + s.SubscriptionRoot = s.Objects.ByName(s.Schema.Subscription.Name) + } + + if err := b.injectIntrospectionRoots(&s); err != nil { + return nil, err + } + + s.ReferencedTypes, err = b.buildTypes() + if err != nil { + return nil, err + } + + sort.Slice(s.Objects, func(i, j int) bool { + return s.Objects[i].Definition.Name < s.Objects[j].Definition.Name + }) + + sort.Slice(s.Inputs, func(i, j int) bool { + return s.Inputs[i].Definition.Name < s.Inputs[j].Definition.Name + }) + + return &s, nil +} + +func (b *builder) injectIntrospectionRoots(s *Data) error { + obj := s.Objects.ByName(b.Schema.Query.Name) + if obj == nil { + return fmt.Errorf("root query type must be defined") + } + + __type, err := b.buildField(obj, &ast.FieldDefinition{ + Name: "__type", + Type: ast.NamedType("__Type", nil), + Arguments: []*ast.ArgumentDefinition{ + { + Name: "name", + Type: ast.NonNullNamedType("String", nil), + }, + }, + }) + if err != nil { + return err + } + + __schema, err := b.buildField(obj, &ast.FieldDefinition{ + Name: "__schema", + Type: ast.NamedType("__Schema", nil), + }) + if err != nil { + return err + } + + obj.Fields = append(obj.Fields, __type, __schema) + + return nil +} diff --git a/vendor/github.com/99designs/gqlgen/codegen/directive.go b/vendor/github.com/99designs/gqlgen/codegen/directive.go index 8017da069acb2b72a648999f6a6c19e3e8299e2f..5a27e8ace71d0d2f4ade667d196bc5fe7c93362b 100644 --- a/vendor/github.com/99designs/gqlgen/codegen/directive.go +++ b/vendor/github.com/99designs/gqlgen/codegen/directive.go @@ -4,11 +4,101 @@ import ( "fmt" "strconv" "strings" + + "github.com/99designs/gqlgen/codegen/templates" + "github.com/pkg/errors" + "github.com/vektah/gqlparser/ast" ) type Directive struct { - Name string - Args []FieldArgument + Name string + Args []*FieldArgument + Builtin bool +} + +func (b *builder) buildDirectives() (map[string]*Directive, error) { + directives := make(map[string]*Directive, len(b.Schema.Directives)) + + for name, dir := range b.Schema.Directives { + if _, ok := directives[name]; ok { + return nil, errors.Errorf("directive with name %s already exists", name) + } + + var builtin bool + if name == "skip" || name == "include" || name == "deprecated" { + builtin = true + } + + var args []*FieldArgument + for _, arg := range dir.Arguments { + tr, err := b.Binder.TypeReference(arg.Type, nil) + if err != nil { + return nil, err + } + + newArg := &FieldArgument{ + ArgumentDefinition: arg, + TypeReference: tr, + VarName: templates.ToGoPrivate(arg.Name), + } + + if arg.DefaultValue != nil { + var err error + newArg.Default, err = arg.DefaultValue.Value(nil) + if err != nil { + return nil, errors.Errorf("default value for directive argument %s(%s) is not valid: %s", dir.Name, arg.Name, err.Error()) + } + } + args = append(args, newArg) + } + + directives[name] = &Directive{ + Name: name, + Args: args, + Builtin: builtin, + } + } + + return directives, nil +} + +func (b *builder) getDirectives(list ast.DirectiveList) ([]*Directive, error) { + dirs := make([]*Directive, len(list)) + for i, d := range list { + argValues := make(map[string]interface{}, len(d.Arguments)) + for _, da := range d.Arguments { + val, err := da.Value.Value(nil) + if err != nil { + return nil, err + } + argValues[da.Name] = val + } + def, ok := b.Directives[d.Name] + if !ok { + return nil, fmt.Errorf("directive %s not found", d.Name) + } + + var args []*FieldArgument + for _, a := range def.Args { + value := a.Default + if argValue, ok := argValues[a.Name]; ok { + value = argValue + } + args = append(args, &FieldArgument{ + ArgumentDefinition: a.ArgumentDefinition, + Value: value, + VarName: a.VarName, + TypeReference: a.TypeReference, + }) + } + dirs[i] = &Directive{ + Name: d.Name, + Args: args, + } + + } + + return dirs, nil } func (d *Directive) ArgsFunc() string { @@ -23,7 +113,28 @@ func (d *Directive) CallArgs() string { args := []string{"ctx", "obj", "n"} for _, arg := range d.Args { - args = append(args, "args["+strconv.Quote(arg.GQLName)+"].("+arg.Signature()+")") + args = append(args, "args["+strconv.Quote(arg.Name)+"].("+templates.CurrentImports.LookupType(arg.TypeReference.GO)+")") + } + + return strings.Join(args, ", ") +} + +func (d *Directive) ResolveArgs(obj string, next string) string { + args := []string{"ctx", obj, next} + + for _, arg := range d.Args { + dArg := "&" + arg.VarName + if !arg.TypeReference.IsPtr() { + if arg.Value != nil { + dArg = templates.Dump(arg.Value) + } else { + dArg = templates.Dump(arg.Default) + } + } else if arg.Value == nil && arg.Default == nil { + dArg = "nil" + } + + args = append(args, dArg) } return strings.Join(args, ", ") @@ -33,7 +144,7 @@ func (d *Directive) Declaration() string { res := ucFirst(d.Name) + " func(ctx context.Context, obj interface{}, next graphql.Resolver" for _, arg := range d.Args { - res += fmt.Sprintf(", %s %s", arg.GoVarName, arg.Signature()) + res += fmt.Sprintf(", %s %s", arg.Name, templates.CurrentImports.LookupType(arg.TypeReference.GO)) } res += ") (res interface{}, err error)" diff --git a/vendor/github.com/99designs/gqlgen/codegen/directive_build.go b/vendor/github.com/99designs/gqlgen/codegen/directive_build.go deleted file mode 100644 index af77dc441f66fc6df2b3cc40674f69feaf4c9f94..0000000000000000000000000000000000000000 --- a/vendor/github.com/99designs/gqlgen/codegen/directive_build.go +++ /dev/null @@ -1,48 +0,0 @@ -package codegen - -import ( - "sort" - - "github.com/pkg/errors" -) - -func (cfg *Config) buildDirectives(types NamedTypes) ([]*Directive, error) { - var directives []*Directive - - for name, dir := range cfg.schema.Directives { - if name == "skip" || name == "include" || name == "deprecated" { - continue - } - - var args []FieldArgument - for _, arg := range dir.Arguments { - newArg := FieldArgument{ - GQLName: arg.Name, - Type: types.getType(arg.Type), - GoVarName: sanitizeArgName(arg.Name), - } - - if !newArg.Type.IsInput && !newArg.Type.IsScalar { - return nil, errors.Errorf("%s cannot be used as argument of directive %s(%s) only input and scalar types are allowed", arg.Type, dir.Name, arg.Name) - } - - if arg.DefaultValue != nil { - var err error - newArg.Default, err = arg.DefaultValue.Value(nil) - if err != nil { - return nil, errors.Errorf("default value for directive argument %s(%s) is not valid: %s", dir.Name, arg.Name, err.Error()) - } - } - args = append(args, newArg) - } - - directives = append(directives, &Directive{ - Name: name, - Args: args, - }) - } - - sort.Slice(directives, func(i, j int) bool { return directives[i].Name < directives[j].Name }) - - return directives, nil -} diff --git a/vendor/github.com/99designs/gqlgen/codegen/enum.go b/vendor/github.com/99designs/gqlgen/codegen/enum.go deleted file mode 100644 index 7804971c02a76cc748433e0d90321d47f3033c67..0000000000000000000000000000000000000000 --- a/vendor/github.com/99designs/gqlgen/codegen/enum.go +++ /dev/null @@ -1,12 +0,0 @@ -package codegen - -type Enum struct { - *NamedType - Description string - Values []EnumValue -} - -type EnumValue struct { - Name string - Description string -} diff --git a/vendor/github.com/99designs/gqlgen/codegen/enum_build.go b/vendor/github.com/99designs/gqlgen/codegen/enum_build.go deleted file mode 100644 index 457d923f22c1381117363d6ef5829e02ddbdd440..0000000000000000000000000000000000000000 --- a/vendor/github.com/99designs/gqlgen/codegen/enum_build.go +++ /dev/null @@ -1,39 +0,0 @@ -package codegen - -import ( - "sort" - "strings" - - "github.com/99designs/gqlgen/codegen/templates" - "github.com/vektah/gqlparser/ast" -) - -func (cfg *Config) buildEnums(types NamedTypes) []Enum { - var enums []Enum - - for _, typ := range cfg.schema.Types { - namedType := types[typ.Name] - if typ.Kind != ast.Enum || strings.HasPrefix(typ.Name, "__") || namedType.IsUserDefined { - continue - } - - var values []EnumValue - for _, v := range typ.EnumValues { - values = append(values, EnumValue{v.Name, v.Description}) - } - - enum := Enum{ - NamedType: namedType, - Values: values, - Description: typ.Description, - } - enum.GoType = templates.ToCamel(enum.GQLType) - enums = append(enums, enum) - } - - sort.Slice(enums, func(i, j int) bool { - return enums[i].GQLType < enums[j].GQLType - }) - - return enums -} diff --git a/vendor/github.com/99designs/gqlgen/codegen/field.go b/vendor/github.com/99designs/gqlgen/codegen/field.go new file mode 100644 index 0000000000000000000000000000000000000000..f5f7b22139c1f53a562d0c88915aef223e299cea --- /dev/null +++ b/vendor/github.com/99designs/gqlgen/codegen/field.go @@ -0,0 +1,394 @@ +package codegen + +import ( + "fmt" + "go/types" + "log" + "reflect" + "strconv" + "strings" + + "github.com/99designs/gqlgen/codegen/config" + "github.com/99designs/gqlgen/codegen/templates" + "github.com/pkg/errors" + "github.com/vektah/gqlparser/ast" +) + +type Field struct { + *ast.FieldDefinition + + TypeReference *config.TypeReference + GoFieldType GoFieldType // The field type in go, if any + GoReceiverName string // The name of method & var receiver in go, if any + GoFieldName string // The name of the method or var in go, if any + IsResolver bool // Does this field need a resolver + Args []*FieldArgument // A list of arguments to be passed to this field + MethodHasContext bool // If this is bound to a go method, does the method also take a context + NoErr bool // If this is bound to a go method, does that method have an error as the second argument + Object *Object // A link back to the parent object + Default interface{} // The default value + Directives []*Directive +} + +func (b *builder) buildField(obj *Object, field *ast.FieldDefinition) (*Field, error) { + dirs, err := b.getDirectives(field.Directives) + if err != nil { + return nil, err + } + + f := Field{ + FieldDefinition: field, + Object: obj, + Directives: dirs, + GoFieldName: templates.ToGo(field.Name), + GoFieldType: GoFieldVariable, + GoReceiverName: "obj", + } + + if field.DefaultValue != nil { + var err error + f.Default, err = field.DefaultValue.Value(nil) + if err != nil { + return nil, errors.Errorf("default value %s is not valid: %s", field.Name, err.Error()) + } + } + + for _, arg := range field.Arguments { + newArg, err := b.buildArg(obj, arg) + if err != nil { + return nil, err + } + f.Args = append(f.Args, newArg) + } + + if err = b.bindField(obj, &f); err != nil { + f.IsResolver = true + log.Println(err.Error()) + } + + if f.IsResolver && !f.TypeReference.IsPtr() && f.TypeReference.IsStruct() { + f.TypeReference = b.Binder.PointerTo(f.TypeReference) + } + + return &f, nil +} + +func (b *builder) bindField(obj *Object, f *Field) error { + defer func() { + if f.TypeReference == nil { + tr, err := b.Binder.TypeReference(f.Type, nil) + if err != nil { + panic(err) + } + f.TypeReference = tr + } + }() + + switch { + case f.Name == "__schema": + f.GoFieldType = GoFieldMethod + f.GoReceiverName = "ec" + f.GoFieldName = "introspectSchema" + return nil + case f.Name == "__type": + f.GoFieldType = GoFieldMethod + f.GoReceiverName = "ec" + f.GoFieldName = "introspectType" + return nil + case obj.Root: + f.IsResolver = true + return nil + case b.Config.Models[obj.Name].Fields[f.Name].Resolver: + f.IsResolver = true + return nil + case obj.Type == config.MapType: + f.GoFieldType = GoFieldMap + return nil + case b.Config.Models[obj.Name].Fields[f.Name].FieldName != "": + f.GoFieldName = b.Config.Models[obj.Name].Fields[f.Name].FieldName + } + + target, err := b.findBindTarget(obj.Type.(*types.Named), f.GoFieldName) + if err != nil { + return err + } + + pos := b.Binder.ObjectPosition(target) + + switch target := target.(type) { + case nil: + objPos := b.Binder.TypePosition(obj.Type) + return fmt.Errorf( + "%s:%d adding resolver method for %s.%s, nothing matched", + objPos.Filename, + objPos.Line, + obj.Name, + f.Name, + ) + + case *types.Func: + sig := target.Type().(*types.Signature) + if sig.Results().Len() == 1 { + f.NoErr = true + } else if sig.Results().Len() != 2 { + return fmt.Errorf("method has wrong number of args") + } + params := sig.Params() + // If the first argument is the context, remove it from the comparison and set + // the MethodHasContext flag so that the context will be passed to this model's method + if params.Len() > 0 && params.At(0).Type().String() == "context.Context" { + f.MethodHasContext = true + vars := make([]*types.Var, params.Len()-1) + for i := 1; i < params.Len(); i++ { + vars[i-1] = params.At(i) + } + params = types.NewTuple(vars...) + } + + if err = b.bindArgs(f, params); err != nil { + return errors.Wrapf(err, "%s:%d", pos.Filename, pos.Line) + } + + result := sig.Results().At(0) + tr, err := b.Binder.TypeReference(f.Type, result.Type()) + if err != nil { + return err + } + + // success, args and return type match. Bind to method + f.GoFieldType = GoFieldMethod + f.GoReceiverName = "obj" + f.GoFieldName = target.Name() + f.TypeReference = tr + + return nil + + case *types.Var: + tr, err := b.Binder.TypeReference(f.Type, target.Type()) + if err != nil { + return err + } + + // success, bind to var + f.GoFieldType = GoFieldVariable + f.GoReceiverName = "obj" + f.GoFieldName = target.Name() + f.TypeReference = tr + + return nil + default: + panic(fmt.Errorf("unknown bind target %T for %s", target, f.Name)) + } +} + +// findField attempts to match the name to a struct field with the following +// priorites: +// 1. Any method with a matching name +// 2. Any Fields with a struct tag (see config.StructTag) +// 3. Any fields with a matching name +// 4. Same logic again for embedded fields +func (b *builder) findBindTarget(named *types.Named, name string) (types.Object, error) { + for i := 0; i < named.NumMethods(); i++ { + method := named.Method(i) + if !method.Exported() { + continue + } + + if !strings.EqualFold(method.Name(), name) { + continue + } + + return method, nil + } + + strukt, ok := named.Underlying().(*types.Struct) + if !ok { + return nil, fmt.Errorf("not a struct") + } + return b.findBindStructTarget(strukt, name) +} + +func (b *builder) findBindStructTarget(strukt *types.Struct, name string) (types.Object, error) { + // struct tags have the highest priority + if b.Config.StructTag != "" { + var foundField *types.Var + for i := 0; i < strukt.NumFields(); i++ { + field := strukt.Field(i) + if !field.Exported() { + continue + } + tags := reflect.StructTag(strukt.Tag(i)) + if val, ok := tags.Lookup(b.Config.StructTag); ok && equalFieldName(val, name) { + if foundField != nil { + return nil, errors.Errorf("tag %s is ambigious; multiple fields have the same tag value of %s", b.Config.StructTag, val) + } + + foundField = field + } + } + if foundField != nil { + return foundField, nil + } + } + + // Then matching field names + for i := 0; i < strukt.NumFields(); i++ { + field := strukt.Field(i) + if !field.Exported() { + continue + } + if equalFieldName(field.Name(), name) { // aqui! + return field, nil + } + } + + // Then look in embedded structs + for i := 0; i < strukt.NumFields(); i++ { + field := strukt.Field(i) + if !field.Exported() { + continue + } + + if !field.Anonymous() { + continue + } + + fieldType := field.Type() + if ptr, ok := fieldType.(*types.Pointer); ok { + fieldType = ptr.Elem() + } + + switch fieldType := fieldType.(type) { + case *types.Named: + f, err := b.findBindTarget(fieldType, name) + if err != nil { + return nil, err + } + if f != nil { + return f, nil + } + case *types.Struct: + f, err := b.findBindStructTarget(fieldType, name) + if err != nil { + return nil, err + } + if f != nil { + return f, nil + } + default: + panic(fmt.Errorf("unknown embedded field type %T", field.Type())) + } + } + + return nil, nil +} + +func (f *Field) HasDirectives() bool { + return len(f.Directives) > 0 +} + +func (f *Field) IsReserved() bool { + return strings.HasPrefix(f.Name, "__") +} + +func (f *Field) IsMethod() bool { + return f.GoFieldType == GoFieldMethod +} + +func (f *Field) IsVariable() bool { + return f.GoFieldType == GoFieldVariable +} + +func (f *Field) IsMap() bool { + return f.GoFieldType == GoFieldMap +} + +func (f *Field) IsConcurrent() bool { + if f.Object.DisableConcurrency { + return false + } + return f.MethodHasContext || f.IsResolver +} + +func (f *Field) GoNameUnexported() string { + return templates.ToGoPrivate(f.Name) +} + +func (f *Field) ShortInvocation() string { + return fmt.Sprintf("%s().%s(%s)", f.Object.Definition.Name, f.GoFieldName, f.CallArgs()) +} + +func (f *Field) ArgsFunc() string { + if len(f.Args) == 0 { + return "" + } + + return "field_" + f.Object.Definition.Name + "_" + f.Name + "_args" +} + +func (f *Field) ResolverType() string { + if !f.IsResolver { + return "" + } + + return fmt.Sprintf("%s().%s(%s)", f.Object.Definition.Name, f.GoFieldName, f.CallArgs()) +} + +func (f *Field) ShortResolverDeclaration() string { + res := "(ctx context.Context" + + if !f.Object.Root { + res += fmt.Sprintf(", obj *%s", templates.CurrentImports.LookupType(f.Object.Type)) + } + for _, arg := range f.Args { + res += fmt.Sprintf(", %s %s", arg.VarName, templates.CurrentImports.LookupType(arg.TypeReference.GO)) + } + + result := templates.CurrentImports.LookupType(f.TypeReference.GO) + if f.Object.Stream { + result = "<-chan " + result + } + + res += fmt.Sprintf(") (%s, error)", result) + return res +} + +func (f *Field) ComplexitySignature() string { + res := fmt.Sprintf("func(childComplexity int") + for _, arg := range f.Args { + res += fmt.Sprintf(", %s %s", arg.VarName, templates.CurrentImports.LookupType(arg.TypeReference.GO)) + } + res += ") int" + return res +} + +func (f *Field) ComplexityArgs() string { + var args []string + for _, arg := range f.Args { + args = append(args, "args["+strconv.Quote(arg.Name)+"].("+templates.CurrentImports.LookupType(arg.TypeReference.GO)+")") + } + + return strings.Join(args, ", ") +} + +func (f *Field) CallArgs() string { + var args []string + + if f.IsResolver { + args = append(args, "rctx") + + if !f.Object.Root { + args = append(args, "obj") + } + } else { + if f.MethodHasContext { + args = append(args, "ctx") + } + } + + for _, arg := range f.Args { + args = append(args, "args["+strconv.Quote(arg.Name)+"].("+templates.CurrentImports.LookupType(arg.TypeReference.GO)+")") + } + + return strings.Join(args, ", ") +} diff --git a/vendor/github.com/99designs/gqlgen/codegen/templates/field.gotpl b/vendor/github.com/99designs/gqlgen/codegen/field.gotpl similarity index 55% rename from vendor/github.com/99designs/gqlgen/codegen/templates/field.gotpl rename to vendor/github.com/99designs/gqlgen/codegen/field.gotpl index 3df847fa980754486cba24e2c4b9b9ba09f6df56..9718a08aadf7016ec714ef450ee727c75e891842 100644 --- a/vendor/github.com/99designs/gqlgen/codegen/templates/field.gotpl +++ b/vendor/github.com/99designs/gqlgen/codegen/field.gotpl @@ -1,19 +1,19 @@ -{{ $field := . }} -{{ $object := $field.Object }} +{{- range $object := .Objects }}{{- range $field := $object.Fields }} {{- if $object.Stream }} - func (ec *executionContext) _{{$object.GQLType}}_{{$field.GQLName}}(ctx context.Context, field graphql.CollectedField) func() graphql.Marshaler { + func (ec *executionContext) _{{$object.Name}}_{{$field.Name}}(ctx context.Context, field graphql.CollectedField) func() graphql.Marshaler { + ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ + Field: field, + Args: nil, + }) {{- if $field.Args }} rawArgs := field.ArgumentMap(ec.Variables) - args, err := {{ $field.ArgsFunc }}(rawArgs) + args, err := ec.{{ $field.ArgsFunc }}(ctx,rawArgs) if err != nil { ec.Error(ctx, err) return nil } {{- end }} - ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ - Field: field, - }) // FIXME: subscriptions are missing request middleware stack https://github.com/99designs/gqlgen/issues/259 // and Tracer stack rctx := ctx @@ -27,35 +27,51 @@ if !ok { return nil } - var out graphql.OrderedMap - out.Add(field.Alias, func() graphql.Marshaler { {{ $field.WriteJson }} }()) - return &out + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte{'{'}) + graphql.MarshalString(field.Alias).MarshalGQL(w) + w.Write([]byte{':'}) + ec.{{ $field.TypeReference.MarshalFunc }}(ctx, field.Selections, res).MarshalGQL(w) + w.Write([]byte{'}'}) + }) } } {{ else }} - // nolint: vetshadow - func (ec *executionContext) _{{$object.GQLType}}_{{$field.GQLName}}(ctx context.Context, field graphql.CollectedField, {{if not $object.Root}}obj *{{$object.FullName}}{{end}}) graphql.Marshaler { + func (ec *executionContext) _{{$object.Name}}_{{$field.Name}}(ctx context.Context, field graphql.CollectedField{{ if not $object.Root }}, obj {{$object.Reference | ref}}{{end}}) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func () { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: {{$object.Name|quote}}, + Field: field, + Args: nil, + IsMethod: {{or $field.IsMethod $field.IsResolver}}, + } + ctx = graphql.WithResolverContext(ctx, rctx) {{- if $field.Args }} rawArgs := field.ArgumentMap(ec.Variables) - args, err := {{ $field.ArgsFunc }}(rawArgs) + args, err := ec.{{ $field.ArgsFunc }}(ctx,rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } + rctx.Args = args {{- end }} - rctx := &graphql.ResolverContext{ - Object: {{$object.GQLType|quote}}, - Args: {{if $field.Args }}args{{else}}nil{{end}}, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, {{if $object.Root}}nil{{else}}obj{{end}}, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children {{- if $field.IsResolver }} return ec.resolvers.{{ $field.ShortInvocation }} + {{- else if $field.IsMap }} + switch v := {{$field.GoReceiverName}}[{{$field.Name|quote}}].(type) { + case {{$field.TypeReference.GO | ref}}: + return v, nil + case {{$field.TypeReference.Elem.GO | ref}}: + return &v, nil + case nil: + return ({{$field.TypeReference.GO | ref}})(nil), nil + default: + return nil, fmt.Errorf("unexpected type %T for field %s", v, {{ $field.Name | quote}}) + } {{- else if $field.IsMethod }} {{- if $field.NoErr }} return {{$field.GoReceiverName}}.{{$field.GoFieldName}}({{ $field.CallArgs }}), nil @@ -67,16 +83,18 @@ {{- end }} }) if resTmp == nil { - {{- if $field.ASTType.NonNull }} + {{- if $field.TypeReference.GQL.NonNull }} if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") } {{- end }} return graphql.Null } - res := resTmp.({{$field.Signature}}) + res := resTmp.({{$field.TypeReference.GO | ref}}) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - {{ $field.WriteJson }} + return ec.{{ $field.TypeReference.MarshalFunc }}(ctx, field.Selections, res) } {{ end }} + +{{- end }}{{- end}} diff --git a/vendor/github.com/99designs/gqlgen/codegen/generate.go b/vendor/github.com/99designs/gqlgen/codegen/generate.go new file mode 100644 index 0000000000000000000000000000000000000000..eafa3f87434573878137b46652a0a057ca7e2c6a --- /dev/null +++ b/vendor/github.com/99designs/gqlgen/codegen/generate.go @@ -0,0 +1,15 @@ +package codegen + +import ( + "github.com/99designs/gqlgen/codegen/templates" +) + +func GenerateCode(data *Data) error { + return templates.Render(templates.Options{ + PackageName: data.Config.Exec.Package, + Filename: data.Config.Exec.Filename, + Data: data, + RegionTags: true, + GeneratedHeader: true, + }) +} diff --git a/vendor/github.com/99designs/gqlgen/codegen/templates/generated.gotpl b/vendor/github.com/99designs/gqlgen/codegen/generated!.gotpl similarity index 67% rename from vendor/github.com/99designs/gqlgen/codegen/templates/generated.gotpl rename to vendor/github.com/99designs/gqlgen/codegen/generated!.gotpl index a37a1613e9cb64071b3ef78c033edc635dcc4b69..dce8ce977c71c417ef127c596da55ef4d95e58db 100644 --- a/vendor/github.com/99designs/gqlgen/codegen/templates/generated.gotpl +++ b/vendor/github.com/99designs/gqlgen/codegen/generated!.gotpl @@ -1,24 +1,17 @@ -// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. +{{ reserveImport "context" }} +{{ reserveImport "fmt" }} +{{ reserveImport "io" }} +{{ reserveImport "strconv" }} +{{ reserveImport "time" }} +{{ reserveImport "sync" }} +{{ reserveImport "errors" }} +{{ reserveImport "bytes" }} -package {{ .PackageName }} +{{ reserveImport "github.com/vektah/gqlparser" }} +{{ reserveImport "github.com/vektah/gqlparser/ast" }} +{{ reserveImport "github.com/99designs/gqlgen/graphql" }} +{{ reserveImport "github.com/99designs/gqlgen/graphql/introspection" }} -import ( - %%%IMPORTS%%% - - {{ reserveImport "context" }} - {{ reserveImport "fmt" }} - {{ reserveImport "io" }} - {{ reserveImport "strconv" }} - {{ reserveImport "time" }} - {{ reserveImport "sync" }} - {{ reserveImport "errors" }} - {{ reserveImport "bytes" }} - - {{ reserveImport "github.com/vektah/gqlparser" }} - {{ reserveImport "github.com/vektah/gqlparser/ast" }} - {{ reserveImport "github.com/99designs/gqlgen/graphql" }} - {{ reserveImport "github.com/99designs/gqlgen/graphql/introspection" }} -) // NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface. func NewExecutableSchema(cfg Config) graphql.ExecutableSchema { @@ -38,7 +31,7 @@ type Config struct { type ResolverRoot interface { {{- range $object := .Objects -}} {{ if $object.HasResolvers -}} - {{$object.GQLType}}() {{$object.GQLType}}Resolver + {{$object.Name}}() {{$object.Name}}Resolver {{ end }} {{- end }} } @@ -52,10 +45,10 @@ type DirectiveRoot struct { type ComplexityRoot struct { {{ range $object := .Objects }} {{ if not $object.IsReserved -}} - {{ $object.GQLType|toCamel }} struct { - {{ range $field := $object.Fields -}} + {{ $object.Name|go }} struct { + {{ range $field := $object.UniqueFields -}} {{ if not $field.IsReserved -}} - {{ $field.GQLName|toCamel }} {{ $field.ComplexitySignature }} + {{ $field.GoFieldName }} {{ $field.ComplexitySignature }} {{ end }} {{- end }} } @@ -65,32 +58,16 @@ type ComplexityRoot struct { {{ range $object := .Objects -}} {{ if $object.HasResolvers }} - type {{$object.GQLType}}Resolver interface { + type {{$object.Name}}Resolver interface { {{ range $field := $object.Fields -}} - {{ $field.ShortResolverDeclaration }} + {{- if $field.IsResolver }} + {{- $field.GoFieldName}}{{ $field.ShortResolverDeclaration }} + {{- end }} {{ end }} } {{- end }} {{- end }} -{{ range $object := .Objects -}} - {{ range $field := $object.Fields -}} - {{ if $field.Args }} - func {{ $field.ArgsFunc }}(rawArgs map[string]interface{}) (map[string]interface{}, error) { - {{ template "args.gotpl" $field.Args }} - } - {{ end }} - {{ end }} -{{- end }} - -{{ range $directive := .Directives }} - {{ if $directive.Args }} - func {{ $directive.ArgsFunc }}(rawArgs map[string]interface{}) (map[string]interface{}, error) { - {{ template "args.gotpl" $directive.Args }} - } - {{ end }} -{{ end }} - type executableSchema struct { resolvers ResolverRoot directives DirectiveRoot @@ -102,22 +79,24 @@ func (e *executableSchema) Schema() *ast.Schema { } func (e *executableSchema) Complexity(typeName, field string, childComplexity int, rawArgs map[string]interface{}) (int, bool) { + ec := executionContext{nil, e} + _ = ec switch typeName + "." + field { {{ range $object := .Objects }} {{ if not $object.IsReserved }} - {{ range $field := $object.Fields }} + {{ range $field := $object.UniqueFields }} {{ if not $field.IsReserved }} - case "{{$object.GQLType}}.{{$field.GQLName}}": - if e.complexity.{{$object.GQLType|toCamel}}.{{$field.GQLName|toCamel}} == nil { + case "{{$object.Name}}.{{$field.GoFieldName}}": + if e.complexity.{{$object.Name|go}}.{{$field.GoFieldName}} == nil { break } {{ if $field.Args }} - args, err := {{ $field.ArgsFunc }}(rawArgs) + args, err := ec.{{ $field.ArgsFunc }}(context.TODO(),rawArgs) if err != nil { return 0, false } {{ end }} - return e.complexity.{{$object.GQLType|toCamel}}.{{$field.GQLName|toCamel}}(childComplexity{{if $field.Args}}, {{$field.ComplexityArgs}} {{end}}), true + return e.complexity.{{$object.Name|go}}.{{$field.GoFieldName}}(childComplexity{{if $field.Args}}, {{$field.ComplexityArgs}} {{end}}), true {{ end }} {{ end }} {{ end }} @@ -131,7 +110,7 @@ func (e *executableSchema) Query(ctx context.Context, op *ast.OperationDefinitio ec := executionContext{graphql.GetRequestContext(ctx), e} buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte { - data := ec._{{.QueryRoot.GQLType}}(ctx, op.SelectionSet) + data := ec._{{.QueryRoot.Name}}(ctx, op.SelectionSet) var buf bytes.Buffer data.MarshalGQL(&buf) return buf.Bytes() @@ -140,7 +119,8 @@ func (e *executableSchema) Query(ctx context.Context, op *ast.OperationDefinitio return &graphql.Response{ Data: buf, Errors: ec.Errors, - Extensions: ec.Extensions, } + Extensions: ec.Extensions, + } {{- else }} return graphql.ErrorResponse(ctx, "queries are not supported") {{- end }} @@ -151,7 +131,7 @@ func (e *executableSchema) Mutation(ctx context.Context, op *ast.OperationDefini ec := executionContext{graphql.GetRequestContext(ctx), e} buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte { - data := ec._{{.MutationRoot.GQLType}}(ctx, op.SelectionSet) + data := ec._{{.MutationRoot.Name}}(ctx, op.SelectionSet) var buf bytes.Buffer data.MarshalGQL(&buf) return buf.Bytes() @@ -171,7 +151,7 @@ func (e *executableSchema) Subscription(ctx context.Context, op *ast.OperationDe {{- if .SubscriptionRoot }} ec := executionContext{graphql.GetRequestContext(ctx), e} - next := ec._{{.SubscriptionRoot.GQLType}}(ctx, op.SelectionSet) + next := ec._{{.SubscriptionRoot.Name}}(ctx, op.SelectionSet) if ec.Errors != nil { return graphql.OneShot(&graphql.Response{Data: []byte("null"), Errors: ec.Errors}) } @@ -209,22 +189,6 @@ type executionContext struct { *executableSchema } -{{- range $object := .Objects }} - {{ template "object.gotpl" $object }} - - {{- range $field := $object.Fields }} - {{ template "field.gotpl" $field }} - {{ end }} -{{- end}} - -{{- range $interface := .Interfaces }} - {{ template "interface.gotpl" $interface }} -{{- end }} - -{{- range $input := .Inputs }} - {{ template "input.gotpl" $input }} -{{- end }} - func (ec *executionContext) FieldMiddleware(ctx context.Context, obj interface{}, next graphql.Resolver) (ret interface{}) { defer func() { if r := recover(); r != nil { @@ -241,7 +205,7 @@ func (ec *executionContext) FieldMiddleware(ctx context.Context, obj interface{} if ec.directives.{{$directive.Name|ucFirst}} != nil { {{- if $directive.Args }} rawArgs := d.ArgumentMap(ec.Variables) - args, err := {{ $directive.ArgsFunc }}(rawArgs) + args, err := ec.{{ $directive.ArgsFunc }}(ctx,rawArgs) if err != nil { ec.Error(ctx, err) return nil @@ -279,7 +243,7 @@ func (ec *executionContext) introspectType(name string) (*introspection.Type, er } var parsedSchema = gqlparser.MustLoadSchema( - {{- range $filename, $schema := .SchemaRaw }} + {{- range $filename, $schema := .SchemaStr }} &ast.Source{Name: {{$filename|quote}}, Input: {{$schema|rawQuote}}}, {{- end }} ) diff --git a/vendor/github.com/99designs/gqlgen/codegen/input.gotpl b/vendor/github.com/99designs/gqlgen/codegen/input.gotpl new file mode 100644 index 0000000000000000000000000000000000000000..c8ac7ad3a5d50f6fb9d6926760b2a81ad5c970e4 --- /dev/null +++ b/vendor/github.com/99designs/gqlgen/codegen/input.gotpl @@ -0,0 +1,56 @@ +{{- range $input := .Inputs }} + {{- if not .HasUnmarshal }} + func (ec *executionContext) unmarshalInput{{ .Name }}(ctx context.Context, v interface{}) ({{.Type | ref}}, error) { + var it {{.Type | ref}} + var asMap = v.(map[string]interface{}) + {{ range $field := .Fields}} + {{- if $field.Default}} + if _, present := asMap[{{$field.Name|quote}}] ; !present { + asMap[{{$field.Name|quote}}] = {{ $field.Default | dump }} + } + {{- end}} + {{- end }} + + for k, v := range asMap { + switch k { + {{- range $field := .Fields }} + case {{$field.Name|quote}}: + var err error + {{- if $field.Directives }} + getField0 := func(ctx context.Context) (interface{}, error) { return ec.{{ $field.TypeReference.UnmarshalFunc }}(ctx, v) } + + {{- range $i, $directive := $field.Directives }} + getField{{add $i 1}} := func(ctx context.Context) (res interface{}, err error) { + {{- range $dArg := $directive.Args }} + {{- if and $dArg.TypeReference.IsPtr ( notNil "Value" $dArg ) }} + {{ $dArg.VarName }} := {{ $dArg.Value | dump }} + {{- end }} + {{- end }} + n := getField{{$i}} + return ec.directives.{{$directive.Name|ucFirst}}({{$directive.ResolveArgs "it" "n" }}) + } + {{- end }} + + tmp, err := getField{{$field.Directives|len}}(ctx) + if err != nil { + return it, err + } + if data, ok := tmp.({{ $field.TypeReference.GO | ref }}) ; ok { + it.{{$field.GoFieldName}} = data + } else { + return it, fmt.Errorf(`unexpected type %T from directive, should be {{ $field.TypeReference.GO }}`, tmp) + } + {{- else }} + it.{{$field.GoFieldName}}, err = ec.{{ $field.TypeReference.UnmarshalFunc }}(ctx, v) + if err != nil { + return it, err + } + {{- end }} + {{- end }} + } + } + + return it, nil + } + {{- end }} +{{ end }} diff --git a/vendor/github.com/99designs/gqlgen/codegen/input_build.go b/vendor/github.com/99designs/gqlgen/codegen/input_build.go deleted file mode 100644 index 70fa564da97ebe9ae1cd136959092426430c8135..0000000000000000000000000000000000000000 --- a/vendor/github.com/99designs/gqlgen/codegen/input_build.go +++ /dev/null @@ -1,96 +0,0 @@ -package codegen - -import ( - "go/types" - "sort" - - "github.com/pkg/errors" - "github.com/vektah/gqlparser/ast" - "golang.org/x/tools/go/loader" -) - -func (cfg *Config) buildInputs(namedTypes NamedTypes, prog *loader.Program) (Objects, error) { - var inputs Objects - - for _, typ := range cfg.schema.Types { - switch typ.Kind { - case ast.InputObject: - input, err := cfg.buildInput(namedTypes, typ) - if err != nil { - return nil, err - } - - def, err := findGoType(prog, input.Package, input.GoType) - if err != nil { - return nil, errors.Wrap(err, "cannot find type") - } - if def != nil { - input.Marshaler = buildInputMarshaler(typ, def) - bindErrs := bindObject(def.Type(), input, cfg.StructTag) - if len(bindErrs) > 0 { - return nil, bindErrs - } - } - - inputs = append(inputs, input) - } - } - - sort.Slice(inputs, func(i, j int) bool { - return inputs[i].GQLType < inputs[j].GQLType - }) - - return inputs, nil -} - -func (cfg *Config) buildInput(types NamedTypes, typ *ast.Definition) (*Object, error) { - obj := &Object{NamedType: types[typ.Name]} - typeEntry, entryExists := cfg.Models[typ.Name] - - for _, field := range typ.Fields { - newField := Field{ - GQLName: field.Name, - Type: types.getType(field.Type), - Object: obj, - } - - if entryExists { - if typeField, ok := typeEntry.Fields[field.Name]; ok { - newField.GoFieldName = typeField.FieldName - } - } - - if field.DefaultValue != nil { - var err error - newField.Default, err = field.DefaultValue.Value(nil) - if err != nil { - return nil, errors.Errorf("default value for %s.%s is not valid: %s", typ.Name, field.Name, err.Error()) - } - } - - if !newField.Type.IsInput && !newField.Type.IsScalar { - return nil, errors.Errorf("%s cannot be used as a field of %s. only input and scalar types are allowed", newField.GQLType, obj.GQLType) - } - - obj.Fields = append(obj.Fields, newField) - - } - return obj, nil -} - -// if user has implemented an UnmarshalGQL method on the input type manually, use it -// otherwise we will generate one. -func buildInputMarshaler(typ *ast.Definition, def types.Object) *Ref { - switch def := def.(type) { - case *types.TypeName: - namedType := def.Type().(*types.Named) - for i := 0; i < namedType.NumMethods(); i++ { - method := namedType.Method(i) - if method.Name() == "UnmarshalGQL" { - return nil - } - } - } - - return &Ref{GoType: typ.Name} -} diff --git a/vendor/github.com/99designs/gqlgen/codegen/interface.go b/vendor/github.com/99designs/gqlgen/codegen/interface.go index 2de0c88a9b3de01c0f2ddd9bde267a280f4e774e..f59e8ed07154ec21afef1fe0ce613a759370bfc4 100644 --- a/vendor/github.com/99designs/gqlgen/codegen/interface.go +++ b/vendor/github.com/99designs/gqlgen/codegen/interface.go @@ -1,13 +1,63 @@ package codegen -type Interface struct { - *NamedType +import ( + "go/types" + + "github.com/vektah/gqlparser/ast" +) +type Interface struct { + *ast.Definition + Type types.Type Implementors []InterfaceImplementor + InTypemap bool } type InterfaceImplementor struct { - ValueReceiver bool + *ast.Definition + + Interface *Interface + Type types.Type +} + +func (b *builder) buildInterface(typ *ast.Definition) *Interface { + obj, err := b.Binder.DefaultUserObject(typ.Name) + if err != nil { + panic(err) + } + + i := &Interface{ + Definition: typ, + Type: obj, + InTypemap: b.Config.Models.UserDefined(typ.Name), + } + + for _, implementor := range b.Schema.GetPossibleTypes(typ) { + obj, err := b.Binder.DefaultUserObject(implementor.Name) + if err != nil { + panic(err) + } + + i.Implementors = append(i.Implementors, InterfaceImplementor{ + Definition: implementor, + Type: obj, + Interface: i, + }) + } + + return i +} + +func (i *InterfaceImplementor) ValueReceiver() bool { + interfaceType, err := findGoInterface(i.Interface.Type) + if interfaceType == nil || err != nil { + return true + } + + implementorType, err := findGoNamedType(i.Type) + if implementorType == nil || err != nil { + return true + } - *NamedType + return types.Implements(implementorType, interfaceType) } diff --git a/vendor/github.com/99designs/gqlgen/codegen/interface.gotpl b/vendor/github.com/99designs/gqlgen/codegen/interface.gotpl new file mode 100644 index 0000000000000000000000000000000000000000..81a5807653ca3a4a01843720b533d6e8a3cb36fd --- /dev/null +++ b/vendor/github.com/99designs/gqlgen/codegen/interface.gotpl @@ -0,0 +1,20 @@ +{{- range $interface := .Interfaces }} + +func (ec *executionContext) _{{$interface.Name}}(ctx context.Context, sel ast.SelectionSet, obj *{{$interface.Type | ref}}) graphql.Marshaler { + switch obj := (*obj).(type) { + case nil: + return graphql.Null + {{- range $implementor := $interface.Implementors }} + {{- if $implementor.ValueReceiver }} + case {{$implementor.Type | ref}}: + return ec._{{$implementor.Name}}(ctx, sel, &obj) + {{- end}} + case *{{$implementor.Type | ref}}: + return ec._{{$implementor.Name}}(ctx, sel, obj) + {{- end }} + default: + panic(fmt.Errorf("unexpected type %T", obj)) + } +} + +{{- end }} diff --git a/vendor/github.com/99designs/gqlgen/codegen/interface_build.go b/vendor/github.com/99designs/gqlgen/codegen/interface_build.go deleted file mode 100644 index 92052ba6b99ceed709ad7ca1ed17ce6350eae10a..0000000000000000000000000000000000000000 --- a/vendor/github.com/99designs/gqlgen/codegen/interface_build.go +++ /dev/null @@ -1,53 +0,0 @@ -package codegen - -import ( - "go/types" - "sort" - - "github.com/vektah/gqlparser/ast" - "golang.org/x/tools/go/loader" -) - -func (cfg *Config) buildInterfaces(types NamedTypes, prog *loader.Program) []*Interface { - var interfaces []*Interface - for _, typ := range cfg.schema.Types { - if typ.Kind == ast.Union || typ.Kind == ast.Interface { - interfaces = append(interfaces, cfg.buildInterface(types, typ, prog)) - } - } - - sort.Slice(interfaces, func(i, j int) bool { - return interfaces[i].GQLType < interfaces[j].GQLType - }) - - return interfaces -} - -func (cfg *Config) buildInterface(types NamedTypes, typ *ast.Definition, prog *loader.Program) *Interface { - i := &Interface{NamedType: types[typ.Name]} - - for _, implementor := range cfg.schema.GetPossibleTypes(typ) { - t := types[implementor.Name] - - i.Implementors = append(i.Implementors, InterfaceImplementor{ - NamedType: t, - ValueReceiver: cfg.isValueReceiver(types[typ.Name], t, prog), - }) - } - - return i -} - -func (cfg *Config) isValueReceiver(intf *NamedType, implementor *NamedType, prog *loader.Program) bool { - interfaceType, err := findGoInterface(prog, intf.Package, intf.GoType) - if interfaceType == nil || err != nil { - return true - } - - implementorType, err := findGoNamedType(prog, implementor.Package, implementor.GoType) - if implementorType == nil || err != nil { - return true - } - - return types.Implements(implementorType, interfaceType) -} diff --git a/vendor/github.com/99designs/gqlgen/codegen/model.go b/vendor/github.com/99designs/gqlgen/codegen/model.go deleted file mode 100644 index bcdc8703a6c49fa87c955c9b142811f10c202da9..0000000000000000000000000000000000000000 --- a/vendor/github.com/99designs/gqlgen/codegen/model.go +++ /dev/null @@ -1,17 +0,0 @@ -package codegen - -type Model struct { - *NamedType - Description string - Fields []ModelField - Implements []*NamedType -} - -type ModelField struct { - *Type - GQLName string - GoFieldName string - GoFKName string - GoFKType string - Description string -} diff --git a/vendor/github.com/99designs/gqlgen/codegen/models_build.go b/vendor/github.com/99designs/gqlgen/codegen/models_build.go deleted file mode 100644 index 56d2ff1fae1fbbbce4e933414abc8abb0836ed04..0000000000000000000000000000000000000000 --- a/vendor/github.com/99designs/gqlgen/codegen/models_build.go +++ /dev/null @@ -1,91 +0,0 @@ -package codegen - -import ( - "sort" - - "github.com/vektah/gqlparser/ast" - "golang.org/x/tools/go/loader" -) - -func (cfg *Config) buildModels(types NamedTypes, prog *loader.Program) ([]Model, error) { - var models []Model - - for _, typ := range cfg.schema.Types { - var model Model - switch typ.Kind { - case ast.Object: - obj, err := cfg.buildObject(types, typ) - if err != nil { - return nil, err - } - if obj.Root || obj.IsUserDefined { - continue - } - model = cfg.obj2Model(obj) - case ast.InputObject: - obj, err := cfg.buildInput(types, typ) - if err != nil { - return nil, err - } - if obj.IsUserDefined { - continue - } - model = cfg.obj2Model(obj) - case ast.Interface, ast.Union: - intf := cfg.buildInterface(types, typ, prog) - if intf.IsUserDefined { - continue - } - model = int2Model(intf) - default: - continue - } - model.Description = typ.Description // It's this or change both obj2Model and buildObject - - models = append(models, model) - } - - sort.Slice(models, func(i, j int) bool { - return models[i].GQLType < models[j].GQLType - }) - - return models, nil -} - -func (cfg *Config) obj2Model(obj *Object) Model { - model := Model{ - NamedType: obj.NamedType, - Implements: obj.Implements, - Fields: []ModelField{}, - } - - model.GoType = ucFirst(obj.GQLType) - model.Marshaler = &Ref{GoType: obj.GoType} - - for i := range obj.Fields { - field := &obj.Fields[i] - mf := ModelField{Type: field.Type, GQLName: field.GQLName} - - if field.GoFieldName != "" { - mf.GoFieldName = field.GoFieldName - } else { - mf.GoFieldName = field.GoNameExported() - } - - model.Fields = append(model.Fields, mf) - } - - return model -} - -func int2Model(obj *Interface) Model { - model := Model{ - NamedType: obj.NamedType, - Fields: []ModelField{}, - } - - model.GoType = ucFirst(obj.GQLType) - model.Marshaler = &Ref{GoType: obj.GoType} - - return model -} diff --git a/vendor/github.com/99designs/gqlgen/codegen/object.go b/vendor/github.com/99designs/gqlgen/codegen/object.go index 656af297a07aa4dff71bcb37de0523bddf4fa14f..539c3164c5086f583ed923151231b80d85da4f05 100644 --- a/vendor/github.com/99designs/gqlgen/codegen/object.go +++ b/vendor/github.com/99designs/gqlgen/codegen/object.go @@ -1,13 +1,13 @@ package codegen import ( - "bytes" - "fmt" + "go/types" "strconv" "strings" - "text/template" "unicode" + "github.com/99designs/gqlgen/codegen/config" + "github.com/pkg/errors" "github.com/vektah/gqlparser/ast" ) @@ -17,337 +17,150 @@ const ( GoFieldUndefined GoFieldType = iota GoFieldMethod GoFieldVariable + GoFieldMap ) type Object struct { - *NamedType + *ast.Definition - Fields []Field - Satisfies []string - Implements []*NamedType - ResolverInterface *Ref + Type types.Type + ResolverInterface types.Type Root bool + Fields []*Field + Implements []*ast.Definition DisableConcurrency bool Stream bool + Directives []*Directive } -type Field struct { - *Type - Description string // Description of a field - GQLName string // The name of the field in graphql - GoFieldType GoFieldType // The field type in go, if any - GoReceiverName string // The name of method & var receiver in go, if any - GoFieldName string // The name of the method or var in go, if any - Args []FieldArgument // A list of arguments to be passed to this field - ForceResolver bool // Should be emit Resolver method - MethodHasContext bool // If this is bound to a go method, does the method also take a context - NoErr bool // If this is bound to a go method, does that method have an error as the second argument - Object *Object // A link back to the parent object - Default interface{} // The default value -} - -type FieldArgument struct { - *Type - - GQLName string // The name of the argument in graphql - GoVarName string // The name of the var in go - Object *Object // A link back to the parent object - Default interface{} // The default value -} - -type Objects []*Object - -func (o *Object) Implementors() string { - satisfiedBy := strconv.Quote(o.GQLType) - for _, s := range o.Satisfies { - satisfiedBy += ", " + strconv.Quote(s) - } - return "[]string{" + satisfiedBy + "}" -} - -func (o *Object) HasResolvers() bool { - for _, f := range o.Fields { - if f.IsResolver() { - return true +func (b *builder) buildObject(typ *ast.Definition) (*Object, error) { + dirs, err := b.getDirectives(typ.Directives) + if err != nil { + return nil, errors.Wrap(err, typ.Name) + } + + obj := &Object{ + Definition: typ, + Root: b.Schema.Query == typ || b.Schema.Mutation == typ || b.Schema.Subscription == typ, + DisableConcurrency: typ == b.Schema.Mutation, + Stream: typ == b.Schema.Subscription, + Directives: dirs, + ResolverInterface: types.NewNamed( + types.NewTypeName(0, b.Config.Exec.Pkg(), typ.Name+"Resolver", nil), + nil, + nil, + ), + } + + if !obj.Root { + goObject, err := b.Binder.DefaultUserObject(typ.Name) + if err != nil { + return nil, err } + obj.Type = goObject } - return false -} -func (o *Object) IsConcurrent() bool { - for _, f := range o.Fields { - if f.IsConcurrent() { - return true - } + for _, intf := range b.Schema.GetImplements(typ) { + obj.Implements = append(obj.Implements, b.Schema.Types[intf.Name]) } - return false -} - -func (o *Object) IsReserved() bool { - return strings.HasPrefix(o.GQLType, "__") -} -func (f *Field) IsResolver() bool { - return f.GoFieldName == "" -} - -func (f *Field) IsReserved() bool { - return strings.HasPrefix(f.GQLName, "__") -} - -func (f *Field) IsMethod() bool { - return f.GoFieldType == GoFieldMethod -} + for _, field := range typ.Fields { + if strings.HasPrefix(field.Name, "__") { + continue + } -func (f *Field) IsVariable() bool { - return f.GoFieldType == GoFieldVariable -} + var f *Field + f, err = b.buildField(obj, field) + if err != nil { + return nil, err + } -func (f *Field) IsConcurrent() bool { - if f.Object.DisableConcurrency { - return false + obj.Fields = append(obj.Fields, f) } - return f.MethodHasContext || f.IsResolver() -} -func (f *Field) GoNameExported() string { - return lintName(ucFirst(f.GQLName)) + return obj, nil } -func (f *Field) GoNameUnexported() string { - return lintName(f.GQLName) -} - -func (f *Field) ShortInvocation() string { - if !f.IsResolver() { - return "" +func (o *Object) Reference() types.Type { + switch o.Type.(type) { + case *types.Pointer, *types.Slice, *types.Map: + return o.Type } - return fmt.Sprintf("%s().%s(%s)", f.Object.GQLType, f.GoNameExported(), f.CallArgs()) + return types.NewPointer(o.Type) } -func (f *Field) ArgsFunc() string { - if len(f.Args) == 0 { - return "" - } - - return "field_" + f.Object.GQLType + "_" + f.GQLName + "_args" -} +type Objects []*Object -func (f *Field) ResolverType() string { - if !f.IsResolver() { - return "" +func (o *Object) Implementors() string { + satisfiedBy := strconv.Quote(o.Name) + for _, s := range o.Implements { + satisfiedBy += ", " + strconv.Quote(s.Name) } - - return fmt.Sprintf("%s().%s(%s)", f.Object.GQLType, f.GoNameExported(), f.CallArgs()) + return "[]string{" + satisfiedBy + "}" } -func (f *Field) ShortResolverDeclaration() string { - if !f.IsResolver() { - return "" - } - res := fmt.Sprintf("%s(ctx context.Context", f.GoNameExported()) - - if !f.Object.Root { - res += fmt.Sprintf(", obj *%s", f.Object.FullName()) - } - for _, arg := range f.Args { - res += fmt.Sprintf(", %s %s", arg.GoVarName, arg.Signature()) - } - - result := f.Signature() - if f.Object.Stream { - result = "<-chan " + result +func (o *Object) HasResolvers() bool { + for _, f := range o.Fields { + if f.IsResolver { + return true + } } - - res += fmt.Sprintf(") (%s, error)", result) - return res + return false } -func (f *Field) ResolverDeclaration() string { - if !f.IsResolver() { - return "" - } - res := fmt.Sprintf("%s_%s(ctx context.Context", f.Object.GQLType, f.GoNameUnexported()) - - if !f.Object.Root { - res += fmt.Sprintf(", obj *%s", f.Object.FullName()) +func (o *Object) HasUnmarshal() bool { + if o.Type == config.MapType { + return true } - for _, arg := range f.Args { - res += fmt.Sprintf(", %s %s", arg.GoVarName, arg.Signature()) - } - - result := f.Signature() - if f.Object.Stream { - result = "<-chan " + result + for i := 0; i < o.Type.(*types.Named).NumMethods(); i++ { + switch o.Type.(*types.Named).Method(i).Name() { + case "UnmarshalGQL": + return true + } } - - res += fmt.Sprintf(") (%s, error)", result) - return res + return false } -func (f *Field) ComplexitySignature() string { - res := fmt.Sprintf("func(childComplexity int") - for _, arg := range f.Args { - res += fmt.Sprintf(", %s %s", arg.GoVarName, arg.Signature()) +func (o *Object) HasDirectives() bool { + if len(o.Directives) > 0 { + return true } - res += ") int" - return res -} - -func (f *Field) ComplexityArgs() string { - var args []string - for _, arg := range f.Args { - args = append(args, "args["+strconv.Quote(arg.GQLName)+"].("+arg.Signature()+")") + for _, f := range o.Fields { + if f.HasDirectives() { + return true + } } - return strings.Join(args, ", ") + return false } -func (f *Field) CallArgs() string { - var args []string - - if f.IsResolver() { - args = append(args, "rctx") - - if !f.Object.Root { - args = append(args, "obj") - } - } else { - if f.MethodHasContext { - args = append(args, "ctx") +func (o *Object) IsConcurrent() bool { + for _, f := range o.Fields { + if f.IsConcurrent() { + return true } } - - for _, arg := range f.Args { - args = append(args, "args["+strconv.Quote(arg.GQLName)+"].("+arg.Signature()+")") - } - - return strings.Join(args, ", ") -} - -// should be in the template, but its recursive and has a bunch of args -func (f *Field) WriteJson() string { - return f.doWriteJson("res", f.Type.Modifiers, f.ASTType, false, 1) + return false } -func (f *Field) doWriteJson(val string, remainingMods []string, astType *ast.Type, isPtr bool, depth int) string { - switch { - case len(remainingMods) > 0 && remainingMods[0] == modPtr: - return tpl(` - if {{.val}} == nil { - {{- if .nonNull }} - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } - {{- end }} - return graphql.Null - } - {{.next }}`, map[string]interface{}{ - "val": val, - "nonNull": astType.NonNull, - "next": f.doWriteJson(val, remainingMods[1:], astType, true, depth+1), - }) - - case len(remainingMods) > 0 && remainingMods[0] == modList: - if isPtr { - val = "*" + val - } - var arr = "arr" + strconv.Itoa(depth) - var index = "idx" + strconv.Itoa(depth) - var usePtr bool - if len(remainingMods) == 1 && !isPtr { - usePtr = true - } - - return tpl(` - {{.arr}} := make(graphql.Array, len({{.val}})) - {{ if and .top (not .isScalar) }} var wg sync.WaitGroup {{ end }} - {{ if not .isScalar }} - isLen1 := len({{.val}}) == 1 - if !isLen1 { - wg.Add(len({{.val}})) - } - {{ end }} - for {{.index}} := range {{.val}} { - {{- if not .isScalar }} - {{.index}} := {{.index}} - rctx := &graphql.ResolverContext{ - Index: &{{.index}}, - Result: {{ if .usePtr }}&{{end}}{{.val}}[{{.index}}], - } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func({{.index}} int) { - if !isLen1 { - defer wg.Done() - } - {{.arr}}[{{.index}}] = func() graphql.Marshaler { - {{ .next }} - }() - } - if isLen1 { - f({{.index}}) - } else { - go f({{.index}}) - } - {{ else }} - {{.arr}}[{{.index}}] = func() graphql.Marshaler { - {{ .next }} - }() - {{- end}} - } - {{ if and .top (not .isScalar) }} wg.Wait() {{ end }} - return {{.arr}}`, map[string]interface{}{ - "val": val, - "arr": arr, - "index": index, - "top": depth == 1, - "arrayLen": len(val), - "isScalar": f.IsScalar, - "usePtr": usePtr, - "next": f.doWriteJson(val+"["+index+"]", remainingMods[1:], astType.Elem, false, depth+1), - }) - - case f.IsScalar: - if isPtr { - val = "*" + val - } - return f.Marshal(val) - - default: - if !isPtr { - val = "&" + val - } - return tpl(` - return ec._{{.type}}(ctx, field.Selections, {{.val}})`, map[string]interface{}{ - "type": f.GQLType, - "val": val, - }) - } +func (o *Object) IsReserved() bool { + return strings.HasPrefix(o.Definition.Name, "__") } -func (f *FieldArgument) Stream() bool { - return f.Object != nil && f.Object.Stream +func (o *Object) Description() string { + return o.Definition.Description } func (os Objects) ByName(name string) *Object { for i, o := range os { - if strings.EqualFold(o.GQLType, name) { + if strings.EqualFold(o.Definition.Name, name) { return os[i] } } return nil } -func tpl(tpl string, vars map[string]interface{}) string { - b := &bytes.Buffer{} - err := template.Must(template.New("inline").Parse(tpl)).Execute(b, vars) - if err != nil { - panic(err) - } - return b.String() -} - func ucFirst(s string) string { if s == "" { return "" @@ -357,117 +170,3 @@ func ucFirst(s string) string { r[0] = unicode.ToUpper(r[0]) return string(r) } - -// copy from https://github.com/golang/lint/blob/06c8688daad7faa9da5a0c2f163a3d14aac986ca/lint.go#L679 - -// lintName returns a different name if it should be different. -func lintName(name string) (should string) { - // Fast path for simple cases: "_" and all lowercase. - if name == "_" { - return name - } - allLower := true - for _, r := range name { - if !unicode.IsLower(r) { - allLower = false - break - } - } - if allLower { - return name - } - - // Split camelCase at any lower->upper transition, and split on underscores. - // Check each word for common initialisms. - runes := []rune(name) - w, i := 0, 0 // index of start of word, scan - for i+1 <= len(runes) { - eow := false // whether we hit the end of a word - if i+1 == len(runes) { - eow = true - } else if runes[i+1] == '_' { - // underscore; shift the remainder forward over any run of underscores - eow = true - n := 1 - for i+n+1 < len(runes) && runes[i+n+1] == '_' { - n++ - } - - // Leave at most one underscore if the underscore is between two digits - if i+n+1 < len(runes) && unicode.IsDigit(runes[i]) && unicode.IsDigit(runes[i+n+1]) { - n-- - } - - copy(runes[i+1:], runes[i+n+1:]) - runes = runes[:len(runes)-n] - } else if unicode.IsLower(runes[i]) && !unicode.IsLower(runes[i+1]) { - // lower->non-lower - eow = true - } - i++ - if !eow { - continue - } - - // [w,i) is a word. - word := string(runes[w:i]) - if u := strings.ToUpper(word); commonInitialisms[u] { - // Keep consistent case, which is lowercase only at the start. - if w == 0 && unicode.IsLower(runes[w]) { - u = strings.ToLower(u) - } - // All the common initialisms are ASCII, - // so we can replace the bytes exactly. - copy(runes[w:], []rune(u)) - } else if w > 0 && strings.ToLower(word) == word { - // already all lowercase, and not the first word, so uppercase the first character. - runes[w] = unicode.ToUpper(runes[w]) - } - w = i - } - return string(runes) -} - -// commonInitialisms is a set of common initialisms. -// Only add entries that are highly unlikely to be non-initialisms. -// For instance, "ID" is fine (Freudian code is rare), but "AND" is not. -var commonInitialisms = map[string]bool{ - "ACL": true, - "API": true, - "ASCII": true, - "CPU": true, - "CSS": true, - "DNS": true, - "EOF": true, - "GUID": true, - "HTML": true, - "HTTP": true, - "HTTPS": true, - "ID": true, - "IP": true, - "JSON": true, - "LHS": true, - "QPS": true, - "RAM": true, - "RHS": true, - "RPC": true, - "SLA": true, - "SMTP": true, - "SQL": true, - "SSH": true, - "TCP": true, - "TLS": true, - "TTL": true, - "UDP": true, - "UI": true, - "UID": true, - "UUID": true, - "URI": true, - "URL": true, - "UTF8": true, - "VM": true, - "XML": true, - "XMPP": true, - "XSRF": true, - "XSS": true, -} diff --git a/vendor/github.com/99designs/gqlgen/codegen/object.gotpl b/vendor/github.com/99designs/gqlgen/codegen/object.gotpl new file mode 100644 index 0000000000000000000000000000000000000000..19da1b1988ba5a84537cb8781db86ce52e5d5ab9 --- /dev/null +++ b/vendor/github.com/99designs/gqlgen/codegen/object.gotpl @@ -0,0 +1,77 @@ +{{- range $object := .Objects }} + +var {{ $object.Name|lcFirst}}Implementors = {{$object.Implementors}} + +{{- if .Stream }} +func (ec *executionContext) _{{$object.Name}}(ctx context.Context, sel ast.SelectionSet) func() graphql.Marshaler { + fields := graphql.CollectFields(ctx, sel, {{$object.Name|lcFirst}}Implementors) + ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ + Object: {{$object.Name|quote}}, + }) + if len(fields) != 1 { + ec.Errorf(ctx, "must subscribe to exactly one stream") + return nil + } + + switch fields[0].Name { + {{- range $field := $object.Fields }} + case "{{$field.Name}}": + return ec._{{$object.Name}}_{{$field.Name}}(ctx, fields[0]) + {{- end }} + default: + panic("unknown field " + strconv.Quote(fields[0].Name)) + } +} +{{- else }} +func (ec *executionContext) _{{$object.Name}}(ctx context.Context, sel ast.SelectionSet{{ if not $object.Root }},obj {{$object.Reference | ref }}{{ end }}) graphql.Marshaler { + fields := graphql.CollectFields(ctx, sel, {{$object.Name|lcFirst}}Implementors) + {{if $object.Root}} + ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ + Object: {{$object.Name|quote}}, + }) + {{end}} + + out := graphql.NewFieldSet(fields) + invalid := false + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString({{$object.Name|quote}}) + {{- range $field := $object.Fields }} + case "{{$field.Name}}": + {{- if $field.IsConcurrent }} + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._{{$object.Name}}_{{$field.Name}}(ctx, field{{if not $object.Root}}, obj{{end}}) + {{- if $field.TypeReference.GQL.NonNull }} + if res == graphql.Null { + invalid = true + } + {{- end }} + return res + }) + {{- else }} + out.Values[i] = ec._{{$object.Name}}_{{$field.Name}}(ctx, field{{if not $object.Root}}, obj{{end}}) + {{- if $field.TypeReference.GQL.NonNull }} + if out.Values[i] == graphql.Null { + invalid = true + } + {{- end }} + {{- end }} + {{- end }} + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch() + if invalid { return graphql.Null } + return out +} +{{- end }} + +{{- end }} diff --git a/vendor/github.com/99designs/gqlgen/codegen/object_build.go b/vendor/github.com/99designs/gqlgen/codegen/object_build.go deleted file mode 100644 index 279d1eb6bec83c0d4a3db74dfa5b2b7cb57d3996..0000000000000000000000000000000000000000 --- a/vendor/github.com/99designs/gqlgen/codegen/object_build.go +++ /dev/null @@ -1,181 +0,0 @@ -package codegen - -import ( - "log" - "sort" - - "github.com/pkg/errors" - "github.com/vektah/gqlparser/ast" - "golang.org/x/tools/go/loader" -) - -func (cfg *Config) buildObjects(types NamedTypes, prog *loader.Program) (Objects, error) { - var objects Objects - - for _, typ := range cfg.schema.Types { - if typ.Kind != ast.Object { - continue - } - - obj, err := cfg.buildObject(types, typ) - if err != nil { - return nil, err - } - - def, err := findGoType(prog, obj.Package, obj.GoType) - if err != nil { - return nil, err - } - if def != nil { - for _, bindErr := range bindObject(def.Type(), obj, cfg.StructTag) { - log.Println(bindErr.Error()) - log.Println(" Adding resolver method") - } - } - - objects = append(objects, obj) - } - - sort.Slice(objects, func(i, j int) bool { - return objects[i].GQLType < objects[j].GQLType - }) - - return objects, nil -} - -var keywords = []string{ - "break", - "default", - "func", - "interface", - "select", - "case", - "defer", - "go", - "map", - "struct", - "chan", - "else", - "goto", - "package", - "switch", - "const", - "fallthrough", - "if", - "range", - "type", - "continue", - "for", - "import", - "return", - "var", -} - -// sanitizeArgName prevents collisions with go keywords for arguments to resolver functions -func sanitizeArgName(name string) string { - for _, k := range keywords { - if name == k { - return name + "Arg" - } - } - return name -} - -func (cfg *Config) buildObject(types NamedTypes, typ *ast.Definition) (*Object, error) { - obj := &Object{NamedType: types[typ.Name]} - typeEntry, entryExists := cfg.Models[typ.Name] - - obj.ResolverInterface = &Ref{GoType: obj.GQLType + "Resolver"} - - if typ == cfg.schema.Query { - obj.Root = true - } - - if typ == cfg.schema.Mutation { - obj.Root = true - obj.DisableConcurrency = true - } - - if typ == cfg.schema.Subscription { - obj.Root = true - obj.Stream = true - } - - obj.Satisfies = append(obj.Satisfies, typ.Interfaces...) - - for _, intf := range cfg.schema.GetImplements(typ) { - obj.Implements = append(obj.Implements, types[intf.Name]) - } - - for _, field := range typ.Fields { - if typ == cfg.schema.Query && field.Name == "__type" { - obj.Fields = append(obj.Fields, Field{ - Type: &Type{types["__Schema"], []string{modPtr}, ast.NamedType("__Schema", nil), nil}, - GQLName: "__schema", - GoFieldType: GoFieldMethod, - GoReceiverName: "ec", - GoFieldName: "introspectSchema", - Object: obj, - Description: field.Description, - }) - continue - } - if typ == cfg.schema.Query && field.Name == "__schema" { - obj.Fields = append(obj.Fields, Field{ - Type: &Type{types["__Type"], []string{modPtr}, ast.NamedType("__Schema", nil), nil}, - GQLName: "__type", - GoFieldType: GoFieldMethod, - GoReceiverName: "ec", - GoFieldName: "introspectType", - Args: []FieldArgument{ - {GQLName: "name", Type: &Type{types["String"], []string{}, ast.NamedType("String", nil), nil}, Object: &Object{}}, - }, - Object: obj, - }) - continue - } - - var forceResolver bool - var goName string - if entryExists { - if typeField, ok := typeEntry.Fields[field.Name]; ok { - goName = typeField.FieldName - forceResolver = typeField.Resolver - } - } - - var args []FieldArgument - for _, arg := range field.Arguments { - newArg := FieldArgument{ - GQLName: arg.Name, - Type: types.getType(arg.Type), - Object: obj, - GoVarName: sanitizeArgName(arg.Name), - } - - if !newArg.Type.IsInput && !newArg.Type.IsScalar { - return nil, errors.Errorf("%s cannot be used as argument of %s.%s. only input and scalar types are allowed", arg.Type, obj.GQLType, field.Name) - } - - if arg.DefaultValue != nil { - var err error - newArg.Default, err = arg.DefaultValue.Value(nil) - if err != nil { - return nil, errors.Errorf("default value for %s.%s is not valid: %s", typ.Name, field.Name, err.Error()) - } - } - args = append(args, newArg) - } - - obj.Fields = append(obj.Fields, Field{ - GQLName: field.Name, - Type: types.getType(field.Type), - Args: args, - Object: obj, - GoFieldName: goName, - ForceResolver: forceResolver, - }) - } - - return obj, nil -} diff --git a/vendor/github.com/99designs/gqlgen/codegen/templates/args.gotpl b/vendor/github.com/99designs/gqlgen/codegen/templates/args.gotpl deleted file mode 100644 index 870a99edcbf1fba631eb47f529cecc0db9edeefc..0000000000000000000000000000000000000000 --- a/vendor/github.com/99designs/gqlgen/codegen/templates/args.gotpl +++ /dev/null @@ -1,13 +0,0 @@ - args := map[string]interface{}{} - {{- range $i, $arg := . }} - var arg{{$i}} {{$arg.Signature }} - if tmp, ok := rawArgs[{{$arg.GQLName|quote}}]; ok { - var err error - {{$arg.Unmarshal (print "arg" $i) "tmp" }} - if err != nil { - return nil, err - } - } - args[{{$arg.GQLName|quote}}] = arg{{$i}} - {{- end }} - return args, nil diff --git a/vendor/github.com/99designs/gqlgen/codegen/templates/data.go b/vendor/github.com/99designs/gqlgen/codegen/templates/data.go deleted file mode 100644 index d3098aaae14b4a1494d40c790bb10de1513f434b..0000000000000000000000000000000000000000 --- a/vendor/github.com/99designs/gqlgen/codegen/templates/data.go +++ /dev/null @@ -1,13 +0,0 @@ -package templates - -var data = map[string]string{ - "args.gotpl": "\targs := map[string]interface{}{}\n\t{{- range $i, $arg := . }}\n\t\tvar arg{{$i}} {{$arg.Signature }}\n\t\tif tmp, ok := rawArgs[{{$arg.GQLName|quote}}]; ok {\n\t\t\tvar err error\n\t\t\t{{$arg.Unmarshal (print \"arg\" $i) \"tmp\" }}\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\targs[{{$arg.GQLName|quote}}] = arg{{$i}}\n\t{{- end }}\n\treturn args, nil\n", - "field.gotpl": "{{ $field := . }}\n{{ $object := $field.Object }}\n\n{{- if $object.Stream }}\n\tfunc (ec *executionContext) _{{$object.GQLType}}_{{$field.GQLName}}(ctx context.Context, field graphql.CollectedField) func() graphql.Marshaler {\n\t\t{{- if $field.Args }}\n\t\t\trawArgs := field.ArgumentMap(ec.Variables)\n\t\t\targs, err := {{ $field.ArgsFunc }}(rawArgs)\n\t\t\tif err != nil {\n\t\t\t\tec.Error(ctx, err)\n\t\t\t\treturn nil\n\t\t\t}\n\t\t{{- end }}\n\t\tctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{\n\t\t\tField: field,\n\t\t})\n\t\t// FIXME: subscriptions are missing request middleware stack https://github.com/99designs/gqlgen/issues/259\n\t\t// and Tracer stack\n\t\trctx := ctx\n\t\tresults, err := ec.resolvers.{{ $field.ShortInvocation }}\n\t\tif err != nil {\n\t\t\tec.Error(ctx, err)\n\t\t\treturn nil\n\t\t}\n\t\treturn func() graphql.Marshaler {\n\t\t\tres, ok := <-results\n\t\t\tif !ok {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tvar out graphql.OrderedMap\n\t\t\tout.Add(field.Alias, func() graphql.Marshaler { {{ $field.WriteJson }} }())\n\t\t\treturn &out\n\t\t}\n\t}\n{{ else }}\n\t// nolint: vetshadow\n\tfunc (ec *executionContext) _{{$object.GQLType}}_{{$field.GQLName}}(ctx context.Context, field graphql.CollectedField, {{if not $object.Root}}obj *{{$object.FullName}}{{end}}) graphql.Marshaler {\n\t\tctx = ec.Tracer.StartFieldExecution(ctx, field)\n\t\tdefer func () { ec.Tracer.EndFieldExecution(ctx) }()\n\t\t{{- if $field.Args }}\n\t\t\trawArgs := field.ArgumentMap(ec.Variables)\n\t\t\targs, err := {{ $field.ArgsFunc }}(rawArgs)\n\t\t\tif err != nil {\n\t\t\t\tec.Error(ctx, err)\n\t\t\t\treturn graphql.Null\n\t\t\t}\n\t\t{{- end }}\n\t\trctx := &graphql.ResolverContext{\n\t\t\tObject: {{$object.GQLType|quote}},\n\t\t\tArgs: {{if $field.Args }}args{{else}}nil{{end}},\n\t\t\tField: field,\n\t\t}\n\t\tctx = graphql.WithResolverContext(ctx, rctx)\n\t\tctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)\n\t\tresTmp := ec.FieldMiddleware(ctx, {{if $object.Root}}nil{{else}}obj{{end}}, func(rctx context.Context) (interface{}, error) {\n\t\t\tctx = rctx // use context from middleware stack in children\n\t\t\t{{- if $field.IsResolver }}\n\t\t\t\treturn ec.resolvers.{{ $field.ShortInvocation }}\n\t\t\t{{- else if $field.IsMethod }}\n\t\t\t\t{{- if $field.NoErr }}\n\t\t\t\t\treturn {{$field.GoReceiverName}}.{{$field.GoFieldName}}({{ $field.CallArgs }}), nil\n\t\t\t\t{{- else }}\n\t\t\t\t\treturn {{$field.GoReceiverName}}.{{$field.GoFieldName}}({{ $field.CallArgs }})\n\t\t\t\t{{- end }}\n\t\t\t{{- else if $field.IsVariable }}\n\t\t\t\treturn {{$field.GoReceiverName}}.{{$field.GoFieldName}}, nil\n\t\t\t{{- end }}\n\t\t})\n\t\tif resTmp == nil {\n\t\t\t{{- if $field.ASTType.NonNull }}\n\t\t\t\tif !ec.HasError(rctx) {\n\t\t\t\t\tec.Errorf(ctx, \"must not be null\")\n\t\t\t\t}\n\t\t\t{{- end }}\n\t\t\treturn graphql.Null\n\t\t}\n\t\tres := resTmp.({{$field.Signature}})\n\t\trctx.Result = res\n\t\tctx = ec.Tracer.StartFieldChildExecution(ctx)\n\t\t{{ $field.WriteJson }}\n\t}\n{{ end }}\n", - "generated.gotpl": "// Code generated by github.com/99designs/gqlgen, DO NOT EDIT.\n\npackage {{ .PackageName }}\n\nimport (\n\t%%%IMPORTS%%%\n\n\t{{ reserveImport \"context\" }}\n\t{{ reserveImport \"fmt\" }}\n\t{{ reserveImport \"io\" }}\n\t{{ reserveImport \"strconv\" }}\n\t{{ reserveImport \"time\" }}\n\t{{ reserveImport \"sync\" }}\n\t{{ reserveImport \"errors\" }}\n\t{{ reserveImport \"bytes\" }}\n\n\t{{ reserveImport \"github.com/vektah/gqlparser\" }}\n\t{{ reserveImport \"github.com/vektah/gqlparser/ast\" }}\n\t{{ reserveImport \"github.com/99designs/gqlgen/graphql\" }}\n\t{{ reserveImport \"github.com/99designs/gqlgen/graphql/introspection\" }}\n)\n\n// NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface.\nfunc NewExecutableSchema(cfg Config) graphql.ExecutableSchema {\n\treturn &executableSchema{\n\t\tresolvers: cfg.Resolvers,\n\t\tdirectives: cfg.Directives,\n\t\tcomplexity: cfg.Complexity,\n\t}\n}\n\ntype Config struct {\n\tResolvers ResolverRoot\n\tDirectives DirectiveRoot\n\tComplexity ComplexityRoot\n}\n\ntype ResolverRoot interface {\n{{- range $object := .Objects -}}\n\t{{ if $object.HasResolvers -}}\n\t\t{{$object.GQLType}}() {{$object.GQLType}}Resolver\n\t{{ end }}\n{{- end }}\n}\n\ntype DirectiveRoot struct {\n{{ range $directive := .Directives }}\n\t{{ $directive.Declaration }}\n{{ end }}\n}\n\ntype ComplexityRoot struct {\n{{ range $object := .Objects }}\n\t{{ if not $object.IsReserved -}}\n\t\t{{ $object.GQLType|toCamel }} struct {\n\t\t{{ range $field := $object.Fields -}}\n\t\t\t{{ if not $field.IsReserved -}}\n\t\t\t\t{{ $field.GQLName|toCamel }} {{ $field.ComplexitySignature }}\n\t\t\t{{ end }}\n\t\t{{- end }}\n\t\t}\n\t{{- end }}\n{{ end }}\n}\n\n{{ range $object := .Objects -}}\n\t{{ if $object.HasResolvers }}\n\t\ttype {{$object.GQLType}}Resolver interface {\n\t\t{{ range $field := $object.Fields -}}\n\t\t\t{{ $field.ShortResolverDeclaration }}\n\t\t{{ end }}\n\t\t}\n\t{{- end }}\n{{- end }}\n\n{{ range $object := .Objects -}}\n\t{{ range $field := $object.Fields -}}\n\t\t{{ if $field.Args }}\n\t\t\tfunc {{ $field.ArgsFunc }}(rawArgs map[string]interface{}) (map[string]interface{}, error) {\n\t\t\t{{ template \"args.gotpl\" $field.Args }}\n\t\t\t}\n\t\t{{ end }}\n\t{{ end }}\n{{- end }}\n\n{{ range $directive := .Directives }}\n\t{{ if $directive.Args }}\n\t\tfunc {{ $directive.ArgsFunc }}(rawArgs map[string]interface{}) (map[string]interface{}, error) {\n\t\t{{ template \"args.gotpl\" $directive.Args }}\n\t\t}\n\t{{ end }}\n{{ end }}\n\ntype executableSchema struct {\n\tresolvers ResolverRoot\n\tdirectives DirectiveRoot\n\tcomplexity ComplexityRoot\n}\n\nfunc (e *executableSchema) Schema() *ast.Schema {\n\treturn parsedSchema\n}\n\nfunc (e *executableSchema) Complexity(typeName, field string, childComplexity int, rawArgs map[string]interface{}) (int, bool) {\n\tswitch typeName + \".\" + field {\n\t{{ range $object := .Objects }}\n\t\t{{ if not $object.IsReserved }}\n\t\t\t{{ range $field := $object.Fields }}\n\t\t\t\t{{ if not $field.IsReserved }}\n\t\t\t\t\tcase \"{{$object.GQLType}}.{{$field.GQLName}}\":\n\t\t\t\t\t\tif e.complexity.{{$object.GQLType|toCamel}}.{{$field.GQLName|toCamel}} == nil {\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t\t{{ if $field.Args }}\n\t\t\t\t\t\t\targs, err := {{ $field.ArgsFunc }}(rawArgs)\n\t\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\t\treturn 0, false\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t{{ end }}\n\t\t\t\t\t\treturn e.complexity.{{$object.GQLType|toCamel}}.{{$field.GQLName|toCamel}}(childComplexity{{if $field.Args}}, {{$field.ComplexityArgs}} {{end}}), true\n\t\t\t\t{{ end }}\n\t\t\t{{ end }}\n\t\t{{ end }}\n\t{{ end }}\n\t}\n\treturn 0, false\n}\n\nfunc (e *executableSchema) Query(ctx context.Context, op *ast.OperationDefinition) *graphql.Response {\n\t{{- if .QueryRoot }}\n\t\tec := executionContext{graphql.GetRequestContext(ctx), e}\n\n\t\tbuf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte {\n\t\t\tdata := ec._{{.QueryRoot.GQLType}}(ctx, op.SelectionSet)\n\t\t\tvar buf bytes.Buffer\n\t\t\tdata.MarshalGQL(&buf)\n\t\t\treturn buf.Bytes()\n\t\t})\n\n\t\treturn &graphql.Response{\n\t\t\tData: buf,\n\t\t\tErrors: ec.Errors,\n\t\t\tExtensions: ec.Extensions,\t\t}\n\t{{- else }}\n\t\treturn graphql.ErrorResponse(ctx, \"queries are not supported\")\n\t{{- end }}\n}\n\nfunc (e *executableSchema) Mutation(ctx context.Context, op *ast.OperationDefinition) *graphql.Response {\n\t{{- if .MutationRoot }}\n\t\tec := executionContext{graphql.GetRequestContext(ctx), e}\n\n\t\tbuf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte {\n\t\t\tdata := ec._{{.MutationRoot.GQLType}}(ctx, op.SelectionSet)\n\t\t\tvar buf bytes.Buffer\n\t\t\tdata.MarshalGQL(&buf)\n\t\t\treturn buf.Bytes()\n\t\t})\n\n\t\treturn &graphql.Response{\n\t\t\tData: buf,\n\t\t\tErrors: ec.Errors,\n\t\t\tExtensions: ec.Extensions,\n\t\t}\n\t{{- else }}\n\t\treturn graphql.ErrorResponse(ctx, \"mutations are not supported\")\n\t{{- end }}\n}\n\nfunc (e *executableSchema) Subscription(ctx context.Context, op *ast.OperationDefinition) func() *graphql.Response {\n\t{{- if .SubscriptionRoot }}\n\t\tec := executionContext{graphql.GetRequestContext(ctx), e}\n\n\t\tnext := ec._{{.SubscriptionRoot.GQLType}}(ctx, op.SelectionSet)\n\t\tif ec.Errors != nil {\n\t\t\treturn graphql.OneShot(&graphql.Response{Data: []byte(\"null\"), Errors: ec.Errors})\n\t\t}\n\n\t\tvar buf bytes.Buffer\n\t\treturn func() *graphql.Response {\n\t\t\tbuf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte {\n\t\t\t\tbuf.Reset()\n\t\t\t\tdata := next()\n\n\t\t\t\tif data == nil {\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t\tdata.MarshalGQL(&buf)\n\t\t\t\treturn buf.Bytes()\n\t\t\t})\n\n\t\t\tif buf == nil {\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\treturn &graphql.Response{\n\t\t\t\tData: buf,\n\t\t\t\tErrors: ec.Errors,\n\t\t\t\tExtensions: ec.Extensions,\n\t\t\t}\n\t\t}\n\t{{- else }}\n\t\treturn graphql.OneShot(graphql.ErrorResponse(ctx, \"subscriptions are not supported\"))\n\t{{- end }}\n}\n\ntype executionContext struct {\n\t*graphql.RequestContext\n\t*executableSchema\n}\n\n{{- range $object := .Objects }}\n\t{{ template \"object.gotpl\" $object }}\n\n\t{{- range $field := $object.Fields }}\n\t\t{{ template \"field.gotpl\" $field }}\n\t{{ end }}\n{{- end}}\n\n{{- range $interface := .Interfaces }}\n\t{{ template \"interface.gotpl\" $interface }}\n{{- end }}\n\n{{- range $input := .Inputs }}\n\t{{ template \"input.gotpl\" $input }}\n{{- end }}\n\nfunc (ec *executionContext) FieldMiddleware(ctx context.Context, obj interface{}, next graphql.Resolver) (ret interface{}) {\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tec.Error(ctx, ec.Recover(ctx, r))\n\t\t\tret = nil\n\t\t}\n\t}()\n\t{{- if .Directives }}\n\trctx := graphql.GetResolverContext(ctx)\n\tfor _, d := range rctx.Field.Definition.Directives {\n\t\tswitch d.Name {\n\t\t{{- range $directive := .Directives }}\n\t\tcase \"{{$directive.Name}}\":\n\t\t\tif ec.directives.{{$directive.Name|ucFirst}} != nil {\n\t\t\t\t{{- if $directive.Args }}\n\t\t\t\t\trawArgs := d.ArgumentMap(ec.Variables)\n\t\t\t\t\targs, err := {{ $directive.ArgsFunc }}(rawArgs)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tec.Error(ctx, err)\n\t\t\t\t\t\treturn nil\n\t\t\t\t\t}\n\t\t\t\t{{- end }}\n\t\t\t\tn := next\n\t\t\t\tnext = func(ctx context.Context) (interface{}, error) {\n\t\t\t\t\treturn ec.directives.{{$directive.Name|ucFirst}}({{$directive.CallArgs}})\n\t\t\t\t}\n\t\t\t}\n\t\t{{- end }}\n\t\t}\n\t}\n\t{{- end }}\n\tres, err := ec.ResolverMiddleware(ctx, next)\n\tif err != nil {\n\t\tec.Error(ctx, err)\n\t\treturn nil\n\t}\n\treturn res\n}\n\nfunc (ec *executionContext) introspectSchema() (*introspection.Schema, error) {\n\tif ec.DisableIntrospection {\n\t\treturn nil, errors.New(\"introspection disabled\")\n\t}\n\treturn introspection.WrapSchema(parsedSchema), nil\n}\n\nfunc (ec *executionContext) introspectType(name string) (*introspection.Type, error) {\n\tif ec.DisableIntrospection {\n\t\treturn nil, errors.New(\"introspection disabled\")\n\t}\n\treturn introspection.WrapTypeFromDef(parsedSchema, parsedSchema.Types[name]), nil\n}\n\nvar parsedSchema = gqlparser.MustLoadSchema(\n\t{{- range $filename, $schema := .SchemaRaw }}\n\t\t&ast.Source{Name: {{$filename|quote}}, Input: {{$schema|rawQuote}}},\n\t{{- end }}\n)\n", - "input.gotpl": "\t{{- if .IsMarshaled }}\n\tfunc Unmarshal{{ .GQLType }}(v interface{}) ({{.FullName}}, error) {\n\t\tvar it {{.FullName}}\n\t\tvar asMap = v.(map[string]interface{})\n\t\t{{ range $field := .Fields}}\n\t\t\t{{- if $field.Default}}\n\t\t\t\tif _, present := asMap[{{$field.GQLName|quote}}] ; !present {\n\t\t\t\t\tasMap[{{$field.GQLName|quote}}] = {{ $field.Default | dump }}\n\t\t\t\t}\n\t\t\t{{- end}}\n\t\t{{- end }}\n\n\t\tfor k, v := range asMap {\n\t\t\tswitch k {\n\t\t\t{{- range $field := .Fields }}\n\t\t\tcase {{$field.GQLName|quote}}:\n\t\t\t\tvar err error\n\t\t\t\t{{ $field.Unmarshal (print \"it.\" $field.GoFieldName) \"v\" }}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn it, err\n\t\t\t\t}\n\t\t\t{{- end }}\n\t\t\t}\n\t\t}\n\n\t\treturn it, nil\n\t}\n\t{{- end }}\n", - "interface.gotpl": "{{- $interface := . }}\n\nfunc (ec *executionContext) _{{$interface.GQLType}}(ctx context.Context, sel ast.SelectionSet, obj *{{$interface.FullName}}) graphql.Marshaler {\n\tswitch obj := (*obj).(type) {\n\tcase nil:\n\t\treturn graphql.Null\n\t{{- range $implementor := $interface.Implementors }}\n\t\t{{- if $implementor.ValueReceiver }}\n\t\t\tcase {{$implementor.FullName}}:\n\t\t\t\treturn ec._{{$implementor.GQLType}}(ctx, sel, &obj)\n\t\t{{- end}}\n\t\tcase *{{$implementor.FullName}}:\n\t\t\treturn ec._{{$implementor.GQLType}}(ctx, sel, obj)\n\t{{- end }}\n\tdefault:\n\t\tpanic(fmt.Errorf(\"unexpected type %T\", obj))\n\t}\n}\n", - "models.gotpl": "// Code generated by github.com/99designs/gqlgen, DO NOT EDIT.\n\npackage {{ .PackageName }}\n\nimport (\n\t%%%IMPORTS%%%\n\n\t{{ reserveImport \"context\" }}\n\t{{ reserveImport \"fmt\" }}\n\t{{ reserveImport \"io\" }}\n\t{{ reserveImport \"strconv\" }}\n\t{{ reserveImport \"time\" }}\n\t{{ reserveImport \"sync\" }}\n\t{{ reserveImport \"errors\" }}\n\t{{ reserveImport \"bytes\" }}\n\n\t{{ reserveImport \"github.com/vektah/gqlparser\" }}\n\t{{ reserveImport \"github.com/vektah/gqlparser/ast\" }}\n\t{{ reserveImport \"github.com/99designs/gqlgen/graphql\" }}\n\t{{ reserveImport \"github.com/99designs/gqlgen/graphql/introspection\" }}\n)\n\n{{ range $model := .Models }}\n\t{{with .Description}} {{.|prefixLines \"// \"}} {{end}}\n\t{{- if .IsInterface }}\n\t\ttype {{.GoType}} interface {\n\t\t\tIs{{.GoType}}()\n\t\t}\n\t{{- else }}\n\t\ttype {{.GoType}} struct {\n\t\t\t{{- range $field := .Fields }}\n\t\t\t\t{{- with .Description}}\n\t\t\t\t\t{{.|prefixLines \"// \"}}\n\t\t\t\t{{- end}}\n\t\t\t\t{{- if $field.GoFieldName }}\n\t\t\t\t\t{{ $field.GoFieldName }} {{$field.Signature}} `json:\"{{$field.GQLName}}\"`\n\t\t\t\t{{- else }}\n\t\t\t\t\t{{ $field.GoFKName }} {{$field.GoFKType}}\n\t\t\t\t{{- end }}\n\t\t\t{{- end }}\n\t\t}\n\n\t\t{{- range $iface := .Implements }}\n\t\t\tfunc ({{$model.GoType}}) Is{{$iface.GoType}}() {}\n\t\t{{- end }}\n\n\t{{- end }}\n{{- end}}\n\n{{ range $enum := .Enums }}\n\t{{with .Description}}{{.|prefixLines \"// \"}} {{end}}\n\ttype {{.GoType}} string\n\tconst (\n\t{{- range $value := .Values}}\n\t\t{{- with .Description}}\n\t\t\t{{.|prefixLines \"// \"}}\n\t\t{{- end}}\n\t\t{{$enum.GoType}}{{ .Name|toCamel }} {{$enum.GoType}} = {{.Name|quote}}\n\t{{- end }}\n\t)\n\n\tfunc (e {{.GoType}}) IsValid() bool {\n\t\tswitch e {\n\t\tcase {{ range $index, $element := .Values}}{{if $index}},{{end}}{{ $enum.GoType }}{{ $element.Name|toCamel }}{{end}}:\n\t\t\treturn true\n\t\t}\n\t\treturn false\n\t}\n\n\tfunc (e {{.GoType}}) String() string {\n\t\treturn string(e)\n\t}\n\n\tfunc (e *{{.GoType}}) UnmarshalGQL(v interface{}) error {\n\t\tstr, ok := v.(string)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"enums must be strings\")\n\t\t}\n\n\t\t*e = {{.GoType}}(str)\n\t\tif !e.IsValid() {\n\t\t\treturn fmt.Errorf(\"%s is not a valid {{.GQLType}}\", str)\n\t\t}\n\t\treturn nil\n\t}\n\n\tfunc (e {{.GoType}}) MarshalGQL(w io.Writer) {\n\t\tfmt.Fprint(w, strconv.Quote(e.String()))\n\t}\n\n{{- end }}\n", - "object.gotpl": "{{ $object := . }}\n\nvar {{ $object.GQLType|lcFirst}}Implementors = {{$object.Implementors}}\n\n// nolint: gocyclo, errcheck, gas, goconst\n{{- if .Stream }}\nfunc (ec *executionContext) _{{$object.GQLType}}(ctx context.Context, sel ast.SelectionSet) func() graphql.Marshaler {\n\tfields := graphql.CollectFields(ctx, sel, {{$object.GQLType|lcFirst}}Implementors)\n\tctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{\n\t\tObject: {{$object.GQLType|quote}},\n\t})\n\tif len(fields) != 1 {\n\t\tec.Errorf(ctx, \"must subscribe to exactly one stream\")\n\t\treturn nil\n\t}\n\n\tswitch fields[0].Name {\n\t{{- range $field := $object.Fields }}\n\tcase \"{{$field.GQLName}}\":\n\t\treturn ec._{{$object.GQLType}}_{{$field.GQLName}}(ctx, fields[0])\n\t{{- end }}\n\tdefault:\n\t\tpanic(\"unknown field \" + strconv.Quote(fields[0].Name))\n\t}\n}\n{{- else }}\nfunc (ec *executionContext) _{{$object.GQLType}}(ctx context.Context, sel ast.SelectionSet{{if not $object.Root}}, obj *{{$object.FullName}} {{end}}) graphql.Marshaler {\n\tfields := graphql.CollectFields(ctx, sel, {{$object.GQLType|lcFirst}}Implementors)\n\t{{if $object.Root}}\n\t\tctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{\n\t\t\tObject: {{$object.GQLType|quote}},\n\t\t})\n\t{{end}}\n\n\t{{if $object.IsConcurrent}} var wg sync.WaitGroup {{end}}\n\tout := graphql.NewOrderedMap(len(fields))\n\tinvalid := false\n\tfor i, field := range fields {\n\t\tout.Keys[i] = field.Alias\n\n\t\tswitch field.Name {\n\t\tcase \"__typename\":\n\t\t\tout.Values[i] = graphql.MarshalString({{$object.GQLType|quote}})\n\t\t{{- range $field := $object.Fields }}\n\t\tcase \"{{$field.GQLName}}\":\n\t\t\t{{- if $field.IsConcurrent }}\n\t\t\t\twg.Add(1)\n\t\t\t\tgo func(i int, field graphql.CollectedField) {\n\t\t\t{{- end }}\n\t\t\t\tout.Values[i] = ec._{{$object.GQLType}}_{{$field.GQLName}}(ctx, field{{if not $object.Root}}, obj{{end}})\n\t\t\t\t{{- if $field.ASTType.NonNull }}\n\t\t\t\t\tif out.Values[i] == graphql.Null {\n\t\t\t\t\t\tinvalid = true\n\t\t\t\t\t}\n\t\t\t\t{{- end }}\n\t\t\t{{- if $field.IsConcurrent }}\n\t\t\t\t\twg.Done()\n\t\t\t\t}(i, field)\n\t\t\t{{- end }}\n\t\t{{- end }}\n\t\tdefault:\n\t\t\tpanic(\"unknown field \" + strconv.Quote(field.Name))\n\t\t}\n\t}\n\t{{if $object.IsConcurrent}} wg.Wait() {{end}}\n\tif invalid { return graphql.Null }\n\treturn out\n}\n{{- end }}\n", - "resolver.gotpl": "package {{ .PackageName }}\n\nimport (\n\t%%%IMPORTS%%%\n\n\t{{ reserveImport \"context\" }}\n\t{{ reserveImport \"fmt\" }}\n\t{{ reserveImport \"io\" }}\n\t{{ reserveImport \"strconv\" }}\n\t{{ reserveImport \"time\" }}\n\t{{ reserveImport \"sync\" }}\n\t{{ reserveImport \"errors\" }}\n\t{{ reserveImport \"bytes\" }}\n\n\t{{ reserveImport \"github.com/99designs/gqlgen/handler\" }}\n\t{{ reserveImport \"github.com/vektah/gqlparser\" }}\n\t{{ reserveImport \"github.com/vektah/gqlparser/ast\" }}\n\t{{ reserveImport \"github.com/99designs/gqlgen/graphql\" }}\n\t{{ reserveImport \"github.com/99designs/gqlgen/graphql/introspection\" }}\n)\n\ntype {{.ResolverType}} struct {}\n\n{{ range $object := .Objects -}}\n\t{{- if $object.HasResolvers -}}\n\t\tfunc (r *{{$.ResolverType}}) {{$object.GQLType}}() {{ $object.ResolverInterface.FullName }} {\n\t\t\treturn &{{lcFirst $object.GQLType}}Resolver{r}\n\t\t}\n\t{{ end -}}\n{{ end }}\n\n{{ range $object := .Objects -}}\n\t{{- if $object.HasResolvers -}}\n\t\ttype {{lcFirst $object.GQLType}}Resolver struct { *Resolver }\n\n\t\t{{ range $field := $object.Fields -}}\n\t\t\t{{- if $field.IsResolver -}}\n\t\t\tfunc (r *{{lcFirst $object.GQLType}}Resolver) {{ $field.ShortResolverDeclaration }} {\n\t\t\t\tpanic(\"not implemented\")\n\t\t\t}\n\t\t\t{{ end -}}\n\t\t{{ end -}}\n\t{{ end -}}\n{{ end }}\n", - "server.gotpl": "package main\n\nimport (\n\t%%%IMPORTS%%%\n\n\t{{ reserveImport \"context\" }}\n\t{{ reserveImport \"log\" }}\n\t{{ reserveImport \"net/http\" }}\n\t{{ reserveImport \"os\" }}\n\t{{ reserveImport \"github.com/99designs/gqlgen/handler\" }}\n)\n\nconst defaultPort = \"8080\"\n\nfunc main() {\n\tport := os.Getenv(\"PORT\")\n\tif port == \"\" {\n\t\tport = defaultPort\n\t}\n\n\thttp.Handle(\"/\", handler.Playground(\"GraphQL playground\", \"/query\"))\n\thttp.Handle(\"/query\", handler.GraphQL({{ lookupImport .ExecPackageName }}.NewExecutableSchema({{ lookupImport .ExecPackageName}}.Config{Resolvers: &{{ lookupImport .ResolverPackageName}}.Resolver{}})))\n\n\tlog.Printf(\"connect to http://localhost:%s/ for GraphQL playground\", port)\n\tlog.Fatal(http.ListenAndServe(\":\" + port, nil))\n}\n", -} diff --git a/vendor/github.com/99designs/gqlgen/codegen/templates/import.go b/vendor/github.com/99designs/gqlgen/codegen/templates/import.go index c9db2d96bba35d29589501cb4afd344af4f32bfd..effe9a0dfb52ea7f6dbdb035f76bb03aae956af1 100644 --- a/vendor/github.com/99designs/gqlgen/codegen/templates/import.go +++ b/vendor/github.com/99designs/gqlgen/codegen/templates/import.go @@ -2,10 +2,10 @@ package templates import ( "fmt" - "go/build" + "go/types" "strconv" - "github.com/99designs/gqlgen/internal/gopath" + "github.com/99designs/gqlgen/internal/code" ) type Import struct { @@ -38,43 +38,42 @@ func (s *Imports) String() string { return res } -func (s *Imports) Reserve(path string, aliases ...string) string { +func (s *Imports) Reserve(path string, aliases ...string) (string, error) { if path == "" { panic("empty ambient import") } // if we are referencing our own package we dont need an import - if gopath.MustDir2Import(s.destDir) == path { - return "" - } - - pkg, err := build.Default.Import(path, s.destDir, 0) - if err != nil { - panic(err) + if code.ImportPathForDir(s.destDir) == path { + return "", nil } + name := code.NameForPackage(path) var alias string if len(aliases) != 1 { - alias = pkg.Name + alias = name } else { alias = aliases[0] } if existing := s.findByPath(path); existing != nil { - panic("ambient import already exists") + if existing.Alias == alias { + return "", nil + } + return "", fmt.Errorf("ambient import already exists") } if alias := s.findByAlias(alias); alias != nil { - panic("ambient import collides on an alias") + return "", fmt.Errorf("ambient import collides on an alias") } s.imports = append(s.imports, &Import{ - Name: pkg.Name, + Name: name, Path: path, Alias: alias, }) - return "" + return "", nil } func (s *Imports) Lookup(path string) string { @@ -82,8 +81,10 @@ func (s *Imports) Lookup(path string) string { return "" } + path = code.NormalizeVendor(path) + // if we are referencing our own package we dont need an import - if gopath.MustDir2Import(s.destDir) == path { + if code.ImportPathForDir(s.destDir) == path { return "" } @@ -91,13 +92,8 @@ func (s *Imports) Lookup(path string) string { return existing.Alias } - pkg, err := build.Default.Import(path, s.destDir, 0) - if err != nil { - panic(err) - } - imp := &Import{ - Name: pkg.Name, + Name: code.NameForPackage(path), Path: path, } s.imports = append(s.imports, imp) @@ -116,6 +112,12 @@ func (s *Imports) Lookup(path string) string { return imp.Alias } +func (s *Imports) LookupType(t types.Type) string { + return types.TypeString(t, func(i *types.Package) string { + return s.Lookup(i.Path()) + }) +} + func (s Imports) findByPath(importPath string) *Import { for _, imp := range s.imports { if imp.Path == importPath { diff --git a/vendor/github.com/99designs/gqlgen/codegen/templates/input.gotpl b/vendor/github.com/99designs/gqlgen/codegen/templates/input.gotpl deleted file mode 100644 index f543608df0c8029a03ce448b8c83126f9af7d5fa..0000000000000000000000000000000000000000 --- a/vendor/github.com/99designs/gqlgen/codegen/templates/input.gotpl +++ /dev/null @@ -1,28 +0,0 @@ - {{- if .IsMarshaled }} - func Unmarshal{{ .GQLType }}(v interface{}) ({{.FullName}}, error) { - var it {{.FullName}} - var asMap = v.(map[string]interface{}) - {{ range $field := .Fields}} - {{- if $field.Default}} - if _, present := asMap[{{$field.GQLName|quote}}] ; !present { - asMap[{{$field.GQLName|quote}}] = {{ $field.Default | dump }} - } - {{- end}} - {{- end }} - - for k, v := range asMap { - switch k { - {{- range $field := .Fields }} - case {{$field.GQLName|quote}}: - var err error - {{ $field.Unmarshal (print "it." $field.GoFieldName) "v" }} - if err != nil { - return it, err - } - {{- end }} - } - } - - return it, nil - } - {{- end }} diff --git a/vendor/github.com/99designs/gqlgen/codegen/templates/interface.gotpl b/vendor/github.com/99designs/gqlgen/codegen/templates/interface.gotpl deleted file mode 100644 index 84cbe5002c59c3854a51222b699b3aea90ac745f..0000000000000000000000000000000000000000 --- a/vendor/github.com/99designs/gqlgen/codegen/templates/interface.gotpl +++ /dev/null @@ -1,18 +0,0 @@ -{{- $interface := . }} - -func (ec *executionContext) _{{$interface.GQLType}}(ctx context.Context, sel ast.SelectionSet, obj *{{$interface.FullName}}) graphql.Marshaler { - switch obj := (*obj).(type) { - case nil: - return graphql.Null - {{- range $implementor := $interface.Implementors }} - {{- if $implementor.ValueReceiver }} - case {{$implementor.FullName}}: - return ec._{{$implementor.GQLType}}(ctx, sel, &obj) - {{- end}} - case *{{$implementor.FullName}}: - return ec._{{$implementor.GQLType}}(ctx, sel, obj) - {{- end }} - default: - panic(fmt.Errorf("unexpected type %T", obj)) - } -} diff --git a/vendor/github.com/99designs/gqlgen/codegen/templates/models.gotpl b/vendor/github.com/99designs/gqlgen/codegen/templates/models.gotpl deleted file mode 100644 index db63a996ba8a8017ea14d20737c89f30c0a45575..0000000000000000000000000000000000000000 --- a/vendor/github.com/99designs/gqlgen/codegen/templates/models.gotpl +++ /dev/null @@ -1,91 +0,0 @@ -// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. - -package {{ .PackageName }} - -import ( - %%%IMPORTS%%% - - {{ reserveImport "context" }} - {{ reserveImport "fmt" }} - {{ reserveImport "io" }} - {{ reserveImport "strconv" }} - {{ reserveImport "time" }} - {{ reserveImport "sync" }} - {{ reserveImport "errors" }} - {{ reserveImport "bytes" }} - - {{ reserveImport "github.com/vektah/gqlparser" }} - {{ reserveImport "github.com/vektah/gqlparser/ast" }} - {{ reserveImport "github.com/99designs/gqlgen/graphql" }} - {{ reserveImport "github.com/99designs/gqlgen/graphql/introspection" }} -) - -{{ range $model := .Models }} - {{with .Description}} {{.|prefixLines "// "}} {{end}} - {{- if .IsInterface }} - type {{.GoType}} interface { - Is{{.GoType}}() - } - {{- else }} - type {{.GoType}} struct { - {{- range $field := .Fields }} - {{- with .Description}} - {{.|prefixLines "// "}} - {{- end}} - {{- if $field.GoFieldName }} - {{ $field.GoFieldName }} {{$field.Signature}} `json:"{{$field.GQLName}}"` - {{- else }} - {{ $field.GoFKName }} {{$field.GoFKType}} - {{- end }} - {{- end }} - } - - {{- range $iface := .Implements }} - func ({{$model.GoType}}) Is{{$iface.GoType}}() {} - {{- end }} - - {{- end }} -{{- end}} - -{{ range $enum := .Enums }} - {{with .Description}}{{.|prefixLines "// "}} {{end}} - type {{.GoType}} string - const ( - {{- range $value := .Values}} - {{- with .Description}} - {{.|prefixLines "// "}} - {{- end}} - {{$enum.GoType}}{{ .Name|toCamel }} {{$enum.GoType}} = {{.Name|quote}} - {{- end }} - ) - - func (e {{.GoType}}) IsValid() bool { - switch e { - case {{ range $index, $element := .Values}}{{if $index}},{{end}}{{ $enum.GoType }}{{ $element.Name|toCamel }}{{end}}: - return true - } - return false - } - - func (e {{.GoType}}) String() string { - return string(e) - } - - func (e *{{.GoType}}) UnmarshalGQL(v interface{}) error { - str, ok := v.(string) - if !ok { - return fmt.Errorf("enums must be strings") - } - - *e = {{.GoType}}(str) - if !e.IsValid() { - return fmt.Errorf("%s is not a valid {{.GQLType}}", str) - } - return nil - } - - func (e {{.GoType}}) MarshalGQL(w io.Writer) { - fmt.Fprint(w, strconv.Quote(e.String())) - } - -{{- end }} diff --git a/vendor/github.com/99designs/gqlgen/codegen/templates/object.gotpl b/vendor/github.com/99designs/gqlgen/codegen/templates/object.gotpl deleted file mode 100644 index e98cbe1ee55041f184cdd8ddaef37895855e96f2..0000000000000000000000000000000000000000 --- a/vendor/github.com/99designs/gqlgen/codegen/templates/object.gotpl +++ /dev/null @@ -1,69 +0,0 @@ -{{ $object := . }} - -var {{ $object.GQLType|lcFirst}}Implementors = {{$object.Implementors}} - -// nolint: gocyclo, errcheck, gas, goconst -{{- if .Stream }} -func (ec *executionContext) _{{$object.GQLType}}(ctx context.Context, sel ast.SelectionSet) func() graphql.Marshaler { - fields := graphql.CollectFields(ctx, sel, {{$object.GQLType|lcFirst}}Implementors) - ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ - Object: {{$object.GQLType|quote}}, - }) - if len(fields) != 1 { - ec.Errorf(ctx, "must subscribe to exactly one stream") - return nil - } - - switch fields[0].Name { - {{- range $field := $object.Fields }} - case "{{$field.GQLName}}": - return ec._{{$object.GQLType}}_{{$field.GQLName}}(ctx, fields[0]) - {{- end }} - default: - panic("unknown field " + strconv.Quote(fields[0].Name)) - } -} -{{- else }} -func (ec *executionContext) _{{$object.GQLType}}(ctx context.Context, sel ast.SelectionSet{{if not $object.Root}}, obj *{{$object.FullName}} {{end}}) graphql.Marshaler { - fields := graphql.CollectFields(ctx, sel, {{$object.GQLType|lcFirst}}Implementors) - {{if $object.Root}} - ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ - Object: {{$object.GQLType|quote}}, - }) - {{end}} - - {{if $object.IsConcurrent}} var wg sync.WaitGroup {{end}} - out := graphql.NewOrderedMap(len(fields)) - invalid := false - for i, field := range fields { - out.Keys[i] = field.Alias - - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString({{$object.GQLType|quote}}) - {{- range $field := $object.Fields }} - case "{{$field.GQLName}}": - {{- if $field.IsConcurrent }} - wg.Add(1) - go func(i int, field graphql.CollectedField) { - {{- end }} - out.Values[i] = ec._{{$object.GQLType}}_{{$field.GQLName}}(ctx, field{{if not $object.Root}}, obj{{end}}) - {{- if $field.ASTType.NonNull }} - if out.Values[i] == graphql.Null { - invalid = true - } - {{- end }} - {{- if $field.IsConcurrent }} - wg.Done() - }(i, field) - {{- end }} - {{- end }} - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - {{if $object.IsConcurrent}} wg.Wait() {{end}} - if invalid { return graphql.Null } - return out -} -{{- end }} diff --git a/vendor/github.com/99designs/gqlgen/codegen/templates/resolver.gotpl b/vendor/github.com/99designs/gqlgen/codegen/templates/resolver.gotpl deleted file mode 100644 index 53ba8c43380e2a1fed09b38914ce6bad42a878c0..0000000000000000000000000000000000000000 --- a/vendor/github.com/99designs/gqlgen/codegen/templates/resolver.gotpl +++ /dev/null @@ -1,44 +0,0 @@ -package {{ .PackageName }} - -import ( - %%%IMPORTS%%% - - {{ reserveImport "context" }} - {{ reserveImport "fmt" }} - {{ reserveImport "io" }} - {{ reserveImport "strconv" }} - {{ reserveImport "time" }} - {{ reserveImport "sync" }} - {{ reserveImport "errors" }} - {{ reserveImport "bytes" }} - - {{ reserveImport "github.com/99designs/gqlgen/handler" }} - {{ reserveImport "github.com/vektah/gqlparser" }} - {{ reserveImport "github.com/vektah/gqlparser/ast" }} - {{ reserveImport "github.com/99designs/gqlgen/graphql" }} - {{ reserveImport "github.com/99designs/gqlgen/graphql/introspection" }} -) - -type {{.ResolverType}} struct {} - -{{ range $object := .Objects -}} - {{- if $object.HasResolvers -}} - func (r *{{$.ResolverType}}) {{$object.GQLType}}() {{ $object.ResolverInterface.FullName }} { - return &{{lcFirst $object.GQLType}}Resolver{r} - } - {{ end -}} -{{ end }} - -{{ range $object := .Objects -}} - {{- if $object.HasResolvers -}} - type {{lcFirst $object.GQLType}}Resolver struct { *Resolver } - - {{ range $field := $object.Fields -}} - {{- if $field.IsResolver -}} - func (r *{{lcFirst $object.GQLType}}Resolver) {{ $field.ShortResolverDeclaration }} { - panic("not implemented") - } - {{ end -}} - {{ end -}} - {{ end -}} -{{ end }} diff --git a/vendor/github.com/99designs/gqlgen/codegen/templates/templates.go b/vendor/github.com/99designs/gqlgen/codegen/templates/templates.go index 22e5d7395cb2eab60697f3cd499e12965c262529..4c2927326d17689fe6400553bd8ecd15f5f264de 100644 --- a/vendor/github.com/99designs/gqlgen/codegen/templates/templates.go +++ b/vendor/github.com/99designs/gqlgen/codegen/templates/templates.go @@ -1,13 +1,14 @@ -//go:generate go run ./inliner/inliner.go - package templates import ( "bytes" "fmt" + "go/types" "io/ioutil" "os" "path/filepath" + "reflect" + "runtime" "sort" "strconv" "strings" @@ -15,40 +16,141 @@ import ( "unicode" "github.com/99designs/gqlgen/internal/imports" - "github.com/pkg/errors" ) // this is done with a global because subtemplates currently get called in functions. Lets aim to remove this eventually. var CurrentImports *Imports -func Run(name string, tpldata interface{}) (*bytes.Buffer, error) { - t := template.New("").Funcs(template.FuncMap{ - "ucFirst": ucFirst, - "lcFirst": lcFirst, - "quote": strconv.Quote, - "rawQuote": rawQuote, - "toCamel": ToCamel, - "dump": dump, - "prefixLines": prefixLines, - "reserveImport": CurrentImports.Reserve, - "lookupImport": CurrentImports.Lookup, +type Options struct { + PackageName string + Filename string + RegionTags bool + GeneratedHeader bool + Data interface{} + Funcs template.FuncMap +} + +func Render(cfg Options) error { + if CurrentImports != nil { + panic(fmt.Errorf("recursive or concurrent call to RenderToFile detected")) + } + CurrentImports = &Imports{destDir: filepath.Dir(cfg.Filename)} + + // load path relative to calling source file + _, callerFile, _, _ := runtime.Caller(1) + rootDir := filepath.Dir(callerFile) + + funcs := Funcs() + for n, f := range cfg.Funcs { + funcs[n] = f + } + t := template.New("").Funcs(funcs) + + var roots []string + // load all the templates in the directory + err := filepath.Walk(rootDir, func(path string, info os.FileInfo, err error) error { + if err != nil { + return err + } + name := filepath.ToSlash(strings.TrimPrefix(path, rootDir+string(os.PathSeparator))) + if !strings.HasSuffix(info.Name(), ".gotpl") { + return nil + } + b, err := ioutil.ReadFile(path) + if err != nil { + return err + } + + t, err = t.New(name).Parse(string(b)) + if err != nil { + return errors.Wrap(err, cfg.Filename) + } + + roots = append(roots, name) + + return nil }) + if err != nil { + return errors.Wrap(err, "locating templates") + } - for filename, data := range data { - _, err := t.New(filename).Parse(data) + // then execute all the important looking ones in order, adding them to the same file + sort.Slice(roots, func(i, j int) bool { + // important files go first + if strings.HasSuffix(roots[i], "!.gotpl") { + return true + } + if strings.HasSuffix(roots[j], "!.gotpl") { + return false + } + return roots[i] < roots[j] + }) + var buf bytes.Buffer + for _, root := range roots { + if cfg.RegionTags { + buf.WriteString("\n// region " + center(70, "*", " "+root+" ") + "\n") + } + err = t.Lookup(root).Execute(&buf, cfg.Data) if err != nil { - panic(err) + return errors.Wrap(err, root) + } + if cfg.RegionTags { + buf.WriteString("\n// endregion " + center(70, "*", " "+root+" ") + "\n") } } - buf := &bytes.Buffer{} - err := t.Lookup(name).Execute(buf, tpldata) + var result bytes.Buffer + if cfg.GeneratedHeader { + result.WriteString("// Code generated by github.com/99designs/gqlgen, DO NOT EDIT.\n\n") + } + result.WriteString("package ") + result.WriteString(cfg.PackageName) + result.WriteString("\n\n") + result.WriteString("import (\n") + result.WriteString(CurrentImports.String()) + result.WriteString(")\n") + _, err = buf.WriteTo(&result) if err != nil { - return nil, err + return err } + CurrentImports = nil - return buf, nil + return write(cfg.Filename, result.Bytes()) +} + +func center(width int, pad string, s string) string { + if len(s)+2 > width { + return s + } + lpad := (width - len(s)) / 2 + rpad := width - (lpad + len(s)) + return strings.Repeat(pad, lpad) + s + strings.Repeat(pad, rpad) +} + +func Funcs() template.FuncMap { + return template.FuncMap{ + "ucFirst": ucFirst, + "lcFirst": lcFirst, + "quote": strconv.Quote, + "rawQuote": rawQuote, + "dump": Dump, + "ref": ref, + "ts": TypeIdentifier, + "call": Call, + "prefixLines": prefixLines, + "notNil": notNil, + "reserveImport": CurrentImports.Reserve, + "lookupImport": CurrentImports.Lookup, + "go": ToGo, + "goPrivate": ToGoPrivate, + "add": func(a, b int) int { + return a + b + }, + "render": func(filename string, tpldata interface{}) (*bytes.Buffer, error) { + return render(resolveName(filename, 0), tpldata) + }, + } } func ucFirst(s string) string { @@ -74,37 +176,276 @@ func isDelimiter(c rune) bool { return c == '-' || c == '_' || unicode.IsSpace(c) } -func ToCamel(s string) string { - buffer := make([]rune, 0, len(s)) - upper := true - lastWasUpper := false +func ref(p types.Type) string { + return CurrentImports.LookupType(p) +} - for _, c := range s { - if isDelimiter(c) { - upper = true +var pkgReplacer = strings.NewReplacer( + "/", "ᚋ", + ".", "ᚗ", + "-", "ᚑ", +) + +func TypeIdentifier(t types.Type) string { + res := "" + for { + switch it := t.(type) { + case *types.Pointer: + t.Underlying() + res += "ᚖ" + t = it.Elem() + case *types.Slice: + res += "ᚕ" + t = it.Elem() + case *types.Named: + res += pkgReplacer.Replace(it.Obj().Pkg().Path()) + res += "ᚐ" + res += it.Obj().Name() + return res + case *types.Basic: + res += it.Name() + return res + case *types.Map: + res += "map" + return res + case *types.Interface: + res += "interface" + return res + default: + panic(fmt.Errorf("unexpected type %T", it)) + } + } +} + +func Call(p *types.Func) string { + pkg := CurrentImports.Lookup(p.Pkg().Path()) + + if pkg != "" { + pkg += "." + } + + if p.Type() != nil { + // make sure the returned type is listed in our imports. + ref(p.Type().(*types.Signature).Results().At(0).Type()) + } + + return pkg + p.Name() +} + +func ToGo(name string) string { + runes := make([]rune, 0, len(name)) + + wordWalker(name, func(info *wordInfo) { + word := info.Word + if info.MatchCommonInitial { + word = strings.ToUpper(word) + } else if !info.HasCommonInitial { + if strings.ToUpper(word) == word || strings.ToLower(word) == word { + // FOO or foo → Foo + // FOo → FOo + word = ucFirst(strings.ToLower(word)) + } + } + runes = append(runes, []rune(word)...) + }) + + return string(runes) +} + +func ToGoPrivate(name string) string { + runes := make([]rune, 0, len(name)) + + first := true + wordWalker(name, func(info *wordInfo) { + word := info.Word + if first { + if strings.ToUpper(word) == word || strings.ToLower(word) == word { + // ID → id, CAMEL → camel + word = strings.ToLower(info.Word) + } else { + // ITicket → iTicket + word = lcFirst(info.Word) + } + first = false + } else if info.MatchCommonInitial { + word = strings.ToUpper(word) + } else if !info.HasCommonInitial { + word = ucFirst(strings.ToLower(word)) + } + runes = append(runes, []rune(word)...) + }) + + return sanitizeKeywords(string(runes)) +} + +type wordInfo struct { + Word string + MatchCommonInitial bool + HasCommonInitial bool +} + +// This function is based on the following code. +// https://github.com/golang/lint/blob/06c8688daad7faa9da5a0c2f163a3d14aac986ca/lint.go#L679 +func wordWalker(str string, f func(*wordInfo)) { + runes := []rune(str) + w, i := 0, 0 // index of start of word, scan + hasCommonInitial := false + for i+1 <= len(runes) { + eow := false // whether we hit the end of a word + if i+1 == len(runes) { + eow = true + } else if isDelimiter(runes[i+1]) { + // underscore; shift the remainder forward over any run of underscores + eow = true + n := 1 + for i+n+1 < len(runes) && isDelimiter(runes[i+n+1]) { + n++ + } + + // Leave at most one underscore if the underscore is between two digits + if i+n+1 < len(runes) && unicode.IsDigit(runes[i]) && unicode.IsDigit(runes[i+n+1]) { + n-- + } + + copy(runes[i+1:], runes[i+n+1:]) + runes = runes[:len(runes)-n] + } else if unicode.IsLower(runes[i]) && !unicode.IsLower(runes[i+1]) { + // lower->non-lower + eow = true + } + i++ + + // [w,i) is a word. + word := string(runes[w:i]) + if !eow && commonInitialisms[word] && !unicode.IsLower(runes[i]) { + // through + // split IDFoo → ID, Foo + // but URLs → URLs + } else if !eow { + if commonInitialisms[word] { + hasCommonInitial = true + } continue } - if !lastWasUpper && unicode.IsUpper(c) { - upper = true + + matchCommonInitial := false + if commonInitialisms[strings.ToUpper(word)] { + hasCommonInitial = true + matchCommonInitial = true } - if upper { - buffer = append(buffer, unicode.ToUpper(c)) - } else { - buffer = append(buffer, unicode.ToLower(c)) + f(&wordInfo{ + Word: word, + MatchCommonInitial: matchCommonInitial, + HasCommonInitial: hasCommonInitial, + }) + hasCommonInitial = false + w = i + } +} + +var keywords = []string{ + "break", + "default", + "func", + "interface", + "select", + "case", + "defer", + "go", + "map", + "struct", + "chan", + "else", + "goto", + "package", + "switch", + "const", + "fallthrough", + "if", + "range", + "type", + "continue", + "for", + "import", + "return", + "var", + "_", +} + +// sanitizeKeywords prevents collisions with go keywords for arguments to resolver functions +func sanitizeKeywords(name string) string { + for _, k := range keywords { + if name == k { + return name + "Arg" } - upper = false - lastWasUpper = unicode.IsUpper(c) } + return name +} - return string(buffer) +// commonInitialisms is a set of common initialisms. +// Only add entries that are highly unlikely to be non-initialisms. +// For instance, "ID" is fine (Freudian code is rare), but "AND" is not. +var commonInitialisms = map[string]bool{ + "ACL": true, + "API": true, + "ASCII": true, + "CPU": true, + "CSS": true, + "DNS": true, + "EOF": true, + "GUID": true, + "HTML": true, + "HTTP": true, + "HTTPS": true, + "ID": true, + "IP": true, + "JSON": true, + "LHS": true, + "QPS": true, + "RAM": true, + "RHS": true, + "RPC": true, + "SLA": true, + "SMTP": true, + "SQL": true, + "SSH": true, + "TCP": true, + "TLS": true, + "TTL": true, + "UDP": true, + "UI": true, + "UID": true, + "UUID": true, + "URI": true, + "URL": true, + "UTF8": true, + "VM": true, + "XML": true, + "XMPP": true, + "XSRF": true, + "XSS": true, } func rawQuote(s string) string { return "`" + strings.Replace(s, "`", "`+\"`\"+`", -1) + "`" } -func dump(val interface{}) string { +func notNil(field string, data interface{}) bool { + v := reflect.ValueOf(data) + + if v.Kind() == reflect.Ptr { + v = v.Elem() + } + if v.Kind() != reflect.Struct { + return false + } + val := v.FieldByName(field) + + return val.IsValid() && !val.IsNil() +} + +func Dump(val interface{}) string { switch val := val.(type) { case int: return strconv.Itoa(val) @@ -121,7 +462,7 @@ func dump(val interface{}) string { case []interface{}: var parts []string for _, part := range val { - parts = append(parts, dump(part)) + parts = append(parts, Dump(part)) } return "[]interface{}{" + strings.Join(parts, ",") + "}" case map[string]interface{}: @@ -138,7 +479,7 @@ func dump(val interface{}) string { buf.WriteString(strconv.Quote(key)) buf.WriteString(":") - buf.WriteString(dump(data)) + buf.WriteString(Dump(data)) buf.WriteString(",") } buf.WriteString("}") @@ -152,22 +493,33 @@ func prefixLines(prefix, s string) string { return prefix + strings.Replace(s, "\n", "\n"+prefix, -1) } -func RenderToFile(tpl string, filename string, data interface{}) error { - if CurrentImports != nil { - panic(fmt.Errorf("recursive or concurrent call to RenderToFile detected")) +func resolveName(name string, skip int) string { + if name[0] == '.' { + // load path relative to calling source file + _, callerFile, _, _ := runtime.Caller(skip + 1) + return filepath.Join(filepath.Dir(callerFile), name[1:]) } - CurrentImports = &Imports{destDir: filepath.Dir(filename)} - var buf *bytes.Buffer - buf, err := Run(tpl, data) + // load path relative to this directory + _, callerFile, _, _ := runtime.Caller(0) + return filepath.Join(filepath.Dir(callerFile), name) +} + +func render(filename string, tpldata interface{}) (*bytes.Buffer, error) { + t := template.New("").Funcs(Funcs()) + + b, err := ioutil.ReadFile(filename) if err != nil { - return errors.Wrap(err, filename+" generation failed") + return nil, err } - b := bytes.Replace(buf.Bytes(), []byte("%%%IMPORTS%%%"), []byte(CurrentImports.String()), -1) - CurrentImports = nil + t, err = t.New(filepath.Base(filename)).Parse(string(b)) + if err != nil { + panic(err) + } - return write(filename, b) + buf := &bytes.Buffer{} + return buf, t.Execute(buf, tpldata) } func write(filename string, b []byte) error { diff --git a/vendor/github.com/99designs/gqlgen/codegen/type.go b/vendor/github.com/99designs/gqlgen/codegen/type.go index 04d9bb2fde131c93c714c339ac4de636ce9a7405..e0083732368c99476ccea2682fdf15686cbebb3c 100644 --- a/vendor/github.com/99designs/gqlgen/codegen/type.go +++ b/vendor/github.com/99designs/gqlgen/codegen/type.go @@ -1,174 +1,18 @@ package codegen import ( - "strconv" - "strings" - - "github.com/99designs/gqlgen/codegen/templates" - - "github.com/vektah/gqlparser/ast" -) - -type NamedTypes map[string]*NamedType - -type NamedType struct { - Ref - IsScalar bool - IsInterface bool - IsInput bool - GQLType string // Name of the graphql type - Marshaler *Ref // If this type has an external marshaler this will be set -} - -type Ref struct { - GoType string // Name of the go type - Package string // the package the go type lives in - IsUserDefined bool // does the type exist in the typemap -} - -type Type struct { - *NamedType - - Modifiers []string - ASTType *ast.Type - AliasedType *Ref -} - -const ( - modList = "[]" - modPtr = "*" + "github.com/99designs/gqlgen/codegen/config" ) -func (t Ref) FullName() string { - return t.PkgDot() + t.GoType -} - -func (t Ref) PkgDot() string { - name := templates.CurrentImports.Lookup(t.Package) - if name == "" { - return "" - - } - - return name + "." -} - -func (t Type) Signature() string { - if t.AliasedType != nil { - return strings.Join(t.Modifiers, "") + t.AliasedType.FullName() - } - return strings.Join(t.Modifiers, "") + t.FullName() -} - -func (t Type) FullSignature() string { - pkg := "" - if t.Package != "" { - pkg = t.Package + "." - } - - return strings.Join(t.Modifiers, "") + pkg + t.GoType -} +func (b *builder) buildTypes() (map[string]*config.TypeReference, error) { + ret := map[string]*config.TypeReference{} -func (t Type) IsPtr() bool { - return len(t.Modifiers) > 0 && t.Modifiers[0] == modPtr -} + for _, ref := range b.Binder.References { + for ref != nil { + ret[ref.UniquenessKey()] = ref -func (t *Type) StripPtr() { - if !t.IsPtr() { - return + ref = ref.Elem() + } } - t.Modifiers = t.Modifiers[0 : len(t.Modifiers)-1] -} - -func (t Type) IsSlice() bool { - return len(t.Modifiers) > 0 && t.Modifiers[0] == modList || - len(t.Modifiers) > 1 && t.Modifiers[0] == modPtr && t.Modifiers[1] == modList -} - -func (t NamedType) IsMarshaled() bool { - return t.Marshaler != nil -} - -func (t Type) Unmarshal(result, raw string) string { - return t.unmarshal(result, raw, t.Modifiers, 1) -} - -func (t Type) unmarshal(result, raw string, remainingMods []string, depth int) string { - switch { - case len(remainingMods) > 0 && remainingMods[0] == modPtr: - ptr := "ptr" + strconv.Itoa(depth) - return tpl(`var {{.ptr}} {{.mods}}{{.t.FullName}} - if {{.raw}} != nil { - {{.next}} - {{.result}} = &{{.ptr -}} - } - `, map[string]interface{}{ - "ptr": ptr, - "t": t, - "raw": raw, - "result": result, - "mods": strings.Join(remainingMods[1:], ""), - "next": t.unmarshal(ptr, raw, remainingMods[1:], depth+1), - }) - - case len(remainingMods) > 0 && remainingMods[0] == modList: - var rawIf = "rawIf" + strconv.Itoa(depth) - var index = "idx" + strconv.Itoa(depth) - - return tpl(`var {{.rawSlice}} []interface{} - if {{.raw}} != nil { - if tmp1, ok := {{.raw}}.([]interface{}); ok { - {{.rawSlice}} = tmp1 - } else { - {{.rawSlice}} = []interface{}{ {{.raw}} } - } - } - {{.result}} = make({{.type}}, len({{.rawSlice}})) - for {{.index}} := range {{.rawSlice}} { - {{ .next -}} - }`, map[string]interface{}{ - "raw": raw, - "rawSlice": rawIf, - "index": index, - "result": result, - "type": strings.Join(remainingMods, "") + t.NamedType.FullName(), - "next": t.unmarshal(result+"["+index+"]", rawIf+"["+index+"]", remainingMods[1:], depth+1), - }) - } - - realResult := result - if t.AliasedType != nil { - result = "castTmp" - } - - return tpl(`{{- if .t.AliasedType }} - var castTmp {{.t.FullName}} - {{ end }} - {{- if eq .t.GoType "map[string]interface{}" }} - {{- .result }} = {{.raw}}.(map[string]interface{}) - {{- else if .t.Marshaler }} - {{- .result }}, err = {{ .t.Marshaler.PkgDot }}Unmarshal{{.t.Marshaler.GoType}}({{.raw}}) - {{- else -}} - err = (&{{.result}}).UnmarshalGQL({{.raw}}) - {{- end }} - {{- if .t.AliasedType }} - {{ .realResult }} = {{.t.AliasedType.FullName}}(castTmp) - {{- end }}`, map[string]interface{}{ - "realResult": realResult, - "result": result, - "raw": raw, - "t": t, - }) -} - -func (t Type) Marshal(val string) string { - if t.AliasedType != nil { - val = t.GoType + "(" + val + ")" - } - - if t.Marshaler != nil { - return "return " + t.Marshaler.PkgDot() + "Marshal" + t.Marshaler.GoType + "(" + val + ")" - } - - return "return " + val + return ret, nil } diff --git a/vendor/github.com/99designs/gqlgen/codegen/type.gotpl b/vendor/github.com/99designs/gqlgen/codegen/type.gotpl new file mode 100644 index 0000000000000000000000000000000000000000..f727baaca3c438d065097ee6bff38fe87e6593e0 --- /dev/null +++ b/vendor/github.com/99designs/gqlgen/codegen/type.gotpl @@ -0,0 +1,131 @@ +{{- range $type := .ReferencedTypes }} + {{ with $type.UnmarshalFunc }} + func (ec *executionContext) {{ . }}(ctx context.Context, v interface{}) ({{ $type.GO | ref }}, error) { + {{- if $type.IsNilable }} + if v == nil { return nil, nil } + {{- end }} + {{- if $type.IsPtr }} + res, err := ec.{{ $type.Elem.UnmarshalFunc }}(ctx, v) + return &res, err + {{- else if $type.IsSlice }} + var vSlice []interface{} + if v != nil { + if tmp1, ok := v.([]interface{}); ok { + vSlice = tmp1 + } else { + vSlice = []interface{}{ v } + } + } + var err error + res := make([]{{$type.GO.Elem | ref}}, len(vSlice)) + for i := range vSlice { + res[i], err = ec.{{ $type.Elem.UnmarshalFunc }}(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil + {{- else }} + {{- if $type.Unmarshaler }} + {{- if $type.CastType }} + tmp, err := {{ $type.Unmarshaler | call }}(v) + return {{ $type.GO | ref }}(tmp), err + {{- else}} + return {{ $type.Unmarshaler | call }}(v) + {{- end }} + {{- else if eq ($type.GO | ref) "map[string]interface{}" }} + return v.(map[string]interface{}), nil + {{- else if $type.IsMarshaler -}} + var res {{ $type.GO | ref }} + return res, res.UnmarshalGQL(v) + {{- else }} + return ec.unmarshalInput{{ $type.GQL.Name }}(ctx, v) + {{- end }} + {{- end }} + } + {{- end }} + + {{ with $type.MarshalFunc }} + func (ec *executionContext) {{ . }}(ctx context.Context, sel ast.SelectionSet, v {{ $type.GO | ref }}) graphql.Marshaler { + {{- if $type.IsNilable }} + if v == nil { + {{- if $type.GQL.NonNull }} + if !ec.HasError(graphql.GetResolverContext(ctx)) { + ec.Errorf(ctx, "must not be null") + } + {{- end }} + return graphql.Null + } + {{- else if $type.HasIsZero }} + if v.IsZero() { + {{- if $type.GQL.NonNull }} + if !ec.HasError(graphql.GetResolverContext(ctx)) { + ec.Errorf(ctx, "must not be null") + } + {{- end }} + return graphql.Null + } + {{- end }} + + {{- if $type.IsSlice }} + {{- if not $type.GQL.NonNull }} + if v == nil { + return graphql.Null + } + {{- end }} + ret := make(graphql.Array, len(v)) + {{- if not $type.IsScalar }} + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + {{- end }} + for i := range v { + {{- if not $type.IsScalar }} + i := i + rctx := &graphql.ResolverContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.{{ $type.Elem.MarshalFunc }}(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + {{ else }} + ret[i] = ec.{{ $type.Elem.MarshalFunc }}(ctx, sel, v[i]) + {{- end}} + } + {{ if not $type.IsScalar }} wg.Wait() {{ end }} + return ret + {{- else }} + + {{- if $type.IsMarshaler }} + return v + {{- else if $type.Marshaler }} + {{- if $type.IsPtr }} + return ec.{{ $type.Elem.MarshalFunc }}(ctx, sel, *v) + {{- else }} + return {{ $type.Marshaler | call }}({{- if $type.CastType }}{{ $type.CastType | ref }}(v){{else}}v{{- end }}) + {{- end }} + {{- else }} + return ec._{{$type.Definition.Name}}(ctx, sel, {{ if not $type.IsNilable}}&{{end}} v) + {{- end }} + {{- end }} + } + {{- end }} +{{- end }} diff --git a/vendor/github.com/99designs/gqlgen/codegen/type_build.go b/vendor/github.com/99designs/gqlgen/codegen/type_build.go deleted file mode 100644 index 586b0db238622c3c644d955b53dd284f49cdfe28..0000000000000000000000000000000000000000 --- a/vendor/github.com/99designs/gqlgen/codegen/type_build.go +++ /dev/null @@ -1,100 +0,0 @@ -package codegen - -import ( - "go/types" - "strings" - - "github.com/vektah/gqlparser/ast" - "golang.org/x/tools/go/loader" -) - -// namedTypeFromSchema objects for every graphql type, including scalars. There should only be one instance of Type for each thing -func (cfg *Config) buildNamedTypes() NamedTypes { - types := map[string]*NamedType{} - for _, schemaType := range cfg.schema.Types { - t := namedTypeFromSchema(schemaType) - - if userEntry, ok := cfg.Models[t.GQLType]; ok && userEntry.Model != "" { - t.IsUserDefined = true - t.Package, t.GoType = pkgAndType(userEntry.Model) - } else if t.IsScalar { - t.Package = "github.com/99designs/gqlgen/graphql" - t.GoType = "String" - } - - types[t.GQLType] = t - } - return types -} - -func (cfg *Config) bindTypes(namedTypes NamedTypes, destDir string, prog *loader.Program) { - for _, t := range namedTypes { - if t.Package == "" { - continue - } - - def, _ := findGoType(prog, t.Package, "Marshal"+t.GoType) - switch def := def.(type) { - case *types.Func: - sig := def.Type().(*types.Signature) - cpy := t.Ref - t.Marshaler = &cpy - - t.Package, t.GoType = pkgAndType(sig.Params().At(0).Type().String()) - } - } -} - -// namedTypeFromSchema objects for every graphql type, including primitives. -// don't recurse into object fields or interfaces yet, lets make sure we have collected everything first. -func namedTypeFromSchema(schemaType *ast.Definition) *NamedType { - switch schemaType.Kind { - case ast.Scalar, ast.Enum: - return &NamedType{GQLType: schemaType.Name, IsScalar: true} - case ast.Interface, ast.Union: - return &NamedType{GQLType: schemaType.Name, IsInterface: true} - case ast.InputObject: - return &NamedType{GQLType: schemaType.Name, IsInput: true} - default: - return &NamedType{GQLType: schemaType.Name} - } -} - -// take a string in the form github.com/package/blah.Type and split it into package and type -func pkgAndType(name string) (string, string) { - parts := strings.Split(name, ".") - if len(parts) == 1 { - return "", name - } - - return normalizeVendor(strings.Join(parts[:len(parts)-1], ".")), parts[len(parts)-1] -} - -func (n NamedTypes) getType(t *ast.Type) *Type { - orig := t - var modifiers []string - for { - if t.Elem != nil { - modifiers = append(modifiers, modList) - t = t.Elem - } else { - if !t.NonNull { - modifiers = append(modifiers, modPtr) - } - if n[t.NamedType] == nil { - panic("missing type " + t.NamedType) - } - res := &Type{ - NamedType: n[t.NamedType], - Modifiers: modifiers, - ASTType: orig, - } - - if res.IsInterface { - res.StripPtr() - } - - return res - } - } -} diff --git a/vendor/github.com/99designs/gqlgen/codegen/util.go b/vendor/github.com/99designs/gqlgen/codegen/util.go index cc6246fdb74560e145ddd025e3f86fea876a3536..59dfde08cdc16ff46898aeed9744740b04efc977 100644 --- a/vendor/github.com/99designs/gqlgen/codegen/util.go +++ b/vendor/github.com/99designs/gqlgen/codegen/util.go @@ -1,65 +1,30 @@ package codegen import ( - "fmt" "go/types" - "reflect" - "regexp" "strings" "github.com/pkg/errors" - "golang.org/x/tools/go/loader" ) -func findGoType(prog *loader.Program, pkgName string, typeName string) (types.Object, error) { - if pkgName == "" { - return nil, nil - } - fullName := typeName - if pkgName != "" { - fullName = pkgName + "." + typeName - } - - pkgName, err := resolvePkg(pkgName) - if err != nil { - return nil, errors.Errorf("unable to resolve package for %s: %s\n", fullName, err.Error()) - } - - pkg := prog.Imported[pkgName] - if pkg == nil { - return nil, errors.Errorf("required package was not loaded: %s", fullName) - } - - for astNode, def := range pkg.Defs { - if astNode.Name != typeName || def.Parent() == nil || def.Parent() != pkg.Pkg.Scope() { - continue - } - - return def, nil - } - - return nil, errors.Errorf("unable to find type %s\n", fullName) -} - -func findGoNamedType(prog *loader.Program, pkgName string, typeName string) (*types.Named, error) { - def, err := findGoType(prog, pkgName, typeName) - if err != nil { - return nil, err - } +func findGoNamedType(def types.Type) (*types.Named, error) { if def == nil { return nil, nil } - namedType, ok := def.Type().(*types.Named) + namedType, ok := def.(*types.Named) if !ok { - return nil, errors.Errorf("expected %s to be a named type, instead found %T\n", typeName, def.Type()) + return nil, errors.Errorf("expected %s to be a named type, instead found %T\n", def.String(), def) } return namedType, nil } -func findGoInterface(prog *loader.Program, pkgName string, typeName string) (*types.Interface, error) { - namedType, err := findGoNamedType(prog, pkgName, typeName) +func findGoInterface(def types.Type) (*types.Interface, error) { + if def == nil { + return nil, nil + } + namedType, err := findGoNamedType(def) if err != nil { return nil, err } @@ -69,319 +34,14 @@ func findGoInterface(prog *loader.Program, pkgName string, typeName string) (*ty underlying, ok := namedType.Underlying().(*types.Interface) if !ok { - return nil, errors.Errorf("expected %s to be a named interface, instead found %s", typeName, namedType.String()) + return nil, errors.Errorf("expected %s to be a named interface, instead found %s", def.String(), namedType.String()) } return underlying, nil } -func findMethod(typ *types.Named, name string) *types.Func { - for i := 0; i < typ.NumMethods(); i++ { - method := typ.Method(i) - if !method.Exported() { - continue - } - - if strings.EqualFold(method.Name(), name) { - return method - } - } - - if s, ok := typ.Underlying().(*types.Struct); ok { - for i := 0; i < s.NumFields(); i++ { - field := s.Field(i) - if !field.Anonymous() { - continue - } - - if named, ok := field.Type().(*types.Named); ok { - if f := findMethod(named, name); f != nil { - return f - } - } - } - } - - return nil -} - func equalFieldName(source, target string) bool { source = strings.Replace(source, "_", "", -1) target = strings.Replace(target, "_", "", -1) return strings.EqualFold(source, target) } - -// findField attempts to match the name to a struct field with the following -// priorites: -// 1. If struct tag is passed then struct tag has highest priority -// 2. Field in an embedded struct -// 3. Actual Field name -func findField(typ *types.Struct, name, structTag string) (*types.Var, error) { - var foundField *types.Var - foundFieldWasTag := false - - for i := 0; i < typ.NumFields(); i++ { - field := typ.Field(i) - - if structTag != "" { - tags := reflect.StructTag(typ.Tag(i)) - if val, ok := tags.Lookup(structTag); ok { - if equalFieldName(val, name) { - if foundField != nil && foundFieldWasTag { - return nil, errors.Errorf("tag %s is ambigious; multiple fields have the same tag value of %s", structTag, val) - } - - foundField = field - foundFieldWasTag = true - } - } - } - - if field.Anonymous() { - - fieldType := field.Type() - - if ptr, ok := fieldType.(*types.Pointer); ok { - fieldType = ptr.Elem() - } - - // Type.Underlying() returns itself for all types except types.Named, where it returns a struct type. - // It should be safe to always call. - if named, ok := fieldType.Underlying().(*types.Struct); ok { - f, err := findField(named, name, structTag) - if err != nil && !strings.HasPrefix(err.Error(), "no field named") { - return nil, err - } - if f != nil && foundField == nil { - foundField = f - } - } - } - - if !field.Exported() { - continue - } - - if equalFieldName(field.Name(), name) && foundField == nil { // aqui! - foundField = field - } - } - - if foundField == nil { - return nil, fmt.Errorf("no field named %s", name) - } - - return foundField, nil -} - -type BindError struct { - object *Object - field *Field - typ types.Type - methodErr error - varErr error -} - -func (b BindError) Error() string { - return fmt.Sprintf( - "Unable to bind %s.%s to %s\n %s\n %s", - b.object.GQLType, - b.field.GQLName, - b.typ.String(), - b.methodErr.Error(), - b.varErr.Error(), - ) -} - -type BindErrors []BindError - -func (b BindErrors) Error() string { - var errs []string - for _, err := range b { - errs = append(errs, err.Error()) - } - return strings.Join(errs, "\n\n") -} - -func bindObject(t types.Type, object *Object, structTag string) BindErrors { - var errs BindErrors - for i := range object.Fields { - field := &object.Fields[i] - - if field.ForceResolver { - continue - } - - // first try binding to a method - methodErr := bindMethod(t, field) - if methodErr == nil { - continue - } - - // otherwise try binding to a var - varErr := bindVar(t, field, structTag) - - if varErr != nil { - errs = append(errs, BindError{ - object: object, - typ: t, - field: field, - varErr: varErr, - methodErr: methodErr, - }) - } - } - return errs -} - -func bindMethod(t types.Type, field *Field) error { - namedType, ok := t.(*types.Named) - if !ok { - return fmt.Errorf("not a named type") - } - - goName := field.GQLName - if field.GoFieldName != "" { - goName = field.GoFieldName - } - method := findMethod(namedType, goName) - if method == nil { - return fmt.Errorf("no method named %s", field.GQLName) - } - sig := method.Type().(*types.Signature) - - if sig.Results().Len() == 1 { - field.NoErr = true - } else if sig.Results().Len() != 2 { - return fmt.Errorf("method has wrong number of args") - } - params := sig.Params() - // If the first argument is the context, remove it from the comparison and set - // the MethodHasContext flag so that the context will be passed to this model's method - if params.Len() > 0 && params.At(0).Type().String() == "context.Context" { - field.MethodHasContext = true - vars := make([]*types.Var, params.Len()-1) - for i := 1; i < params.Len(); i++ { - vars[i-1] = params.At(i) - } - params = types.NewTuple(vars...) - } - - newArgs, err := matchArgs(field, params) - if err != nil { - return err - } - - result := sig.Results().At(0) - if err := validateTypeBinding(field, result.Type()); err != nil { - return errors.Wrap(err, "method has wrong return type") - } - - // success, args and return type match. Bind to method - field.GoFieldType = GoFieldMethod - field.GoReceiverName = "obj" - field.GoFieldName = method.Name() - field.Args = newArgs - return nil -} - -func bindVar(t types.Type, field *Field, structTag string) error { - underlying, ok := t.Underlying().(*types.Struct) - if !ok { - return fmt.Errorf("not a struct") - } - - goName := field.GQLName - if field.GoFieldName != "" { - goName = field.GoFieldName - } - structField, err := findField(underlying, goName, structTag) - if err != nil { - return err - } - - if err := validateTypeBinding(field, structField.Type()); err != nil { - return errors.Wrap(err, "field has wrong type") - } - - // success, bind to var - field.GoFieldType = GoFieldVariable - field.GoReceiverName = "obj" - field.GoFieldName = structField.Name() - return nil -} - -func matchArgs(field *Field, params *types.Tuple) ([]FieldArgument, error) { - var newArgs []FieldArgument - -nextArg: - for j := 0; j < params.Len(); j++ { - param := params.At(j) - for _, oldArg := range field.Args { - if strings.EqualFold(oldArg.GQLName, param.Name()) { - if !field.ForceResolver { - oldArg.Type.Modifiers = modifiersFromGoType(param.Type()) - } - newArgs = append(newArgs, oldArg) - continue nextArg - } - } - - // no matching arg found, abort - return nil, fmt.Errorf("arg %s not found on method", param.Name()) - } - return newArgs, nil -} - -func validateTypeBinding(field *Field, goType types.Type) error { - gqlType := normalizeVendor(field.Type.FullSignature()) - goTypeStr := normalizeVendor(goType.String()) - - if equalTypes(goTypeStr, gqlType) { - field.Type.Modifiers = modifiersFromGoType(goType) - return nil - } - - // deal with type aliases - underlyingStr := normalizeVendor(goType.Underlying().String()) - if equalTypes(underlyingStr, gqlType) { - field.Type.Modifiers = modifiersFromGoType(goType) - pkg, typ := pkgAndType(goType.String()) - field.AliasedType = &Ref{GoType: typ, Package: pkg} - return nil - } - - return fmt.Errorf("%s is not compatible with %s", gqlType, goTypeStr) -} - -func modifiersFromGoType(t types.Type) []string { - var modifiers []string - for { - switch val := t.(type) { - case *types.Pointer: - modifiers = append(modifiers, modPtr) - t = val.Elem() - case *types.Array: - modifiers = append(modifiers, modList) - t = val.Elem() - case *types.Slice: - modifiers = append(modifiers, modList) - t = val.Elem() - default: - return modifiers - } - } -} - -var modsRegex = regexp.MustCompile(`^(\*|\[\])*`) - -func normalizeVendor(pkg string) string { - modifiers := modsRegex.FindAllString(pkg, 1)[0] - pkg = strings.TrimPrefix(pkg, modifiers) - parts := strings.Split(pkg, "/vendor/") - return modifiers + parts[len(parts)-1] -} - -func equalTypes(goType string, gqlType string) bool { - return goType == gqlType || "*"+goType == gqlType || goType == "*"+gqlType || strings.Replace(goType, "[]*", "[]", -1) == gqlType -} diff --git a/vendor/github.com/99designs/gqlgen/docs/content/_introduction.md b/vendor/github.com/99designs/gqlgen/docs/content/_introduction.md new file mode 120000 index 0000000000000000000000000000000000000000..fe840054137e2ccda075344f21e728249a60a2fc --- /dev/null +++ b/vendor/github.com/99designs/gqlgen/docs/content/_introduction.md @@ -0,0 +1 @@ +../../README.md \ No newline at end of file diff --git a/vendor/github.com/99designs/gqlgen/graphql/bool.go b/vendor/github.com/99designs/gqlgen/graphql/bool.go index 7053bbcaa3280d37547ccd82f1df3cd4bfbde6c3..b175ca98628e3ff4101c62104beff88be3bd57ce 100644 --- a/vendor/github.com/99designs/gqlgen/graphql/bool.go +++ b/vendor/github.com/99designs/gqlgen/graphql/bool.go @@ -19,7 +19,7 @@ func MarshalBoolean(b bool) Marshaler { func UnmarshalBoolean(v interface{}) (bool, error) { switch v := v.(type) { case string: - return "true" == strings.ToLower(v), nil + return strings.ToLower(v) == "true", nil case int: return v != 0, nil case bool: diff --git a/vendor/github.com/99designs/gqlgen/graphql/context.go b/vendor/github.com/99designs/gqlgen/graphql/context.go index f83fa36f4ea9ef00a58c0e29b8b70bb85a4d0e43..58d3c741e12a3cf6cd630fa86a14a785d3a434da 100644 --- a/vendor/github.com/99designs/gqlgen/graphql/context.go +++ b/vendor/github.com/99designs/gqlgen/graphql/context.go @@ -12,6 +12,7 @@ import ( type Resolver func(ctx context.Context) (res interface{}, err error) type FieldMiddleware func(ctx context.Context, next Resolver) (res interface{}, err error) type RequestMiddleware func(ctx context.Context, next func(ctx context.Context) []byte) []byte +type ComplexityLimitFunc func(ctx context.Context) int type RequestContext struct { RawQuery string @@ -71,12 +72,10 @@ const ( ) func GetRequestContext(ctx context.Context) *RequestContext { - val := ctx.Value(request) - if val == nil { - return nil + if val, ok := ctx.Value(request).(*RequestContext); ok { + return val } - - return val.(*RequestContext) + return nil } func WithRequestContext(ctx context.Context, rc *RequestContext) context.Context { @@ -95,6 +94,8 @@ type ResolverContext struct { Index *int // The result object of resolver Result interface{} + // IsMethod indicates if the resolver is a method + IsMethod bool } func (r *ResolverContext) Path() []interface{} { @@ -117,8 +118,10 @@ func (r *ResolverContext) Path() []interface{} { } func GetResolverContext(ctx context.Context) *ResolverContext { - val, _ := ctx.Value(resolver).(*ResolverContext) - return val + if val, ok := ctx.Value(resolver).(*ResolverContext); ok { + return val + } + return nil } func WithResolverContext(ctx context.Context, rc *ResolverContext) context.Context { @@ -132,6 +135,24 @@ func CollectFieldsCtx(ctx context.Context, satisfies []string) []CollectedField return CollectFields(ctx, resctx.Field.Selections, satisfies) } +// CollectAllFields returns a slice of all GraphQL field names that were selected for the current resolver context. +// The slice will contain the unique set of all field names requested regardless of fragment type conditions. +func CollectAllFields(ctx context.Context) []string { + resctx := GetResolverContext(ctx) + collected := CollectFields(ctx, resctx.Field.Selections, nil) + uniq := make([]string, 0, len(collected)) +Next: + for _, f := range collected { + for _, name := range uniq { + if name == f.Name { + continue Next + } + } + uniq = append(uniq, f.Name) + } + return uniq +} + // Errorf sends an error string to the client, passing it through the formatter. func (c *RequestContext) Errorf(ctx context.Context, format string, args ...interface{}) { c.errorsMu.Lock() @@ -217,3 +238,37 @@ func (c *RequestContext) RegisterExtension(key string, value interface{}) error c.Extensions[key] = value return nil } + +// ChainFieldMiddleware add chain by FieldMiddleware +func ChainFieldMiddleware(handleFunc ...FieldMiddleware) FieldMiddleware { + n := len(handleFunc) + + if n > 1 { + lastI := n - 1 + return func(ctx context.Context, next Resolver) (interface{}, error) { + var ( + chainHandler Resolver + curI int + ) + chainHandler = func(currentCtx context.Context) (interface{}, error) { + if curI == lastI { + return next(currentCtx) + } + curI++ + res, err := handleFunc[curI](currentCtx, chainHandler) + curI-- + return res, err + + } + return handleFunc[0](ctx, chainHandler) + } + } + + if n == 1 { + return handleFunc[0] + } + + return func(ctx context.Context, next Resolver) (interface{}, error) { + return next(ctx) + } +} diff --git a/vendor/github.com/99designs/gqlgen/graphql/error.go b/vendor/github.com/99designs/gqlgen/graphql/error.go index 7f161a4306bd780f3268a9f255ed75a68b577a56..af8b4ce4088107d6aafb5366cec71fc54bc8a57c 100644 --- a/vendor/github.com/99designs/gqlgen/graphql/error.go +++ b/vendor/github.com/99designs/gqlgen/graphql/error.go @@ -14,7 +14,9 @@ type ExtendedError interface { func DefaultErrorPresenter(ctx context.Context, err error) *gqlerror.Error { if gqlerr, ok := err.(*gqlerror.Error); ok { - gqlerr.Path = GetResolverContext(ctx).Path() + if gqlerr.Path == nil { + gqlerr.Path = GetResolverContext(ctx).Path() + } return gqlerr } diff --git a/vendor/github.com/99designs/gqlgen/graphql/exec.go b/vendor/github.com/99designs/gqlgen/graphql/exec.go index 9beb3149078326aed91646cc7002167413c730b6..17c57bf67a50bb29fcd6b75e2c4b11f0e2e4520f 100644 --- a/vendor/github.com/99designs/gqlgen/graphql/exec.go +++ b/vendor/github.com/99designs/gqlgen/graphql/exec.go @@ -16,6 +16,9 @@ type ExecutableSchema interface { Subscription(ctx context.Context, op *ast.OperationDefinition) func() *Response } +// CollectFields returns the set of fields from an ast.SelectionSet where all collected fields satisfy at least one of the GraphQL types +// passed through satisfies. Providing an empty or nil slice for satisfies will return collect all fields regardless of fragment +// type conditions. func CollectFields(ctx context.Context, selSet ast.SelectionSet, satisfies []string) []CollectedField { return collectFields(GetRequestContext(ctx), selSet, satisfies, map[string]bool{}) } @@ -35,7 +38,10 @@ func collectFields(reqCtx *RequestContext, selSet ast.SelectionSet, satisfies [] f.Selections = append(f.Selections, sel.SelectionSet...) case *ast.InlineFragment: - if !shouldIncludeNode(sel.Directives, reqCtx.Variables) || !instanceOf(sel.TypeCondition, satisfies) { + if !shouldIncludeNode(sel.Directives, reqCtx.Variables) { + continue + } + if len(satisfies) > 0 && !instanceOf(sel.TypeCondition, satisfies) { continue } for _, childField := range collectFields(reqCtx, sel.SelectionSet, satisfies, visited) { @@ -59,7 +65,7 @@ func collectFields(reqCtx *RequestContext, selSet ast.SelectionSet, satisfies [] panic(fmt.Errorf("missing fragment %s", fragmentName)) } - if !instanceOf(fragment.TypeCondition, satisfies) { + if len(satisfies) > 0 && !instanceOf(fragment.TypeCondition, satisfies) { continue } diff --git a/vendor/github.com/99designs/gqlgen/graphql/fieldset.go b/vendor/github.com/99designs/gqlgen/graphql/fieldset.go new file mode 100644 index 0000000000000000000000000000000000000000..351e266fdb30bbb9c4165f72d2e76ea1014da3b3 --- /dev/null +++ b/vendor/github.com/99designs/gqlgen/graphql/fieldset.go @@ -0,0 +1,63 @@ +package graphql + +import ( + "io" + "sync" +) + +type FieldSet struct { + fields []CollectedField + Values []Marshaler + delayed []delayedResult +} + +type delayedResult struct { + i int + f func() Marshaler +} + +func NewFieldSet(fields []CollectedField) *FieldSet { + return &FieldSet{ + fields: fields, + Values: make([]Marshaler, len(fields)), + } +} + +func (m *FieldSet) Concurrently(i int, f func() Marshaler) { + m.delayed = append(m.delayed, delayedResult{i: i, f: f}) +} + +func (m *FieldSet) Dispatch() { + if len(m.delayed) == 1 { + // only one concurrent task, no need to spawn a goroutine or deal create waitgroups + d := m.delayed[0] + m.Values[d.i] = d.f() + } else if len(m.delayed) > 1 { + // more than one concurrent task, use the main goroutine to do one, only spawn goroutines for the others + + var wg sync.WaitGroup + for _, d := range m.delayed[1:] { + wg.Add(1) + go func(d delayedResult) { + m.Values[d.i] = d.f() + wg.Done() + }(d) + } + + m.Values[m.delayed[0].i] = m.delayed[0].f() + wg.Wait() + } +} + +func (m *FieldSet) MarshalGQL(writer io.Writer) { + writer.Write(openBrace) + for i, field := range m.fields { + if i != 0 { + writer.Write(comma) + } + writeQuotedString(writer, field.Alias) + writer.Write(colon) + m.Values[i].MarshalGQL(writer) + } + writer.Write(closeBrace) +} diff --git a/vendor/github.com/99designs/gqlgen/graphql/id.go b/vendor/github.com/99designs/gqlgen/graphql/id.go index a5a7960f3466e68f100244304256a01027acb667..4f532037d0842c86ebacab24756f54c2d6df5989 100644 --- a/vendor/github.com/99designs/gqlgen/graphql/id.go +++ b/vendor/github.com/99designs/gqlgen/graphql/id.go @@ -34,3 +34,24 @@ func UnmarshalID(v interface{}) (string, error) { return "", fmt.Errorf("%T is not a string", v) } } + +func MarshalIntID(i int) Marshaler { + return WriterFunc(func(w io.Writer) { + writeQuotedString(w, strconv.Itoa(i)) + }) +} + +func UnmarshalIntID(v interface{}) (int, error) { + switch v := v.(type) { + case string: + return strconv.Atoi(v) + case int: + return v, nil + case int64: + return int(v), nil + case json.Number: + return strconv.Atoi(string(v)) + default: + return 0, fmt.Errorf("%T is not an int", v) + } +} diff --git a/vendor/github.com/99designs/gqlgen/graphql/int.go b/vendor/github.com/99designs/gqlgen/graphql/int.go index ff87574cab7767430deaf1177eea0d77ef20fbcd..57d0d589baefea7120b798212bf1bf63c4739d09 100644 --- a/vendor/github.com/99designs/gqlgen/graphql/int.go +++ b/vendor/github.com/99designs/gqlgen/graphql/int.go @@ -27,3 +27,53 @@ func UnmarshalInt(v interface{}) (int, error) { return 0, fmt.Errorf("%T is not an int", v) } } + +func MarshalInt64(i int64) Marshaler { + return WriterFunc(func(w io.Writer) { + io.WriteString(w, strconv.FormatInt(i, 10)) + }) +} + +func UnmarshalInt64(v interface{}) (int64, error) { + switch v := v.(type) { + case string: + return strconv.ParseInt(v, 10, 64) + case int: + return int64(v), nil + case int64: + return v, nil + case json.Number: + return strconv.ParseInt(string(v), 10, 64) + default: + return 0, fmt.Errorf("%T is not an int", v) + } +} + +func MarshalInt32(i int32) Marshaler { + return WriterFunc(func(w io.Writer) { + io.WriteString(w, strconv.FormatInt(int64(i), 10)) + }) +} + +func UnmarshalInt32(v interface{}) (int32, error) { + switch v := v.(type) { + case string: + iv, err := strconv.ParseInt(v, 10, 32) + if err != nil { + return 0, err + } + return int32(iv), nil + case int: + return int32(v), nil + case int64: + return int32(v), nil + case json.Number: + iv, err := strconv.ParseInt(string(v), 10, 32) + if err != nil { + return 0, err + } + return int32(iv), nil + default: + return 0, fmt.Errorf("%T is not an int", v) + } +} diff --git a/vendor/github.com/99designs/gqlgen/graphql/introspection/type.go b/vendor/github.com/99designs/gqlgen/graphql/introspection/type.go index b963aa0e27daa8f2b911a4de4d122ffdf4fe9ea0..f1228edf62d1c1a279ec535e9ce156382162ddd9 100644 --- a/vendor/github.com/99designs/gqlgen/graphql/introspection/type.go +++ b/vendor/github.com/99designs/gqlgen/graphql/introspection/type.go @@ -62,9 +62,9 @@ func (t *Type) Description() string { func (t *Type) Fields(includeDeprecated bool) []Field { if t.def == nil || (t.def.Kind != ast.Object && t.def.Kind != ast.Interface) { - return nil + return []Field{} } - var fields []Field + fields := []Field{} for _, f := range t.def.Fields { if strings.HasPrefix(f.Name, "__") { continue @@ -93,10 +93,10 @@ func (t *Type) Fields(includeDeprecated bool) []Field { func (t *Type) InputFields() []InputValue { if t.def == nil || t.def.Kind != ast.InputObject { - return nil + return []InputValue{} } - var res []InputValue + res := []InputValue{} for _, f := range t.def.Fields { res = append(res, InputValue{ Name: f.Name, @@ -118,10 +118,10 @@ func defaultValue(value *ast.Value) *string { func (t *Type) Interfaces() []Type { if t.def == nil || t.def.Kind != ast.Object { - return nil + return []Type{} } - var res []Type + res := []Type{} for _, intf := range t.def.Interfaces { res = append(res, *WrapTypeFromDef(t.schema, t.schema.Types[intf])) } @@ -131,10 +131,10 @@ func (t *Type) Interfaces() []Type { func (t *Type) PossibleTypes() []Type { if t.def == nil || (t.def.Kind != ast.Interface && t.def.Kind != ast.Union) { - return nil + return []Type{} } - var res []Type + res := []Type{} for _, pt := range t.schema.GetPossibleTypes(t.def) { res = append(res, *WrapTypeFromDef(t.schema, pt)) } @@ -143,10 +143,10 @@ func (t *Type) PossibleTypes() []Type { func (t *Type) EnumValues(includeDeprecated bool) []EnumValue { if t.def == nil || t.def.Kind != ast.Enum { - return nil + return []EnumValue{} } - var res []EnumValue + res := []EnumValue{} for _, val := range t.def.EnumValues { res = append(res, EnumValue{ Name: val.Name, diff --git a/vendor/github.com/99designs/gqlgen/graphql/jsonw.go b/vendor/github.com/99designs/gqlgen/graphql/jsonw.go index c112444a7e675eb32f9ff48b8fc3708b3ad3bd09..db95d8e441967e7480d83747036c73fae38e20a3 100644 --- a/vendor/github.com/99designs/gqlgen/graphql/jsonw.go +++ b/vendor/github.com/99designs/gqlgen/graphql/jsonw.go @@ -2,7 +2,6 @@ package graphql import ( "io" - "strconv" ) var nullLit = []byte(`null`) @@ -27,42 +26,12 @@ type Unmarshaler interface { UnmarshalGQL(v interface{}) error } -type OrderedMap struct { - Keys []string - Values []Marshaler -} - type WriterFunc func(writer io.Writer) func (f WriterFunc) MarshalGQL(w io.Writer) { f(w) } -func NewOrderedMap(len int) *OrderedMap { - return &OrderedMap{ - Keys: make([]string, len), - Values: make([]Marshaler, len), - } -} - -func (m *OrderedMap) Add(key string, value Marshaler) { - m.Keys = append(m.Keys, key) - m.Values = append(m.Values, value) -} - -func (m *OrderedMap) MarshalGQL(writer io.Writer) { - writer.Write(openBrace) - for i, key := range m.Keys { - if i != 0 { - writer.Write(comma) - } - io.WriteString(writer, strconv.Quote(key)) - writer.Write(colon) - m.Values[i].MarshalGQL(writer) - } - writer.Write(closeBrace) -} - type Array []Marshaler func (a Array) MarshalGQL(writer io.Writer) { diff --git a/vendor/github.com/99designs/gqlgen/graphql/root.go b/vendor/github.com/99designs/gqlgen/graphql/root.go new file mode 100644 index 0000000000000000000000000000000000000000..3405d18054dc419bc9999120fe3af569320b5e44 --- /dev/null +++ b/vendor/github.com/99designs/gqlgen/graphql/root.go @@ -0,0 +1,7 @@ +package graphql + +type Query struct{} + +type Mutation struct{} + +type Subscription struct{} diff --git a/vendor/github.com/99designs/gqlgen/graphql/string.go b/vendor/github.com/99designs/gqlgen/graphql/string.go index d5fb32947dcc7b34eb3a0ab6827a70ffdaf35f5e..7c1b7d95775250acf84695b438d40f97711253ec 100644 --- a/vendor/github.com/99designs/gqlgen/graphql/string.go +++ b/vendor/github.com/99designs/gqlgen/graphql/string.go @@ -10,37 +10,42 @@ const encodeHex = "0123456789ABCDEF" func MarshalString(s string) Marshaler { return WriterFunc(func(w io.Writer) { - start := 0 - io.WriteString(w, `"`) - - for i, c := range s { - if c < 0x20 || c == '\\' || c == '"' { - io.WriteString(w, s[start:i]) - - switch c { - case '\t': - io.WriteString(w, `\t`) - case '\r': - io.WriteString(w, `\r`) - case '\n': - io.WriteString(w, `\n`) - case '\\': - io.WriteString(w, `\\`) - case '"': - io.WriteString(w, `\"`) - default: - io.WriteString(w, `\u00`) - w.Write([]byte{encodeHex[c>>4], encodeHex[c&0xf]}) - } - - start = i + 1 + writeQuotedString(w, s) + }) +} + +func writeQuotedString(w io.Writer, s string) { + start := 0 + io.WriteString(w, `"`) + + for i, c := range s { + if c < 0x20 || c == '\\' || c == '"' { + io.WriteString(w, s[start:i]) + + switch c { + case '\t': + io.WriteString(w, `\t`) + case '\r': + io.WriteString(w, `\r`) + case '\n': + io.WriteString(w, `\n`) + case '\\': + io.WriteString(w, `\\`) + case '"': + io.WriteString(w, `\"`) + default: + io.WriteString(w, `\u00`) + w.Write([]byte{encodeHex[c>>4], encodeHex[c&0xf]}) } + + start = i + 1 } + } - io.WriteString(w, s[start:]) - io.WriteString(w, `"`) - }) + io.WriteString(w, s[start:]) + io.WriteString(w, `"`) } + func UnmarshalString(v interface{}) (string, error) { switch v := v.(type) { case string: diff --git a/vendor/github.com/99designs/gqlgen/graphql/version.go b/vendor/github.com/99designs/gqlgen/graphql/version.go index 490ff3ff2e4443e5518d0a138c654f7fba1cd182..88014abf60ba72f3fb300678278e5e00f4c65337 100644 --- a/vendor/github.com/99designs/gqlgen/graphql/version.go +++ b/vendor/github.com/99designs/gqlgen/graphql/version.go @@ -1,3 +1,3 @@ package graphql -const Version = "v0.7.2" +const Version = "v0.8.3" diff --git a/vendor/github.com/99designs/gqlgen/handler/graphql.go b/vendor/github.com/99designs/gqlgen/handler/graphql.go index 7c5f70cfdfdad9d8f55c743791544b9f1012d9a2..92a0471ce24a1c15fd717f91a1bb18669d6aca7e 100644 --- a/vendor/github.com/99designs/gqlgen/handler/graphql.go +++ b/vendor/github.com/99designs/gqlgen/handler/graphql.go @@ -34,6 +34,7 @@ type Config struct { requestHook graphql.RequestMiddleware tracer graphql.Tracer complexityLimit int + complexityLimitFunc graphql.ComplexityLimitFunc disableIntrospection bool connectionKeepAlivePingInterval time.Duration } @@ -60,11 +61,9 @@ func (c *Config) newRequestContext(es graphql.ExecutableSchema, doc *ast.QueryDo if hook := c.tracer; hook != nil { reqCtx.Tracer = hook - } else { - reqCtx.Tracer = &graphql.NopTracer{} } - if c.complexityLimit > 0 { + if c.complexityLimit > 0 || c.complexityLimitFunc != nil { reqCtx.ComplexityLimit = c.complexityLimit operationComplexity := complexity.Calculate(es, op, variables) reqCtx.OperationComplexity = operationComplexity @@ -112,6 +111,15 @@ func ComplexityLimit(limit int) Option { } } +// ComplexityLimitFunc allows you to define a function to dynamically set the maximum query complexity that is allowed +// to be executed. +// If a query is submitted that exceeds the limit, a 422 status code will be returned. +func ComplexityLimitFunc(complexityLimitFunc graphql.ComplexityLimitFunc) Option { + return func(cfg *Config) { + cfg.complexityLimitFunc = complexityLimitFunc + } +} + // ResolverMiddleware allows you to define a function that will be called around every resolver, // useful for logging. func ResolverMiddleware(middleware graphql.FieldMiddleware) Option { @@ -243,19 +251,23 @@ func CacheSize(size int) Option { } } -const DefaultCacheSize = 1000 - -// WebsocketKeepAliveDuration allows you to reconfigure the keepAlive behavior. -// By default, keep-alive is disabled. +// WebsocketKeepAliveDuration allows you to reconfigure the keepalive behavior. +// By default, keepalive is enabled with a DefaultConnectionKeepAlivePingInterval +// duration. Set handler.connectionKeepAlivePingInterval = 0 to disable keepalive +// altogether. func WebsocketKeepAliveDuration(duration time.Duration) Option { return func(cfg *Config) { cfg.connectionKeepAlivePingInterval = duration } } +const DefaultCacheSize = 1000 +const DefaultConnectionKeepAlivePingInterval = 25 * time.Second + func GraphQL(exec graphql.ExecutableSchema, options ...Option) http.HandlerFunc { cfg := &Config{ - cacheSize: DefaultCacheSize, + cacheSize: DefaultCacheSize, + connectionKeepAlivePingInterval: DefaultConnectionKeepAlivePingInterval, upgrader: websocket.Upgrader{ ReadBufferSize: 1024, WriteBufferSize: 1024, @@ -269,7 +281,7 @@ func GraphQL(exec graphql.ExecutableSchema, options ...Option) http.HandlerFunc var cache *lru.Cache if cfg.cacheSize > 0 { var err error - cache, err = lru.New(DefaultCacheSize) + cache, err = lru.New(cfg.cacheSize) if err != nil { // An error is only returned for non-positive cache size // and we already checked for that. @@ -305,10 +317,11 @@ func (gh *graphqlHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { } if strings.Contains(r.Header.Get("Upgrade"), "websocket") { - connectWs(gh.exec, w, r, gh.cfg) + connectWs(gh.exec, w, r, gh.cfg, gh.cache) return } + w.Header().Set("Content-Type", "application/json") var reqParams params switch r.Method { case http.MethodGet: @@ -330,7 +343,6 @@ func (gh *graphqlHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusMethodNotAllowed) return } - w.Header().Set("Content-Type", "application/json") ctx := r.Context() @@ -379,6 +391,10 @@ func (gh *graphqlHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { } }() + if gh.cfg.complexityLimitFunc != nil { + reqCtx.ComplexityLimit = gh.cfg.complexityLimitFunc(ctx) + } + if reqCtx.ComplexityLimit > 0 && reqCtx.OperationComplexity > reqCtx.ComplexityLimit { sendErrorf(w, http.StatusUnprocessableEntity, "operation has complexity %d, which exceeds the limit of %d", reqCtx.OperationComplexity, reqCtx.ComplexityLimit) return diff --git a/vendor/github.com/99designs/gqlgen/handler/playground.go b/vendor/github.com/99designs/gqlgen/handler/playground.go index f1687defb767bed6a88f82e0ebeeb31d45dc35a9..0e1ca76863bdb38c7f053b7fa9f3511e83394604 100644 --- a/vendor/github.com/99designs/gqlgen/handler/playground.go +++ b/vendor/github.com/99designs/gqlgen/handler/playground.go @@ -11,9 +11,12 @@ var page = template.Must(template.New("graphiql").Parse(` - - - + + +