From 6299f6d5e89f65447e9b39896d4d6d1f948d2ab0 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 24 Mar 2022 14:00:21 +0100 Subject: [PATCH] api: refactor build --- .gitignore | 3 + Makefile | 14 +- api/graph/api/generated.go | 10439 ----------------------- api/loaders/jobgroupsbyidloader_gen.go | 224 - api/loaders/jobsbyidloader_gen.go | 224 - api/loaders/usersbyidloader_gen.go | 224 - api/loaders/usersbynameloader_gen.go | 224 - 7 files changed, 16 insertions(+), 11336 deletions(-) delete mode 100644 api/graph/api/generated.go delete mode 100644 api/loaders/jobgroupsbyidloader_gen.go delete mode 100644 api/loaders/jobsbyidloader_gen.go delete mode 100644 api/loaders/usersbyidloader_gen.go delete mode 100644 api/loaders/usersbynameloader_gen.go diff --git a/.gitignore b/.gitignore index 32a8c53..d123994 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,6 @@ vmlinuz vmlinux *.img api/api +worker/worker +api/graph/api/generated.go +api/loaders/*_gen.go diff --git a/Makefile b/Makefile index 591b474..7f81dea 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,15 @@ -SRHT_PATH?=/usr/lib/python3.8/site-packages/srht +SRHT_PATH?=/usr/lib/python3.9/site-packages/srht MODULE=buildsrht/ include ${SRHT_PATH}/Makefile + +all: api worker + +api: + cd api && go generate ./loaders + cd api && go generate ./graph + cd api && go build + +worker: + cd worker && go build + +.PHONY: all api worker diff --git a/api/graph/api/generated.go b/api/graph/api/generated.go deleted file mode 100644 index a624aea..0000000 --- a/api/graph/api/generated.go +++ /dev/null @@ -1,10439 +0,0 @@ -// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. - -package api - -import ( - "bytes" - "context" - "errors" - "fmt" - "strconv" - "sync" - "sync/atomic" - "time" - - "git.sr.ht/~sircmpwn/builds.sr.ht/api/graph/model" - model1 "git.sr.ht/~sircmpwn/core-go/model" - "github.com/99designs/gqlgen/graphql" - "github.com/99designs/gqlgen/graphql/introspection" - gqlparser "github.com/vektah/gqlparser/v2" - "github.com/vektah/gqlparser/v2/ast" -) - -// region ************************** generated!.gotpl ************************** - -// NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface. -func NewExecutableSchema(cfg Config) graphql.ExecutableSchema { - return &executableSchema{ - resolvers: cfg.Resolvers, - directives: cfg.Directives, - complexity: cfg.Complexity, - } -} - -type Config struct { - Resolvers ResolverRoot - Directives DirectiveRoot - Complexity ComplexityRoot -} - -type ResolverRoot interface { - Job() JobResolver - JobGroup() JobGroupResolver - Mutation() MutationResolver - PGPKey() PGPKeyResolver - Query() QueryResolver - SSHKey() SSHKeyResolver - SecretFile() SecretFileResolver - Task() TaskResolver - User() UserResolver -} - -type DirectiveRoot struct { - Access func(ctx context.Context, obj interface{}, next graphql.Resolver, scope model.AccessScope, kind model.AccessKind) (res interface{}, err error) - Scopehelp func(ctx context.Context, obj interface{}, next graphql.Resolver, details string) (res interface{}, err error) - Worker func(ctx context.Context, obj interface{}, next graphql.Resolver) (res interface{}, err error) -} - -type ComplexityRoot struct { - Artifact struct { - Created func(childComplexity int) int - ID func(childComplexity int) int - Path func(childComplexity int) int - Size func(childComplexity int) int - URL func(childComplexity int) int - } - - EmailTrigger struct { - Cc func(childComplexity int) int - Condition func(childComplexity int) int - InReplyTo func(childComplexity int) int - To func(childComplexity int) int - } - - Job struct { - Artifacts func(childComplexity int) int - Created func(childComplexity int) int - Group func(childComplexity int) int - ID func(childComplexity int) int - Image func(childComplexity int) int - Log func(childComplexity int) int - Manifest func(childComplexity int) int - Note func(childComplexity int) int - Owner func(childComplexity int) int - Runner func(childComplexity int) int - Secrets func(childComplexity int) int - Status func(childComplexity int) int - Tags func(childComplexity int) int - Tasks func(childComplexity int) int - Updated func(childComplexity int) int - } - - JobCursor struct { - Cursor func(childComplexity int) int - Results func(childComplexity int) int - } - - JobGroup struct { - Created func(childComplexity int) int - ID func(childComplexity int) int - Jobs func(childComplexity int) int - Note func(childComplexity int) int - Owner func(childComplexity int) int - Triggers func(childComplexity int) int - } - - Log struct { - FullURL func(childComplexity int) int - Last128KiB func(childComplexity int) int - } - - Mutation struct { - Cancel func(childComplexity int, jobID int) int - Claim func(childComplexity int, jobID int) int - CreateArtifact func(childComplexity int, jobID int, path string, contents string) int - CreateGroup func(childComplexity int, jobIds []int, triggers []*model.TriggerInput, execute *bool, note *string) int - Start func(childComplexity int, jobID int) int - StartGroup func(childComplexity int, groupID int) int - Submit func(childComplexity int, manifest string, tags []string, note *string, secrets *bool, execute *bool) int - UpdateJob func(childComplexity int, jobID int, status model.JobStatus) int - UpdateTask func(childComplexity int, taskID int, status model.TaskStatus) int - } - - PGPKey struct { - Created func(childComplexity int) int - ID func(childComplexity int) int - Name func(childComplexity int) int - PrivateKey func(childComplexity int) int - UUID func(childComplexity int) int - } - - Query struct { - Job func(childComplexity int, id int) int - Jobs func(childComplexity int, cursor *model1.Cursor) int - Me func(childComplexity int) int - Secrets func(childComplexity int, cursor *model1.Cursor) int - UserByID func(childComplexity int, id int) int - UserByName func(childComplexity int, username string) int - Version func(childComplexity int) int - } - - SSHKey struct { - Created func(childComplexity int) int - ID func(childComplexity int) int - Name func(childComplexity int) int - PrivateKey func(childComplexity int) int - UUID func(childComplexity int) int - } - - SecretCursor struct { - Cursor func(childComplexity int) int - Results func(childComplexity int) int - } - - SecretFile struct { - Created func(childComplexity int) int - Data func(childComplexity int) int - ID func(childComplexity int) int - Mode func(childComplexity int) int - Name func(childComplexity int) int - Path func(childComplexity int) int - UUID func(childComplexity int) int - } - - Settings struct { - BuildTimeout func(childComplexity int) int - SSHUser func(childComplexity int) int - } - - Task struct { - Created func(childComplexity int) int - ID func(childComplexity int) int - Job func(childComplexity int) int - Log func(childComplexity int) int - Name func(childComplexity int) int - Status func(childComplexity int) int - Updated func(childComplexity int) int - } - - User struct { - Bio func(childComplexity int) int - CanonicalName func(childComplexity int) int - Created func(childComplexity int) int - Email func(childComplexity int) int - ID func(childComplexity int) int - Jobs func(childComplexity int, cursor *model1.Cursor) int - Location func(childComplexity int) int - URL func(childComplexity int) int - Updated func(childComplexity int) int - Username func(childComplexity int) int - } - - Version struct { - DeprecationDate func(childComplexity int) int - Major func(childComplexity int) int - Minor func(childComplexity int) int - Patch func(childComplexity int) int - Settings func(childComplexity int) int - } - - WebhookTrigger struct { - Condition func(childComplexity int) int - URL func(childComplexity int) int - } -} - -type JobResolver interface { - Owner(ctx context.Context, obj *model.Job) (model.Entity, error) - Group(ctx context.Context, obj *model.Job) (*model.JobGroup, error) - Tasks(ctx context.Context, obj *model.Job) ([]*model.Task, error) - Artifacts(ctx context.Context, obj *model.Job) ([]*model.Artifact, error) - Log(ctx context.Context, obj *model.Job) (*model.Log, error) - Secrets(ctx context.Context, obj *model.Job) ([]model.Secret, error) -} -type JobGroupResolver interface { - Owner(ctx context.Context, obj *model.JobGroup) (model.Entity, error) - Jobs(ctx context.Context, obj *model.JobGroup) ([]*model.Job, error) - Triggers(ctx context.Context, obj *model.JobGroup) ([]model.Trigger, error) -} -type MutationResolver interface { - Submit(ctx context.Context, manifest string, tags []string, note *string, secrets *bool, execute *bool) (*model.Job, error) - Start(ctx context.Context, jobID int) (*model.Job, error) - Cancel(ctx context.Context, jobID int) (*model.Job, error) - CreateGroup(ctx context.Context, jobIds []int, triggers []*model.TriggerInput, execute *bool, note *string) (*model.JobGroup, error) - StartGroup(ctx context.Context, groupID int) (*model.JobGroup, error) - Claim(ctx context.Context, jobID int) (*model.Job, error) - UpdateJob(ctx context.Context, jobID int, status model.JobStatus) (*model.Job, error) - UpdateTask(ctx context.Context, taskID int, status model.TaskStatus) (*model.Job, error) - CreateArtifact(ctx context.Context, jobID int, path string, contents string) (*model.Artifact, error) -} -type PGPKeyResolver interface { - PrivateKey(ctx context.Context, obj *model.PGPKey) (string, error) -} -type QueryResolver interface { - Version(ctx context.Context) (*model.Version, error) - Me(ctx context.Context) (*model.User, error) - UserByID(ctx context.Context, id int) (*model.User, error) - UserByName(ctx context.Context, username string) (*model.User, error) - Jobs(ctx context.Context, cursor *model1.Cursor) (*model.JobCursor, error) - Job(ctx context.Context, id int) (*model.Job, error) - Secrets(ctx context.Context, cursor *model1.Cursor) (*model.SecretCursor, error) -} -type SSHKeyResolver interface { - PrivateKey(ctx context.Context, obj *model.SSHKey) (string, error) -} -type SecretFileResolver interface { - Data(ctx context.Context, obj *model.SecretFile) (string, error) -} -type TaskResolver interface { - Log(ctx context.Context, obj *model.Task) (*model.Log, error) - Job(ctx context.Context, obj *model.Task) (*model.Job, error) -} -type UserResolver interface { - Jobs(ctx context.Context, obj *model.User, cursor *model1.Cursor) (*model.JobCursor, error) -} - -type executableSchema struct { - resolvers ResolverRoot - directives DirectiveRoot - complexity ComplexityRoot -} - -func (e *executableSchema) Schema() *ast.Schema { - return parsedSchema -} - -func (e *executableSchema) Complexity(typeName, field string, childComplexity int, rawArgs map[string]interface{}) (int, bool) { - ec := executionContext{nil, e} - _ = ec - switch typeName + "." + field { - - case "Artifact.created": - if e.complexity.Artifact.Created == nil { - break - } - - return e.complexity.Artifact.Created(childComplexity), true - - case "Artifact.id": - if e.complexity.Artifact.ID == nil { - break - } - - return e.complexity.Artifact.ID(childComplexity), true - - case "Artifact.path": - if e.complexity.Artifact.Path == nil { - break - } - - return e.complexity.Artifact.Path(childComplexity), true - - case "Artifact.size": - if e.complexity.Artifact.Size == nil { - break - } - - return e.complexity.Artifact.Size(childComplexity), true - - case "Artifact.url": - if e.complexity.Artifact.URL == nil { - break - } - - return e.complexity.Artifact.URL(childComplexity), true - - case "EmailTrigger.cc": - if e.complexity.EmailTrigger.Cc == nil { - break - } - - return e.complexity.EmailTrigger.Cc(childComplexity), true - - case "EmailTrigger.condition": - if e.complexity.EmailTrigger.Condition == nil { - break - } - - return e.complexity.EmailTrigger.Condition(childComplexity), true - - case "EmailTrigger.inReplyTo": - if e.complexity.EmailTrigger.InReplyTo == nil { - break - } - - return e.complexity.EmailTrigger.InReplyTo(childComplexity), true - - case "EmailTrigger.to": - if e.complexity.EmailTrigger.To == nil { - break - } - - return e.complexity.EmailTrigger.To(childComplexity), true - - case "Job.artifacts": - if e.complexity.Job.Artifacts == nil { - break - } - - return e.complexity.Job.Artifacts(childComplexity), true - - case "Job.created": - if e.complexity.Job.Created == nil { - break - } - - return e.complexity.Job.Created(childComplexity), true - - case "Job.group": - if e.complexity.Job.Group == nil { - break - } - - return e.complexity.Job.Group(childComplexity), true - - case "Job.id": - if e.complexity.Job.ID == nil { - break - } - - return e.complexity.Job.ID(childComplexity), true - - case "Job.image": - if e.complexity.Job.Image == nil { - break - } - - return e.complexity.Job.Image(childComplexity), true - - case "Job.log": - if e.complexity.Job.Log == nil { - break - } - - return e.complexity.Job.Log(childComplexity), true - - case "Job.manifest": - if e.complexity.Job.Manifest == nil { - break - } - - return e.complexity.Job.Manifest(childComplexity), true - - case "Job.note": - if e.complexity.Job.Note == nil { - break - } - - return e.complexity.Job.Note(childComplexity), true - - case "Job.owner": - if e.complexity.Job.Owner == nil { - break - } - - return e.complexity.Job.Owner(childComplexity), true - - case "Job.runner": - if e.complexity.Job.Runner == nil { - break - } - - return e.complexity.Job.Runner(childComplexity), true - - case "Job.secrets": - if e.complexity.Job.Secrets == nil { - break - } - - return e.complexity.Job.Secrets(childComplexity), true - - case "Job.status": - if e.complexity.Job.Status == nil { - break - } - - return e.complexity.Job.Status(childComplexity), true - - case "Job.tags": - if e.complexity.Job.Tags == nil { - break - } - - return e.complexity.Job.Tags(childComplexity), true - - case "Job.tasks": - if e.complexity.Job.Tasks == nil { - break - } - - return e.complexity.Job.Tasks(childComplexity), true - - case "Job.updated": - if e.complexity.Job.Updated == nil { - break - } - - return e.complexity.Job.Updated(childComplexity), true - - case "JobCursor.cursor": - if e.complexity.JobCursor.Cursor == nil { - break - } - - return e.complexity.JobCursor.Cursor(childComplexity), true - - case "JobCursor.results": - if e.complexity.JobCursor.Results == nil { - break - } - - return e.complexity.JobCursor.Results(childComplexity), true - - case "JobGroup.created": - if e.complexity.JobGroup.Created == nil { - break - } - - return e.complexity.JobGroup.Created(childComplexity), true - - case "JobGroup.id": - if e.complexity.JobGroup.ID == nil { - break - } - - return e.complexity.JobGroup.ID(childComplexity), true - - case "JobGroup.jobs": - if e.complexity.JobGroup.Jobs == nil { - break - } - - return e.complexity.JobGroup.Jobs(childComplexity), true - - case "JobGroup.note": - if e.complexity.JobGroup.Note == nil { - break - } - - return e.complexity.JobGroup.Note(childComplexity), true - - case "JobGroup.owner": - if e.complexity.JobGroup.Owner == nil { - break - } - - return e.complexity.JobGroup.Owner(childComplexity), true - - case "JobGroup.triggers": - if e.complexity.JobGroup.Triggers == nil { - break - } - - return e.complexity.JobGroup.Triggers(childComplexity), true - - case "Log.fullURL": - if e.complexity.Log.FullURL == nil { - break - } - - return e.complexity.Log.FullURL(childComplexity), true - - case "Log.last128KiB": - if e.complexity.Log.Last128KiB == nil { - break - } - - return e.complexity.Log.Last128KiB(childComplexity), true - - case "Mutation.cancel": - if e.complexity.Mutation.Cancel == nil { - break - } - - args, err := ec.field_Mutation_cancel_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Mutation.Cancel(childComplexity, args["jobId"].(int)), true - - case "Mutation.claim": - if e.complexity.Mutation.Claim == nil { - break - } - - args, err := ec.field_Mutation_claim_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Mutation.Claim(childComplexity, args["jobId"].(int)), true - - case "Mutation.createArtifact": - if e.complexity.Mutation.CreateArtifact == nil { - break - } - - args, err := ec.field_Mutation_createArtifact_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Mutation.CreateArtifact(childComplexity, args["jobId"].(int), args["path"].(string), args["contents"].(string)), true - - case "Mutation.createGroup": - if e.complexity.Mutation.CreateGroup == nil { - break - } - - args, err := ec.field_Mutation_createGroup_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Mutation.CreateGroup(childComplexity, args["jobIds"].([]int), args["triggers"].([]*model.TriggerInput), args["execute"].(*bool), args["note"].(*string)), true - - case "Mutation.start": - if e.complexity.Mutation.Start == nil { - break - } - - args, err := ec.field_Mutation_start_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Mutation.Start(childComplexity, args["jobID"].(int)), true - - case "Mutation.startGroup": - if e.complexity.Mutation.StartGroup == nil { - break - } - - args, err := ec.field_Mutation_startGroup_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Mutation.StartGroup(childComplexity, args["groupId"].(int)), true - - case "Mutation.submit": - if e.complexity.Mutation.Submit == nil { - break - } - - args, err := ec.field_Mutation_submit_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Mutation.Submit(childComplexity, args["manifest"].(string), args["tags"].([]string), args["note"].(*string), args["secrets"].(*bool), args["execute"].(*bool)), true - - case "Mutation.updateJob": - if e.complexity.Mutation.UpdateJob == nil { - break - } - - args, err := ec.field_Mutation_updateJob_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Mutation.UpdateJob(childComplexity, args["jobId"].(int), args["status"].(model.JobStatus)), true - - case "Mutation.updateTask": - if e.complexity.Mutation.UpdateTask == nil { - break - } - - args, err := ec.field_Mutation_updateTask_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Mutation.UpdateTask(childComplexity, args["taskId"].(int), args["status"].(model.TaskStatus)), true - - case "PGPKey.created": - if e.complexity.PGPKey.Created == nil { - break - } - - return e.complexity.PGPKey.Created(childComplexity), true - - case "PGPKey.id": - if e.complexity.PGPKey.ID == nil { - break - } - - return e.complexity.PGPKey.ID(childComplexity), true - - case "PGPKey.name": - if e.complexity.PGPKey.Name == nil { - break - } - - return e.complexity.PGPKey.Name(childComplexity), true - - case "PGPKey.privateKey": - if e.complexity.PGPKey.PrivateKey == nil { - break - } - - return e.complexity.PGPKey.PrivateKey(childComplexity), true - - case "PGPKey.uuid": - if e.complexity.PGPKey.UUID == nil { - break - } - - return e.complexity.PGPKey.UUID(childComplexity), true - - case "Query.job": - if e.complexity.Query.Job == nil { - break - } - - args, err := ec.field_Query_job_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Query.Job(childComplexity, args["id"].(int)), true - - case "Query.jobs": - if e.complexity.Query.Jobs == nil { - break - } - - args, err := ec.field_Query_jobs_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Query.Jobs(childComplexity, args["cursor"].(*model1.Cursor)), true - - case "Query.me": - if e.complexity.Query.Me == nil { - break - } - - return e.complexity.Query.Me(childComplexity), true - - case "Query.secrets": - if e.complexity.Query.Secrets == nil { - break - } - - args, err := ec.field_Query_secrets_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Query.Secrets(childComplexity, args["cursor"].(*model1.Cursor)), true - - case "Query.userByID": - if e.complexity.Query.UserByID == nil { - break - } - - args, err := ec.field_Query_userByID_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Query.UserByID(childComplexity, args["id"].(int)), true - - case "Query.userByName": - if e.complexity.Query.UserByName == nil { - break - } - - args, err := ec.field_Query_userByName_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Query.UserByName(childComplexity, args["username"].(string)), true - - case "Query.version": - if e.complexity.Query.Version == nil { - break - } - - return e.complexity.Query.Version(childComplexity), true - - case "SSHKey.created": - if e.complexity.SSHKey.Created == nil { - break - } - - return e.complexity.SSHKey.Created(childComplexity), true - - case "SSHKey.id": - if e.complexity.SSHKey.ID == nil { - break - } - - return e.complexity.SSHKey.ID(childComplexity), true - - case "SSHKey.name": - if e.complexity.SSHKey.Name == nil { - break - } - - return e.complexity.SSHKey.Name(childComplexity), true - - case "SSHKey.privateKey": - if e.complexity.SSHKey.PrivateKey == nil { - break - } - - return e.complexity.SSHKey.PrivateKey(childComplexity), true - - case "SSHKey.uuid": - if e.complexity.SSHKey.UUID == nil { - break - } - - return e.complexity.SSHKey.UUID(childComplexity), true - - case "SecretCursor.cursor": - if e.complexity.SecretCursor.Cursor == nil { - break - } - - return e.complexity.SecretCursor.Cursor(childComplexity), true - - case "SecretCursor.results": - if e.complexity.SecretCursor.Results == nil { - break - } - - return e.complexity.SecretCursor.Results(childComplexity), true - - case "SecretFile.created": - if e.complexity.SecretFile.Created == nil { - break - } - - return e.complexity.SecretFile.Created(childComplexity), true - - case "SecretFile.data": - if e.complexity.SecretFile.Data == nil { - break - } - - return e.complexity.SecretFile.Data(childComplexity), true - - case "SecretFile.id": - if e.complexity.SecretFile.ID == nil { - break - } - - return e.complexity.SecretFile.ID(childComplexity), true - - case "SecretFile.mode": - if e.complexity.SecretFile.Mode == nil { - break - } - - return e.complexity.SecretFile.Mode(childComplexity), true - - case "SecretFile.name": - if e.complexity.SecretFile.Name == nil { - break - } - - return e.complexity.SecretFile.Name(childComplexity), true - - case "SecretFile.path": - if e.complexity.SecretFile.Path == nil { - break - } - - return e.complexity.SecretFile.Path(childComplexity), true - - case "SecretFile.uuid": - if e.complexity.SecretFile.UUID == nil { - break - } - - return e.complexity.SecretFile.UUID(childComplexity), true - - case "Settings.buildTimeout": - if e.complexity.Settings.BuildTimeout == nil { - break - } - - return e.complexity.Settings.BuildTimeout(childComplexity), true - - case "Settings.sshUser": - if e.complexity.Settings.SSHUser == nil { - break - } - - return e.complexity.Settings.SSHUser(childComplexity), true - - case "Task.created": - if e.complexity.Task.Created == nil { - break - } - - return e.complexity.Task.Created(childComplexity), true - - case "Task.id": - if e.complexity.Task.ID == nil { - break - } - - return e.complexity.Task.ID(childComplexity), true - - case "Task.job": - if e.complexity.Task.Job == nil { - break - } - - return e.complexity.Task.Job(childComplexity), true - - case "Task.log": - if e.complexity.Task.Log == nil { - break - } - - return e.complexity.Task.Log(childComplexity), true - - case "Task.name": - if e.complexity.Task.Name == nil { - break - } - - return e.complexity.Task.Name(childComplexity), true - - case "Task.status": - if e.complexity.Task.Status == nil { - break - } - - return e.complexity.Task.Status(childComplexity), true - - case "Task.updated": - if e.complexity.Task.Updated == nil { - break - } - - return e.complexity.Task.Updated(childComplexity), true - - case "User.bio": - if e.complexity.User.Bio == nil { - break - } - - return e.complexity.User.Bio(childComplexity), true - - case "User.canonicalName": - if e.complexity.User.CanonicalName == nil { - break - } - - return e.complexity.User.CanonicalName(childComplexity), true - - case "User.created": - if e.complexity.User.Created == nil { - break - } - - return e.complexity.User.Created(childComplexity), true - - case "User.email": - if e.complexity.User.Email == nil { - break - } - - return e.complexity.User.Email(childComplexity), true - - case "User.id": - if e.complexity.User.ID == nil { - break - } - - return e.complexity.User.ID(childComplexity), true - - case "User.jobs": - if e.complexity.User.Jobs == nil { - break - } - - args, err := ec.field_User_jobs_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.User.Jobs(childComplexity, args["cursor"].(*model1.Cursor)), true - - case "User.location": - if e.complexity.User.Location == nil { - break - } - - return e.complexity.User.Location(childComplexity), true - - case "User.url": - if e.complexity.User.URL == nil { - break - } - - return e.complexity.User.URL(childComplexity), true - - case "User.updated": - if e.complexity.User.Updated == nil { - break - } - - return e.complexity.User.Updated(childComplexity), true - - case "User.username": - if e.complexity.User.Username == nil { - break - } - - return e.complexity.User.Username(childComplexity), true - - case "Version.deprecationDate": - if e.complexity.Version.DeprecationDate == nil { - break - } - - return e.complexity.Version.DeprecationDate(childComplexity), true - - case "Version.major": - if e.complexity.Version.Major == nil { - break - } - - return e.complexity.Version.Major(childComplexity), true - - case "Version.minor": - if e.complexity.Version.Minor == nil { - break - } - - return e.complexity.Version.Minor(childComplexity), true - - case "Version.patch": - if e.complexity.Version.Patch == nil { - break - } - - return e.complexity.Version.Patch(childComplexity), true - - case "Version.settings": - if e.complexity.Version.Settings == nil { - break - } - - return e.complexity.Version.Settings(childComplexity), true - - case "WebhookTrigger.condition": - if e.complexity.WebhookTrigger.Condition == nil { - break - } - - return e.complexity.WebhookTrigger.Condition(childComplexity), true - - case "WebhookTrigger.url": - if e.complexity.WebhookTrigger.URL == nil { - break - } - - return e.complexity.WebhookTrigger.URL(childComplexity), true - - } - return 0, false -} - -func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { - rc := graphql.GetOperationContext(ctx) - ec := executionContext{rc, e} - first := true - - switch rc.Operation.Operation { - case ast.Query: - return func(ctx context.Context) *graphql.Response { - if !first { - return nil - } - first = false - data := ec._Query(ctx, rc.Operation.SelectionSet) - var buf bytes.Buffer - data.MarshalGQL(&buf) - - return &graphql.Response{ - Data: buf.Bytes(), - } - } - case ast.Mutation: - return func(ctx context.Context) *graphql.Response { - if !first { - return nil - } - first = false - data := ec._Mutation(ctx, rc.Operation.SelectionSet) - var buf bytes.Buffer - data.MarshalGQL(&buf) - - return &graphql.Response{ - Data: buf.Bytes(), - } - } - - default: - return graphql.OneShot(graphql.ErrorResponse(ctx, "unsupported GraphQL operation")) - } -} - -type executionContext struct { - *graphql.OperationContext - *executableSchema -} - -func (ec *executionContext) introspectSchema() (*introspection.Schema, error) { - if ec.DisableIntrospection { - return nil, errors.New("introspection disabled") - } - return introspection.WrapSchema(parsedSchema), nil -} - -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 -} - -var sources = []*ast.Source{ - {Name: "graph/schema.graphqls", Input: `# This schema definition is available in the public domain, or under the terms -# of CC-0, at your choice. -scalar Time # %Y-%m-%dT%H:%M:%SZ -scalar Binary # base64'd string -scalar Cursor -scalar File - -"Used to provide a human-friendly description of an access scope" -directive @scopehelp(details: String!) on ENUM_VALUE - -enum AccessScope { - PROFILE @scopehelp(details: "profile information") - JOBS @scopehelp(details: "build jobs") - LOGS @scopehelp(details: "build logs") - SECRETS @scopehelp(details: "stored secrets") -} - -enum AccessKind { - RO @scopehelp(details: "read") - RW @scopehelp(details: "read and write") -} - -""" -Decorates fields for which access requires a particular OAuth 2.0 scope with -read or write access. -""" -directive @access(scope: AccessScope!, kind: AccessKind!) on FIELD_DEFINITION - -""" -This used to decorate private resolvers which are only accessible to build -workers, and are used to faciliate the build process. -""" -directive @worker on FIELD_DEFINITION - -# https://semver.org -type Version { - major: Int! - minor: Int! - patch: Int! - - """ - If this API version is scheduled for deprecation, this is the date on which - it will stop working; or null if this API version is not scheduled for - deprecation. - """ - deprecationDate: Time - - # Config settings - settings: Settings! -} - -# Instance specific settings -type Settings { - sshUser: String! - buildTimeout: String! -} - -interface Entity { - id: Int! - created: Time! - updated: Time! - """ - The canonical name of this entity. For users, this is their username - prefixed with '~'. Additional entity types will be supported in the future. - """ - canonicalName: String! -} - -type User implements Entity { - id: Int! - created: Time! - updated: Time! - canonicalName: String! - username: String! - email: String! - url: String - location: String - bio: String - - "Jobs submitted by this user." - jobs(cursor: Cursor): JobCursor! @access(scope: JOBS, kind: RO) -} - -enum JobStatus { - PENDING - QUEUED - RUNNING - SUCCESS - FAILED - TIMEOUT - CANCELLED -} - -type Job { - id: Int! - created: Time! - updated: Time! - status: JobStatus! - manifest: String! - note: String - tags: [String!]! - - "Name of the build image" - image: String! - - """ - Name of the build runner which picked up this job, or null if the job is - pending or queued. - """ - runner: String - - owner: Entity! @access(scope: PROFILE, kind: RO) - group: JobGroup - tasks: [Task!]! - artifacts: [Artifact!]! - - "The job's top-level log file, not associated with any tasks" - log: Log @access(scope: LOGS, kind: RO) - - "List of secrets available to this job, or null if they were disabled" - secrets: [Secret!] @access(scope: SECRETS, kind: RO) -} - -type Log { - "The most recently written 128 KiB of the build log." - last128KiB: String! - """ - The URL at which the full build log can be downloaded with a GET request - (text/plain). - """ - fullURL: String! -} - -type Artifact { - id: Int! - created: Time! - "Original path in the guest" - path: String! - "Size in bytes" - size: Int! - "URL at which the artifact may be downloaded, or null if pruned" - url: String -} - -""" -A cursor for enumerating a list of jobs - -If there are additional results available, the cursor object may be passed -back into the same endpoint to retrieve another page. If the cursor is null, -there are no remaining results to return. -""" -type JobCursor { - results: [Job!]! - cursor: Cursor -} - -type JobGroup { - id: Int! - created: Time! - note: String - owner: Entity! @access(scope: PROFILE, kind: RO) - jobs: [Job!]! - triggers: [Trigger!]! -} - -enum TaskStatus { - PENDING - RUNNING - SUCCESS - FAILED - SKIPPED -} - -type Task { - id: Int! - created: Time! - updated: Time! - name: String! - status: TaskStatus! - log: Log @access(scope: LOGS, kind: RO) - job: Job! -} - -enum TriggerCondition { - SUCCESS - FAILURE - ALWAYS -} - -""" -Triggers run upon the completion of all of the jobs in a job group. Note that -these triggers are distinct from the ones defined by an individual job's -build manifest, but are similar in functionality. -""" -interface Trigger { - condition: TriggerCondition! -} - -type EmailTrigger implements Trigger { - condition: TriggerCondition! - to: String! - cc: String - inReplyTo: String -} - -type WebhookTrigger implements Trigger { - condition: TriggerCondition! - url: String! -} - -interface Secret { - id: Int! - created: Time! - uuid: String! - name: String -} - -""" -A cursor for enumerating a list of secrets - -If there are additional results available, the cursor object may be passed -back into the same endpoint to retrieve another page. If the cursor is null, -there are no remaining results to return. -""" -type SecretCursor { - results: [Secret!]! - cursor: Cursor -} - -type SSHKey implements Secret { - id: Int! - created: Time! - uuid: String! - name: String - privateKey: Binary! @worker -} - -type PGPKey implements Secret { - id: Int! - created: Time! - uuid: String! - name: String - privateKey: Binary! @worker -} - -type SecretFile implements Secret { - id: Int! - created: Time! - uuid: String! - name: String - path: String! - mode: Int! - data: Binary! @worker -} - -type Query { - "Returns API version information." - version: Version! - - "Returns the authenticated user." - me: User! @access(scope: PROFILE, kind: RO) - - "Returns a specific user." - userByID(id: Int!): User @access(scope: PROFILE, kind: RO) - userByName(username: String!): User @access(scope: PROFILE, kind: RO) - - "Returns jobs submitted by the authenticated user." - jobs(cursor: Cursor): JobCursor! @access(scope: JOBS, kind: RO) - - "Returns information about a specific job." - job(id: Int!): Job @access(scope: JOBS, kind: RO) - - "Returns secrets owned by the authenticated user." - secrets(cursor: Cursor): SecretCursor! @access(scope: SECRETS, kind: RO) -} - -enum TriggerType { - EMAIL - WEBHOOK -} - -input EmailTriggerInput { - to: String! - cc: String - inReplyTo: String -} - -input WebhookTriggerInput { - url: String! -} - -input TriggerInput { - type: TriggerType! - condition: TriggerCondition! - email: EmailTriggerInput - webhook: WebhookTriggerInput -} - -type Mutation { - """ - Submits a new job to the queue. - - 'secrets' may be set to false to disable secrets for this build. Secrets - are enabled if unspecified. - - 'execute' may be set to false to defer queueing this job. Builds are - executed immediately if unspecified. - """ - submit(manifest: String!, tags: [String!] note: String, secrets: Boolean, - execute: Boolean): Job! @access(scope: JOBS, kind: RW) - - "Queues a pending job." - start(jobID: Int!): Job @access(scope: JOBS, kind: RW) - - "Cancels a submitted job." - cancel(jobId: Int!): Job @access(scope: JOBS, kind: RW) - - """ - Creates a job group from several pending jobs. - - 'execute' may be set to false to defer queueing this job. The job group is - executed immediately if unspecified. - """ - createGroup(jobIds: [Int!]! triggers: [TriggerInput!], - execute: Boolean, note: String): JobGroup! @access(scope: JOBS, kind: RW) - - "Starts a pending job group." - startGroup(groupId: Int!): JobGroup @access(scope: JOBS, kind: RW) - - ### - ### The following resolvers are for internal worker use - - "Claims a job." - claim(jobId: Int!): Job @worker - - "Updates job status." - updateJob(jobId: Int!, status: JobStatus!): Job @worker - - "Updates task status." - updateTask(taskId: Int!, status: TaskStatus!): Job @worker - - "Uploads a build artifact." - createArtifact(jobId: Int!, path: String!, contents: File!): Artifact @worker -} -`, BuiltIn: false}, -} -var parsedSchema = gqlparser.MustLoadSchema(sources...) - -// endregion ************************** generated!.gotpl ************************** - -// region ***************************** args.gotpl ***************************** - -func (ec *executionContext) dir_access_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { - var err error - args := map[string]interface{}{} - var arg0 model.AccessScope - if tmp, ok := rawArgs["scope"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("scope")) - arg0, err = ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, tmp) - if err != nil { - return nil, err - } - } - args["scope"] = arg0 - var arg1 model.AccessKind - if tmp, ok := rawArgs["kind"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("kind")) - arg1, err = ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessKind(ctx, tmp) - if err != nil { - return nil, err - } - } - args["kind"] = arg1 - return args, nil -} - -func (ec *executionContext) dir_scopehelp_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["details"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("details")) - arg0, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } - } - args["details"] = arg0 - return args, nil -} - -func (ec *executionContext) field_Mutation_cancel_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { - var err error - args := map[string]interface{}{} - var arg0 int - if tmp, ok := rawArgs["jobId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("jobId")) - arg0, err = ec.unmarshalNInt2int(ctx, tmp) - if err != nil { - return nil, err - } - } - args["jobId"] = arg0 - return args, nil -} - -func (ec *executionContext) field_Mutation_claim_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { - var err error - args := map[string]interface{}{} - var arg0 int - if tmp, ok := rawArgs["jobId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("jobId")) - arg0, err = ec.unmarshalNInt2int(ctx, tmp) - if err != nil { - return nil, err - } - } - args["jobId"] = arg0 - return args, nil -} - -func (ec *executionContext) field_Mutation_createArtifact_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { - var err error - args := map[string]interface{}{} - var arg0 int - if tmp, ok := rawArgs["jobId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("jobId")) - arg0, err = ec.unmarshalNInt2int(ctx, tmp) - if err != nil { - return nil, err - } - } - args["jobId"] = arg0 - var arg1 string - if tmp, ok := rawArgs["path"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("path")) - arg1, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } - } - args["path"] = arg1 - var arg2 string - if tmp, ok := rawArgs["contents"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("contents")) - arg2, err = ec.unmarshalNFile2string(ctx, tmp) - if err != nil { - return nil, err - } - } - args["contents"] = arg2 - return args, nil -} - -func (ec *executionContext) field_Mutation_createGroup_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { - var err error - args := map[string]interface{}{} - var arg0 []int - if tmp, ok := rawArgs["jobIds"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("jobIds")) - arg0, err = ec.unmarshalNInt2ᚕintᚄ(ctx, tmp) - if err != nil { - return nil, err - } - } - args["jobIds"] = arg0 - var arg1 []*model.TriggerInput - if tmp, ok := rawArgs["triggers"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("triggers")) - arg1, err = ec.unmarshalOTriggerInput2ᚕᚖgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTriggerInputᚄ(ctx, tmp) - if err != nil { - return nil, err - } - } - args["triggers"] = arg1 - var arg2 *bool - if tmp, ok := rawArgs["execute"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("execute")) - arg2, err = ec.unmarshalOBoolean2ᚖbool(ctx, tmp) - if err != nil { - return nil, err - } - } - args["execute"] = arg2 - var arg3 *string - if tmp, ok := rawArgs["note"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("note")) - arg3, err = ec.unmarshalOString2ᚖstring(ctx, tmp) - if err != nil { - return nil, err - } - } - args["note"] = arg3 - return args, nil -} - -func (ec *executionContext) field_Mutation_startGroup_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { - var err error - args := map[string]interface{}{} - var arg0 int - if tmp, ok := rawArgs["groupId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("groupId")) - arg0, err = ec.unmarshalNInt2int(ctx, tmp) - if err != nil { - return nil, err - } - } - args["groupId"] = arg0 - return args, nil -} - -func (ec *executionContext) field_Mutation_start_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { - var err error - args := map[string]interface{}{} - var arg0 int - if tmp, ok := rawArgs["jobID"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("jobID")) - arg0, err = ec.unmarshalNInt2int(ctx, tmp) - if err != nil { - return nil, err - } - } - args["jobID"] = arg0 - return args, nil -} - -func (ec *executionContext) field_Mutation_submit_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["manifest"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("manifest")) - arg0, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } - } - args["manifest"] = arg0 - var arg1 []string - if tmp, ok := rawArgs["tags"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("tags")) - arg1, err = ec.unmarshalOString2ᚕstringᚄ(ctx, tmp) - if err != nil { - return nil, err - } - } - args["tags"] = arg1 - var arg2 *string - if tmp, ok := rawArgs["note"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("note")) - arg2, err = ec.unmarshalOString2ᚖstring(ctx, tmp) - if err != nil { - return nil, err - } - } - args["note"] = arg2 - var arg3 *bool - if tmp, ok := rawArgs["secrets"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secrets")) - arg3, err = ec.unmarshalOBoolean2ᚖbool(ctx, tmp) - if err != nil { - return nil, err - } - } - args["secrets"] = arg3 - var arg4 *bool - if tmp, ok := rawArgs["execute"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("execute")) - arg4, err = ec.unmarshalOBoolean2ᚖbool(ctx, tmp) - if err != nil { - return nil, err - } - } - args["execute"] = arg4 - return args, nil -} - -func (ec *executionContext) field_Mutation_updateJob_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { - var err error - args := map[string]interface{}{} - var arg0 int - if tmp, ok := rawArgs["jobId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("jobId")) - arg0, err = ec.unmarshalNInt2int(ctx, tmp) - if err != nil { - return nil, err - } - } - args["jobId"] = arg0 - var arg1 model.JobStatus - if tmp, ok := rawArgs["status"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("status")) - arg1, err = ec.unmarshalNJobStatus2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐJobStatus(ctx, tmp) - if err != nil { - return nil, err - } - } - args["status"] = arg1 - return args, nil -} - -func (ec *executionContext) field_Mutation_updateTask_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { - var err error - args := map[string]interface{}{} - var arg0 int - if tmp, ok := rawArgs["taskId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("taskId")) - arg0, err = ec.unmarshalNInt2int(ctx, tmp) - if err != nil { - return nil, err - } - } - args["taskId"] = arg0 - var arg1 model.TaskStatus - if tmp, ok := rawArgs["status"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("status")) - arg1, err = ec.unmarshalNTaskStatus2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTaskStatus(ctx, tmp) - if err != nil { - return nil, err - } - } - args["status"] = arg1 - return args, nil -} - -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 { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - arg0, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } - } - args["name"] = arg0 - return args, nil -} - -func (ec *executionContext) field_Query_job_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { - var err error - args := map[string]interface{}{} - var arg0 int - if tmp, ok := rawArgs["id"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) - arg0, err = ec.unmarshalNInt2int(ctx, tmp) - if err != nil { - return nil, err - } - } - args["id"] = arg0 - return args, nil -} - -func (ec *executionContext) field_Query_jobs_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { - var err error - args := map[string]interface{}{} - var arg0 *model1.Cursor - if tmp, ok := rawArgs["cursor"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cursor")) - arg0, err = ec.unmarshalOCursor2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋcoreᚑgoᚋmodelᚐCursor(ctx, tmp) - if err != nil { - return nil, err - } - } - args["cursor"] = arg0 - return args, nil -} - -func (ec *executionContext) field_Query_secrets_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { - var err error - args := map[string]interface{}{} - var arg0 *model1.Cursor - if tmp, ok := rawArgs["cursor"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cursor")) - arg0, err = ec.unmarshalOCursor2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋcoreᚑgoᚋmodelᚐCursor(ctx, tmp) - if err != nil { - return nil, err - } - } - args["cursor"] = arg0 - return args, nil -} - -func (ec *executionContext) field_Query_userByID_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { - var err error - args := map[string]interface{}{} - var arg0 int - if tmp, ok := rawArgs["id"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) - arg0, err = ec.unmarshalNInt2int(ctx, tmp) - if err != nil { - return nil, err - } - } - args["id"] = arg0 - return args, nil -} - -func (ec *executionContext) field_Query_userByName_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["username"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("username")) - arg0, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } - } - args["username"] = arg0 - return args, nil -} - -func (ec *executionContext) field_User_jobs_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { - var err error - args := map[string]interface{}{} - var arg0 *model1.Cursor - if tmp, ok := rawArgs["cursor"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cursor")) - arg0, err = ec.unmarshalOCursor2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋcoreᚑgoᚋmodelᚐCursor(ctx, tmp) - if err != nil { - return nil, err - } - } - args["cursor"] = arg0 - return args, nil -} - -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 { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) - arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) - if err != nil { - return nil, err - } - } - args["includeDeprecated"] = arg0 - return args, nil -} - -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 { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) - arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) - if err != nil { - return nil, err - } - } - args["includeDeprecated"] = arg0 - return args, nil -} - -// endregion ***************************** args.gotpl ***************************** - -// region ************************** directives.gotpl ************************** - -// endregion ************************** directives.gotpl ************************** - -// region **************************** field.gotpl ***************************** - -func (ec *executionContext) _Artifact_id(ctx context.Context, field graphql.CollectedField, obj *model.Artifact) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Artifact", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.ID, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(int) - fc.Result = res - return ec.marshalNInt2int(ctx, field.Selections, res) -} - -func (ec *executionContext) _Artifact_created(ctx context.Context, field graphql.CollectedField, obj *model.Artifact) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Artifact", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Created, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(time.Time) - fc.Result = res - return ec.marshalNTime2timeᚐTime(ctx, field.Selections, res) -} - -func (ec *executionContext) _Artifact_path(ctx context.Context, field graphql.CollectedField, obj *model.Artifact) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Artifact", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Path, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) -} - -func (ec *executionContext) _Artifact_size(ctx context.Context, field graphql.CollectedField, obj *model.Artifact) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Artifact", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Size, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(int) - fc.Result = res - return ec.marshalNInt2int(ctx, field.Selections, res) -} - -func (ec *executionContext) _Artifact_url(ctx context.Context, field graphql.CollectedField, obj *model.Artifact) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Artifact", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.URL, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) _EmailTrigger_condition(ctx context.Context, field graphql.CollectedField, obj *model.EmailTrigger) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "EmailTrigger", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Condition, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(model.TriggerCondition) - fc.Result = res - return ec.marshalNTriggerCondition2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTriggerCondition(ctx, field.Selections, res) -} - -func (ec *executionContext) _EmailTrigger_to(ctx context.Context, field graphql.CollectedField, obj *model.EmailTrigger) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "EmailTrigger", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.To, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) -} - -func (ec *executionContext) _EmailTrigger_cc(ctx context.Context, field graphql.CollectedField, obj *model.EmailTrigger) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "EmailTrigger", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Cc, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalOString2string(ctx, field.Selections, res) -} - -func (ec *executionContext) _EmailTrigger_inReplyTo(ctx context.Context, field graphql.CollectedField, obj *model.EmailTrigger) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "EmailTrigger", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.InReplyTo, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalOString2string(ctx, field.Selections, res) -} - -func (ec *executionContext) _Job_id(ctx context.Context, field graphql.CollectedField, obj *model.Job) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Job", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.ID, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(int) - fc.Result = res - return ec.marshalNInt2int(ctx, field.Selections, res) -} - -func (ec *executionContext) _Job_created(ctx context.Context, field graphql.CollectedField, obj *model.Job) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Job", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Created, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(time.Time) - fc.Result = res - return ec.marshalNTime2timeᚐTime(ctx, field.Selections, res) -} - -func (ec *executionContext) _Job_updated(ctx context.Context, field graphql.CollectedField, obj *model.Job) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Job", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Updated, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(time.Time) - fc.Result = res - return ec.marshalNTime2timeᚐTime(ctx, field.Selections, res) -} - -func (ec *executionContext) _Job_status(ctx context.Context, field graphql.CollectedField, obj *model.Job) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Job", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Status(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(model.JobStatus) - fc.Result = res - return ec.marshalNJobStatus2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐJobStatus(ctx, field.Selections, res) -} - -func (ec *executionContext) _Job_manifest(ctx context.Context, field graphql.CollectedField, obj *model.Job) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Job", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Manifest, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) -} - -func (ec *executionContext) _Job_note(ctx context.Context, field graphql.CollectedField, obj *model.Job) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Job", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Note, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) _Job_tags(ctx context.Context, field graphql.CollectedField, obj *model.Job) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Job", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Tags(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.([]string) - fc.Result = res - return ec.marshalNString2ᚕstringᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) _Job_image(ctx context.Context, field graphql.CollectedField, obj *model.Job) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Job", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Image, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) -} - -func (ec *executionContext) _Job_runner(ctx context.Context, field graphql.CollectedField, obj *model.Job) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Job", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Runner, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) _Job_owner(ctx context.Context, field graphql.CollectedField, obj *model.Job) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Job", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: true, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - directive0 := func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Job().Owner(rctx, obj) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "PROFILE") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessKind(ctx, "RO") - if err != nil { - return nil, err - } - if ec.directives.Access == nil { - return nil, errors.New("directive access is not implemented") - } - return ec.directives.Access(ctx, obj, directive0, scope, kind) - } - - tmp, err := directive1(rctx) - if err != nil { - return nil, graphql.ErrorOnPath(ctx, err) - } - if tmp == nil { - return nil, nil - } - if data, ok := tmp.(model.Entity); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be git.sr.ht/~sircmpwn/builds.sr.ht/api/graph/model.Entity`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(model.Entity) - fc.Result = res - return ec.marshalNEntity2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEntity(ctx, field.Selections, res) -} - -func (ec *executionContext) _Job_group(ctx context.Context, field graphql.CollectedField, obj *model.Job) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Job", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: true, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Job().Group(rctx, obj) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.JobGroup) - fc.Result = res - return ec.marshalOJobGroup2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐJobGroup(ctx, field.Selections, res) -} - -func (ec *executionContext) _Job_tasks(ctx context.Context, field graphql.CollectedField, obj *model.Job) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Job", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: true, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Job().Tasks(rctx, obj) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.([]*model.Task) - fc.Result = res - return ec.marshalNTask2ᚕᚖgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTaskᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) _Job_artifacts(ctx context.Context, field graphql.CollectedField, obj *model.Job) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Job", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: true, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Job().Artifacts(rctx, obj) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.([]*model.Artifact) - fc.Result = res - return ec.marshalNArtifact2ᚕᚖgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐArtifactᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) _Job_log(ctx context.Context, field graphql.CollectedField, obj *model.Job) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Job", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: true, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - directive0 := func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Job().Log(rctx, obj) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "LOGS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessKind(ctx, "RO") - if err != nil { - return nil, err - } - if ec.directives.Access == nil { - return nil, errors.New("directive access is not implemented") - } - return ec.directives.Access(ctx, obj, directive0, scope, kind) - } - - tmp, err := directive1(rctx) - if err != nil { - return nil, graphql.ErrorOnPath(ctx, err) - } - if tmp == nil { - return nil, nil - } - if data, ok := tmp.(*model.Log); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/builds.sr.ht/api/graph/model.Log`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.Log) - fc.Result = res - return ec.marshalOLog2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐLog(ctx, field.Selections, res) -} - -func (ec *executionContext) _Job_secrets(ctx context.Context, field graphql.CollectedField, obj *model.Job) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Job", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: true, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - directive0 := func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Job().Secrets(rctx, obj) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "SECRETS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessKind(ctx, "RO") - if err != nil { - return nil, err - } - if ec.directives.Access == nil { - return nil, errors.New("directive access is not implemented") - } - return ec.directives.Access(ctx, obj, directive0, scope, kind) - } - - tmp, err := directive1(rctx) - if err != nil { - return nil, graphql.ErrorOnPath(ctx, err) - } - if tmp == nil { - return nil, nil - } - if data, ok := tmp.([]model.Secret); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be []git.sr.ht/~sircmpwn/builds.sr.ht/api/graph/model.Secret`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.([]model.Secret) - fc.Result = res - return ec.marshalOSecret2ᚕgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐSecretᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) _JobCursor_results(ctx context.Context, field graphql.CollectedField, obj *model.JobCursor) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "JobCursor", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Results, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.([]*model.Job) - fc.Result = res - return ec.marshalNJob2ᚕᚖgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐJobᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) _JobCursor_cursor(ctx context.Context, field graphql.CollectedField, obj *model.JobCursor) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "JobCursor", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Cursor, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model1.Cursor) - fc.Result = res - return ec.marshalOCursor2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋcoreᚑgoᚋmodelᚐCursor(ctx, field.Selections, res) -} - -func (ec *executionContext) _JobGroup_id(ctx context.Context, field graphql.CollectedField, obj *model.JobGroup) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "JobGroup", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.ID, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(int) - fc.Result = res - return ec.marshalNInt2int(ctx, field.Selections, res) -} - -func (ec *executionContext) _JobGroup_created(ctx context.Context, field graphql.CollectedField, obj *model.JobGroup) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "JobGroup", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Created, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(time.Time) - fc.Result = res - return ec.marshalNTime2timeᚐTime(ctx, field.Selections, res) -} - -func (ec *executionContext) _JobGroup_note(ctx context.Context, field graphql.CollectedField, obj *model.JobGroup) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "JobGroup", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Note, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) _JobGroup_owner(ctx context.Context, field graphql.CollectedField, obj *model.JobGroup) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "JobGroup", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: true, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - directive0 := func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.JobGroup().Owner(rctx, obj) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "PROFILE") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessKind(ctx, "RO") - if err != nil { - return nil, err - } - if ec.directives.Access == nil { - return nil, errors.New("directive access is not implemented") - } - return ec.directives.Access(ctx, obj, directive0, scope, kind) - } - - tmp, err := directive1(rctx) - if err != nil { - return nil, graphql.ErrorOnPath(ctx, err) - } - if tmp == nil { - return nil, nil - } - if data, ok := tmp.(model.Entity); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be git.sr.ht/~sircmpwn/builds.sr.ht/api/graph/model.Entity`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(model.Entity) - fc.Result = res - return ec.marshalNEntity2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEntity(ctx, field.Selections, res) -} - -func (ec *executionContext) _JobGroup_jobs(ctx context.Context, field graphql.CollectedField, obj *model.JobGroup) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "JobGroup", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: true, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.JobGroup().Jobs(rctx, obj) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.([]*model.Job) - fc.Result = res - return ec.marshalNJob2ᚕᚖgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐJobᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) _JobGroup_triggers(ctx context.Context, field graphql.CollectedField, obj *model.JobGroup) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "JobGroup", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: true, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.JobGroup().Triggers(rctx, obj) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.([]model.Trigger) - fc.Result = res - return ec.marshalNTrigger2ᚕgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTriggerᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) _Log_last128KiB(ctx context.Context, field graphql.CollectedField, obj *model.Log) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Log", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Last128KiB, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) -} - -func (ec *executionContext) _Log_fullURL(ctx context.Context, field graphql.CollectedField, obj *model.Log) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Log", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.FullURL, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) -} - -func (ec *executionContext) _Mutation_submit(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Mutation", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: true, - } - - ctx = graphql.WithFieldContext(ctx, fc) - rawArgs := field.ArgumentMap(ec.Variables) - args, err := ec.field_Mutation_submit_args(ctx, rawArgs) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - fc.Args = args - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - directive0 := func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().Submit(rctx, args["manifest"].(string), args["tags"].([]string), args["note"].(*string), args["secrets"].(*bool), args["execute"].(*bool)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "JOBS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessKind(ctx, "RW") - if err != nil { - return nil, err - } - if ec.directives.Access == nil { - return nil, errors.New("directive access is not implemented") - } - return ec.directives.Access(ctx, nil, directive0, scope, kind) - } - - tmp, err := directive1(rctx) - if err != nil { - return nil, graphql.ErrorOnPath(ctx, err) - } - if tmp == nil { - return nil, nil - } - if data, ok := tmp.(*model.Job); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/builds.sr.ht/api/graph/model.Job`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(*model.Job) - fc.Result = res - return ec.marshalNJob2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐJob(ctx, field.Selections, res) -} - -func (ec *executionContext) _Mutation_start(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Mutation", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: true, - } - - ctx = graphql.WithFieldContext(ctx, fc) - rawArgs := field.ArgumentMap(ec.Variables) - args, err := ec.field_Mutation_start_args(ctx, rawArgs) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - fc.Args = args - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - directive0 := func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().Start(rctx, args["jobID"].(int)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "JOBS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessKind(ctx, "RW") - if err != nil { - return nil, err - } - if ec.directives.Access == nil { - return nil, errors.New("directive access is not implemented") - } - return ec.directives.Access(ctx, nil, directive0, scope, kind) - } - - tmp, err := directive1(rctx) - if err != nil { - return nil, graphql.ErrorOnPath(ctx, err) - } - if tmp == nil { - return nil, nil - } - if data, ok := tmp.(*model.Job); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/builds.sr.ht/api/graph/model.Job`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.Job) - fc.Result = res - return ec.marshalOJob2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐJob(ctx, field.Selections, res) -} - -func (ec *executionContext) _Mutation_cancel(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Mutation", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: true, - } - - ctx = graphql.WithFieldContext(ctx, fc) - rawArgs := field.ArgumentMap(ec.Variables) - args, err := ec.field_Mutation_cancel_args(ctx, rawArgs) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - fc.Args = args - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - directive0 := func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().Cancel(rctx, args["jobId"].(int)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "JOBS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessKind(ctx, "RW") - if err != nil { - return nil, err - } - if ec.directives.Access == nil { - return nil, errors.New("directive access is not implemented") - } - return ec.directives.Access(ctx, nil, directive0, scope, kind) - } - - tmp, err := directive1(rctx) - if err != nil { - return nil, graphql.ErrorOnPath(ctx, err) - } - if tmp == nil { - return nil, nil - } - if data, ok := tmp.(*model.Job); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/builds.sr.ht/api/graph/model.Job`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.Job) - fc.Result = res - return ec.marshalOJob2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐJob(ctx, field.Selections, res) -} - -func (ec *executionContext) _Mutation_createGroup(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Mutation", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: true, - } - - ctx = graphql.WithFieldContext(ctx, fc) - rawArgs := field.ArgumentMap(ec.Variables) - args, err := ec.field_Mutation_createGroup_args(ctx, rawArgs) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - fc.Args = args - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - directive0 := func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().CreateGroup(rctx, args["jobIds"].([]int), args["triggers"].([]*model.TriggerInput), args["execute"].(*bool), args["note"].(*string)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "JOBS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessKind(ctx, "RW") - if err != nil { - return nil, err - } - if ec.directives.Access == nil { - return nil, errors.New("directive access is not implemented") - } - return ec.directives.Access(ctx, nil, directive0, scope, kind) - } - - tmp, err := directive1(rctx) - if err != nil { - return nil, graphql.ErrorOnPath(ctx, err) - } - if tmp == nil { - return nil, nil - } - if data, ok := tmp.(*model.JobGroup); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/builds.sr.ht/api/graph/model.JobGroup`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(*model.JobGroup) - fc.Result = res - return ec.marshalNJobGroup2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐJobGroup(ctx, field.Selections, res) -} - -func (ec *executionContext) _Mutation_startGroup(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Mutation", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: true, - } - - ctx = graphql.WithFieldContext(ctx, fc) - rawArgs := field.ArgumentMap(ec.Variables) - args, err := ec.field_Mutation_startGroup_args(ctx, rawArgs) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - fc.Args = args - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - directive0 := func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().StartGroup(rctx, args["groupId"].(int)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "JOBS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessKind(ctx, "RW") - if err != nil { - return nil, err - } - if ec.directives.Access == nil { - return nil, errors.New("directive access is not implemented") - } - return ec.directives.Access(ctx, nil, directive0, scope, kind) - } - - tmp, err := directive1(rctx) - if err != nil { - return nil, graphql.ErrorOnPath(ctx, err) - } - if tmp == nil { - return nil, nil - } - if data, ok := tmp.(*model.JobGroup); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/builds.sr.ht/api/graph/model.JobGroup`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.JobGroup) - fc.Result = res - return ec.marshalOJobGroup2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐJobGroup(ctx, field.Selections, res) -} - -func (ec *executionContext) _Mutation_claim(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Mutation", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: true, - } - - ctx = graphql.WithFieldContext(ctx, fc) - rawArgs := field.ArgumentMap(ec.Variables) - args, err := ec.field_Mutation_claim_args(ctx, rawArgs) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - fc.Args = args - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - directive0 := func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().Claim(rctx, args["jobId"].(int)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - if ec.directives.Worker == nil { - return nil, errors.New("directive worker is not implemented") - } - return ec.directives.Worker(ctx, nil, directive0) - } - - tmp, err := directive1(rctx) - if err != nil { - return nil, graphql.ErrorOnPath(ctx, err) - } - if tmp == nil { - return nil, nil - } - if data, ok := tmp.(*model.Job); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/builds.sr.ht/api/graph/model.Job`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.Job) - fc.Result = res - return ec.marshalOJob2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐJob(ctx, field.Selections, res) -} - -func (ec *executionContext) _Mutation_updateJob(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Mutation", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: true, - } - - ctx = graphql.WithFieldContext(ctx, fc) - rawArgs := field.ArgumentMap(ec.Variables) - args, err := ec.field_Mutation_updateJob_args(ctx, rawArgs) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - fc.Args = args - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - directive0 := func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().UpdateJob(rctx, args["jobId"].(int), args["status"].(model.JobStatus)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - if ec.directives.Worker == nil { - return nil, errors.New("directive worker is not implemented") - } - return ec.directives.Worker(ctx, nil, directive0) - } - - tmp, err := directive1(rctx) - if err != nil { - return nil, graphql.ErrorOnPath(ctx, err) - } - if tmp == nil { - return nil, nil - } - if data, ok := tmp.(*model.Job); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/builds.sr.ht/api/graph/model.Job`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.Job) - fc.Result = res - return ec.marshalOJob2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐJob(ctx, field.Selections, res) -} - -func (ec *executionContext) _Mutation_updateTask(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Mutation", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: true, - } - - ctx = graphql.WithFieldContext(ctx, fc) - rawArgs := field.ArgumentMap(ec.Variables) - args, err := ec.field_Mutation_updateTask_args(ctx, rawArgs) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - fc.Args = args - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - directive0 := func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().UpdateTask(rctx, args["taskId"].(int), args["status"].(model.TaskStatus)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - if ec.directives.Worker == nil { - return nil, errors.New("directive worker is not implemented") - } - return ec.directives.Worker(ctx, nil, directive0) - } - - tmp, err := directive1(rctx) - if err != nil { - return nil, graphql.ErrorOnPath(ctx, err) - } - if tmp == nil { - return nil, nil - } - if data, ok := tmp.(*model.Job); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/builds.sr.ht/api/graph/model.Job`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.Job) - fc.Result = res - return ec.marshalOJob2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐJob(ctx, field.Selections, res) -} - -func (ec *executionContext) _Mutation_createArtifact(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Mutation", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: true, - } - - ctx = graphql.WithFieldContext(ctx, fc) - rawArgs := field.ArgumentMap(ec.Variables) - args, err := ec.field_Mutation_createArtifact_args(ctx, rawArgs) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - fc.Args = args - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - directive0 := func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().CreateArtifact(rctx, args["jobId"].(int), args["path"].(string), args["contents"].(string)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - if ec.directives.Worker == nil { - return nil, errors.New("directive worker is not implemented") - } - return ec.directives.Worker(ctx, nil, directive0) - } - - tmp, err := directive1(rctx) - if err != nil { - return nil, graphql.ErrorOnPath(ctx, err) - } - if tmp == nil { - return nil, nil - } - if data, ok := tmp.(*model.Artifact); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/builds.sr.ht/api/graph/model.Artifact`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.Artifact) - fc.Result = res - return ec.marshalOArtifact2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐArtifact(ctx, field.Selections, res) -} - -func (ec *executionContext) _PGPKey_id(ctx context.Context, field graphql.CollectedField, obj *model.PGPKey) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "PGPKey", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.ID, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(int) - fc.Result = res - return ec.marshalNInt2int(ctx, field.Selections, res) -} - -func (ec *executionContext) _PGPKey_created(ctx context.Context, field graphql.CollectedField, obj *model.PGPKey) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "PGPKey", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Created, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(time.Time) - fc.Result = res - return ec.marshalNTime2timeᚐTime(ctx, field.Selections, res) -} - -func (ec *executionContext) _PGPKey_uuid(ctx context.Context, field graphql.CollectedField, obj *model.PGPKey) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "PGPKey", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.UUID, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) -} - -func (ec *executionContext) _PGPKey_name(ctx context.Context, field graphql.CollectedField, obj *model.PGPKey) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "PGPKey", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Name, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) _PGPKey_privateKey(ctx context.Context, field graphql.CollectedField, obj *model.PGPKey) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "PGPKey", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: true, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - directive0 := func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.PGPKey().PrivateKey(rctx, obj) - } - directive1 := func(ctx context.Context) (interface{}, error) { - if ec.directives.Worker == nil { - return nil, errors.New("directive worker is not implemented") - } - return ec.directives.Worker(ctx, obj, directive0) - } - - tmp, err := directive1(rctx) - if err != nil { - return nil, graphql.ErrorOnPath(ctx, err) - } - if tmp == nil { - return nil, nil - } - if data, ok := tmp.(string); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be string`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalNBinary2string(ctx, field.Selections, res) -} - -func (ec *executionContext) _Query_version(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: true, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().Version(rctx) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(*model.Version) - fc.Result = res - return ec.marshalNVersion2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐVersion(ctx, field.Selections, res) -} - -func (ec *executionContext) _Query_me(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: true, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - directive0 := func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().Me(rctx) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "PROFILE") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessKind(ctx, "RO") - if err != nil { - return nil, err - } - if ec.directives.Access == nil { - return nil, errors.New("directive access is not implemented") - } - return ec.directives.Access(ctx, nil, directive0, scope, kind) - } - - tmp, err := directive1(rctx) - if err != nil { - return nil, graphql.ErrorOnPath(ctx, err) - } - if tmp == nil { - return nil, nil - } - if data, ok := tmp.(*model.User); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/builds.sr.ht/api/graph/model.User`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(*model.User) - fc.Result = res - return ec.marshalNUser2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐUser(ctx, field.Selections, res) -} - -func (ec *executionContext) _Query_userByID(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: true, - } - - ctx = graphql.WithFieldContext(ctx, fc) - rawArgs := field.ArgumentMap(ec.Variables) - args, err := ec.field_Query_userByID_args(ctx, rawArgs) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - fc.Args = args - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - directive0 := func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().UserByID(rctx, args["id"].(int)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "PROFILE") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessKind(ctx, "RO") - if err != nil { - return nil, err - } - if ec.directives.Access == nil { - return nil, errors.New("directive access is not implemented") - } - return ec.directives.Access(ctx, nil, directive0, scope, kind) - } - - tmp, err := directive1(rctx) - if err != nil { - return nil, graphql.ErrorOnPath(ctx, err) - } - if tmp == nil { - return nil, nil - } - if data, ok := tmp.(*model.User); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/builds.sr.ht/api/graph/model.User`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.User) - fc.Result = res - return ec.marshalOUser2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐUser(ctx, field.Selections, res) -} - -func (ec *executionContext) _Query_userByName(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: true, - } - - ctx = graphql.WithFieldContext(ctx, fc) - rawArgs := field.ArgumentMap(ec.Variables) - args, err := ec.field_Query_userByName_args(ctx, rawArgs) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - fc.Args = args - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - directive0 := func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().UserByName(rctx, args["username"].(string)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "PROFILE") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessKind(ctx, "RO") - if err != nil { - return nil, err - } - if ec.directives.Access == nil { - return nil, errors.New("directive access is not implemented") - } - return ec.directives.Access(ctx, nil, directive0, scope, kind) - } - - tmp, err := directive1(rctx) - if err != nil { - return nil, graphql.ErrorOnPath(ctx, err) - } - if tmp == nil { - return nil, nil - } - if data, ok := tmp.(*model.User); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/builds.sr.ht/api/graph/model.User`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.User) - fc.Result = res - return ec.marshalOUser2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐUser(ctx, field.Selections, res) -} - -func (ec *executionContext) _Query_jobs(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: true, - } - - ctx = graphql.WithFieldContext(ctx, fc) - rawArgs := field.ArgumentMap(ec.Variables) - args, err := ec.field_Query_jobs_args(ctx, rawArgs) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - fc.Args = args - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - directive0 := func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().Jobs(rctx, args["cursor"].(*model1.Cursor)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "JOBS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessKind(ctx, "RO") - if err != nil { - return nil, err - } - if ec.directives.Access == nil { - return nil, errors.New("directive access is not implemented") - } - return ec.directives.Access(ctx, nil, directive0, scope, kind) - } - - tmp, err := directive1(rctx) - if err != nil { - return nil, graphql.ErrorOnPath(ctx, err) - } - if tmp == nil { - return nil, nil - } - if data, ok := tmp.(*model.JobCursor); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/builds.sr.ht/api/graph/model.JobCursor`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(*model.JobCursor) - fc.Result = res - return ec.marshalNJobCursor2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐJobCursor(ctx, field.Selections, res) -} - -func (ec *executionContext) _Query_job(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: true, - } - - ctx = graphql.WithFieldContext(ctx, fc) - rawArgs := field.ArgumentMap(ec.Variables) - args, err := ec.field_Query_job_args(ctx, rawArgs) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - fc.Args = args - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - directive0 := func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().Job(rctx, args["id"].(int)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "JOBS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessKind(ctx, "RO") - if err != nil { - return nil, err - } - if ec.directives.Access == nil { - return nil, errors.New("directive access is not implemented") - } - return ec.directives.Access(ctx, nil, directive0, scope, kind) - } - - tmp, err := directive1(rctx) - if err != nil { - return nil, graphql.ErrorOnPath(ctx, err) - } - if tmp == nil { - return nil, nil - } - if data, ok := tmp.(*model.Job); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/builds.sr.ht/api/graph/model.Job`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.Job) - fc.Result = res - return ec.marshalOJob2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐJob(ctx, field.Selections, res) -} - -func (ec *executionContext) _Query_secrets(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: true, - } - - ctx = graphql.WithFieldContext(ctx, fc) - rawArgs := field.ArgumentMap(ec.Variables) - args, err := ec.field_Query_secrets_args(ctx, rawArgs) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - fc.Args = args - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - directive0 := func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().Secrets(rctx, args["cursor"].(*model1.Cursor)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "SECRETS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessKind(ctx, "RO") - if err != nil { - return nil, err - } - if ec.directives.Access == nil { - return nil, errors.New("directive access is not implemented") - } - return ec.directives.Access(ctx, nil, directive0, scope, kind) - } - - tmp, err := directive1(rctx) - if err != nil { - return nil, graphql.ErrorOnPath(ctx, err) - } - if tmp == nil { - return nil, nil - } - if data, ok := tmp.(*model.SecretCursor); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/builds.sr.ht/api/graph/model.SecretCursor`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(*model.SecretCursor) - fc.Result = res - return ec.marshalNSecretCursor2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐSecretCursor(ctx, field.Selections, res) -} - -func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - rawArgs := field.ArgumentMap(ec.Variables) - args, err := ec.field_Query___type_args(ctx, rawArgs) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - fc.Args = args - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.introspectType(args["name"].(string)) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*introspection.Type) - fc.Result = res - return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) -} - -func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.introspectSchema() - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*introspection.Schema) - fc.Result = res - return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res) -} - -func (ec *executionContext) _SSHKey_id(ctx context.Context, field graphql.CollectedField, obj *model.SSHKey) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "SSHKey", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.ID, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(int) - fc.Result = res - return ec.marshalNInt2int(ctx, field.Selections, res) -} - -func (ec *executionContext) _SSHKey_created(ctx context.Context, field graphql.CollectedField, obj *model.SSHKey) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "SSHKey", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Created, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(time.Time) - fc.Result = res - return ec.marshalNTime2timeᚐTime(ctx, field.Selections, res) -} - -func (ec *executionContext) _SSHKey_uuid(ctx context.Context, field graphql.CollectedField, obj *model.SSHKey) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "SSHKey", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.UUID, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) -} - -func (ec *executionContext) _SSHKey_name(ctx context.Context, field graphql.CollectedField, obj *model.SSHKey) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "SSHKey", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Name, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) _SSHKey_privateKey(ctx context.Context, field graphql.CollectedField, obj *model.SSHKey) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "SSHKey", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: true, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - directive0 := func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.SSHKey().PrivateKey(rctx, obj) - } - directive1 := func(ctx context.Context) (interface{}, error) { - if ec.directives.Worker == nil { - return nil, errors.New("directive worker is not implemented") - } - return ec.directives.Worker(ctx, obj, directive0) - } - - tmp, err := directive1(rctx) - if err != nil { - return nil, graphql.ErrorOnPath(ctx, err) - } - if tmp == nil { - return nil, nil - } - if data, ok := tmp.(string); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be string`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalNBinary2string(ctx, field.Selections, res) -} - -func (ec *executionContext) _SecretCursor_results(ctx context.Context, field graphql.CollectedField, obj *model.SecretCursor) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "SecretCursor", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Results, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.([]model.Secret) - fc.Result = res - return ec.marshalNSecret2ᚕgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐSecretᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) _SecretCursor_cursor(ctx context.Context, field graphql.CollectedField, obj *model.SecretCursor) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "SecretCursor", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Cursor, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model1.Cursor) - fc.Result = res - return ec.marshalOCursor2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋcoreᚑgoᚋmodelᚐCursor(ctx, field.Selections, res) -} - -func (ec *executionContext) _SecretFile_id(ctx context.Context, field graphql.CollectedField, obj *model.SecretFile) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "SecretFile", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.ID, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(int) - fc.Result = res - return ec.marshalNInt2int(ctx, field.Selections, res) -} - -func (ec *executionContext) _SecretFile_created(ctx context.Context, field graphql.CollectedField, obj *model.SecretFile) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "SecretFile", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Created, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(time.Time) - fc.Result = res - return ec.marshalNTime2timeᚐTime(ctx, field.Selections, res) -} - -func (ec *executionContext) _SecretFile_uuid(ctx context.Context, field graphql.CollectedField, obj *model.SecretFile) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "SecretFile", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.UUID, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) -} - -func (ec *executionContext) _SecretFile_name(ctx context.Context, field graphql.CollectedField, obj *model.SecretFile) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "SecretFile", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Name, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) _SecretFile_path(ctx context.Context, field graphql.CollectedField, obj *model.SecretFile) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "SecretFile", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Path, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) -} - -func (ec *executionContext) _SecretFile_mode(ctx context.Context, field graphql.CollectedField, obj *model.SecretFile) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "SecretFile", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Mode, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(int) - fc.Result = res - return ec.marshalNInt2int(ctx, field.Selections, res) -} - -func (ec *executionContext) _SecretFile_data(ctx context.Context, field graphql.CollectedField, obj *model.SecretFile) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "SecretFile", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: true, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - directive0 := func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.SecretFile().Data(rctx, obj) - } - directive1 := func(ctx context.Context) (interface{}, error) { - if ec.directives.Worker == nil { - return nil, errors.New("directive worker is not implemented") - } - return ec.directives.Worker(ctx, obj, directive0) - } - - tmp, err := directive1(rctx) - if err != nil { - return nil, graphql.ErrorOnPath(ctx, err) - } - if tmp == nil { - return nil, nil - } - if data, ok := tmp.(string); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be string`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalNBinary2string(ctx, field.Selections, res) -} - -func (ec *executionContext) _Settings_sshUser(ctx context.Context, field graphql.CollectedField, obj *model.Settings) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Settings", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.SSHUser, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) -} - -func (ec *executionContext) _Settings_buildTimeout(ctx context.Context, field graphql.CollectedField, obj *model.Settings) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Settings", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.BuildTimeout, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) -} - -func (ec *executionContext) _Task_id(ctx context.Context, field graphql.CollectedField, obj *model.Task) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Task", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.ID, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(int) - fc.Result = res - return ec.marshalNInt2int(ctx, field.Selections, res) -} - -func (ec *executionContext) _Task_created(ctx context.Context, field graphql.CollectedField, obj *model.Task) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Task", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Created, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(time.Time) - fc.Result = res - return ec.marshalNTime2timeᚐTime(ctx, field.Selections, res) -} - -func (ec *executionContext) _Task_updated(ctx context.Context, field graphql.CollectedField, obj *model.Task) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Task", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Updated, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(time.Time) - fc.Result = res - return ec.marshalNTime2timeᚐTime(ctx, field.Selections, res) -} - -func (ec *executionContext) _Task_name(ctx context.Context, field graphql.CollectedField, obj *model.Task) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Task", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Name, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) -} - -func (ec *executionContext) _Task_status(ctx context.Context, field graphql.CollectedField, obj *model.Task) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Task", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Status(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(model.TaskStatus) - fc.Result = res - return ec.marshalNTaskStatus2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTaskStatus(ctx, field.Selections, res) -} - -func (ec *executionContext) _Task_log(ctx context.Context, field graphql.CollectedField, obj *model.Task) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Task", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: true, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - directive0 := func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Task().Log(rctx, obj) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "LOGS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessKind(ctx, "RO") - if err != nil { - return nil, err - } - if ec.directives.Access == nil { - return nil, errors.New("directive access is not implemented") - } - return ec.directives.Access(ctx, obj, directive0, scope, kind) - } - - tmp, err := directive1(rctx) - if err != nil { - return nil, graphql.ErrorOnPath(ctx, err) - } - if tmp == nil { - return nil, nil - } - if data, ok := tmp.(*model.Log); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/builds.sr.ht/api/graph/model.Log`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.Log) - fc.Result = res - return ec.marshalOLog2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐLog(ctx, field.Selections, res) -} - -func (ec *executionContext) _Task_job(ctx context.Context, field graphql.CollectedField, obj *model.Task) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Task", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: true, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Task().Job(rctx, obj) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(*model.Job) - fc.Result = res - return ec.marshalNJob2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐJob(ctx, field.Selections, res) -} - -func (ec *executionContext) _User_id(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "User", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.ID, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(int) - fc.Result = res - return ec.marshalNInt2int(ctx, field.Selections, res) -} - -func (ec *executionContext) _User_created(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "User", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Created, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(time.Time) - fc.Result = res - return ec.marshalNTime2timeᚐTime(ctx, field.Selections, res) -} - -func (ec *executionContext) _User_updated(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "User", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Updated, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(time.Time) - fc.Result = res - return ec.marshalNTime2timeᚐTime(ctx, field.Selections, res) -} - -func (ec *executionContext) _User_canonicalName(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "User", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.CanonicalName(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) -} - -func (ec *executionContext) _User_username(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "User", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Username, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) -} - -func (ec *executionContext) _User_email(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "User", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Email, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) -} - -func (ec *executionContext) _User_url(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "User", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.URL, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) _User_location(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "User", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Location, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) _User_bio(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "User", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Bio, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) _User_jobs(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "User", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: true, - } - - ctx = graphql.WithFieldContext(ctx, fc) - rawArgs := field.ArgumentMap(ec.Variables) - args, err := ec.field_User_jobs_args(ctx, rawArgs) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - fc.Args = args - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - directive0 := func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.User().Jobs(rctx, obj, args["cursor"].(*model1.Cursor)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "JOBS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessKind(ctx, "RO") - if err != nil { - return nil, err - } - if ec.directives.Access == nil { - return nil, errors.New("directive access is not implemented") - } - return ec.directives.Access(ctx, obj, directive0, scope, kind) - } - - tmp, err := directive1(rctx) - if err != nil { - return nil, graphql.ErrorOnPath(ctx, err) - } - if tmp == nil { - return nil, nil - } - if data, ok := tmp.(*model.JobCursor); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/builds.sr.ht/api/graph/model.JobCursor`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(*model.JobCursor) - fc.Result = res - return ec.marshalNJobCursor2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐJobCursor(ctx, field.Selections, res) -} - -func (ec *executionContext) _Version_major(ctx context.Context, field graphql.CollectedField, obj *model.Version) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Version", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Major, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(int) - fc.Result = res - return ec.marshalNInt2int(ctx, field.Selections, res) -} - -func (ec *executionContext) _Version_minor(ctx context.Context, field graphql.CollectedField, obj *model.Version) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Version", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Minor, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(int) - fc.Result = res - return ec.marshalNInt2int(ctx, field.Selections, res) -} - -func (ec *executionContext) _Version_patch(ctx context.Context, field graphql.CollectedField, obj *model.Version) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Version", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Patch, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(int) - fc.Result = res - return ec.marshalNInt2int(ctx, field.Selections, res) -} - -func (ec *executionContext) _Version_deprecationDate(ctx context.Context, field graphql.CollectedField, obj *model.Version) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Version", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.DeprecationDate, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*time.Time) - fc.Result = res - return ec.marshalOTime2ᚖtimeᚐTime(ctx, field.Selections, res) -} - -func (ec *executionContext) _Version_settings(ctx context.Context, field graphql.CollectedField, obj *model.Version) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Version", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Settings, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(*model.Settings) - fc.Result = res - return ec.marshalNSettings2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐSettings(ctx, field.Selections, res) -} - -func (ec *executionContext) _WebhookTrigger_condition(ctx context.Context, field graphql.CollectedField, obj *model.WebhookTrigger) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "WebhookTrigger", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Condition, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(model.TriggerCondition) - fc.Result = res - return ec.marshalNTriggerCondition2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTriggerCondition(ctx, field.Selections, res) -} - -func (ec *executionContext) _WebhookTrigger_url(ctx context.Context, field graphql.CollectedField, obj *model.WebhookTrigger) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "WebhookTrigger", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.URL, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) -} - -func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "__Directive", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Name, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) -} - -func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "__Directive", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Description(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "__Directive", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Locations, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.([]string) - fc.Result = res - return ec.marshalN__DirectiveLocation2ᚕstringᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "__Directive", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Args, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.([]introspection.InputValue) - fc.Result = res - return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) ___Directive_isRepeatable(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "__Directive", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.IsRepeatable, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(bool) - fc.Result = res - return ec.marshalNBoolean2bool(ctx, field.Selections, res) -} - -func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Name, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) -} - -func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Description(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.IsDeprecated(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(bool) - fc.Result = res - return ec.marshalNBoolean2bool(ctx, field.Selections, res) -} - -func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.DeprecationReason(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Name, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) -} - -func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Description(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Args, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.([]introspection.InputValue) - fc.Result = res - return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Type, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(*introspection.Type) - fc.Result = res - return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) -} - -func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.IsDeprecated(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(bool) - fc.Result = res - return ec.marshalNBoolean2bool(ctx, field.Selections, res) -} - -func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.DeprecationReason(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Name, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) -} - -func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Description(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Type, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(*introspection.Type) - fc.Result = res - return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) -} - -func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.DefaultValue, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) ___Schema_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Description(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Types(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.([]introspection.Type) - fc.Result = res - return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.QueryType(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(*introspection.Type) - fc.Result = res - return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) -} - -func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.MutationType(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*introspection.Type) - fc.Result = res - return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) -} - -func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.SubscriptionType(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*introspection.Type) - fc.Result = res - 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) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Directives(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.([]introspection.Directive) - fc.Result = res - return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirectiveᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Kind(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalN__TypeKind2string(ctx, field.Selections, res) -} - -func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Name(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Description(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - rawArgs := field.ArgumentMap(ec.Variables) - args, err := ec.field___Type_fields_args(ctx, rawArgs) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - fc.Args = args - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Fields(args["includeDeprecated"].(bool)), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.([]introspection.Field) - fc.Result = res - 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) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Interfaces(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.([]introspection.Type) - fc.Result = res - return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.PossibleTypes(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.([]introspection.Type) - fc.Result = res - return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - rawArgs := field.ArgumentMap(ec.Variables) - args, err := ec.field___Type_enumValues_args(ctx, rawArgs) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - fc.Args = args - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.EnumValues(args["includeDeprecated"].(bool)), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.([]introspection.EnumValue) - fc.Result = res - 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) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.InputFields(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.([]introspection.InputValue) - fc.Result = res - return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.OfType(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*introspection.Type) - fc.Result = res - return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) -} - -func (ec *executionContext) ___Type_specifiedByURL(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.SpecifiedByURL(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -// endregion **************************** field.gotpl ***************************** - -// region **************************** input.gotpl ***************************** - -func (ec *executionContext) unmarshalInputEmailTriggerInput(ctx context.Context, obj interface{}) (model.EmailTriggerInput, error) { - var it model.EmailTriggerInput - asMap := map[string]interface{}{} - for k, v := range obj.(map[string]interface{}) { - asMap[k] = v - } - - for k, v := range asMap { - switch k { - case "to": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("to")) - it.To, err = ec.unmarshalNString2string(ctx, v) - if err != nil { - return it, err - } - case "cc": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cc")) - it.Cc, err = ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - case "inReplyTo": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("inReplyTo")) - it.InReplyTo, err = ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - } - } - - return it, nil -} - -func (ec *executionContext) unmarshalInputTriggerInput(ctx context.Context, obj interface{}) (model.TriggerInput, error) { - var it model.TriggerInput - asMap := map[string]interface{}{} - for k, v := range obj.(map[string]interface{}) { - asMap[k] = v - } - - for k, v := range asMap { - switch k { - case "type": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("type")) - it.Type, err = ec.unmarshalNTriggerType2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTriggerType(ctx, v) - if err != nil { - return it, err - } - case "condition": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("condition")) - it.Condition, err = ec.unmarshalNTriggerCondition2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTriggerCondition(ctx, v) - if err != nil { - return it, err - } - case "email": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("email")) - it.Email, err = ec.unmarshalOEmailTriggerInput2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEmailTriggerInput(ctx, v) - if err != nil { - return it, err - } - case "webhook": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("webhook")) - it.Webhook, err = ec.unmarshalOWebhookTriggerInput2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐWebhookTriggerInput(ctx, v) - if err != nil { - return it, err - } - } - } - - return it, nil -} - -func (ec *executionContext) unmarshalInputWebhookTriggerInput(ctx context.Context, obj interface{}) (model.WebhookTriggerInput, error) { - var it model.WebhookTriggerInput - asMap := map[string]interface{}{} - for k, v := range obj.(map[string]interface{}) { - asMap[k] = v - } - - for k, v := range asMap { - switch k { - case "url": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("url")) - it.URL, err = ec.unmarshalNString2string(ctx, v) - if err != nil { - return it, err - } - } - } - - return it, nil -} - -// endregion **************************** input.gotpl ***************************** - -// region ************************** interface.gotpl *************************** - -func (ec *executionContext) _Entity(ctx context.Context, sel ast.SelectionSet, obj model.Entity) graphql.Marshaler { - switch obj := (obj).(type) { - case nil: - return graphql.Null - case model.User: - return ec._User(ctx, sel, &obj) - case *model.User: - if obj == nil { - return graphql.Null - } - return ec._User(ctx, sel, obj) - default: - panic(fmt.Errorf("unexpected type %T", obj)) - } -} - -func (ec *executionContext) _Secret(ctx context.Context, sel ast.SelectionSet, obj model.Secret) graphql.Marshaler { - switch obj := (obj).(type) { - case nil: - return graphql.Null - case model.SSHKey: - return ec._SSHKey(ctx, sel, &obj) - case *model.SSHKey: - if obj == nil { - return graphql.Null - } - return ec._SSHKey(ctx, sel, obj) - case model.PGPKey: - return ec._PGPKey(ctx, sel, &obj) - case *model.PGPKey: - if obj == nil { - return graphql.Null - } - return ec._PGPKey(ctx, sel, obj) - case model.SecretFile: - return ec._SecretFile(ctx, sel, &obj) - case *model.SecretFile: - if obj == nil { - return graphql.Null - } - return ec._SecretFile(ctx, sel, obj) - default: - panic(fmt.Errorf("unexpected type %T", obj)) - } -} - -func (ec *executionContext) _Trigger(ctx context.Context, sel ast.SelectionSet, obj model.Trigger) graphql.Marshaler { - switch obj := (obj).(type) { - case nil: - return graphql.Null - case model.EmailTrigger: - return ec._EmailTrigger(ctx, sel, &obj) - case *model.EmailTrigger: - if obj == nil { - return graphql.Null - } - return ec._EmailTrigger(ctx, sel, obj) - case model.WebhookTrigger: - return ec._WebhookTrigger(ctx, sel, &obj) - case *model.WebhookTrigger: - if obj == nil { - return graphql.Null - } - return ec._WebhookTrigger(ctx, sel, obj) - default: - panic(fmt.Errorf("unexpected type %T", obj)) - } -} - -// endregion ************************** interface.gotpl *************************** - -// region **************************** object.gotpl **************************** - -var artifactImplementors = []string{"Artifact"} - -func (ec *executionContext) _Artifact(ctx context.Context, sel ast.SelectionSet, obj *model.Artifact) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, artifactImplementors) - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("Artifact") - case "id": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._Artifact_id(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - invalids++ - } - case "created": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._Artifact_created(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - invalids++ - } - case "path": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._Artifact_path(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - invalids++ - } - case "size": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._Artifact_size(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - invalids++ - } - case "url": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._Artifact_url(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch() - if invalids > 0 { - return graphql.Null - } - return out -} - -var emailTriggerImplementors = []string{"EmailTrigger", "Trigger"} - -func (ec *executionContext) _EmailTrigger(ctx context.Context, sel ast.SelectionSet, obj *model.EmailTrigger) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, emailTriggerImplementors) - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("EmailTrigger") - case "condition": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._EmailTrigger_condition(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - invalids++ - } - case "to": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._EmailTrigger_to(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - invalids++ - } - case "cc": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._EmailTrigger_cc(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - case "inReplyTo": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._EmailTrigger_inReplyTo(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch() - if invalids > 0 { - return graphql.Null - } - return out -} - -var jobImplementors = []string{"Job"} - -func (ec *executionContext) _Job(ctx context.Context, sel ast.SelectionSet, obj *model.Job) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, jobImplementors) - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("Job") - case "id": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._Job_id(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "created": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._Job_created(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "updated": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._Job_updated(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "status": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._Job_status(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "manifest": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._Job_manifest(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "note": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._Job_note(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - case "tags": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._Job_tags(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "image": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._Job_image(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "runner": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._Job_runner(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - case "owner": - field := field - - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Job_owner(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - } - - out.Concurrently(i, func() graphql.Marshaler { - return innerFunc(ctx) - - }) - case "group": - field := field - - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Job_group(ctx, field, obj) - return res - } - - out.Concurrently(i, func() graphql.Marshaler { - return innerFunc(ctx) - - }) - case "tasks": - field := field - - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Job_tasks(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - } - - out.Concurrently(i, func() graphql.Marshaler { - return innerFunc(ctx) - - }) - case "artifacts": - field := field - - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Job_artifacts(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - } - - out.Concurrently(i, func() graphql.Marshaler { - return innerFunc(ctx) - - }) - case "log": - field := field - - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Job_log(ctx, field, obj) - return res - } - - out.Concurrently(i, func() graphql.Marshaler { - return innerFunc(ctx) - - }) - case "secrets": - field := field - - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Job_secrets(ctx, field, obj) - return res - } - - out.Concurrently(i, func() graphql.Marshaler { - return innerFunc(ctx) - - }) - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch() - if invalids > 0 { - return graphql.Null - } - return out -} - -var jobCursorImplementors = []string{"JobCursor"} - -func (ec *executionContext) _JobCursor(ctx context.Context, sel ast.SelectionSet, obj *model.JobCursor) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, jobCursorImplementors) - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("JobCursor") - case "results": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._JobCursor_results(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - invalids++ - } - case "cursor": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._JobCursor_cursor(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch() - if invalids > 0 { - return graphql.Null - } - return out -} - -var jobGroupImplementors = []string{"JobGroup"} - -func (ec *executionContext) _JobGroup(ctx context.Context, sel ast.SelectionSet, obj *model.JobGroup) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, jobGroupImplementors) - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("JobGroup") - case "id": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._JobGroup_id(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "created": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._JobGroup_created(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "note": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._JobGroup_note(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - case "owner": - field := field - - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._JobGroup_owner(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - } - - out.Concurrently(i, func() graphql.Marshaler { - return innerFunc(ctx) - - }) - case "jobs": - field := field - - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._JobGroup_jobs(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - } - - out.Concurrently(i, func() graphql.Marshaler { - return innerFunc(ctx) - - }) - case "triggers": - field := field - - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._JobGroup_triggers(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - } - - out.Concurrently(i, func() graphql.Marshaler { - return innerFunc(ctx) - - }) - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch() - if invalids > 0 { - return graphql.Null - } - return out -} - -var logImplementors = []string{"Log"} - -func (ec *executionContext) _Log(ctx context.Context, sel ast.SelectionSet, obj *model.Log) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, logImplementors) - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("Log") - case "last128KiB": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._Log_last128KiB(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - invalids++ - } - case "fullURL": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._Log_fullURL(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - invalids++ - } - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch() - if invalids > 0 { - return graphql.Null - } - return out -} - -var mutationImplementors = []string{"Mutation"} - -func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, mutationImplementors) - ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ - Object: "Mutation", - }) - - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ - Object: field.Name, - Field: field, - }) - - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("Mutation") - case "submit": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._Mutation_submit(ctx, field) - } - - out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, innerFunc) - - if out.Values[i] == graphql.Null { - invalids++ - } - case "start": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._Mutation_start(ctx, field) - } - - out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, innerFunc) - - case "cancel": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._Mutation_cancel(ctx, field) - } - - out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, innerFunc) - - case "createGroup": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._Mutation_createGroup(ctx, field) - } - - out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, innerFunc) - - if out.Values[i] == graphql.Null { - invalids++ - } - case "startGroup": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._Mutation_startGroup(ctx, field) - } - - out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, innerFunc) - - case "claim": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._Mutation_claim(ctx, field) - } - - out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, innerFunc) - - case "updateJob": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._Mutation_updateJob(ctx, field) - } - - out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, innerFunc) - - case "updateTask": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._Mutation_updateTask(ctx, field) - } - - out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, innerFunc) - - case "createArtifact": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._Mutation_createArtifact(ctx, field) - } - - out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, innerFunc) - - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch() - if invalids > 0 { - return graphql.Null - } - return out -} - -var pGPKeyImplementors = []string{"PGPKey", "Secret"} - -func (ec *executionContext) _PGPKey(ctx context.Context, sel ast.SelectionSet, obj *model.PGPKey) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, pGPKeyImplementors) - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("PGPKey") - case "id": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._PGPKey_id(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "created": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._PGPKey_created(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "uuid": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._PGPKey_uuid(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "name": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._PGPKey_name(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - case "privateKey": - field := field - - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._PGPKey_privateKey(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - } - - out.Concurrently(i, func() graphql.Marshaler { - return innerFunc(ctx) - - }) - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch() - if invalids > 0 { - return graphql.Null - } - return out -} - -var queryImplementors = []string{"Query"} - -func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, queryImplementors) - ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ - Object: "Query", - }) - - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ - Object: field.Name, - Field: field, - }) - - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("Query") - case "version": - field := field - - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Query_version(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - } - - rrm := func(ctx context.Context) graphql.Marshaler { - return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc) - } - - out.Concurrently(i, func() graphql.Marshaler { - return rrm(innerCtx) - }) - case "me": - field := field - - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Query_me(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - } - - rrm := func(ctx context.Context) graphql.Marshaler { - return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc) - } - - out.Concurrently(i, func() graphql.Marshaler { - return rrm(innerCtx) - }) - case "userByID": - field := field - - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Query_userByID(ctx, field) - return res - } - - rrm := func(ctx context.Context) graphql.Marshaler { - return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc) - } - - out.Concurrently(i, func() graphql.Marshaler { - return rrm(innerCtx) - }) - case "userByName": - field := field - - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Query_userByName(ctx, field) - return res - } - - rrm := func(ctx context.Context) graphql.Marshaler { - return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc) - } - - out.Concurrently(i, func() graphql.Marshaler { - return rrm(innerCtx) - }) - case "jobs": - field := field - - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Query_jobs(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - } - - rrm := func(ctx context.Context) graphql.Marshaler { - return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc) - } - - out.Concurrently(i, func() graphql.Marshaler { - return rrm(innerCtx) - }) - case "job": - field := field - - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Query_job(ctx, field) - return res - } - - rrm := func(ctx context.Context) graphql.Marshaler { - return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc) - } - - out.Concurrently(i, func() graphql.Marshaler { - return rrm(innerCtx) - }) - case "secrets": - field := field - - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Query_secrets(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - } - - rrm := func(ctx context.Context) graphql.Marshaler { - return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc) - } - - out.Concurrently(i, func() graphql.Marshaler { - return rrm(innerCtx) - }) - case "__type": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._Query___type(ctx, field) - } - - out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, innerFunc) - - case "__schema": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._Query___schema(ctx, field) - } - - out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, innerFunc) - - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch() - if invalids > 0 { - return graphql.Null - } - return out -} - -var sSHKeyImplementors = []string{"SSHKey", "Secret"} - -func (ec *executionContext) _SSHKey(ctx context.Context, sel ast.SelectionSet, obj *model.SSHKey) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, sSHKeyImplementors) - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("SSHKey") - case "id": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._SSHKey_id(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "created": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._SSHKey_created(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "uuid": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._SSHKey_uuid(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "name": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._SSHKey_name(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - case "privateKey": - field := field - - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._SSHKey_privateKey(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - } - - out.Concurrently(i, func() graphql.Marshaler { - return innerFunc(ctx) - - }) - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch() - if invalids > 0 { - return graphql.Null - } - return out -} - -var secretCursorImplementors = []string{"SecretCursor"} - -func (ec *executionContext) _SecretCursor(ctx context.Context, sel ast.SelectionSet, obj *model.SecretCursor) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, secretCursorImplementors) - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("SecretCursor") - case "results": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._SecretCursor_results(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - invalids++ - } - case "cursor": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._SecretCursor_cursor(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch() - if invalids > 0 { - return graphql.Null - } - return out -} - -var secretFileImplementors = []string{"SecretFile", "Secret"} - -func (ec *executionContext) _SecretFile(ctx context.Context, sel ast.SelectionSet, obj *model.SecretFile) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, secretFileImplementors) - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("SecretFile") - case "id": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._SecretFile_id(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "created": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._SecretFile_created(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "uuid": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._SecretFile_uuid(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "name": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._SecretFile_name(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - case "path": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._SecretFile_path(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "mode": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._SecretFile_mode(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "data": - field := field - - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._SecretFile_data(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - } - - out.Concurrently(i, func() graphql.Marshaler { - return innerFunc(ctx) - - }) - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch() - if invalids > 0 { - return graphql.Null - } - return out -} - -var settingsImplementors = []string{"Settings"} - -func (ec *executionContext) _Settings(ctx context.Context, sel ast.SelectionSet, obj *model.Settings) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, settingsImplementors) - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("Settings") - case "sshUser": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._Settings_sshUser(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - invalids++ - } - case "buildTimeout": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._Settings_buildTimeout(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - invalids++ - } - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch() - if invalids > 0 { - return graphql.Null - } - return out -} - -var taskImplementors = []string{"Task"} - -func (ec *executionContext) _Task(ctx context.Context, sel ast.SelectionSet, obj *model.Task) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, taskImplementors) - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("Task") - case "id": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._Task_id(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "created": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._Task_created(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "updated": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._Task_updated(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "name": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._Task_name(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "status": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._Task_status(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "log": - field := field - - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Task_log(ctx, field, obj) - return res - } - - out.Concurrently(i, func() graphql.Marshaler { - return innerFunc(ctx) - - }) - case "job": - field := field - - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Task_job(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - } - - out.Concurrently(i, func() graphql.Marshaler { - return innerFunc(ctx) - - }) - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch() - if invalids > 0 { - return graphql.Null - } - return out -} - -var userImplementors = []string{"User", "Entity"} - -func (ec *executionContext) _User(ctx context.Context, sel ast.SelectionSet, obj *model.User) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, userImplementors) - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("User") - case "id": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._User_id(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "created": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._User_created(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "updated": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._User_updated(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "canonicalName": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._User_canonicalName(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "username": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._User_username(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "email": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._User_email(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "url": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._User_url(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - case "location": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._User_location(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - case "bio": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._User_bio(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - case "jobs": - field := field - - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._User_jobs(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - } - - out.Concurrently(i, func() graphql.Marshaler { - return innerFunc(ctx) - - }) - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch() - if invalids > 0 { - return graphql.Null - } - return out -} - -var versionImplementors = []string{"Version"} - -func (ec *executionContext) _Version(ctx context.Context, sel ast.SelectionSet, obj *model.Version) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, versionImplementors) - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("Version") - case "major": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._Version_major(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - invalids++ - } - case "minor": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._Version_minor(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - invalids++ - } - case "patch": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._Version_patch(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - invalids++ - } - case "deprecationDate": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._Version_deprecationDate(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - case "settings": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._Version_settings(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - invalids++ - } - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch() - if invalids > 0 { - return graphql.Null - } - return out -} - -var webhookTriggerImplementors = []string{"WebhookTrigger", "Trigger"} - -func (ec *executionContext) _WebhookTrigger(ctx context.Context, sel ast.SelectionSet, obj *model.WebhookTrigger) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, webhookTriggerImplementors) - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("WebhookTrigger") - case "condition": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._WebhookTrigger_condition(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - invalids++ - } - case "url": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec._WebhookTrigger_url(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - invalids++ - } - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch() - if invalids > 0 { - return graphql.Null - } - return out -} - -var __DirectiveImplementors = []string{"__Directive"} - -func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionSet, obj *introspection.Directive) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, __DirectiveImplementors) - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("__Directive") - case "name": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec.___Directive_name(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - invalids++ - } - case "description": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec.___Directive_description(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - case "locations": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec.___Directive_locations(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - invalids++ - } - case "args": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec.___Directive_args(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - invalids++ - } - case "isRepeatable": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec.___Directive_isRepeatable(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - invalids++ - } - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch() - if invalids > 0 { - return graphql.Null - } - return out -} - -var __EnumValueImplementors = []string{"__EnumValue"} - -func (ec *executionContext) ___EnumValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.EnumValue) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, __EnumValueImplementors) - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("__EnumValue") - case "name": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec.___EnumValue_name(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - invalids++ - } - case "description": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec.___EnumValue_description(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - case "isDeprecated": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec.___EnumValue_isDeprecated(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - invalids++ - } - case "deprecationReason": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec.___EnumValue_deprecationReason(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch() - if invalids > 0 { - return graphql.Null - } - return out -} - -var __FieldImplementors = []string{"__Field"} - -func (ec *executionContext) ___Field(ctx context.Context, sel ast.SelectionSet, obj *introspection.Field) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, __FieldImplementors) - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("__Field") - case "name": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec.___Field_name(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - invalids++ - } - case "description": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec.___Field_description(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - case "args": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec.___Field_args(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - invalids++ - } - case "type": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec.___Field_type(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - invalids++ - } - case "isDeprecated": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec.___Field_isDeprecated(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - invalids++ - } - case "deprecationReason": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec.___Field_deprecationReason(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch() - if invalids > 0 { - return graphql.Null - } - return out -} - -var __InputValueImplementors = []string{"__InputValue"} - -func (ec *executionContext) ___InputValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.InputValue) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, __InputValueImplementors) - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("__InputValue") - case "name": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec.___InputValue_name(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - invalids++ - } - case "description": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec.___InputValue_description(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - case "type": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec.___InputValue_type(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - invalids++ - } - case "defaultValue": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec.___InputValue_defaultValue(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch() - if invalids > 0 { - return graphql.Null - } - return out -} - -var __SchemaImplementors = []string{"__Schema"} - -func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet, obj *introspection.Schema) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, __SchemaImplementors) - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("__Schema") - case "description": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec.___Schema_description(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - case "types": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec.___Schema_types(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - invalids++ - } - case "queryType": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec.___Schema_queryType(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - invalids++ - } - case "mutationType": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec.___Schema_mutationType(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - case "subscriptionType": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec.___Schema_subscriptionType(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - case "directives": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec.___Schema_directives(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - invalids++ - } - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch() - if invalids > 0 { - return graphql.Null - } - return out -} - -var __TypeImplementors = []string{"__Type"} - -func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, obj *introspection.Type) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, __TypeImplementors) - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("__Type") - case "kind": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec.___Type_kind(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - if out.Values[i] == graphql.Null { - invalids++ - } - case "name": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec.___Type_name(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - case "description": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec.___Type_description(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - case "fields": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec.___Type_fields(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - case "interfaces": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec.___Type_interfaces(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - case "possibleTypes": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec.___Type_possibleTypes(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - case "enumValues": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec.___Type_enumValues(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - case "inputFields": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec.___Type_inputFields(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - case "ofType": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec.___Type_ofType(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - case "specifiedByURL": - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - return ec.___Type_specifiedByURL(ctx, field, obj) - } - - out.Values[i] = innerFunc(ctx) - - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch() - if invalids > 0 { - return graphql.Null - } - return out -} - -// endregion **************************** object.gotpl **************************** - -// region ***************************** type.gotpl ***************************** - -func (ec *executionContext) unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessKind(ctx context.Context, v interface{}) (model.AccessKind, error) { - var res model.AccessKind - err := res.UnmarshalGQL(v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessKind(ctx context.Context, sel ast.SelectionSet, v model.AccessKind) graphql.Marshaler { - return v -} - -func (ec *executionContext) unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx context.Context, v interface{}) (model.AccessScope, error) { - var res model.AccessScope - err := res.UnmarshalGQL(v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx context.Context, sel ast.SelectionSet, v model.AccessScope) graphql.Marshaler { - return v -} - -func (ec *executionContext) marshalNArtifact2ᚕᚖgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐArtifactᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.Artifact) 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 - fc := &graphql.FieldContext{ - Index: &i, - Result: &v[i], - } - ctx := graphql.WithFieldContext(ctx, fc) - 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.marshalNArtifact2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐArtifact(ctx, sel, v[i]) - } - if isLen1 { - f(i) - } else { - go f(i) - } - - } - wg.Wait() - - for _, e := range ret { - if e == graphql.Null { - return graphql.Null - } - } - - return ret -} - -func (ec *executionContext) marshalNArtifact2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐArtifact(ctx context.Context, sel ast.SelectionSet, v *model.Artifact) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - return ec._Artifact(ctx, sel, v) -} - -func (ec *executionContext) unmarshalNBinary2string(ctx context.Context, v interface{}) (string, error) { - res, err := graphql.UnmarshalString(v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalNBinary2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { - res := graphql.MarshalString(v) - if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - } - return res -} - -func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interface{}) (bool, error) { - res, err := graphql.UnmarshalBoolean(v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { - res := graphql.MarshalBoolean(v) - if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - } - return res -} - -func (ec *executionContext) marshalNEntity2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEntity(ctx context.Context, sel ast.SelectionSet, v model.Entity) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - return ec._Entity(ctx, sel, v) -} - -func (ec *executionContext) unmarshalNFile2string(ctx context.Context, v interface{}) (string, error) { - res, err := graphql.UnmarshalString(v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalNFile2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { - res := graphql.MarshalString(v) - if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - } - return res -} - -func (ec *executionContext) unmarshalNInt2int(ctx context.Context, v interface{}) (int, error) { - res, err := graphql.UnmarshalInt(v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalNInt2int(ctx context.Context, sel ast.SelectionSet, v int) graphql.Marshaler { - res := graphql.MarshalInt(v) - if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - } - return res -} - -func (ec *executionContext) unmarshalNInt2ᚕintᚄ(ctx context.Context, v interface{}) ([]int, error) { - var vSlice []interface{} - if v != nil { - vSlice = graphql.CoerceList(v) - } - var err error - res := make([]int, len(vSlice)) - for i := range vSlice { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) - res[i], err = ec.unmarshalNInt2int(ctx, vSlice[i]) - if err != nil { - return nil, err - } - } - return res, nil -} - -func (ec *executionContext) marshalNInt2ᚕintᚄ(ctx context.Context, sel ast.SelectionSet, v []int) graphql.Marshaler { - ret := make(graphql.Array, len(v)) - for i := range v { - ret[i] = ec.marshalNInt2int(ctx, sel, v[i]) - } - - for _, e := range ret { - if e == graphql.Null { - return graphql.Null - } - } - - return ret -} - -func (ec *executionContext) marshalNJob2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐJob(ctx context.Context, sel ast.SelectionSet, v model.Job) graphql.Marshaler { - return ec._Job(ctx, sel, &v) -} - -func (ec *executionContext) marshalNJob2ᚕᚖgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐJobᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.Job) 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 - fc := &graphql.FieldContext{ - Index: &i, - Result: &v[i], - } - ctx := graphql.WithFieldContext(ctx, fc) - 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.marshalNJob2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐJob(ctx, sel, v[i]) - } - if isLen1 { - f(i) - } else { - go f(i) - } - - } - wg.Wait() - - for _, e := range ret { - if e == graphql.Null { - return graphql.Null - } - } - - return ret -} - -func (ec *executionContext) marshalNJob2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐJob(ctx context.Context, sel ast.SelectionSet, v *model.Job) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - return ec._Job(ctx, sel, v) -} - -func (ec *executionContext) marshalNJobCursor2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐJobCursor(ctx context.Context, sel ast.SelectionSet, v model.JobCursor) graphql.Marshaler { - return ec._JobCursor(ctx, sel, &v) -} - -func (ec *executionContext) marshalNJobCursor2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐJobCursor(ctx context.Context, sel ast.SelectionSet, v *model.JobCursor) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - return ec._JobCursor(ctx, sel, v) -} - -func (ec *executionContext) marshalNJobGroup2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐJobGroup(ctx context.Context, sel ast.SelectionSet, v model.JobGroup) graphql.Marshaler { - return ec._JobGroup(ctx, sel, &v) -} - -func (ec *executionContext) marshalNJobGroup2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐJobGroup(ctx context.Context, sel ast.SelectionSet, v *model.JobGroup) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - return ec._JobGroup(ctx, sel, v) -} - -func (ec *executionContext) unmarshalNJobStatus2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐJobStatus(ctx context.Context, v interface{}) (model.JobStatus, error) { - var res model.JobStatus - err := res.UnmarshalGQL(v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalNJobStatus2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐJobStatus(ctx context.Context, sel ast.SelectionSet, v model.JobStatus) graphql.Marshaler { - return v -} - -func (ec *executionContext) marshalNSecret2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐSecret(ctx context.Context, sel ast.SelectionSet, v model.Secret) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - return ec._Secret(ctx, sel, v) -} - -func (ec *executionContext) marshalNSecret2ᚕgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐSecretᚄ(ctx context.Context, sel ast.SelectionSet, v []model.Secret) 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 - fc := &graphql.FieldContext{ - Index: &i, - Result: &v[i], - } - ctx := graphql.WithFieldContext(ctx, fc) - 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.marshalNSecret2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐSecret(ctx, sel, v[i]) - } - if isLen1 { - f(i) - } else { - go f(i) - } - - } - wg.Wait() - - for _, e := range ret { - if e == graphql.Null { - return graphql.Null - } - } - - return ret -} - -func (ec *executionContext) marshalNSecretCursor2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐSecretCursor(ctx context.Context, sel ast.SelectionSet, v model.SecretCursor) graphql.Marshaler { - return ec._SecretCursor(ctx, sel, &v) -} - -func (ec *executionContext) marshalNSecretCursor2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐSecretCursor(ctx context.Context, sel ast.SelectionSet, v *model.SecretCursor) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - return ec._SecretCursor(ctx, sel, v) -} - -func (ec *executionContext) marshalNSettings2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐSettings(ctx context.Context, sel ast.SelectionSet, v *model.Settings) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - return ec._Settings(ctx, sel, v) -} - -func (ec *executionContext) unmarshalNString2string(ctx context.Context, v interface{}) (string, error) { - res, err := graphql.UnmarshalString(v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { - res := graphql.MarshalString(v) - if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - } - return res -} - -func (ec *executionContext) unmarshalNString2ᚕstringᚄ(ctx context.Context, v interface{}) ([]string, error) { - var vSlice []interface{} - if v != nil { - vSlice = graphql.CoerceList(v) - } - var err error - res := make([]string, len(vSlice)) - for i := range vSlice { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) - res[i], err = ec.unmarshalNString2string(ctx, vSlice[i]) - if err != nil { - return nil, err - } - } - return res, nil -} - -func (ec *executionContext) marshalNString2ᚕstringᚄ(ctx context.Context, sel ast.SelectionSet, v []string) graphql.Marshaler { - ret := make(graphql.Array, len(v)) - for i := range v { - ret[i] = ec.marshalNString2string(ctx, sel, v[i]) - } - - for _, e := range ret { - if e == graphql.Null { - return graphql.Null - } - } - - return ret -} - -func (ec *executionContext) marshalNTask2ᚕᚖgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTaskᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.Task) 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 - fc := &graphql.FieldContext{ - Index: &i, - Result: &v[i], - } - ctx := graphql.WithFieldContext(ctx, fc) - 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.marshalNTask2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTask(ctx, sel, v[i]) - } - if isLen1 { - f(i) - } else { - go f(i) - } - - } - wg.Wait() - - for _, e := range ret { - if e == graphql.Null { - return graphql.Null - } - } - - return ret -} - -func (ec *executionContext) marshalNTask2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTask(ctx context.Context, sel ast.SelectionSet, v *model.Task) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - return ec._Task(ctx, sel, v) -} - -func (ec *executionContext) unmarshalNTaskStatus2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTaskStatus(ctx context.Context, v interface{}) (model.TaskStatus, error) { - var res model.TaskStatus - err := res.UnmarshalGQL(v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalNTaskStatus2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTaskStatus(ctx context.Context, sel ast.SelectionSet, v model.TaskStatus) graphql.Marshaler { - return v -} - -func (ec *executionContext) unmarshalNTime2timeᚐTime(ctx context.Context, v interface{}) (time.Time, error) { - res, err := graphql.UnmarshalTime(v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalNTime2timeᚐTime(ctx context.Context, sel ast.SelectionSet, v time.Time) graphql.Marshaler { - res := graphql.MarshalTime(v) - if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - } - return res -} - -func (ec *executionContext) marshalNTrigger2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTrigger(ctx context.Context, sel ast.SelectionSet, v model.Trigger) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - return ec._Trigger(ctx, sel, v) -} - -func (ec *executionContext) marshalNTrigger2ᚕgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTriggerᚄ(ctx context.Context, sel ast.SelectionSet, v []model.Trigger) 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 - fc := &graphql.FieldContext{ - Index: &i, - Result: &v[i], - } - ctx := graphql.WithFieldContext(ctx, fc) - 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.marshalNTrigger2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTrigger(ctx, sel, v[i]) - } - if isLen1 { - f(i) - } else { - go f(i) - } - - } - wg.Wait() - - for _, e := range ret { - if e == graphql.Null { - return graphql.Null - } - } - - return ret -} - -func (ec *executionContext) unmarshalNTriggerCondition2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTriggerCondition(ctx context.Context, v interface{}) (model.TriggerCondition, error) { - var res model.TriggerCondition - err := res.UnmarshalGQL(v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalNTriggerCondition2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTriggerCondition(ctx context.Context, sel ast.SelectionSet, v model.TriggerCondition) graphql.Marshaler { - return v -} - -func (ec *executionContext) unmarshalNTriggerInput2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTriggerInput(ctx context.Context, v interface{}) (*model.TriggerInput, error) { - res, err := ec.unmarshalInputTriggerInput(ctx, v) - return &res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) unmarshalNTriggerType2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTriggerType(ctx context.Context, v interface{}) (model.TriggerType, error) { - var res model.TriggerType - err := res.UnmarshalGQL(v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalNTriggerType2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTriggerType(ctx context.Context, sel ast.SelectionSet, v model.TriggerType) graphql.Marshaler { - return v -} - -func (ec *executionContext) marshalNUser2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐUser(ctx context.Context, sel ast.SelectionSet, v model.User) graphql.Marshaler { - return ec._User(ctx, sel, &v) -} - -func (ec *executionContext) marshalNUser2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐUser(ctx context.Context, sel ast.SelectionSet, v *model.User) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - return ec._User(ctx, sel, v) -} - -func (ec *executionContext) marshalNVersion2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐVersion(ctx context.Context, sel ast.SelectionSet, v model.Version) graphql.Marshaler { - return ec._Version(ctx, sel, &v) -} - -func (ec *executionContext) marshalNVersion2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐVersion(ctx context.Context, sel ast.SelectionSet, v *model.Version) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - return ec._Version(ctx, sel, v) -} - -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) 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 - fc := &graphql.FieldContext{ - Index: &i, - Result: &v[i], - } - ctx := graphql.WithFieldContext(ctx, fc) - 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) - } - - } - wg.Wait() - - for _, e := range ret { - if e == graphql.Null { - return graphql.Null - } - } - - return ret -} - -func (ec *executionContext) unmarshalN__DirectiveLocation2string(ctx context.Context, v interface{}) (string, error) { - res, err := graphql.UnmarshalString(v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalN__DirectiveLocation2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { - res := graphql.MarshalString(v) - if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - } - return res -} - -func (ec *executionContext) unmarshalN__DirectiveLocation2ᚕstringᚄ(ctx context.Context, v interface{}) ([]string, error) { - var vSlice []interface{} - if v != nil { - vSlice = graphql.CoerceList(v) - } - var err error - res := make([]string, len(vSlice)) - for i := range vSlice { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) - res[i], err = ec.unmarshalN__DirectiveLocation2string(ctx, vSlice[i]) - if err != nil { - return nil, err - } - } - return res, nil -} - -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 - fc := &graphql.FieldContext{ - Index: &i, - Result: &v[i], - } - ctx := graphql.WithFieldContext(ctx, fc) - 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) - } - - } - wg.Wait() - - for _, e := range ret { - if e == graphql.Null { - return graphql.Null - } - } - - return ret -} - -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) -} - -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) -} - -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) -} - -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 - fc := &graphql.FieldContext{ - Index: &i, - Result: &v[i], - } - ctx := graphql.WithFieldContext(ctx, fc) - 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) - } - - } - wg.Wait() - - for _, e := range ret { - if e == graphql.Null { - return graphql.Null - } - } - - return ret -} - -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) -} - -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 - fc := &graphql.FieldContext{ - Index: &i, - Result: &v[i], - } - ctx := graphql.WithFieldContext(ctx, fc) - 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() - - for _, e := range ret { - if e == graphql.Null { - return graphql.Null - } - } - - return ret -} - -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 !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - return ec.___Type(ctx, sel, v) -} - -func (ec *executionContext) unmarshalN__TypeKind2string(ctx context.Context, v interface{}) (string, error) { - res, err := graphql.UnmarshalString(v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { - res := graphql.MarshalString(v) - if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - } - return res -} - -func (ec *executionContext) marshalOArtifact2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐArtifact(ctx context.Context, sel ast.SelectionSet, v *model.Artifact) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return ec._Artifact(ctx, sel, v) -} - -func (ec *executionContext) unmarshalOBoolean2bool(ctx context.Context, v interface{}) (bool, error) { - res, err := graphql.UnmarshalBoolean(v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalOBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { - res := graphql.MarshalBoolean(v) - return res -} - -func (ec *executionContext) unmarshalOBoolean2ᚖbool(ctx context.Context, v interface{}) (*bool, error) { - if v == nil { - return nil, nil - } - res, err := graphql.UnmarshalBoolean(v) - return &res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalOBoolean2ᚖbool(ctx context.Context, sel ast.SelectionSet, v *bool) graphql.Marshaler { - if v == nil { - return graphql.Null - } - res := graphql.MarshalBoolean(*v) - return res -} - -func (ec *executionContext) unmarshalOCursor2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋcoreᚑgoᚋmodelᚐCursor(ctx context.Context, v interface{}) (*model1.Cursor, error) { - if v == nil { - return nil, nil - } - var res = new(model1.Cursor) - err := res.UnmarshalGQL(v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalOCursor2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋcoreᚑgoᚋmodelᚐCursor(ctx context.Context, sel ast.SelectionSet, v *model1.Cursor) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return v -} - -func (ec *executionContext) unmarshalOEmailTriggerInput2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEmailTriggerInput(ctx context.Context, v interface{}) (*model.EmailTriggerInput, error) { - if v == nil { - return nil, nil - } - res, err := ec.unmarshalInputEmailTriggerInput(ctx, v) - return &res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalOJob2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐJob(ctx context.Context, sel ast.SelectionSet, v *model.Job) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return ec._Job(ctx, sel, v) -} - -func (ec *executionContext) marshalOJobGroup2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐJobGroup(ctx context.Context, sel ast.SelectionSet, v *model.JobGroup) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return ec._JobGroup(ctx, sel, v) -} - -func (ec *executionContext) marshalOLog2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐLog(ctx context.Context, sel ast.SelectionSet, v *model.Log) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return ec._Log(ctx, sel, v) -} - -func (ec *executionContext) marshalOSecret2ᚕgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐSecretᚄ(ctx context.Context, sel ast.SelectionSet, v []model.Secret) 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 - fc := &graphql.FieldContext{ - Index: &i, - Result: &v[i], - } - ctx := graphql.WithFieldContext(ctx, fc) - 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.marshalNSecret2gitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐSecret(ctx, sel, v[i]) - } - if isLen1 { - f(i) - } else { - go f(i) - } - - } - wg.Wait() - - for _, e := range ret { - if e == graphql.Null { - return graphql.Null - } - } - - return ret -} - -func (ec *executionContext) unmarshalOString2string(ctx context.Context, v interface{}) (string, error) { - res, err := graphql.UnmarshalString(v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalOString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { - res := graphql.MarshalString(v) - return res -} - -func (ec *executionContext) unmarshalOString2ᚕstringᚄ(ctx context.Context, v interface{}) ([]string, error) { - if v == nil { - return nil, nil - } - var vSlice []interface{} - if v != nil { - vSlice = graphql.CoerceList(v) - } - var err error - res := make([]string, len(vSlice)) - for i := range vSlice { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) - res[i], err = ec.unmarshalNString2string(ctx, vSlice[i]) - if err != nil { - return nil, err - } - } - return res, nil -} - -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]) - } - - for _, e := range ret { - if e == graphql.Null { - return graphql.Null - } - } - - return ret -} - -func (ec *executionContext) unmarshalOString2ᚖstring(ctx context.Context, v interface{}) (*string, error) { - if v == nil { - return nil, nil - } - res, err := graphql.UnmarshalString(v) - return &res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalOString2ᚖstring(ctx context.Context, sel ast.SelectionSet, v *string) graphql.Marshaler { - if v == nil { - return graphql.Null - } - res := graphql.MarshalString(*v) - return res -} - -func (ec *executionContext) unmarshalOTime2ᚖtimeᚐTime(ctx context.Context, v interface{}) (*time.Time, error) { - if v == nil { - return nil, nil - } - res, err := graphql.UnmarshalTime(v) - return &res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalOTime2ᚖtimeᚐTime(ctx context.Context, sel ast.SelectionSet, v *time.Time) graphql.Marshaler { - if v == nil { - return graphql.Null - } - res := graphql.MarshalTime(*v) - return res -} - -func (ec *executionContext) unmarshalOTriggerInput2ᚕᚖgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTriggerInputᚄ(ctx context.Context, v interface{}) ([]*model.TriggerInput, error) { - if v == nil { - return nil, nil - } - var vSlice []interface{} - if v != nil { - vSlice = graphql.CoerceList(v) - } - var err error - res := make([]*model.TriggerInput, len(vSlice)) - for i := range vSlice { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) - res[i], err = ec.unmarshalNTriggerInput2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTriggerInput(ctx, vSlice[i]) - if err != nil { - return nil, err - } - } - return res, nil -} - -func (ec *executionContext) marshalOUser2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐUser(ctx context.Context, sel ast.SelectionSet, v *model.User) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return ec._User(ctx, sel, v) -} - -func (ec *executionContext) unmarshalOWebhookTriggerInput2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋbuildsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐWebhookTriggerInput(ctx context.Context, v interface{}) (*model.WebhookTriggerInput, error) { - if v == nil { - return nil, nil - } - res, err := ec.unmarshalInputWebhookTriggerInput(ctx, v) - return &res, graphql.ErrorOnPath(ctx, err) -} - -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 - fc := &graphql.FieldContext{ - Index: &i, - Result: &v[i], - } - ctx := graphql.WithFieldContext(ctx, fc) - 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) - } - - } - wg.Wait() - - for _, e := range ret { - if e == graphql.Null { - return graphql.Null - } - } - - return ret -} - -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 - fc := &graphql.FieldContext{ - Index: &i, - Result: &v[i], - } - ctx := graphql.WithFieldContext(ctx, fc) - 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() - - for _, e := range ret { - if e == graphql.Null { - return graphql.Null - } - } - - return ret -} - -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 - fc := &graphql.FieldContext{ - Index: &i, - Result: &v[i], - } - ctx := graphql.WithFieldContext(ctx, fc) - 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) - } - - } - wg.Wait() - - for _, e := range ret { - if e == graphql.Null { - return graphql.Null - } - } - - return ret -} - -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) -} - -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 - fc := &graphql.FieldContext{ - Index: &i, - Result: &v[i], - } - ctx := graphql.WithFieldContext(ctx, fc) - 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() - - for _, e := range ret { - if e == graphql.Null { - return graphql.Null - } - } - - return ret -} - -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) -} - -// endregion ***************************** type.gotpl ***************************** diff --git a/api/loaders/jobgroupsbyidloader_gen.go b/api/loaders/jobgroupsbyidloader_gen.go deleted file mode 100644 index d68afdc..0000000 --- a/api/loaders/jobgroupsbyidloader_gen.go +++ /dev/null @@ -1,224 +0,0 @@ -// Code generated by github.com/vektah/dataloaden, DO NOT EDIT. - -package loaders - -import ( - "sync" - "time" - - "git.sr.ht/~sircmpwn/builds.sr.ht/api/graph/model" -) - -// JobGroupsByIDLoaderConfig captures the config to create a new JobGroupsByIDLoader -type JobGroupsByIDLoaderConfig struct { - // Fetch is a method that provides the data for the loader - Fetch func(keys []int) ([]*model.JobGroup, []error) - - // Wait is how long wait before sending a batch - Wait time.Duration - - // MaxBatch will limit the maximum number of keys to send in one batch, 0 = not limit - MaxBatch int -} - -// NewJobGroupsByIDLoader creates a new JobGroupsByIDLoader given a fetch, wait, and maxBatch -func NewJobGroupsByIDLoader(config JobGroupsByIDLoaderConfig) *JobGroupsByIDLoader { - return &JobGroupsByIDLoader{ - fetch: config.Fetch, - wait: config.Wait, - maxBatch: config.MaxBatch, - } -} - -// JobGroupsByIDLoader batches and caches requests -type JobGroupsByIDLoader struct { - // this method provides the data for the loader - fetch func(keys []int) ([]*model.JobGroup, []error) - - // how long to done before sending a batch - wait time.Duration - - // this will limit the maximum number of keys to send in one batch, 0 = no limit - maxBatch int - - // INTERNAL - - // lazily created cache - cache map[int]*model.JobGroup - - // the current batch. keys will continue to be collected until timeout is hit, - // then everything will be sent to the fetch method and out to the listeners - batch *jobGroupsByIDLoaderBatch - - // mutex to prevent races - mu sync.Mutex -} - -type jobGroupsByIDLoaderBatch struct { - keys []int - data []*model.JobGroup - error []error - closing bool - done chan struct{} -} - -// Load a JobGroup by key, batching and caching will be applied automatically -func (l *JobGroupsByIDLoader) Load(key int) (*model.JobGroup, error) { - return l.LoadThunk(key)() -} - -// LoadThunk returns a function that when called will block waiting for a JobGroup. -// This method should be used if you want one goroutine to make requests to many -// different data loaders without blocking until the thunk is called. -func (l *JobGroupsByIDLoader) LoadThunk(key int) func() (*model.JobGroup, error) { - l.mu.Lock() - if it, ok := l.cache[key]; ok { - l.mu.Unlock() - return func() (*model.JobGroup, error) { - return it, nil - } - } - if l.batch == nil { - l.batch = &jobGroupsByIDLoaderBatch{done: make(chan struct{})} - } - batch := l.batch - pos := batch.keyIndex(l, key) - l.mu.Unlock() - - return func() (*model.JobGroup, error) { - <-batch.done - - var data *model.JobGroup - if pos < len(batch.data) { - data = batch.data[pos] - } - - var err error - // its convenient to be able to return a single error for everything - if len(batch.error) == 1 { - err = batch.error[0] - } else if batch.error != nil { - err = batch.error[pos] - } - - if err == nil { - l.mu.Lock() - l.unsafeSet(key, data) - l.mu.Unlock() - } - - return data, err - } -} - -// LoadAll fetches many keys at once. It will be broken into appropriate sized -// sub batches depending on how the loader is configured -func (l *JobGroupsByIDLoader) LoadAll(keys []int) ([]*model.JobGroup, []error) { - results := make([]func() (*model.JobGroup, error), len(keys)) - - for i, key := range keys { - results[i] = l.LoadThunk(key) - } - - jobGroups := make([]*model.JobGroup, len(keys)) - errors := make([]error, len(keys)) - for i, thunk := range results { - jobGroups[i], errors[i] = thunk() - } - return jobGroups, errors -} - -// LoadAllThunk returns a function that when called will block waiting for a JobGroups. -// This method should be used if you want one goroutine to make requests to many -// different data loaders without blocking until the thunk is called. -func (l *JobGroupsByIDLoader) LoadAllThunk(keys []int) func() ([]*model.JobGroup, []error) { - results := make([]func() (*model.JobGroup, error), len(keys)) - for i, key := range keys { - results[i] = l.LoadThunk(key) - } - return func() ([]*model.JobGroup, []error) { - jobGroups := make([]*model.JobGroup, len(keys)) - errors := make([]error, len(keys)) - for i, thunk := range results { - jobGroups[i], errors[i] = thunk() - } - return jobGroups, errors - } -} - -// Prime the cache with the provided key and value. If the key already exists, no change is made -// and false is returned. -// (To forcefully prime the cache, clear the key first with loader.clear(key).prime(key, value).) -func (l *JobGroupsByIDLoader) Prime(key int, value *model.JobGroup) bool { - l.mu.Lock() - var found bool - if _, found = l.cache[key]; !found { - // make a copy when writing to the cache, its easy to pass a pointer in from a loop var - // and end up with the whole cache pointing to the same value. - cpy := *value - l.unsafeSet(key, &cpy) - } - l.mu.Unlock() - return !found -} - -// Clear the value at key from the cache, if it exists -func (l *JobGroupsByIDLoader) Clear(key int) { - l.mu.Lock() - delete(l.cache, key) - l.mu.Unlock() -} - -func (l *JobGroupsByIDLoader) unsafeSet(key int, value *model.JobGroup) { - if l.cache == nil { - l.cache = map[int]*model.JobGroup{} - } - l.cache[key] = value -} - -// keyIndex will return the location of the key in the batch, if its not found -// it will add the key to the batch -func (b *jobGroupsByIDLoaderBatch) keyIndex(l *JobGroupsByIDLoader, key int) int { - for i, existingKey := range b.keys { - if key == existingKey { - return i - } - } - - pos := len(b.keys) - b.keys = append(b.keys, key) - if pos == 0 { - go b.startTimer(l) - } - - if l.maxBatch != 0 && pos >= l.maxBatch-1 { - if !b.closing { - b.closing = true - l.batch = nil - go b.end(l) - } - } - - return pos -} - -func (b *jobGroupsByIDLoaderBatch) startTimer(l *JobGroupsByIDLoader) { - time.Sleep(l.wait) - l.mu.Lock() - - // we must have hit a batch limit and are already finalizing this batch - if b.closing { - l.mu.Unlock() - return - } - - l.batch = nil - l.mu.Unlock() - - b.end(l) -} - -func (b *jobGroupsByIDLoaderBatch) end(l *JobGroupsByIDLoader) { - b.data, b.error = l.fetch(b.keys) - close(b.done) -} diff --git a/api/loaders/jobsbyidloader_gen.go b/api/loaders/jobsbyidloader_gen.go deleted file mode 100644 index 45fc7b3..0000000 --- a/api/loaders/jobsbyidloader_gen.go +++ /dev/null @@ -1,224 +0,0 @@ -// Code generated by github.com/vektah/dataloaden, DO NOT EDIT. - -package loaders - -import ( - "sync" - "time" - - "git.sr.ht/~sircmpwn/builds.sr.ht/api/graph/model" -) - -// JobsByIDLoaderConfig captures the config to create a new JobsByIDLoader -type JobsByIDLoaderConfig struct { - // Fetch is a method that provides the data for the loader - Fetch func(keys []int) ([]*model.Job, []error) - - // Wait is how long wait before sending a batch - Wait time.Duration - - // MaxBatch will limit the maximum number of keys to send in one batch, 0 = not limit - MaxBatch int -} - -// NewJobsByIDLoader creates a new JobsByIDLoader given a fetch, wait, and maxBatch -func NewJobsByIDLoader(config JobsByIDLoaderConfig) *JobsByIDLoader { - return &JobsByIDLoader{ - fetch: config.Fetch, - wait: config.Wait, - maxBatch: config.MaxBatch, - } -} - -// JobsByIDLoader batches and caches requests -type JobsByIDLoader struct { - // this method provides the data for the loader - fetch func(keys []int) ([]*model.Job, []error) - - // how long to done before sending a batch - wait time.Duration - - // this will limit the maximum number of keys to send in one batch, 0 = no limit - maxBatch int - - // INTERNAL - - // lazily created cache - cache map[int]*model.Job - - // the current batch. keys will continue to be collected until timeout is hit, - // then everything will be sent to the fetch method and out to the listeners - batch *jobsByIDLoaderBatch - - // mutex to prevent races - mu sync.Mutex -} - -type jobsByIDLoaderBatch struct { - keys []int - data []*model.Job - error []error - closing bool - done chan struct{} -} - -// Load a Job by key, batching and caching will be applied automatically -func (l *JobsByIDLoader) Load(key int) (*model.Job, error) { - return l.LoadThunk(key)() -} - -// LoadThunk returns a function that when called will block waiting for a Job. -// This method should be used if you want one goroutine to make requests to many -// different data loaders without blocking until the thunk is called. -func (l *JobsByIDLoader) LoadThunk(key int) func() (*model.Job, error) { - l.mu.Lock() - if it, ok := l.cache[key]; ok { - l.mu.Unlock() - return func() (*model.Job, error) { - return it, nil - } - } - if l.batch == nil { - l.batch = &jobsByIDLoaderBatch{done: make(chan struct{})} - } - batch := l.batch - pos := batch.keyIndex(l, key) - l.mu.Unlock() - - return func() (*model.Job, error) { - <-batch.done - - var data *model.Job - if pos < len(batch.data) { - data = batch.data[pos] - } - - var err error - // its convenient to be able to return a single error for everything - if len(batch.error) == 1 { - err = batch.error[0] - } else if batch.error != nil { - err = batch.error[pos] - } - - if err == nil { - l.mu.Lock() - l.unsafeSet(key, data) - l.mu.Unlock() - } - - return data, err - } -} - -// LoadAll fetches many keys at once. It will be broken into appropriate sized -// sub batches depending on how the loader is configured -func (l *JobsByIDLoader) LoadAll(keys []int) ([]*model.Job, []error) { - results := make([]func() (*model.Job, error), len(keys)) - - for i, key := range keys { - results[i] = l.LoadThunk(key) - } - - jobs := make([]*model.Job, len(keys)) - errors := make([]error, len(keys)) - for i, thunk := range results { - jobs[i], errors[i] = thunk() - } - return jobs, errors -} - -// LoadAllThunk returns a function that when called will block waiting for a Jobs. -// This method should be used if you want one goroutine to make requests to many -// different data loaders without blocking until the thunk is called. -func (l *JobsByIDLoader) LoadAllThunk(keys []int) func() ([]*model.Job, []error) { - results := make([]func() (*model.Job, error), len(keys)) - for i, key := range keys { - results[i] = l.LoadThunk(key) - } - return func() ([]*model.Job, []error) { - jobs := make([]*model.Job, len(keys)) - errors := make([]error, len(keys)) - for i, thunk := range results { - jobs[i], errors[i] = thunk() - } - return jobs, errors - } -} - -// Prime the cache with the provided key and value. If the key already exists, no change is made -// and false is returned. -// (To forcefully prime the cache, clear the key first with loader.clear(key).prime(key, value).) -func (l *JobsByIDLoader) Prime(key int, value *model.Job) bool { - l.mu.Lock() - var found bool - if _, found = l.cache[key]; !found { - // make a copy when writing to the cache, its easy to pass a pointer in from a loop var - // and end up with the whole cache pointing to the same value. - cpy := *value - l.unsafeSet(key, &cpy) - } - l.mu.Unlock() - return !found -} - -// Clear the value at key from the cache, if it exists -func (l *JobsByIDLoader) Clear(key int) { - l.mu.Lock() - delete(l.cache, key) - l.mu.Unlock() -} - -func (l *JobsByIDLoader) unsafeSet(key int, value *model.Job) { - if l.cache == nil { - l.cache = map[int]*model.Job{} - } - l.cache[key] = value -} - -// keyIndex will return the location of the key in the batch, if its not found -// it will add the key to the batch -func (b *jobsByIDLoaderBatch) keyIndex(l *JobsByIDLoader, key int) int { - for i, existingKey := range b.keys { - if key == existingKey { - return i - } - } - - pos := len(b.keys) - b.keys = append(b.keys, key) - if pos == 0 { - go b.startTimer(l) - } - - if l.maxBatch != 0 && pos >= l.maxBatch-1 { - if !b.closing { - b.closing = true - l.batch = nil - go b.end(l) - } - } - - return pos -} - -func (b *jobsByIDLoaderBatch) startTimer(l *JobsByIDLoader) { - time.Sleep(l.wait) - l.mu.Lock() - - // we must have hit a batch limit and are already finalizing this batch - if b.closing { - l.mu.Unlock() - return - } - - l.batch = nil - l.mu.Unlock() - - b.end(l) -} - -func (b *jobsByIDLoaderBatch) end(l *JobsByIDLoader) { - b.data, b.error = l.fetch(b.keys) - close(b.done) -} diff --git a/api/loaders/usersbyidloader_gen.go b/api/loaders/usersbyidloader_gen.go deleted file mode 100644 index 7201be0..0000000 --- a/api/loaders/usersbyidloader_gen.go +++ /dev/null @@ -1,224 +0,0 @@ -// Code generated by github.com/vektah/dataloaden, DO NOT EDIT. - -package loaders - -import ( - "sync" - "time" - - "git.sr.ht/~sircmpwn/builds.sr.ht/api/graph/model" -) - -// UsersByIDLoaderConfig captures the config to create a new UsersByIDLoader -type UsersByIDLoaderConfig struct { - // Fetch is a method that provides the data for the loader - Fetch func(keys []int) ([]*model.User, []error) - - // Wait is how long wait before sending a batch - Wait time.Duration - - // MaxBatch will limit the maximum number of keys to send in one batch, 0 = not limit - MaxBatch int -} - -// NewUsersByIDLoader creates a new UsersByIDLoader given a fetch, wait, and maxBatch -func NewUsersByIDLoader(config UsersByIDLoaderConfig) *UsersByIDLoader { - return &UsersByIDLoader{ - fetch: config.Fetch, - wait: config.Wait, - maxBatch: config.MaxBatch, - } -} - -// UsersByIDLoader batches and caches requests -type UsersByIDLoader struct { - // this method provides the data for the loader - fetch func(keys []int) ([]*model.User, []error) - - // how long to done before sending a batch - wait time.Duration - - // this will limit the maximum number of keys to send in one batch, 0 = no limit - maxBatch int - - // INTERNAL - - // lazily created cache - cache map[int]*model.User - - // the current batch. keys will continue to be collected until timeout is hit, - // then everything will be sent to the fetch method and out to the listeners - batch *usersByIDLoaderBatch - - // mutex to prevent races - mu sync.Mutex -} - -type usersByIDLoaderBatch struct { - keys []int - data []*model.User - error []error - closing bool - done chan struct{} -} - -// Load a User by key, batching and caching will be applied automatically -func (l *UsersByIDLoader) Load(key int) (*model.User, error) { - return l.LoadThunk(key)() -} - -// LoadThunk returns a function that when called will block waiting for a User. -// This method should be used if you want one goroutine to make requests to many -// different data loaders without blocking until the thunk is called. -func (l *UsersByIDLoader) LoadThunk(key int) func() (*model.User, error) { - l.mu.Lock() - if it, ok := l.cache[key]; ok { - l.mu.Unlock() - return func() (*model.User, error) { - return it, nil - } - } - if l.batch == nil { - l.batch = &usersByIDLoaderBatch{done: make(chan struct{})} - } - batch := l.batch - pos := batch.keyIndex(l, key) - l.mu.Unlock() - - return func() (*model.User, error) { - <-batch.done - - var data *model.User - if pos < len(batch.data) { - data = batch.data[pos] - } - - var err error - // its convenient to be able to return a single error for everything - if len(batch.error) == 1 { - err = batch.error[0] - } else if batch.error != nil { - err = batch.error[pos] - } - - if err == nil { - l.mu.Lock() - l.unsafeSet(key, data) - l.mu.Unlock() - } - - return data, err - } -} - -// LoadAll fetches many keys at once. It will be broken into appropriate sized -// sub batches depending on how the loader is configured -func (l *UsersByIDLoader) LoadAll(keys []int) ([]*model.User, []error) { - results := make([]func() (*model.User, error), len(keys)) - - for i, key := range keys { - results[i] = l.LoadThunk(key) - } - - users := make([]*model.User, len(keys)) - errors := make([]error, len(keys)) - for i, thunk := range results { - users[i], errors[i] = thunk() - } - return users, errors -} - -// LoadAllThunk returns a function that when called will block waiting for a Users. -// This method should be used if you want one goroutine to make requests to many -// different data loaders without blocking until the thunk is called. -func (l *UsersByIDLoader) LoadAllThunk(keys []int) func() ([]*model.User, []error) { - results := make([]func() (*model.User, error), len(keys)) - for i, key := range keys { - results[i] = l.LoadThunk(key) - } - return func() ([]*model.User, []error) { - users := make([]*model.User, len(keys)) - errors := make([]error, len(keys)) - for i, thunk := range results { - users[i], errors[i] = thunk() - } - return users, errors - } -} - -// Prime the cache with the provided key and value. If the key already exists, no change is made -// and false is returned. -// (To forcefully prime the cache, clear the key first with loader.clear(key).prime(key, value).) -func (l *UsersByIDLoader) Prime(key int, value *model.User) bool { - l.mu.Lock() - var found bool - if _, found = l.cache[key]; !found { - // make a copy when writing to the cache, its easy to pass a pointer in from a loop var - // and end up with the whole cache pointing to the same value. - cpy := *value - l.unsafeSet(key, &cpy) - } - l.mu.Unlock() - return !found -} - -// Clear the value at key from the cache, if it exists -func (l *UsersByIDLoader) Clear(key int) { - l.mu.Lock() - delete(l.cache, key) - l.mu.Unlock() -} - -func (l *UsersByIDLoader) unsafeSet(key int, value *model.User) { - if l.cache == nil { - l.cache = map[int]*model.User{} - } - l.cache[key] = value -} - -// keyIndex will return the location of the key in the batch, if its not found -// it will add the key to the batch -func (b *usersByIDLoaderBatch) keyIndex(l *UsersByIDLoader, key int) int { - for i, existingKey := range b.keys { - if key == existingKey { - return i - } - } - - pos := len(b.keys) - b.keys = append(b.keys, key) - if pos == 0 { - go b.startTimer(l) - } - - if l.maxBatch != 0 && pos >= l.maxBatch-1 { - if !b.closing { - b.closing = true - l.batch = nil - go b.end(l) - } - } - - return pos -} - -func (b *usersByIDLoaderBatch) startTimer(l *UsersByIDLoader) { - time.Sleep(l.wait) - l.mu.Lock() - - // we must have hit a batch limit and are already finalizing this batch - if b.closing { - l.mu.Unlock() - return - } - - l.batch = nil - l.mu.Unlock() - - b.end(l) -} - -func (b *usersByIDLoaderBatch) end(l *UsersByIDLoader) { - b.data, b.error = l.fetch(b.keys) - close(b.done) -} diff --git a/api/loaders/usersbynameloader_gen.go b/api/loaders/usersbynameloader_gen.go deleted file mode 100644 index 58f9d9a..0000000 --- a/api/loaders/usersbynameloader_gen.go +++ /dev/null @@ -1,224 +0,0 @@ -// Code generated by github.com/vektah/dataloaden, DO NOT EDIT. - -package loaders - -import ( - "sync" - "time" - - "git.sr.ht/~sircmpwn/builds.sr.ht/api/graph/model" -) - -// UsersByNameLoaderConfig captures the config to create a new UsersByNameLoader -type UsersByNameLoaderConfig struct { - // Fetch is a method that provides the data for the loader - Fetch func(keys []string) ([]*model.User, []error) - - // Wait is how long wait before sending a batch - Wait time.Duration - - // MaxBatch will limit the maximum number of keys to send in one batch, 0 = not limit - MaxBatch int -} - -// NewUsersByNameLoader creates a new UsersByNameLoader given a fetch, wait, and maxBatch -func NewUsersByNameLoader(config UsersByNameLoaderConfig) *UsersByNameLoader { - return &UsersByNameLoader{ - fetch: config.Fetch, - wait: config.Wait, - maxBatch: config.MaxBatch, - } -} - -// UsersByNameLoader batches and caches requests -type UsersByNameLoader struct { - // this method provides the data for the loader - fetch func(keys []string) ([]*model.User, []error) - - // how long to done before sending a batch - wait time.Duration - - // this will limit the maximum number of keys to send in one batch, 0 = no limit - maxBatch int - - // INTERNAL - - // lazily created cache - cache map[string]*model.User - - // the current batch. keys will continue to be collected until timeout is hit, - // then everything will be sent to the fetch method and out to the listeners - batch *usersByNameLoaderBatch - - // mutex to prevent races - mu sync.Mutex -} - -type usersByNameLoaderBatch struct { - keys []string - data []*model.User - error []error - closing bool - done chan struct{} -} - -// Load a User by key, batching and caching will be applied automatically -func (l *UsersByNameLoader) Load(key string) (*model.User, error) { - return l.LoadThunk(key)() -} - -// LoadThunk returns a function that when called will block waiting for a User. -// This method should be used if you want one goroutine to make requests to many -// different data loaders without blocking until the thunk is called. -func (l *UsersByNameLoader) LoadThunk(key string) func() (*model.User, error) { - l.mu.Lock() - if it, ok := l.cache[key]; ok { - l.mu.Unlock() - return func() (*model.User, error) { - return it, nil - } - } - if l.batch == nil { - l.batch = &usersByNameLoaderBatch{done: make(chan struct{})} - } - batch := l.batch - pos := batch.keyIndex(l, key) - l.mu.Unlock() - - return func() (*model.User, error) { - <-batch.done - - var data *model.User - if pos < len(batch.data) { - data = batch.data[pos] - } - - var err error - // its convenient to be able to return a single error for everything - if len(batch.error) == 1 { - err = batch.error[0] - } else if batch.error != nil { - err = batch.error[pos] - } - - if err == nil { - l.mu.Lock() - l.unsafeSet(key, data) - l.mu.Unlock() - } - - return data, err - } -} - -// LoadAll fetches many keys at once. It will be broken into appropriate sized -// sub batches depending on how the loader is configured -func (l *UsersByNameLoader) LoadAll(keys []string) ([]*model.User, []error) { - results := make([]func() (*model.User, error), len(keys)) - - for i, key := range keys { - results[i] = l.LoadThunk(key) - } - - users := make([]*model.User, len(keys)) - errors := make([]error, len(keys)) - for i, thunk := range results { - users[i], errors[i] = thunk() - } - return users, errors -} - -// LoadAllThunk returns a function that when called will block waiting for a Users. -// This method should be used if you want one goroutine to make requests to many -// different data loaders without blocking until the thunk is called. -func (l *UsersByNameLoader) LoadAllThunk(keys []string) func() ([]*model.User, []error) { - results := make([]func() (*model.User, error), len(keys)) - for i, key := range keys { - results[i] = l.LoadThunk(key) - } - return func() ([]*model.User, []error) { - users := make([]*model.User, len(keys)) - errors := make([]error, len(keys)) - for i, thunk := range results { - users[i], errors[i] = thunk() - } - return users, errors - } -} - -// Prime the cache with the provided key and value. If the key already exists, no change is made -// and false is returned. -// (To forcefully prime the cache, clear the key first with loader.clear(key).prime(key, value).) -func (l *UsersByNameLoader) Prime(key string, value *model.User) bool { - l.mu.Lock() - var found bool - if _, found = l.cache[key]; !found { - // make a copy when writing to the cache, its easy to pass a pointer in from a loop var - // and end up with the whole cache pointing to the same value. - cpy := *value - l.unsafeSet(key, &cpy) - } - l.mu.Unlock() - return !found -} - -// Clear the value at key from the cache, if it exists -func (l *UsersByNameLoader) Clear(key string) { - l.mu.Lock() - delete(l.cache, key) - l.mu.Unlock() -} - -func (l *UsersByNameLoader) unsafeSet(key string, value *model.User) { - if l.cache == nil { - l.cache = map[string]*model.User{} - } - l.cache[key] = value -} - -// keyIndex will return the location of the key in the batch, if its not found -// it will add the key to the batch -func (b *usersByNameLoaderBatch) keyIndex(l *UsersByNameLoader, key string) int { - for i, existingKey := range b.keys { - if key == existingKey { - return i - } - } - - pos := len(b.keys) - b.keys = append(b.keys, key) - if pos == 0 { - go b.startTimer(l) - } - - if l.maxBatch != 0 && pos >= l.maxBatch-1 { - if !b.closing { - b.closing = true - l.batch = nil - go b.end(l) - } - } - - return pos -} - -func (b *usersByNameLoaderBatch) startTimer(l *UsersByNameLoader) { - time.Sleep(l.wait) - l.mu.Lock() - - // we must have hit a batch limit and are already finalizing this batch - if b.closing { - l.mu.Unlock() - return - } - - l.batch = nil - l.mu.Unlock() - - b.end(l) -} - -func (b *usersByNameLoaderBatch) end(l *UsersByNameLoader) { - b.data, b.error = l.fetch(b.keys) - close(b.done) -} -- 2.38.5