From a00fbfc7a0558e55256ce6246d1c8abdfb019615 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 24 Mar 2022 14:09:55 +0100 Subject: [PATCH] api: overhaul build --- .gitignore | 3 + Makefile | 11 +- api/go.mod | 9 +- api/go.sum | 49 +- api/graph/api/generated.go | 15651 ---------------- api/loaders/commentsbyidloader_gen.go | 224 - .../entitiesbyparticipantidloader_gen.go | 221 - api/loaders/generate.go | 23 + api/loaders/labelsbyidloader_gen.go | 224 - api/loaders/middleware.go | 15 - api/loaders/participantsbyuseridloader_gen.go | 224 - .../participantsbyusernameloader_gen.go | 224 - api/loaders/subsbyticketidloader_gen.go | 224 - api/loaders/subsbytrackeridloader_gen.go | 224 - api/loaders/ticketsbyidloader_gen.go | 224 - api/loaders/ticketsbytrackeridloader_gen.go | 224 - api/loaders/trackersbyidloader_gen.go | 224 - api/loaders/trackersbynameloader_gen.go | 224 - api/loaders/trackersbyownernameloader_gen.go | 224 - api/loaders/usersbyidloader_gen.go | 224 - api/loaders/usersbynameloader_gen.go | 224 - 21 files changed, 79 insertions(+), 18815 deletions(-) delete mode 100644 api/graph/api/generated.go delete mode 100644 api/loaders/commentsbyidloader_gen.go delete mode 100644 api/loaders/entitiesbyparticipantidloader_gen.go create mode 100644 api/loaders/generate.go delete mode 100644 api/loaders/labelsbyidloader_gen.go delete mode 100644 api/loaders/participantsbyuseridloader_gen.go delete mode 100644 api/loaders/participantsbyusernameloader_gen.go delete mode 100644 api/loaders/subsbyticketidloader_gen.go delete mode 100644 api/loaders/subsbytrackeridloader_gen.go delete mode 100644 api/loaders/ticketsbyidloader_gen.go delete mode 100644 api/loaders/ticketsbytrackeridloader_gen.go delete mode 100644 api/loaders/trackersbyidloader_gen.go delete mode 100644 api/loaders/trackersbynameloader_gen.go delete mode 100644 api/loaders/trackersbyownernameloader_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 2cb12a5..81d115b 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,6 @@ pip-selfcheck.json overrides/ .pgp build +api/api +api/graph/api/generated.go +api/loaders/*_gen.go diff --git a/Makefile b/Makefile index a45fbd0..b252955 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,12 @@ -SRHT_PATH?=/usr/lib/python3.8/site-packages/srht +SRHT_PATH?=/usr/lib/python3.9/site-packages/srht MODULE=todosrht/ include ${SRHT_PATH}/Makefile + +all: api + +api: + cd api && go generate ./loaders + cd api && go generate ./graph + cd api && go build + +.PHONY: all api diff --git a/api/go.mod b/api/go.mod index 08e52d6..d371be0 100644 --- a/api/go.mod +++ b/api/go.mod @@ -4,15 +4,20 @@ go 1.15 require ( git.sr.ht/~sircmpwn/core-go v0.0.0-20220314110514-33bc768cc765 - github.com/99designs/gqlgen v0.14.0 + github.com/99designs/gqlgen v0.17.2 github.com/Masterminds/squirrel v1.4.0 + github.com/agnivade/levenshtein v1.1.1 // indirect github.com/emersion/go-message v0.15.0 github.com/hashicorp/golang-lru v0.5.4 // indirect github.com/kr/text v0.2.0 // indirect github.com/lib/pq v1.8.0 + github.com/matryer/moq v0.2.6 // indirect github.com/mitchellh/mapstructure v1.3.2 // indirect github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect github.com/prometheus/common v0.30.0 // indirect - github.com/vektah/gqlparser/v2 v2.2.0 + github.com/urfave/cli/v2 v2.4.0 // indirect + github.com/vektah/dataloaden v0.2.1-0.20190515034641-a19b9a6e7c9e + github.com/vektah/gqlparser/v2 v2.4.1 + golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8 // indirect gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect ) diff --git a/api/go.sum b/api/go.sum index d898248..f6b9b56 100644 --- a/api/go.sum +++ b/api/go.sum @@ -31,8 +31,6 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -git.sr.ht/~sircmpwn/core-go v0.0.0-20211218082756-f762ad220360 h1:KZwWE8xwafnRCldGTHeeuYH3QKhlrgsCqukIgXHzUgs= -git.sr.ht/~sircmpwn/core-go v0.0.0-20211218082756-f762ad220360/go.mod h1:uUqzeO5OLl/nRZfPk0igIAweRZiVwUmu/OGYfjS9fWc= git.sr.ht/~sircmpwn/core-go v0.0.0-20220314110514-33bc768cc765 h1:QE7Jv8FFOct82B/voDbTQ5UWfrMOhuyj4LxQx2UU/28= git.sr.ht/~sircmpwn/core-go v0.0.0-20220314110514-33bc768cc765/go.mod h1:uUqzeO5OLl/nRZfPk0igIAweRZiVwUmu/OGYfjS9fWc= git.sr.ht/~sircmpwn/dowork v0.0.0-20210820133136-d3970e97def3 h1:9WCv5cK67s2SiY/R4DWT/OchEsFnfYDz3lbevKxZ4QI= @@ -41,8 +39,9 @@ git.sr.ht/~sircmpwn/getopt v0.0.0-20191230200459-23622cc906b3 h1:4wDp4BKF7NQqoh7 git.sr.ht/~sircmpwn/getopt v0.0.0-20191230200459-23622cc906b3/go.mod h1:wMEGFFFNuPos7vHmWXfszqImLppbc0wEhh6JBfJIUgw= git.sr.ht/~sircmpwn/go-bare v0.0.0-20210227202403-5dae5c48f917 h1:/pfEvB399XDXksu4vyjfNTytWn/nbbKiNhvjtpgc4pY= git.sr.ht/~sircmpwn/go-bare v0.0.0-20210227202403-5dae5c48f917/go.mod h1:BVJwbDfVjCjoFiKrhkei6NdGcZYpkDkdyCdg1ukytRA= -github.com/99designs/gqlgen v0.14.0 h1:Wg8aNYQUjMR/4v+W3xD+7SizOy6lSvVeQ06AobNQAXI= github.com/99designs/gqlgen v0.14.0/go.mod h1:S7z4boV+Nx4VvzMUpVrY/YuHjFX4n7rDyuTqvAkuoRE= +github.com/99designs/gqlgen v0.17.2 h1:yczvlwMsfcVu/JtejqfrLwXuSP0yZFhmcss3caEvHw8= +github.com/99designs/gqlgen v0.17.2/go.mod h1:K5fzLKwtph+FFgh9j7nFbRUdBKvTcGnsta51fsMTn3o= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60= @@ -52,8 +51,9 @@ github.com/Masterminds/squirrel v1.4.0/go.mod h1:yaPeOnPG5ZRwL9oKdTsO/prlkPbXWZl github.com/ProtonMail/go-crypto v0.0.0-20211112122917-428f8eabeeb3 h1:XcF0cTDJeiuZ5NU8w7WUDge0HRwwNRmxj/GGk6KSA6g= github.com/ProtonMail/go-crypto v0.0.0-20211112122917-428f8eabeeb3/go.mod h1:z4/9nQmJSSwwds7ejkxaJwO37dru3geImFUdJlaLzQo= github.com/agnivade/levenshtein v1.0.1/go.mod h1:CURSv5d9Uaml+FovSIICkLbAUZ9S4RqaHDIsdSBg7lM= -github.com/agnivade/levenshtein v1.1.0 h1:n6qGwyHG61v3ABce1rPVZklEYRT8NFpCMrpZdBUbYGM= github.com/agnivade/levenshtein v1.1.0/go.mod h1:veldBMzWxcCG2ZvUTKD2kJNRdCk5hVbJomOvKkmgYbo= +github.com/agnivade/levenshtein v1.1.1 h1:QY8M92nrzkmr798gCo3kmMyqXFzdQVpxLlGPRBij0P8= +github.com/agnivade/levenshtein v1.1.1/go.mod h1:veldBMzWxcCG2ZvUTKD2kJNRdCk5hVbJomOvKkmgYbo= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= @@ -76,8 +76,9 @@ github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5P github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cpuguy83/go-md2man/v2 v2.0.1 h1:r/myEWzV9lfsM1tFLgDyu0atFtJ1fXn261LKYj/3DxU= +github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -198,6 +199,7 @@ github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7V github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/kavu/go_reuseport v1.5.0 h1:UNuiY2OblcqAtVDE8Gsg1kZz8zbBWg907sP1ceBV+bk= github.com/kavu/go_reuseport v1.5.0/go.mod h1:CG8Ee7ceMFSMnx/xr25Vm0qXaj2Z4i5PWoUx+JZ5/CU= +github.com/kevinmbeaulieu/eq-go v1.0.0/go.mod h1:G3S8ajA56gKBZm4UB9AOyoOS37JO3roToPzKNM8dtdM= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= @@ -215,8 +217,11 @@ github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0/go.mod h1:vmVJ0l/dxyfGW6Fm github.com/lib/pq v1.8.0 h1:9xohqzkUwzR4Ga4ivdTcawVS89YSDVxXMa3xJX3cGzg= github.com/lib/pq v1.8.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/logrusorgru/aurora v0.0.0-20200102142835-e9ef32dff381/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= -github.com/matryer/moq v0.0.0-20200106131100-75d0ddfc0007 h1:reVOUXwnhsYv/8UqjvhrMOu5CNT9UapHFLbQ2JcXsmg= +github.com/logrusorgru/aurora/v3 v3.0.0/go.mod h1:vsR12bk5grlLvLXAYrBsb5Oc/N+LxAlxggSjiwMnCUc= github.com/matryer/moq v0.0.0-20200106131100-75d0ddfc0007/go.mod h1:9ELz6aaclSIGnZBoaSLZ3NAl1VTufbOrXBPvtcy6WiQ= +github.com/matryer/moq v0.2.3/go.mod h1:9RtPYjTnH1bSBIkpvtHkFN7nbWAnO7oRpdJkEIn6UtE= +github.com/matryer/moq v0.2.6 h1:X4+LF09udTsi2P+Z+1UhSb4p3K8IyiF7KSNFDR9M3M0= +github.com/matryer/moq v0.2.6/go.mod h1:kITsx543GOENm48TUAQyJ9+SAvFSr7iGQXPoth/VUBk= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= @@ -224,6 +229,7 @@ github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0j github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mitchellh/mapstructure v0.0.0-20180203102830-a4e142e9c047/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.2.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.3.2 h1:mRS76wmkOn3KkKAyXDu42V+6ebnXWIztFSYGN7GeoRg= github.com/mitchellh/mapstructure v1.3.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -276,13 +282,13 @@ github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0 github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rs/cors v1.6.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= -github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/shurcooL/httpfs v0.0.0-20171119174359-809beceb2371/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg= -github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/shurcooL/vfsgen v0.0.0-20180121065927-ffb13db8def0/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= @@ -297,20 +303,25 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/urfave/cli/v2 v2.1.1 h1:Qt8FeAtxE/vfdrLmR3rxR6JRE0RoVmbXu8+6kZtYU4k= github.com/urfave/cli/v2 v2.1.1/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ= +github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= +github.com/urfave/cli/v2 v2.4.0 h1:m2pxjjDFgDxSPtO8WSdbndj17Wu2y8vOT86wE/tjr+I= +github.com/urfave/cli/v2 v2.4.0/go.mod h1:NX9W0zmTvedE5oDoOMs2RTC8RvdK98NTYZE5LbaEYPg= github.com/vaughan0/go-ini v0.0.0-20130923145212-a98ad7ee00ec h1:DGmKwyZwEB8dI7tbLt/I/gQuP559o/0FrAkHKlQM/Ks= github.com/vaughan0/go-ini v0.0.0-20130923145212-a98ad7ee00ec/go.mod h1:owBmyHYMLkxyrugmfwE/DLJyW8Ro9mkphwuVErQ0iUw= github.com/vektah/dataloaden v0.2.1-0.20190515034641-a19b9a6e7c9e h1:+w0Zm/9gaWpEAyDlU1eKOuk5twTjAjuevXqcJJw8hrg= github.com/vektah/dataloaden v0.2.1-0.20190515034641-a19b9a6e7c9e/go.mod h1:/HUdMve7rvxZma+2ZELQeNh88+003LL7Pf/CZ089j8U= github.com/vektah/gqlparser v1.3.1 h1:8b0IcD3qZKWJQHSzynbDlrtP3IxVydZ2DZepCGofqfU= github.com/vektah/gqlparser v1.3.1/go.mod h1:bkVf0FX+Stjg/MHnm8mEyubuaArhNEqfQhF+OTiAL74= -github.com/vektah/gqlparser/v2 v2.2.0 h1:bAc3slekAAJW6sZTi07aGq0OrfaCjj4jxARAaC7g2EM= github.com/vektah/gqlparser/v2 v2.2.0/go.mod h1:i3mQIGIrbK2PD1RrCeMTlVbkF2FJ6WkU1KJlJlC+3F4= +github.com/vektah/gqlparser/v2 v2.4.0/go.mod h1:flJWIR04IMQPGz+BXLrORkrARBxv/rtyIAFvd/MceW0= +github.com/vektah/gqlparser/v2 v2.4.1 h1:QOyEn8DAPMUMARGMeshKDkDgNmVoEaEGiDB0uWxcSlQ= +github.com/vektah/gqlparser/v2 v2.4.1/go.mod h1:flJWIR04IMQPGz+BXLrORkrARBxv/rtyIAFvd/MceW0= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= @@ -323,6 +334,7 @@ golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211202192323-5770296d904e h1:MUP6MR3rJ7Gk9LEia0LP2ytiH6MuCfs7qYz+47jGdD8= golang.org/x/crypto v0.0.0-20211202192323-5770296d904e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -354,8 +366,10 @@ golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= +golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 h1:kQgndtyPBW/JIYERgdxfwMYh3AVStj88WQTlNDi2a+o= +golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -390,6 +404,7 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 h1:CIJ76btIcR3eFI5EgSo6k1qKw9KJexJuRLI9G7Hp5wE= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -408,6 +423,7 @@ golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -452,8 +468,10 @@ golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210820121016-41cdb8703e55 h1:rw6UNGRMfarCepjI8qOepea/SXwIBVfTKjztZ5gBbq4= golang.org/x/sys v0.0.0-20210820121016-41cdb8703e55/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8 h1:OH54vjqzRWmbJ62fjuhxy7AxFFgoHN0/DPc/UrL8cAs= +golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -508,10 +526,13 @@ golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roY golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200815165600-90abf76919f3/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210106214847-113979e3529a h1:CB3a9Nez8M13wwlr/E2YtwoU+qYHKfC+JrDa45RXXoQ= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.9/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= +golang.org/x/tools v0.1.10 h1:QjFRCZxdOhBJ/UNgnBZLbNV13DlbnK0quyivTnXJM20= +golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -606,8 +627,10 @@ gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkep gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= diff --git a/api/graph/api/generated.go b/api/graph/api/generated.go deleted file mode 100644 index 4ca0348..0000000 --- a/api/graph/api/generated.go +++ /dev/null @@ -1,15651 +0,0 @@ -// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. - -package api - -import ( - "bytes" - "context" - "errors" - "fmt" - "strconv" - "sync" - "sync/atomic" - "time" - - model1 "git.sr.ht/~sircmpwn/core-go/model" - "git.sr.ht/~sircmpwn/todo.sr.ht/api/graph/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 { - Assignment() AssignmentResolver - Comment() CommentResolver - Created() CreatedResolver - Event() EventResolver - Label() LabelResolver - LabelUpdate() LabelUpdateResolver - Mutation() MutationResolver - Query() QueryResolver - StatusChange() StatusChangeResolver - Ticket() TicketResolver - TicketMention() TicketMentionResolver - TicketSubscription() TicketSubscriptionResolver - Tracker() TrackerResolver - TrackerACL() TrackerACLResolver - TrackerSubscription() TrackerSubscriptionResolver - User() UserResolver - UserMention() UserMentionResolver -} - -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) -} - -type ComplexityRoot struct { - ACLCursor struct { - Cursor func(childComplexity int) int - Results func(childComplexity int) int - } - - ActivitySubscriptionCursor struct { - Cursor func(childComplexity int) int - Results func(childComplexity int) int - } - - Assignment struct { - Assignee func(childComplexity int) int - Assigner func(childComplexity int) int - EventType func(childComplexity int) int - Ticket func(childComplexity int) int - } - - Comment struct { - Authenticity func(childComplexity int) int - Author func(childComplexity int) int - EventType func(childComplexity int) int - SupersededBy func(childComplexity int) int - Text func(childComplexity int) int - Ticket func(childComplexity int) int - } - - Created struct { - Author func(childComplexity int) int - EventType func(childComplexity int) int - Ticket func(childComplexity int) int - } - - DefaultACL struct { - Browse func(childComplexity int) int - Comment func(childComplexity int) int - Edit func(childComplexity int) int - Submit func(childComplexity int) int - Triage func(childComplexity int) int - } - - EmailAddress struct { - CanonicalName func(childComplexity int) int - Mailbox func(childComplexity int) int - Name func(childComplexity int) int - } - - Event struct { - Changes func(childComplexity int) int - Created func(childComplexity int) int - ID func(childComplexity int) int - Ticket func(childComplexity int) int - } - - EventCursor struct { - Cursor func(childComplexity int) int - Results func(childComplexity int) int - } - - ExternalUser struct { - CanonicalName func(childComplexity int) int - ExternalID func(childComplexity int) int - ExternalURL func(childComplexity int) int - } - - Label struct { - BackgroundColor func(childComplexity int) int - Created func(childComplexity int) int - ForegroundColor func(childComplexity int) int - ID func(childComplexity int) int - Name func(childComplexity int) int - Tickets func(childComplexity int, cursor *model1.Cursor) int - Tracker func(childComplexity int) int - } - - LabelCursor struct { - Cursor func(childComplexity int) int - Results func(childComplexity int) int - } - - LabelUpdate struct { - EventType func(childComplexity int) int - Label func(childComplexity int) int - Labeler func(childComplexity int) int - Ticket func(childComplexity int) int - } - - Mutation struct { - AssignUser func(childComplexity int, trackerID int, ticketID int, userID int) int - CreateLabel func(childComplexity int, trackerID int, name string, foreground string, background string) int - CreateTracker func(childComplexity int, name string, description *string, visibility model.Visibility, importArg *graphql.Upload) int - DeleteACL func(childComplexity int, id int) int - DeleteLabel func(childComplexity int, id int) int - DeleteTracker func(childComplexity int, id int) int - LabelTicket func(childComplexity int, trackerID int, ticketID int, labelID int) int - SubmitComment func(childComplexity int, trackerID int, ticketID int, input model.SubmitCommentInput) int - SubmitTicket func(childComplexity int, trackerID int, input model.SubmitTicketInput) int - TicketSubscribe func(childComplexity int, trackerID int, ticketID int) int - TicketUnsubscribe func(childComplexity int, trackerID int, ticketID int) int - TrackerSubscribe func(childComplexity int, trackerID int) int - TrackerUnsubscribe func(childComplexity int, trackerID int, tickets bool) int - UnassignUser func(childComplexity int, trackerID int, ticketID int, userID int) int - UnlabelTicket func(childComplexity int, trackerID int, ticketID int, labelID int) int - UpdateLabel func(childComplexity int, id int, input map[string]interface{}) int - UpdateTicket func(childComplexity int, trackerID int, ticketID int, input map[string]interface{}) int - UpdateTicketStatus func(childComplexity int, trackerID int, ticketID int, input model.UpdateStatusInput) int - UpdateTracker func(childComplexity int, id int, input map[string]interface{}) int - UpdateTrackerACL func(childComplexity int, trackerID int, input model.ACLInput) int - UpdateUserACL func(childComplexity int, trackerID int, userID int, input model.ACLInput) int - } - - Query struct { - Events func(childComplexity int, cursor *model1.Cursor) int - Me func(childComplexity int) int - Subscriptions func(childComplexity int, cursor *model1.Cursor) int - Tracker func(childComplexity int, id int) int - TrackerByName func(childComplexity int, name string) int - TrackerByOwner func(childComplexity int, owner string, tracker string) int - Trackers func(childComplexity int, cursor *model1.Cursor) int - User func(childComplexity int, username string) int - Version func(childComplexity int) int - } - - StatusChange struct { - Editor func(childComplexity int) int - EventType func(childComplexity int) int - NewResolution func(childComplexity int) int - NewStatus func(childComplexity int) int - OldResolution func(childComplexity int) int - OldStatus func(childComplexity int) int - Ticket func(childComplexity int) int - } - - Ticket struct { - Assignees func(childComplexity int) int - Authenticity func(childComplexity int) int - Body func(childComplexity int) int - Created func(childComplexity int) int - Events func(childComplexity int, cursor *model1.Cursor) int - ID func(childComplexity int) int - Labels func(childComplexity int) int - Ref func(childComplexity int) int - Resolution func(childComplexity int) int - Status func(childComplexity int) int - Subject func(childComplexity int) int - Submitter func(childComplexity int) int - Subscription func(childComplexity int) int - Tracker func(childComplexity int) int - Updated func(childComplexity int) int - } - - TicketCursor struct { - Cursor func(childComplexity int) int - Results func(childComplexity int) int - } - - TicketMention struct { - Author func(childComplexity int) int - EventType func(childComplexity int) int - Mentioned func(childComplexity int) int - Ticket func(childComplexity int) int - } - - TicketSubscription struct { - Created func(childComplexity int) int - ID func(childComplexity int) int - Ticket func(childComplexity int) int - } - - Tracker struct { - ACL func(childComplexity int) int - Acls func(childComplexity int, cursor *model1.Cursor) int - Created func(childComplexity int) int - DefaultACL func(childComplexity int) int - Description func(childComplexity int) int - Export func(childComplexity int) int - ID func(childComplexity int) int - Labels func(childComplexity int, cursor *model1.Cursor) int - Name func(childComplexity int) int - Owner func(childComplexity int) int - Subscription func(childComplexity int) int - Ticket func(childComplexity int, id int) int - Tickets func(childComplexity int, cursor *model1.Cursor) int - Updated func(childComplexity int) int - Visibility func(childComplexity int) int - } - - TrackerACL struct { - Browse func(childComplexity int) int - Comment func(childComplexity int) int - Created func(childComplexity int) int - Edit func(childComplexity int) int - Entity func(childComplexity int) int - ID func(childComplexity int) int - Submit func(childComplexity int) int - Tracker func(childComplexity int) int - Triage func(childComplexity int) int - } - - TrackerCursor struct { - Cursor func(childComplexity int) int - Results func(childComplexity int) int - } - - TrackerSubscription struct { - Created func(childComplexity int) int - ID func(childComplexity int) int - Tracker 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 - Location func(childComplexity int) int - Trackers func(childComplexity int, cursor *model1.Cursor) int - URL func(childComplexity int) int - Updated func(childComplexity int) int - Username func(childComplexity int) int - } - - UserMention struct { - Author func(childComplexity int) int - EventType func(childComplexity int) int - Mentioned func(childComplexity int) int - Ticket 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 - } -} - -type AssignmentResolver interface { - Ticket(ctx context.Context, obj *model.Assignment) (*model.Ticket, error) - Assigner(ctx context.Context, obj *model.Assignment) (model.Entity, error) - Assignee(ctx context.Context, obj *model.Assignment) (model.Entity, error) -} -type CommentResolver interface { - Ticket(ctx context.Context, obj *model.Comment) (*model.Ticket, error) - Author(ctx context.Context, obj *model.Comment) (model.Entity, error) - Text(ctx context.Context, obj *model.Comment) (string, error) - Authenticity(ctx context.Context, obj *model.Comment) (model.Authenticity, error) - SupersededBy(ctx context.Context, obj *model.Comment) (*model.Comment, error) -} -type CreatedResolver interface { - Ticket(ctx context.Context, obj *model.Created) (*model.Ticket, error) - Author(ctx context.Context, obj *model.Created) (model.Entity, error) -} -type EventResolver interface { - Ticket(ctx context.Context, obj *model.Event) (*model.Ticket, error) -} -type LabelResolver interface { - Tracker(ctx context.Context, obj *model.Label) (*model.Tracker, error) - - Tickets(ctx context.Context, obj *model.Label, cursor *model1.Cursor) (*model.TicketCursor, error) -} -type LabelUpdateResolver interface { - Ticket(ctx context.Context, obj *model.LabelUpdate) (*model.Ticket, error) - Labeler(ctx context.Context, obj *model.LabelUpdate) (model.Entity, error) - Label(ctx context.Context, obj *model.LabelUpdate) (*model.Label, error) -} -type MutationResolver interface { - CreateTracker(ctx context.Context, name string, description *string, visibility model.Visibility, importArg *graphql.Upload) (*model.Tracker, error) - UpdateTracker(ctx context.Context, id int, input map[string]interface{}) (*model.Tracker, error) - DeleteTracker(ctx context.Context, id int) (*model.Tracker, error) - UpdateUserACL(ctx context.Context, trackerID int, userID int, input model.ACLInput) (*model.TrackerACL, error) - UpdateTrackerACL(ctx context.Context, trackerID int, input model.ACLInput) (*model.DefaultACL, error) - DeleteACL(ctx context.Context, id int) (*model.TrackerACL, error) - TrackerSubscribe(ctx context.Context, trackerID int) (*model.TrackerSubscription, error) - TrackerUnsubscribe(ctx context.Context, trackerID int, tickets bool) (*model.TrackerSubscription, error) - TicketSubscribe(ctx context.Context, trackerID int, ticketID int) (*model.TicketSubscription, error) - TicketUnsubscribe(ctx context.Context, trackerID int, ticketID int) (*model.TicketSubscription, error) - CreateLabel(ctx context.Context, trackerID int, name string, foreground string, background string) (*model.Label, error) - UpdateLabel(ctx context.Context, id int, input map[string]interface{}) (*model.Label, error) - DeleteLabel(ctx context.Context, id int) (*model.Label, error) - SubmitTicket(ctx context.Context, trackerID int, input model.SubmitTicketInput) (*model.Ticket, error) - UpdateTicket(ctx context.Context, trackerID int, ticketID int, input map[string]interface{}) (*model.Ticket, error) - UpdateTicketStatus(ctx context.Context, trackerID int, ticketID int, input model.UpdateStatusInput) (*model.Event, error) - SubmitComment(ctx context.Context, trackerID int, ticketID int, input model.SubmitCommentInput) (*model.Event, error) - AssignUser(ctx context.Context, trackerID int, ticketID int, userID int) (*model.Event, error) - UnassignUser(ctx context.Context, trackerID int, ticketID int, userID int) (*model.Event, error) - LabelTicket(ctx context.Context, trackerID int, ticketID int, labelID int) (*model.Event, error) - UnlabelTicket(ctx context.Context, trackerID int, ticketID int, labelID int) (*model.Event, error) -} -type QueryResolver interface { - Version(ctx context.Context) (*model.Version, error) - Me(ctx context.Context) (*model.User, error) - User(ctx context.Context, username string) (*model.User, error) - Trackers(ctx context.Context, cursor *model1.Cursor) (*model.TrackerCursor, error) - Tracker(ctx context.Context, id int) (*model.Tracker, error) - TrackerByName(ctx context.Context, name string) (*model.Tracker, error) - TrackerByOwner(ctx context.Context, owner string, tracker string) (*model.Tracker, error) - Events(ctx context.Context, cursor *model1.Cursor) (*model.EventCursor, error) - Subscriptions(ctx context.Context, cursor *model1.Cursor) (*model.ActivitySubscriptionCursor, error) -} -type StatusChangeResolver interface { - Ticket(ctx context.Context, obj *model.StatusChange) (*model.Ticket, error) - Editor(ctx context.Context, obj *model.StatusChange) (model.Entity, error) -} -type TicketResolver interface { - Submitter(ctx context.Context, obj *model.Ticket) (model.Entity, error) - Tracker(ctx context.Context, obj *model.Ticket) (*model.Tracker, error) - - Labels(ctx context.Context, obj *model.Ticket) ([]*model.Label, error) - Assignees(ctx context.Context, obj *model.Ticket) ([]model.Entity, error) - Events(ctx context.Context, obj *model.Ticket, cursor *model1.Cursor) (*model.EventCursor, error) - Subscription(ctx context.Context, obj *model.Ticket) (*model.TicketSubscription, error) -} -type TicketMentionResolver interface { - Ticket(ctx context.Context, obj *model.TicketMention) (*model.Ticket, error) - Author(ctx context.Context, obj *model.TicketMention) (model.Entity, error) - Mentioned(ctx context.Context, obj *model.TicketMention) (*model.Ticket, error) -} -type TicketSubscriptionResolver interface { - Ticket(ctx context.Context, obj *model.TicketSubscription) (*model.Ticket, error) -} -type TrackerResolver interface { - Owner(ctx context.Context, obj *model.Tracker) (model.Entity, error) - - Ticket(ctx context.Context, obj *model.Tracker, id int) (*model.Ticket, error) - Tickets(ctx context.Context, obj *model.Tracker, cursor *model1.Cursor) (*model.TicketCursor, error) - Labels(ctx context.Context, obj *model.Tracker, cursor *model1.Cursor) (*model.LabelCursor, error) - Subscription(ctx context.Context, obj *model.Tracker) (*model.TrackerSubscription, error) - ACL(ctx context.Context, obj *model.Tracker) (model.ACL, error) - DefaultACL(ctx context.Context, obj *model.Tracker) (*model.DefaultACL, error) - Acls(ctx context.Context, obj *model.Tracker, cursor *model1.Cursor) (*model.ACLCursor, error) - Export(ctx context.Context, obj *model.Tracker) (string, error) -} -type TrackerACLResolver interface { - Tracker(ctx context.Context, obj *model.TrackerACL) (*model.Tracker, error) - Entity(ctx context.Context, obj *model.TrackerACL) (model.Entity, error) -} -type TrackerSubscriptionResolver interface { - Tracker(ctx context.Context, obj *model.TrackerSubscription) (*model.Tracker, error) -} -type UserResolver interface { - Trackers(ctx context.Context, obj *model.User, cursor *model1.Cursor) (*model.TrackerCursor, error) -} -type UserMentionResolver interface { - Ticket(ctx context.Context, obj *model.UserMention) (*model.Ticket, error) - Author(ctx context.Context, obj *model.UserMention) (model.Entity, error) - Mentioned(ctx context.Context, obj *model.UserMention) (model.Entity, 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 "ACLCursor.cursor": - if e.complexity.ACLCursor.Cursor == nil { - break - } - - return e.complexity.ACLCursor.Cursor(childComplexity), true - - case "ACLCursor.results": - if e.complexity.ACLCursor.Results == nil { - break - } - - return e.complexity.ACLCursor.Results(childComplexity), true - - case "ActivitySubscriptionCursor.cursor": - if e.complexity.ActivitySubscriptionCursor.Cursor == nil { - break - } - - return e.complexity.ActivitySubscriptionCursor.Cursor(childComplexity), true - - case "ActivitySubscriptionCursor.results": - if e.complexity.ActivitySubscriptionCursor.Results == nil { - break - } - - return e.complexity.ActivitySubscriptionCursor.Results(childComplexity), true - - case "Assignment.assignee": - if e.complexity.Assignment.Assignee == nil { - break - } - - return e.complexity.Assignment.Assignee(childComplexity), true - - case "Assignment.assigner": - if e.complexity.Assignment.Assigner == nil { - break - } - - return e.complexity.Assignment.Assigner(childComplexity), true - - case "Assignment.eventType": - if e.complexity.Assignment.EventType == nil { - break - } - - return e.complexity.Assignment.EventType(childComplexity), true - - case "Assignment.ticket": - if e.complexity.Assignment.Ticket == nil { - break - } - - return e.complexity.Assignment.Ticket(childComplexity), true - - case "Comment.authenticity": - if e.complexity.Comment.Authenticity == nil { - break - } - - return e.complexity.Comment.Authenticity(childComplexity), true - - case "Comment.author": - if e.complexity.Comment.Author == nil { - break - } - - return e.complexity.Comment.Author(childComplexity), true - - case "Comment.eventType": - if e.complexity.Comment.EventType == nil { - break - } - - return e.complexity.Comment.EventType(childComplexity), true - - case "Comment.supersededBy": - if e.complexity.Comment.SupersededBy == nil { - break - } - - return e.complexity.Comment.SupersededBy(childComplexity), true - - case "Comment.text": - if e.complexity.Comment.Text == nil { - break - } - - return e.complexity.Comment.Text(childComplexity), true - - case "Comment.ticket": - if e.complexity.Comment.Ticket == nil { - break - } - - return e.complexity.Comment.Ticket(childComplexity), true - - case "Created.author": - if e.complexity.Created.Author == nil { - break - } - - return e.complexity.Created.Author(childComplexity), true - - case "Created.eventType": - if e.complexity.Created.EventType == nil { - break - } - - return e.complexity.Created.EventType(childComplexity), true - - case "Created.ticket": - if e.complexity.Created.Ticket == nil { - break - } - - return e.complexity.Created.Ticket(childComplexity), true - - case "DefaultACL.browse": - if e.complexity.DefaultACL.Browse == nil { - break - } - - return e.complexity.DefaultACL.Browse(childComplexity), true - - case "DefaultACL.comment": - if e.complexity.DefaultACL.Comment == nil { - break - } - - return e.complexity.DefaultACL.Comment(childComplexity), true - - case "DefaultACL.edit": - if e.complexity.DefaultACL.Edit == nil { - break - } - - return e.complexity.DefaultACL.Edit(childComplexity), true - - case "DefaultACL.submit": - if e.complexity.DefaultACL.Submit == nil { - break - } - - return e.complexity.DefaultACL.Submit(childComplexity), true - - case "DefaultACL.triage": - if e.complexity.DefaultACL.Triage == nil { - break - } - - return e.complexity.DefaultACL.Triage(childComplexity), true - - case "EmailAddress.canonicalName": - if e.complexity.EmailAddress.CanonicalName == nil { - break - } - - return e.complexity.EmailAddress.CanonicalName(childComplexity), true - - case "EmailAddress.mailbox": - if e.complexity.EmailAddress.Mailbox == nil { - break - } - - return e.complexity.EmailAddress.Mailbox(childComplexity), true - - case "EmailAddress.name": - if e.complexity.EmailAddress.Name == nil { - break - } - - return e.complexity.EmailAddress.Name(childComplexity), true - - case "Event.changes": - if e.complexity.Event.Changes == nil { - break - } - - return e.complexity.Event.Changes(childComplexity), true - - case "Event.created": - if e.complexity.Event.Created == nil { - break - } - - return e.complexity.Event.Created(childComplexity), true - - case "Event.id": - if e.complexity.Event.ID == nil { - break - } - - return e.complexity.Event.ID(childComplexity), true - - case "Event.ticket": - if e.complexity.Event.Ticket == nil { - break - } - - return e.complexity.Event.Ticket(childComplexity), true - - case "EventCursor.cursor": - if e.complexity.EventCursor.Cursor == nil { - break - } - - return e.complexity.EventCursor.Cursor(childComplexity), true - - case "EventCursor.results": - if e.complexity.EventCursor.Results == nil { - break - } - - return e.complexity.EventCursor.Results(childComplexity), true - - case "ExternalUser.canonicalName": - if e.complexity.ExternalUser.CanonicalName == nil { - break - } - - return e.complexity.ExternalUser.CanonicalName(childComplexity), true - - case "ExternalUser.externalId": - if e.complexity.ExternalUser.ExternalID == nil { - break - } - - return e.complexity.ExternalUser.ExternalID(childComplexity), true - - case "ExternalUser.externalUrl": - if e.complexity.ExternalUser.ExternalURL == nil { - break - } - - return e.complexity.ExternalUser.ExternalURL(childComplexity), true - - case "Label.backgroundColor": - if e.complexity.Label.BackgroundColor == nil { - break - } - - return e.complexity.Label.BackgroundColor(childComplexity), true - - case "Label.created": - if e.complexity.Label.Created == nil { - break - } - - return e.complexity.Label.Created(childComplexity), true - - case "Label.foregroundColor": - if e.complexity.Label.ForegroundColor == nil { - break - } - - return e.complexity.Label.ForegroundColor(childComplexity), true - - case "Label.id": - if e.complexity.Label.ID == nil { - break - } - - return e.complexity.Label.ID(childComplexity), true - - case "Label.name": - if e.complexity.Label.Name == nil { - break - } - - return e.complexity.Label.Name(childComplexity), true - - case "Label.tickets": - if e.complexity.Label.Tickets == nil { - break - } - - args, err := ec.field_Label_tickets_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Label.Tickets(childComplexity, args["cursor"].(*model1.Cursor)), true - - case "Label.tracker": - if e.complexity.Label.Tracker == nil { - break - } - - return e.complexity.Label.Tracker(childComplexity), true - - case "LabelCursor.cursor": - if e.complexity.LabelCursor.Cursor == nil { - break - } - - return e.complexity.LabelCursor.Cursor(childComplexity), true - - case "LabelCursor.results": - if e.complexity.LabelCursor.Results == nil { - break - } - - return e.complexity.LabelCursor.Results(childComplexity), true - - case "LabelUpdate.eventType": - if e.complexity.LabelUpdate.EventType == nil { - break - } - - return e.complexity.LabelUpdate.EventType(childComplexity), true - - case "LabelUpdate.label": - if e.complexity.LabelUpdate.Label == nil { - break - } - - return e.complexity.LabelUpdate.Label(childComplexity), true - - case "LabelUpdate.labeler": - if e.complexity.LabelUpdate.Labeler == nil { - break - } - - return e.complexity.LabelUpdate.Labeler(childComplexity), true - - case "LabelUpdate.ticket": - if e.complexity.LabelUpdate.Ticket == nil { - break - } - - return e.complexity.LabelUpdate.Ticket(childComplexity), true - - case "Mutation.assignUser": - if e.complexity.Mutation.AssignUser == nil { - break - } - - args, err := ec.field_Mutation_assignUser_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Mutation.AssignUser(childComplexity, args["trackerId"].(int), args["ticketId"].(int), args["userId"].(int)), true - - case "Mutation.createLabel": - if e.complexity.Mutation.CreateLabel == nil { - break - } - - args, err := ec.field_Mutation_createLabel_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Mutation.CreateLabel(childComplexity, args["trackerId"].(int), args["name"].(string), args["foreground"].(string), args["background"].(string)), true - - case "Mutation.createTracker": - if e.complexity.Mutation.CreateTracker == nil { - break - } - - args, err := ec.field_Mutation_createTracker_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Mutation.CreateTracker(childComplexity, args["name"].(string), args["description"].(*string), args["visibility"].(model.Visibility), args["import"].(*graphql.Upload)), true - - case "Mutation.deleteACL": - if e.complexity.Mutation.DeleteACL == nil { - break - } - - args, err := ec.field_Mutation_deleteACL_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Mutation.DeleteACL(childComplexity, args["id"].(int)), true - - case "Mutation.deleteLabel": - if e.complexity.Mutation.DeleteLabel == nil { - break - } - - args, err := ec.field_Mutation_deleteLabel_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Mutation.DeleteLabel(childComplexity, args["id"].(int)), true - - case "Mutation.deleteTracker": - if e.complexity.Mutation.DeleteTracker == nil { - break - } - - args, err := ec.field_Mutation_deleteTracker_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Mutation.DeleteTracker(childComplexity, args["id"].(int)), true - - case "Mutation.labelTicket": - if e.complexity.Mutation.LabelTicket == nil { - break - } - - args, err := ec.field_Mutation_labelTicket_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Mutation.LabelTicket(childComplexity, args["trackerId"].(int), args["ticketId"].(int), args["labelId"].(int)), true - - case "Mutation.submitComment": - if e.complexity.Mutation.SubmitComment == nil { - break - } - - args, err := ec.field_Mutation_submitComment_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Mutation.SubmitComment(childComplexity, args["trackerId"].(int), args["ticketId"].(int), args["input"].(model.SubmitCommentInput)), true - - case "Mutation.submitTicket": - if e.complexity.Mutation.SubmitTicket == nil { - break - } - - args, err := ec.field_Mutation_submitTicket_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Mutation.SubmitTicket(childComplexity, args["trackerId"].(int), args["input"].(model.SubmitTicketInput)), true - - case "Mutation.ticketSubscribe": - if e.complexity.Mutation.TicketSubscribe == nil { - break - } - - args, err := ec.field_Mutation_ticketSubscribe_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Mutation.TicketSubscribe(childComplexity, args["trackerId"].(int), args["ticketId"].(int)), true - - case "Mutation.ticketUnsubscribe": - if e.complexity.Mutation.TicketUnsubscribe == nil { - break - } - - args, err := ec.field_Mutation_ticketUnsubscribe_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Mutation.TicketUnsubscribe(childComplexity, args["trackerId"].(int), args["ticketId"].(int)), true - - case "Mutation.trackerSubscribe": - if e.complexity.Mutation.TrackerSubscribe == nil { - break - } - - args, err := ec.field_Mutation_trackerSubscribe_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Mutation.TrackerSubscribe(childComplexity, args["trackerId"].(int)), true - - case "Mutation.trackerUnsubscribe": - if e.complexity.Mutation.TrackerUnsubscribe == nil { - break - } - - args, err := ec.field_Mutation_trackerUnsubscribe_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Mutation.TrackerUnsubscribe(childComplexity, args["trackerId"].(int), args["tickets"].(bool)), true - - case "Mutation.unassignUser": - if e.complexity.Mutation.UnassignUser == nil { - break - } - - args, err := ec.field_Mutation_unassignUser_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Mutation.UnassignUser(childComplexity, args["trackerId"].(int), args["ticketId"].(int), args["userId"].(int)), true - - case "Mutation.unlabelTicket": - if e.complexity.Mutation.UnlabelTicket == nil { - break - } - - args, err := ec.field_Mutation_unlabelTicket_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Mutation.UnlabelTicket(childComplexity, args["trackerId"].(int), args["ticketId"].(int), args["labelId"].(int)), true - - case "Mutation.updateLabel": - if e.complexity.Mutation.UpdateLabel == nil { - break - } - - args, err := ec.field_Mutation_updateLabel_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Mutation.UpdateLabel(childComplexity, args["id"].(int), args["input"].(map[string]interface{})), true - - case "Mutation.updateTicket": - if e.complexity.Mutation.UpdateTicket == nil { - break - } - - args, err := ec.field_Mutation_updateTicket_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Mutation.UpdateTicket(childComplexity, args["trackerId"].(int), args["ticketId"].(int), args["input"].(map[string]interface{})), true - - case "Mutation.updateTicketStatus": - if e.complexity.Mutation.UpdateTicketStatus == nil { - break - } - - args, err := ec.field_Mutation_updateTicketStatus_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Mutation.UpdateTicketStatus(childComplexity, args["trackerId"].(int), args["ticketId"].(int), args["input"].(model.UpdateStatusInput)), true - - case "Mutation.updateTracker": - if e.complexity.Mutation.UpdateTracker == nil { - break - } - - args, err := ec.field_Mutation_updateTracker_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Mutation.UpdateTracker(childComplexity, args["id"].(int), args["input"].(map[string]interface{})), true - - case "Mutation.updateTrackerACL": - if e.complexity.Mutation.UpdateTrackerACL == nil { - break - } - - args, err := ec.field_Mutation_updateTrackerACL_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Mutation.UpdateTrackerACL(childComplexity, args["trackerId"].(int), args["input"].(model.ACLInput)), true - - case "Mutation.updateUserACL": - if e.complexity.Mutation.UpdateUserACL == nil { - break - } - - args, err := ec.field_Mutation_updateUserACL_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Mutation.UpdateUserACL(childComplexity, args["trackerId"].(int), args["userId"].(int), args["input"].(model.ACLInput)), true - - case "Query.events": - if e.complexity.Query.Events == nil { - break - } - - args, err := ec.field_Query_events_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Query.Events(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.subscriptions": - if e.complexity.Query.Subscriptions == nil { - break - } - - args, err := ec.field_Query_subscriptions_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Query.Subscriptions(childComplexity, args["cursor"].(*model1.Cursor)), true - - case "Query.tracker": - if e.complexity.Query.Tracker == nil { - break - } - - args, err := ec.field_Query_tracker_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Query.Tracker(childComplexity, args["id"].(int)), true - - case "Query.trackerByName": - if e.complexity.Query.TrackerByName == nil { - break - } - - args, err := ec.field_Query_trackerByName_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Query.TrackerByName(childComplexity, args["name"].(string)), true - - case "Query.trackerByOwner": - if e.complexity.Query.TrackerByOwner == nil { - break - } - - args, err := ec.field_Query_trackerByOwner_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Query.TrackerByOwner(childComplexity, args["owner"].(string), args["tracker"].(string)), true - - case "Query.trackers": - if e.complexity.Query.Trackers == nil { - break - } - - args, err := ec.field_Query_trackers_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Query.Trackers(childComplexity, args["cursor"].(*model1.Cursor)), true - - case "Query.user": - if e.complexity.Query.User == nil { - break - } - - args, err := ec.field_Query_user_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Query.User(childComplexity, args["username"].(string)), true - - case "Query.version": - if e.complexity.Query.Version == nil { - break - } - - return e.complexity.Query.Version(childComplexity), true - - case "StatusChange.editor": - if e.complexity.StatusChange.Editor == nil { - break - } - - return e.complexity.StatusChange.Editor(childComplexity), true - - case "StatusChange.eventType": - if e.complexity.StatusChange.EventType == nil { - break - } - - return e.complexity.StatusChange.EventType(childComplexity), true - - case "StatusChange.newResolution": - if e.complexity.StatusChange.NewResolution == nil { - break - } - - return e.complexity.StatusChange.NewResolution(childComplexity), true - - case "StatusChange.newStatus": - if e.complexity.StatusChange.NewStatus == nil { - break - } - - return e.complexity.StatusChange.NewStatus(childComplexity), true - - case "StatusChange.oldResolution": - if e.complexity.StatusChange.OldResolution == nil { - break - } - - return e.complexity.StatusChange.OldResolution(childComplexity), true - - case "StatusChange.oldStatus": - if e.complexity.StatusChange.OldStatus == nil { - break - } - - return e.complexity.StatusChange.OldStatus(childComplexity), true - - case "StatusChange.ticket": - if e.complexity.StatusChange.Ticket == nil { - break - } - - return e.complexity.StatusChange.Ticket(childComplexity), true - - case "Ticket.assignees": - if e.complexity.Ticket.Assignees == nil { - break - } - - return e.complexity.Ticket.Assignees(childComplexity), true - - case "Ticket.authenticity": - if e.complexity.Ticket.Authenticity == nil { - break - } - - return e.complexity.Ticket.Authenticity(childComplexity), true - - case "Ticket.body": - if e.complexity.Ticket.Body == nil { - break - } - - return e.complexity.Ticket.Body(childComplexity), true - - case "Ticket.created": - if e.complexity.Ticket.Created == nil { - break - } - - return e.complexity.Ticket.Created(childComplexity), true - - case "Ticket.events": - if e.complexity.Ticket.Events == nil { - break - } - - args, err := ec.field_Ticket_events_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Ticket.Events(childComplexity, args["cursor"].(*model1.Cursor)), true - - case "Ticket.id": - if e.complexity.Ticket.ID == nil { - break - } - - return e.complexity.Ticket.ID(childComplexity), true - - case "Ticket.labels": - if e.complexity.Ticket.Labels == nil { - break - } - - return e.complexity.Ticket.Labels(childComplexity), true - - case "Ticket.ref": - if e.complexity.Ticket.Ref == nil { - break - } - - return e.complexity.Ticket.Ref(childComplexity), true - - case "Ticket.resolution": - if e.complexity.Ticket.Resolution == nil { - break - } - - return e.complexity.Ticket.Resolution(childComplexity), true - - case "Ticket.status": - if e.complexity.Ticket.Status == nil { - break - } - - return e.complexity.Ticket.Status(childComplexity), true - - case "Ticket.subject": - if e.complexity.Ticket.Subject == nil { - break - } - - return e.complexity.Ticket.Subject(childComplexity), true - - case "Ticket.submitter": - if e.complexity.Ticket.Submitter == nil { - break - } - - return e.complexity.Ticket.Submitter(childComplexity), true - - case "Ticket.subscription": - if e.complexity.Ticket.Subscription == nil { - break - } - - return e.complexity.Ticket.Subscription(childComplexity), true - - case "Ticket.tracker": - if e.complexity.Ticket.Tracker == nil { - break - } - - return e.complexity.Ticket.Tracker(childComplexity), true - - case "Ticket.updated": - if e.complexity.Ticket.Updated == nil { - break - } - - return e.complexity.Ticket.Updated(childComplexity), true - - case "TicketCursor.cursor": - if e.complexity.TicketCursor.Cursor == nil { - break - } - - return e.complexity.TicketCursor.Cursor(childComplexity), true - - case "TicketCursor.results": - if e.complexity.TicketCursor.Results == nil { - break - } - - return e.complexity.TicketCursor.Results(childComplexity), true - - case "TicketMention.author": - if e.complexity.TicketMention.Author == nil { - break - } - - return e.complexity.TicketMention.Author(childComplexity), true - - case "TicketMention.eventType": - if e.complexity.TicketMention.EventType == nil { - break - } - - return e.complexity.TicketMention.EventType(childComplexity), true - - case "TicketMention.mentioned": - if e.complexity.TicketMention.Mentioned == nil { - break - } - - return e.complexity.TicketMention.Mentioned(childComplexity), true - - case "TicketMention.ticket": - if e.complexity.TicketMention.Ticket == nil { - break - } - - return e.complexity.TicketMention.Ticket(childComplexity), true - - case "TicketSubscription.created": - if e.complexity.TicketSubscription.Created == nil { - break - } - - return e.complexity.TicketSubscription.Created(childComplexity), true - - case "TicketSubscription.id": - if e.complexity.TicketSubscription.ID == nil { - break - } - - return e.complexity.TicketSubscription.ID(childComplexity), true - - case "TicketSubscription.ticket": - if e.complexity.TicketSubscription.Ticket == nil { - break - } - - return e.complexity.TicketSubscription.Ticket(childComplexity), true - - case "Tracker.acl": - if e.complexity.Tracker.ACL == nil { - break - } - - return e.complexity.Tracker.ACL(childComplexity), true - - case "Tracker.acls": - if e.complexity.Tracker.Acls == nil { - break - } - - args, err := ec.field_Tracker_acls_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Tracker.Acls(childComplexity, args["cursor"].(*model1.Cursor)), true - - case "Tracker.created": - if e.complexity.Tracker.Created == nil { - break - } - - return e.complexity.Tracker.Created(childComplexity), true - - case "Tracker.defaultACL": - if e.complexity.Tracker.DefaultACL == nil { - break - } - - return e.complexity.Tracker.DefaultACL(childComplexity), true - - case "Tracker.description": - if e.complexity.Tracker.Description == nil { - break - } - - return e.complexity.Tracker.Description(childComplexity), true - - case "Tracker.export": - if e.complexity.Tracker.Export == nil { - break - } - - return e.complexity.Tracker.Export(childComplexity), true - - case "Tracker.id": - if e.complexity.Tracker.ID == nil { - break - } - - return e.complexity.Tracker.ID(childComplexity), true - - case "Tracker.labels": - if e.complexity.Tracker.Labels == nil { - break - } - - args, err := ec.field_Tracker_labels_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Tracker.Labels(childComplexity, args["cursor"].(*model1.Cursor)), true - - case "Tracker.name": - if e.complexity.Tracker.Name == nil { - break - } - - return e.complexity.Tracker.Name(childComplexity), true - - case "Tracker.owner": - if e.complexity.Tracker.Owner == nil { - break - } - - return e.complexity.Tracker.Owner(childComplexity), true - - case "Tracker.subscription": - if e.complexity.Tracker.Subscription == nil { - break - } - - return e.complexity.Tracker.Subscription(childComplexity), true - - case "Tracker.ticket": - if e.complexity.Tracker.Ticket == nil { - break - } - - args, err := ec.field_Tracker_ticket_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Tracker.Ticket(childComplexity, args["id"].(int)), true - - case "Tracker.tickets": - if e.complexity.Tracker.Tickets == nil { - break - } - - args, err := ec.field_Tracker_tickets_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Tracker.Tickets(childComplexity, args["cursor"].(*model1.Cursor)), true - - case "Tracker.updated": - if e.complexity.Tracker.Updated == nil { - break - } - - return e.complexity.Tracker.Updated(childComplexity), true - - case "Tracker.visibility": - if e.complexity.Tracker.Visibility == nil { - break - } - - return e.complexity.Tracker.Visibility(childComplexity), true - - case "TrackerACL.browse": - if e.complexity.TrackerACL.Browse == nil { - break - } - - return e.complexity.TrackerACL.Browse(childComplexity), true - - case "TrackerACL.comment": - if e.complexity.TrackerACL.Comment == nil { - break - } - - return e.complexity.TrackerACL.Comment(childComplexity), true - - case "TrackerACL.created": - if e.complexity.TrackerACL.Created == nil { - break - } - - return e.complexity.TrackerACL.Created(childComplexity), true - - case "TrackerACL.edit": - if e.complexity.TrackerACL.Edit == nil { - break - } - - return e.complexity.TrackerACL.Edit(childComplexity), true - - case "TrackerACL.entity": - if e.complexity.TrackerACL.Entity == nil { - break - } - - return e.complexity.TrackerACL.Entity(childComplexity), true - - case "TrackerACL.id": - if e.complexity.TrackerACL.ID == nil { - break - } - - return e.complexity.TrackerACL.ID(childComplexity), true - - case "TrackerACL.submit": - if e.complexity.TrackerACL.Submit == nil { - break - } - - return e.complexity.TrackerACL.Submit(childComplexity), true - - case "TrackerACL.tracker": - if e.complexity.TrackerACL.Tracker == nil { - break - } - - return e.complexity.TrackerACL.Tracker(childComplexity), true - - case "TrackerACL.triage": - if e.complexity.TrackerACL.Triage == nil { - break - } - - return e.complexity.TrackerACL.Triage(childComplexity), true - - case "TrackerCursor.cursor": - if e.complexity.TrackerCursor.Cursor == nil { - break - } - - return e.complexity.TrackerCursor.Cursor(childComplexity), true - - case "TrackerCursor.results": - if e.complexity.TrackerCursor.Results == nil { - break - } - - return e.complexity.TrackerCursor.Results(childComplexity), true - - case "TrackerSubscription.created": - if e.complexity.TrackerSubscription.Created == nil { - break - } - - return e.complexity.TrackerSubscription.Created(childComplexity), true - - case "TrackerSubscription.id": - if e.complexity.TrackerSubscription.ID == nil { - break - } - - return e.complexity.TrackerSubscription.ID(childComplexity), true - - case "TrackerSubscription.tracker": - if e.complexity.TrackerSubscription.Tracker == nil { - break - } - - return e.complexity.TrackerSubscription.Tracker(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.location": - if e.complexity.User.Location == nil { - break - } - - return e.complexity.User.Location(childComplexity), true - - case "User.trackers": - if e.complexity.User.Trackers == nil { - break - } - - args, err := ec.field_User_trackers_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.User.Trackers(childComplexity, args["cursor"].(*model1.Cursor)), 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 "UserMention.author": - if e.complexity.UserMention.Author == nil { - break - } - - return e.complexity.UserMention.Author(childComplexity), true - - case "UserMention.eventType": - if e.complexity.UserMention.EventType == nil { - break - } - - return e.complexity.UserMention.EventType(childComplexity), true - - case "UserMention.mentioned": - if e.complexity.UserMention.Mentioned == nil { - break - } - - return e.complexity.UserMention.Mentioned(childComplexity), true - - case "UserMention.ticket": - if e.complexity.UserMention.Ticket == nil { - break - } - - return e.complexity.UserMention.Ticket(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 - - } - 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 Cursor -scalar Time -scalar URL -scalar Upload - -"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") - TRACKERS @scopehelp(details: "trackers") - TICKETS @scopehelp(details: "tickets") - ACLS @scopehelp(details: "access control lists") - EVENTS @scopehelp(details: "events") - SUBSCRIPTIONS @scopehelp(details: "tracker & ticket subscriptions") -} - -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 - -# 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 -} - -interface Entity { - canonicalName: String! -} - -type User implements Entity { - id: Int! - created: Time! - updated: Time! - canonicalName: String! - username: String! - email: String! - url: String - location: String - bio: String - - trackers(cursor: Cursor): TrackerCursor! @access(scope: TRACKERS, kind: RO) -} - -type EmailAddress implements Entity { - canonicalName: String! - - """ - "jdoe@example.org" of "Jane Doe " - """ - mailbox: String! - """ - "Jane Doe" of "Jane Doe " - """ - name: String -} - -type ExternalUser implements Entity { - canonicalName: String! - - """ - : - e.g. github:ddevault - """ - externalId: String! - "The canonical external URL for this user, e.g. https://github.com/ddevault" - externalUrl: String -} - -enum Visibility { - PUBLIC - UNLISTED - PRIVATE -} - -type Tracker { - id: Int! - created: Time! - updated: Time! - owner: Entity! @access(scope: PROFILE, kind: RO) - name: String! - description: String - visibility: Visibility! - - ticket(id: Int!): Ticket! @access(scope: TICKETS, kind: RO) - tickets(cursor: Cursor): TicketCursor! @access(scope: TICKETS, kind: RO) - labels(cursor: Cursor): LabelCursor! - - """ - If the authenticated user is subscribed to this tracker, this is that - subscription. - """ - subscription: TrackerSubscription @access(scope: SUBSCRIPTIONS, kind: RO) - - """ - The access control list entry (or the default ACL) which describes the - authenticated user's permissions with respect to this tracker. - """ - acl: ACL - - # Only available to the tracker owner: - defaultACL: DefaultACL! - acls(cursor: Cursor): ACLCursor! @access(scope: ACLS, kind: RO) - - """ - Returns a URL from which the tracker owner may download a gzipped JSON - archive of the tracker. - """ - export: URL! -} - -enum TicketStatus { - REPORTED - CONFIRMED - IN_PROGRESS - PENDING - RESOLVED -} - -enum TicketResolution { - UNRESOLVED - FIXED - IMPLEMENTED - WONT_FIX - BY_DESIGN - INVALID - DUPLICATE - NOT_OUR_BUG -} - -enum Authenticity { - """ - The server vouches for this information as entered verbatim by the - attributed entity. - """ - AUTHENTIC - """ - The server does not vouch for this information as entered by the attributed - entity, no authentication was provided. - """ - UNAUTHENTICATED - """ - The server has evidence that the information has likely been manipulated by - a third-party. - """ - TAMPERED -} - -type Ticket { - """ - The ticket ID is unique within each tracker, but is not globally unique. - The first ticket opened on a given tracker will have ID 1, then 2, and so - on. - """ - id: Int! - - created: Time! - updated: Time! - submitter: Entity! @access(scope: PROFILE, kind: RO) - tracker: Tracker! @access(scope: TRACKERS, kind: RO) - - """ - Canonical ticket reference string; may be used in comments to identify the - ticket from anywhere. - """ - ref: String! - - subject: String! - body: String - status: TicketStatus! - resolution: TicketResolution! - authenticity: Authenticity! - - labels: [Label!]! - assignees: [Entity!]! @access(scope: PROFILE, kind: RO) - events(cursor: Cursor): EventCursor! @access(scope: EVENTS, kind: RO) - - """ - If the authenticated user is subscribed to this ticket, this is that - subscription. - """ - subscription: TicketSubscription @access(scope: SUBSCRIPTIONS, kind: RO) -} - -interface ACL { - "Permission to view tickets" - browse: Boolean! - "Permission to submit tickets" - submit: Boolean! - "Permission to comment on tickets" - comment: Boolean! - "Permission to edit tickets" - edit: Boolean! - "Permission to resolve, re-open, transfer, or label tickets" - triage: Boolean! -} - -""" -These ACLs are configured for specific entities, and may be used to expand or -constrain the rights of a participant. -""" -type TrackerACL implements ACL { - id: Int! - created: Time! - tracker: Tracker! @access(scope: TRACKERS, kind: RO) - entity: Entity! @access(scope: PROFILE, kind: RO) - - browse: Boolean! - submit: Boolean! - comment: Boolean! - edit: Boolean! - triage: Boolean! -} - -""" -These ACL policies are applied non-specifically, e.g. the default ACL for all -authenticated users. -""" -type DefaultACL implements ACL { - browse: Boolean! - submit: Boolean! - comment: Boolean! - edit: Boolean! - triage: Boolean! -} - -type Label { - id: Int! - created: Time! - name: String! - tracker: Tracker! @access(scope: TRACKERS, kind: RO) - - "In CSS hexadecimal format" - backgroundColor: String! - foregroundColor: String! - - tickets(cursor: Cursor): TicketCursor! @access(scope: TICKETS, kind: RO) -} - -enum EventType { - CREATED - COMMENT - STATUS_CHANGE - LABEL_ADDED - LABEL_REMOVED - ASSIGNED_USER - UNASSIGNED_USER - USER_MENTIONED - TICKET_MENTIONED -} - -""" -Represents an event which affects a ticket. Multiple changes can occur in a -single event, and are enumerated in the "changes" field. -""" -type Event { - id: Int! - created: Time! - changes: [EventDetail!]! - - ticket: Ticket! @access(scope: TICKETS, kind: RO) -} - -interface EventDetail { - eventType: EventType! - ticket: Ticket! @access(scope: TICKETS, kind: RO) -} - -type Created implements EventDetail { - eventType: EventType! - ticket: Ticket! @access(scope: TICKETS, kind: RO) - author: Entity! @access(scope: PROFILE, kind: RO) -} - -type Assignment implements EventDetail { - eventType: EventType! - ticket: Ticket! @access(scope: TICKETS, kind: RO) - - assigner: Entity! @access(scope: PROFILE, kind: RO) - assignee: Entity! @access(scope: PROFILE, kind: RO) -} - -type Comment implements EventDetail { - eventType: EventType! - ticket: Ticket! @access(scope: TICKETS, kind: RO) - author: Entity! @access(scope: PROFILE, kind: RO) - - text: String! - authenticity: Authenticity! - - "If this comment has been edited, this field points to the new revision." - supersededBy: Comment -} - -type LabelUpdate implements EventDetail { - eventType: EventType! - ticket: Ticket! @access(scope: TICKETS, kind: RO) - labeler: Entity! @access(scope: PROFILE, kind: RO) - label: Label! -} - -type StatusChange implements EventDetail { - eventType: EventType! - ticket: Ticket! @access(scope: TICKETS, kind: RO) - editor: Entity! @access(scope: PROFILE, kind: RO) - - oldStatus: TicketStatus! - newStatus: TicketStatus! - oldResolution: TicketResolution! - newResolution: TicketResolution! -} - -type UserMention implements EventDetail { - eventType: EventType! - ticket: Ticket! @access(scope: TICKETS, kind: RO) - author: Entity! @access(scope: PROFILE, kind: RO) - mentioned: Entity! @access(scope: PROFILE, kind: RO) -} - -type TicketMention implements EventDetail { - eventType: EventType! - ticket: Ticket! @access(scope: TICKETS, kind: RO) - author: Entity! @access(scope: PROFILE, kind: RO) - mentioned: Ticket! @access(scope: TICKETS, kind: RO) -} - -interface ActivitySubscription { - id: Int! - created: Time! -} - -""" -A tracker subscription will notify a participant of all activity for a -tracker, including all new tickets and their events. -""" -type TrackerSubscription implements ActivitySubscription { - id: Int! - created: Time! - tracker: Tracker! @access(scope: TRACKERS, kind: RO) -} - -""" -A ticket subscription will notify a participant when activity occurs on a -ticket. -""" -type TicketSubscription implements ActivitySubscription { - id: Int! - created: Time! - ticket: Ticket! @access(scope: TICKETS, kind: RO) -} - -""" -A cursor for enumerating trackers - -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 TrackerCursor { - results: [Tracker!]! - cursor: Cursor -} - -""" -A cursor for enumerating tickets - -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 TicketCursor { - results: [Ticket!]! - cursor: Cursor -} - -""" -A cursor for enumerating labels - -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 LabelCursor { - results: [Label!]! - cursor: Cursor -} - -""" -A cursor for enumerating access control list entries - -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 ACLCursor { - results: [TrackerACL!]! - cursor: Cursor -} - -""" -A cursor for enumerating events - -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 EventCursor { - results: [Event!]! - cursor: Cursor -} - -""" -A cursor for enumerating subscriptions - -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 ActivitySubscriptionCursor { - results: [ActivitySubscription!]! - cursor: Cursor -} - -type Query { - "Returns API version information." - version: Version! - - "Returns the authenticated user." - me: User! @access(scope: PROFILE, kind: RO) - - "Returns a specific user." - user(username: String!): User @access(scope: PROFILE, kind: RO) - - """ - Returns trackers that the authenticated user has access to. - - NOTE: in this version of the API, only trackers owned by the authenticated - user are returned, but in the future the default behavior will be to return - all trackers that the user either (1) has been given explicit access to via - ACLs or (2) has implicit access to either by ownership or group membership. - """ - trackers(cursor: Cursor): TrackerCursor @access(scope: TRACKERS, kind: RO) - - "Returns a specific tracker by ID." - tracker(id: Int!): Tracker @access(scope: TRACKERS, kind: RO) - - "Returns a specific tracker, owned by the authenticated user." - trackerByName(name: String!): Tracker @access(scope: TRACKERS, kind: RO) - - """ - Returns a specific tracker, owned by the given canonical name (e.g. - "~sircmpwn"). - """ - trackerByOwner(owner: String!, tracker: String!): Tracker @access(scope: TRACKERS, kind: RO) - - # TODO: Add ticket by tracker ID and ticket ID - - """ - List of events which the authenticated user is subscribed to or implicated - in, ordered by the event date (recent events first). - """ - events(cursor: Cursor): EventCursor @access(scope: EVENTS, kind: RO) - - "List of subscriptions of the authenticated user." - subscriptions(cursor: Cursor): ActivitySubscriptionCursor @access(scope: SUBSCRIPTIONS, kind: RO) -} - -"You may omit any fields to leave them unchanged." -# TODO: Allow users to change the name of a tracker -input TrackerInput { - description: String - visibility: Visibility -} - -"You may omit any fields to leave them unchanged." -input UpdateLabelInput { - name: String - foregroundColor: String - backgroundColor: String -} - -input ACLInput { - "Permission to view tickets" - browse: Boolean! - "Permission to submit tickets" - submit: Boolean! - "Permission to comment on tickets" - comment: Boolean! - "Permission to edit tickets" - edit: Boolean! - "Permission to resolve, re-open, transfer, or label tickets" - triage: Boolean! -} - -""" -This is used for importing tickets from third-party services, and may only be -used by the tracker owner. It causes a ticket submission, update, or comment -to be attributed to an external user and appear as if it were submitted at a -specific time. -""" -input ImportInput { - created: Time! - """ - External user ID. By convention this should be "service:username", e.g. - "codeberg:ddevault". - """ - externalId: String! - """ - A URL at which the user's external profile may be found, e.g. - "https://codeberg.org/ddevault". - """ - externalUrl: String! -} - -input SubmitTicketInput { - subject: String! - body: String - - # These fields are meant for use when importing tickets from third-party - # services, and may only be used by the tracker owner. - # TODO: Use ImportInput here - created: Time - externalId: String - externalUrl: String -} - -""" -You may omit any fields to leave them unchanged. To remove the ticket body, -set it to null. -""" -input UpdateTicketInput { - subject: String - body: String - - "For use by the tracker owner only" - import: ImportInput -} - -""" -You may omit the status or resolution fields to leave them unchanged (or if -you do not have permission to change them). "resolution" is required if -status is RESOLVED. -""" -input SubmitCommentInput { - text: String! - status: TicketStatus - resolution: TicketResolution - - "For use by the tracker owner only" - import: ImportInput -} - -""" -"resolution" is required if status is RESOLVED. -""" -input UpdateStatusInput { - status: TicketStatus! - resolution: TicketResolution - - "For use by the tracker owner only" - import: ImportInput -} - -type Mutation { - """ - Creates a new bug tracker. If specified, the 'import' field specifies a - gzipped dump of a tracker to populate tickets from; see Tracker.export. - """ - createTracker( - name: String!, - description: String, - visibility: Visibility!, - import: Upload): Tracker @access(scope: TRACKERS, kind: RW) - - "Updates an existing bug tracker" - updateTracker( - id: Int!, - input: TrackerInput!): Tracker @access(scope: TRACKERS, kind: RW) - - "Deletes a bug tracker" - deleteTracker(id: Int!): Tracker @access(scope: TRACKERS, kind: RW) - - "Adds or updates the ACL for a specific user on a bug tracker" - updateUserACL( - trackerId: Int!, - userId: Int!, - input: ACLInput!): TrackerACL @access(scope: ACLS, kind: RW) - - # "Adds or updates the ACL for an email address on a bug tracker" - # TODO: This requires internal changes - #updateSenderACL( - # trackerId: Int!, - # address: String!, - # input: ACLInput!): TrackerACL @access(scope: ACLS, kind: RW) - - """ - Updates the default ACL for a bug tracker, which applies to users and - senders for whom a more specific ACL does not exist. - """ - updateTrackerACL( - trackerId: Int!, - input: ACLInput!): DefaultACL @access(scope: ACLS, kind: RW) - - """ - Removes a tracker ACL. Following this change, the default tracker ACL will - apply to this user. - """ - deleteACL(id: Int!): TrackerACL @access(scope: ACLS, kind: RW) - - "Subscribes to all email notifications for a tracker" - trackerSubscribe( - trackerId: Int!): TrackerSubscription @access(scope: SUBSCRIPTIONS, kind: RW) - - """ - Unsubscribes from email notifications for a tracker. If "tickets" is true, - also unsubscribe from all tickets on this tracker. - """ - trackerUnsubscribe( - trackerId: Int!, - tickets: Boolean!): TrackerSubscription @access(scope: SUBSCRIPTIONS, kind: RW) - - "Subscribes to all email notifications for a ticket" - ticketSubscribe( - trackerId: Int!, - ticketId: Int!): TicketSubscription @access(scope: SUBSCRIPTIONS, kind: RW) - - "Unsubscribes from email notifications for a ticket" - ticketUnsubscribe( - trackerId: Int!, - ticketId: Int!): TicketSubscription @access(scope: SUBSCRIPTIONS, kind: RW) - - """ - Creates a new ticket label for a tracker. The colors must be in CSS - hexadecimal RGB format "#RRGGBB", i.e. "#000000" for black and "#FF0000" for - red. - """ - createLabel(trackerId: Int!, name: String!, - foreground: String!, background: String!): Label @access(scope: TRACKERS, kind: RW) - - "Changes the name or colors for a label." - updateLabel(id: Int!, input: UpdateLabelInput!): Label @access(scope: TRACKERS, kind: RW) - - """ - Deletes a label, removing it from any tickets which currently have it - applied. - """ - deleteLabel(id: Int!): Label @access(scope: TRACKERS, kind: RW) - - "Creates a new ticket." - submitTicket(trackerId: Int!, - input: SubmitTicketInput!): Ticket @access(scope: TICKETS, kind: RW) - - "Updates a ticket's subject or body" - updateTicket(trackerId: Int!, ticketId: Int!, - input: UpdateTicketInput!): Ticket @access(scope: TICKETS, kind: RW) - - "Updates the status or resolution of a ticket" - updateTicketStatus(trackerId: Int!, ticketId: Int!, - input: UpdateStatusInput!): Event @access(scope: TICKETS, kind: RW) - - "Submits a comment for a ticket" - submitComment(trackerId: Int!, ticketId: Int!, - input: SubmitCommentInput!): Event @access(scope: TICKETS, kind: RW) - - "Adds a user to the list of assigned users for a ticket" - assignUser(trackerId: Int!, ticketId: Int!, - userId: Int!): Event @access(scope: TICKETS, kind: RW) - - "Removes a user from the list of assigned users for a ticket" - unassignUser(trackerId: Int!, ticketId: Int!, - userId: Int!): Event @access(scope: TICKETS, kind: RW) - - "Adds a label to the list of labels for a ticket" - labelTicket(trackerId: Int!, ticketId: Int!, - labelId: Int!): Event @access(scope: TICKETS, kind: RW) - - "Removes a list from the list of labels for a ticket" - unlabelTicket(trackerId: Int!, ticketId: Int!, - labelId: Int!): Event @access(scope: TICKETS, kind: RW) -} -`, 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ᚋtodoᚗ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ᚋtodoᚗ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_Label_tickets_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_Mutation_assignUser_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["trackerId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("trackerId")) - arg0, err = ec.unmarshalNInt2int(ctx, tmp) - if err != nil { - return nil, err - } - } - args["trackerId"] = arg0 - var arg1 int - if tmp, ok := rawArgs["ticketId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ticketId")) - arg1, err = ec.unmarshalNInt2int(ctx, tmp) - if err != nil { - return nil, err - } - } - args["ticketId"] = arg1 - var arg2 int - if tmp, ok := rawArgs["userId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("userId")) - arg2, err = ec.unmarshalNInt2int(ctx, tmp) - if err != nil { - return nil, err - } - } - args["userId"] = arg2 - return args, nil -} - -func (ec *executionContext) field_Mutation_createLabel_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["trackerId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("trackerId")) - arg0, err = ec.unmarshalNInt2int(ctx, tmp) - if err != nil { - return nil, err - } - } - args["trackerId"] = arg0 - var arg1 string - if tmp, ok := rawArgs["name"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - arg1, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } - } - args["name"] = arg1 - var arg2 string - if tmp, ok := rawArgs["foreground"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("foreground")) - arg2, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } - } - args["foreground"] = arg2 - var arg3 string - if tmp, ok := rawArgs["background"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("background")) - arg3, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } - } - args["background"] = arg3 - return args, nil -} - -func (ec *executionContext) field_Mutation_createTracker_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 - var arg1 *string - if tmp, ok := rawArgs["description"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("description")) - arg1, err = ec.unmarshalOString2ᚖstring(ctx, tmp) - if err != nil { - return nil, err - } - } - args["description"] = arg1 - var arg2 model.Visibility - if tmp, ok := rawArgs["visibility"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("visibility")) - arg2, err = ec.unmarshalNVisibility2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐVisibility(ctx, tmp) - if err != nil { - return nil, err - } - } - args["visibility"] = arg2 - var arg3 *graphql.Upload - if tmp, ok := rawArgs["import"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("import")) - arg3, err = ec.unmarshalOUpload2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚐUpload(ctx, tmp) - if err != nil { - return nil, err - } - } - args["import"] = arg3 - return args, nil -} - -func (ec *executionContext) field_Mutation_deleteACL_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_Mutation_deleteLabel_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_Mutation_deleteTracker_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_Mutation_labelTicket_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["trackerId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("trackerId")) - arg0, err = ec.unmarshalNInt2int(ctx, tmp) - if err != nil { - return nil, err - } - } - args["trackerId"] = arg0 - var arg1 int - if tmp, ok := rawArgs["ticketId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ticketId")) - arg1, err = ec.unmarshalNInt2int(ctx, tmp) - if err != nil { - return nil, err - } - } - args["ticketId"] = arg1 - var arg2 int - if tmp, ok := rawArgs["labelId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("labelId")) - arg2, err = ec.unmarshalNInt2int(ctx, tmp) - if err != nil { - return nil, err - } - } - args["labelId"] = arg2 - return args, nil -} - -func (ec *executionContext) field_Mutation_submitComment_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["trackerId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("trackerId")) - arg0, err = ec.unmarshalNInt2int(ctx, tmp) - if err != nil { - return nil, err - } - } - args["trackerId"] = arg0 - var arg1 int - if tmp, ok := rawArgs["ticketId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ticketId")) - arg1, err = ec.unmarshalNInt2int(ctx, tmp) - if err != nil { - return nil, err - } - } - args["ticketId"] = arg1 - var arg2 model.SubmitCommentInput - if tmp, ok := rawArgs["input"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) - arg2, err = ec.unmarshalNSubmitCommentInput2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐSubmitCommentInput(ctx, tmp) - if err != nil { - return nil, err - } - } - args["input"] = arg2 - return args, nil -} - -func (ec *executionContext) field_Mutation_submitTicket_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["trackerId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("trackerId")) - arg0, err = ec.unmarshalNInt2int(ctx, tmp) - if err != nil { - return nil, err - } - } - args["trackerId"] = arg0 - var arg1 model.SubmitTicketInput - if tmp, ok := rawArgs["input"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) - arg1, err = ec.unmarshalNSubmitTicketInput2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐSubmitTicketInput(ctx, tmp) - if err != nil { - return nil, err - } - } - args["input"] = arg1 - return args, nil -} - -func (ec *executionContext) field_Mutation_ticketSubscribe_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["trackerId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("trackerId")) - arg0, err = ec.unmarshalNInt2int(ctx, tmp) - if err != nil { - return nil, err - } - } - args["trackerId"] = arg0 - var arg1 int - if tmp, ok := rawArgs["ticketId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ticketId")) - arg1, err = ec.unmarshalNInt2int(ctx, tmp) - if err != nil { - return nil, err - } - } - args["ticketId"] = arg1 - return args, nil -} - -func (ec *executionContext) field_Mutation_ticketUnsubscribe_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["trackerId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("trackerId")) - arg0, err = ec.unmarshalNInt2int(ctx, tmp) - if err != nil { - return nil, err - } - } - args["trackerId"] = arg0 - var arg1 int - if tmp, ok := rawArgs["ticketId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ticketId")) - arg1, err = ec.unmarshalNInt2int(ctx, tmp) - if err != nil { - return nil, err - } - } - args["ticketId"] = arg1 - return args, nil -} - -func (ec *executionContext) field_Mutation_trackerSubscribe_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["trackerId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("trackerId")) - arg0, err = ec.unmarshalNInt2int(ctx, tmp) - if err != nil { - return nil, err - } - } - args["trackerId"] = arg0 - return args, nil -} - -func (ec *executionContext) field_Mutation_trackerUnsubscribe_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["trackerId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("trackerId")) - arg0, err = ec.unmarshalNInt2int(ctx, tmp) - if err != nil { - return nil, err - } - } - args["trackerId"] = arg0 - var arg1 bool - if tmp, ok := rawArgs["tickets"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("tickets")) - arg1, err = ec.unmarshalNBoolean2bool(ctx, tmp) - if err != nil { - return nil, err - } - } - args["tickets"] = arg1 - return args, nil -} - -func (ec *executionContext) field_Mutation_unassignUser_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["trackerId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("trackerId")) - arg0, err = ec.unmarshalNInt2int(ctx, tmp) - if err != nil { - return nil, err - } - } - args["trackerId"] = arg0 - var arg1 int - if tmp, ok := rawArgs["ticketId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ticketId")) - arg1, err = ec.unmarshalNInt2int(ctx, tmp) - if err != nil { - return nil, err - } - } - args["ticketId"] = arg1 - var arg2 int - if tmp, ok := rawArgs["userId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("userId")) - arg2, err = ec.unmarshalNInt2int(ctx, tmp) - if err != nil { - return nil, err - } - } - args["userId"] = arg2 - return args, nil -} - -func (ec *executionContext) field_Mutation_unlabelTicket_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["trackerId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("trackerId")) - arg0, err = ec.unmarshalNInt2int(ctx, tmp) - if err != nil { - return nil, err - } - } - args["trackerId"] = arg0 - var arg1 int - if tmp, ok := rawArgs["ticketId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ticketId")) - arg1, err = ec.unmarshalNInt2int(ctx, tmp) - if err != nil { - return nil, err - } - } - args["ticketId"] = arg1 - var arg2 int - if tmp, ok := rawArgs["labelId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("labelId")) - arg2, err = ec.unmarshalNInt2int(ctx, tmp) - if err != nil { - return nil, err - } - } - args["labelId"] = arg2 - return args, nil -} - -func (ec *executionContext) field_Mutation_updateLabel_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 - var arg1 map[string]interface{} - if tmp, ok := rawArgs["input"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) - arg1, err = ec.unmarshalNUpdateLabelInput2map(ctx, tmp) - if err != nil { - return nil, err - } - } - args["input"] = arg1 - return args, nil -} - -func (ec *executionContext) field_Mutation_updateTicketStatus_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["trackerId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("trackerId")) - arg0, err = ec.unmarshalNInt2int(ctx, tmp) - if err != nil { - return nil, err - } - } - args["trackerId"] = arg0 - var arg1 int - if tmp, ok := rawArgs["ticketId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ticketId")) - arg1, err = ec.unmarshalNInt2int(ctx, tmp) - if err != nil { - return nil, err - } - } - args["ticketId"] = arg1 - var arg2 model.UpdateStatusInput - if tmp, ok := rawArgs["input"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) - arg2, err = ec.unmarshalNUpdateStatusInput2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐUpdateStatusInput(ctx, tmp) - if err != nil { - return nil, err - } - } - args["input"] = arg2 - return args, nil -} - -func (ec *executionContext) field_Mutation_updateTicket_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["trackerId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("trackerId")) - arg0, err = ec.unmarshalNInt2int(ctx, tmp) - if err != nil { - return nil, err - } - } - args["trackerId"] = arg0 - var arg1 int - if tmp, ok := rawArgs["ticketId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ticketId")) - arg1, err = ec.unmarshalNInt2int(ctx, tmp) - if err != nil { - return nil, err - } - } - args["ticketId"] = arg1 - var arg2 map[string]interface{} - if tmp, ok := rawArgs["input"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) - arg2, err = ec.unmarshalNUpdateTicketInput2map(ctx, tmp) - if err != nil { - return nil, err - } - } - args["input"] = arg2 - return args, nil -} - -func (ec *executionContext) field_Mutation_updateTrackerACL_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["trackerId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("trackerId")) - arg0, err = ec.unmarshalNInt2int(ctx, tmp) - if err != nil { - return nil, err - } - } - args["trackerId"] = arg0 - var arg1 model.ACLInput - if tmp, ok := rawArgs["input"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) - arg1, err = ec.unmarshalNACLInput2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐACLInput(ctx, tmp) - if err != nil { - return nil, err - } - } - args["input"] = arg1 - return args, nil -} - -func (ec *executionContext) field_Mutation_updateTracker_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 - var arg1 map[string]interface{} - if tmp, ok := rawArgs["input"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) - arg1, err = ec.unmarshalNTrackerInput2map(ctx, tmp) - if err != nil { - return nil, err - } - } - args["input"] = arg1 - return args, nil -} - -func (ec *executionContext) field_Mutation_updateUserACL_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["trackerId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("trackerId")) - arg0, err = ec.unmarshalNInt2int(ctx, tmp) - if err != nil { - return nil, err - } - } - args["trackerId"] = arg0 - var arg1 int - if tmp, ok := rawArgs["userId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("userId")) - arg1, err = ec.unmarshalNInt2int(ctx, tmp) - if err != nil { - return nil, err - } - } - args["userId"] = arg1 - var arg2 model.ACLInput - if tmp, ok := rawArgs["input"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) - arg2, err = ec.unmarshalNACLInput2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐACLInput(ctx, tmp) - if err != nil { - return nil, err - } - } - args["input"] = arg2 - 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_events_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_subscriptions_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_trackerByName_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_trackerByOwner_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["owner"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("owner")) - arg0, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } - } - args["owner"] = arg0 - var arg1 string - if tmp, ok := rawArgs["tracker"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("tracker")) - arg1, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } - } - args["tracker"] = arg1 - return args, nil -} - -func (ec *executionContext) field_Query_tracker_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_trackers_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_user_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_Ticket_events_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_Tracker_acls_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_Tracker_labels_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_Tracker_ticket_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_Tracker_tickets_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_User_trackers_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) _ACLCursor_results(ctx context.Context, field graphql.CollectedField, obj *model.ACLCursor) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "ACLCursor", - 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.TrackerACL) - fc.Result = res - return ec.marshalNTrackerACL2ᚕᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTrackerACLᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) _ACLCursor_cursor(ctx context.Context, field graphql.CollectedField, obj *model.ACLCursor) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "ACLCursor", - 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) _ActivitySubscriptionCursor_results(ctx context.Context, field graphql.CollectedField, obj *model.ActivitySubscriptionCursor) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "ActivitySubscriptionCursor", - 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.ActivitySubscription) - fc.Result = res - return ec.marshalNActivitySubscription2ᚕgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐActivitySubscriptionᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) _ActivitySubscriptionCursor_cursor(ctx context.Context, field graphql.CollectedField, obj *model.ActivitySubscriptionCursor) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "ActivitySubscriptionCursor", - 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) _Assignment_eventType(ctx context.Context, field graphql.CollectedField, obj *model.Assignment) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Assignment", - 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.EventType, 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.EventType) - fc.Result = res - return ec.marshalNEventType2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEventType(ctx, field.Selections, res) -} - -func (ec *executionContext) _Assignment_ticket(ctx context.Context, field graphql.CollectedField, obj *model.Assignment) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Assignment", - 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.Assignment().Ticket(rctx, obj) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "TICKETS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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.Ticket); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/todo.sr.ht/api/graph/model.Ticket`, 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.Ticket) - fc.Result = res - return ec.marshalNTicket2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTicket(ctx, field.Selections, res) -} - -func (ec *executionContext) _Assignment_assigner(ctx context.Context, field graphql.CollectedField, obj *model.Assignment) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Assignment", - 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.Assignment().Assigner(rctx, obj) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "PROFILE") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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/todo.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ᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEntity(ctx, field.Selections, res) -} - -func (ec *executionContext) _Assignment_assignee(ctx context.Context, field graphql.CollectedField, obj *model.Assignment) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Assignment", - 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.Assignment().Assignee(rctx, obj) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "PROFILE") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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/todo.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ᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEntity(ctx, field.Selections, res) -} - -func (ec *executionContext) _Comment_eventType(ctx context.Context, field graphql.CollectedField, obj *model.Comment) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Comment", - 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.EventType, 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.EventType) - fc.Result = res - return ec.marshalNEventType2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEventType(ctx, field.Selections, res) -} - -func (ec *executionContext) _Comment_ticket(ctx context.Context, field graphql.CollectedField, obj *model.Comment) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Comment", - 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.Comment().Ticket(rctx, obj) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "TICKETS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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.Ticket); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/todo.sr.ht/api/graph/model.Ticket`, 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.Ticket) - fc.Result = res - return ec.marshalNTicket2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTicket(ctx, field.Selections, res) -} - -func (ec *executionContext) _Comment_author(ctx context.Context, field graphql.CollectedField, obj *model.Comment) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Comment", - 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.Comment().Author(rctx, obj) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "PROFILE") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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/todo.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ᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEntity(ctx, field.Selections, res) -} - -func (ec *executionContext) _Comment_text(ctx context.Context, field graphql.CollectedField, obj *model.Comment) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Comment", - 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.Comment().Text(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.(string) - fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) -} - -func (ec *executionContext) _Comment_authenticity(ctx context.Context, field graphql.CollectedField, obj *model.Comment) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Comment", - 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.Comment().Authenticity(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.Authenticity) - fc.Result = res - return ec.marshalNAuthenticity2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAuthenticity(ctx, field.Selections, res) -} - -func (ec *executionContext) _Comment_supersededBy(ctx context.Context, field graphql.CollectedField, obj *model.Comment) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Comment", - 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.Comment().SupersededBy(rctx, obj) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.Comment) - fc.Result = res - return ec.marshalOComment2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐComment(ctx, field.Selections, res) -} - -func (ec *executionContext) _Created_eventType(ctx context.Context, field graphql.CollectedField, obj *model.Created) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Created", - 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.EventType, 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.EventType) - fc.Result = res - return ec.marshalNEventType2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEventType(ctx, field.Selections, res) -} - -func (ec *executionContext) _Created_ticket(ctx context.Context, field graphql.CollectedField, obj *model.Created) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Created", - 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.Created().Ticket(rctx, obj) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "TICKETS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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.Ticket); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/todo.sr.ht/api/graph/model.Ticket`, 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.Ticket) - fc.Result = res - return ec.marshalNTicket2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTicket(ctx, field.Selections, res) -} - -func (ec *executionContext) _Created_author(ctx context.Context, field graphql.CollectedField, obj *model.Created) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Created", - 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.Created().Author(rctx, obj) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "PROFILE") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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/todo.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ᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEntity(ctx, field.Selections, res) -} - -func (ec *executionContext) _DefaultACL_browse(ctx context.Context, field graphql.CollectedField, obj *model.DefaultACL) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "DefaultACL", - 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.Browse, 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) _DefaultACL_submit(ctx context.Context, field graphql.CollectedField, obj *model.DefaultACL) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "DefaultACL", - 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.Submit, 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) _DefaultACL_comment(ctx context.Context, field graphql.CollectedField, obj *model.DefaultACL) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "DefaultACL", - 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.Comment, 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) _DefaultACL_edit(ctx context.Context, field graphql.CollectedField, obj *model.DefaultACL) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "DefaultACL", - 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.Edit, 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) _DefaultACL_triage(ctx context.Context, field graphql.CollectedField, obj *model.DefaultACL) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "DefaultACL", - 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.Triage, 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) _EmailAddress_canonicalName(ctx context.Context, field graphql.CollectedField, obj *model.EmailAddress) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "EmailAddress", - 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) _EmailAddress_mailbox(ctx context.Context, field graphql.CollectedField, obj *model.EmailAddress) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "EmailAddress", - 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.Mailbox, 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) _EmailAddress_name(ctx context.Context, field graphql.CollectedField, obj *model.EmailAddress) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "EmailAddress", - 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) _Event_id(ctx context.Context, field graphql.CollectedField, obj *model.Event) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Event", - 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) _Event_created(ctx context.Context, field graphql.CollectedField, obj *model.Event) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Event", - 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) _Event_changes(ctx context.Context, field graphql.CollectedField, obj *model.Event) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Event", - 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.Changes(), 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.EventDetail) - fc.Result = res - return ec.marshalNEventDetail2ᚕgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEventDetailᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) _Event_ticket(ctx context.Context, field graphql.CollectedField, obj *model.Event) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Event", - 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.Event().Ticket(rctx, obj) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "TICKETS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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.Ticket); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/todo.sr.ht/api/graph/model.Ticket`, 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.Ticket) - fc.Result = res - return ec.marshalNTicket2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTicket(ctx, field.Selections, res) -} - -func (ec *executionContext) _EventCursor_results(ctx context.Context, field graphql.CollectedField, obj *model.EventCursor) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "EventCursor", - 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.Event) - fc.Result = res - return ec.marshalNEvent2ᚕᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEventᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) _EventCursor_cursor(ctx context.Context, field graphql.CollectedField, obj *model.EventCursor) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "EventCursor", - 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) _ExternalUser_canonicalName(ctx context.Context, field graphql.CollectedField, obj *model.ExternalUser) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "ExternalUser", - 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) _ExternalUser_externalId(ctx context.Context, field graphql.CollectedField, obj *model.ExternalUser) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "ExternalUser", - 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.ExternalID, 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) _ExternalUser_externalUrl(ctx context.Context, field graphql.CollectedField, obj *model.ExternalUser) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "ExternalUser", - 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.ExternalURL, 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) _Label_id(ctx context.Context, field graphql.CollectedField, obj *model.Label) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Label", - 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) _Label_created(ctx context.Context, field graphql.CollectedField, obj *model.Label) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Label", - 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) _Label_name(ctx context.Context, field graphql.CollectedField, obj *model.Label) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Label", - 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) _Label_tracker(ctx context.Context, field graphql.CollectedField, obj *model.Label) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Label", - 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.Label().Tracker(rctx, obj) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "TRACKERS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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.Tracker); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/todo.sr.ht/api/graph/model.Tracker`, 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.Tracker) - fc.Result = res - return ec.marshalNTracker2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTracker(ctx, field.Selections, res) -} - -func (ec *executionContext) _Label_backgroundColor(ctx context.Context, field graphql.CollectedField, obj *model.Label) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Label", - 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.BackgroundColor, 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) _Label_foregroundColor(ctx context.Context, field graphql.CollectedField, obj *model.Label) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Label", - 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.ForegroundColor, 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) _Label_tickets(ctx context.Context, field graphql.CollectedField, obj *model.Label) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Label", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: true, - } - - ctx = graphql.WithFieldContext(ctx, fc) - rawArgs := field.ArgumentMap(ec.Variables) - args, err := ec.field_Label_tickets_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.Label().Tickets(rctx, obj, args["cursor"].(*model1.Cursor)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "TICKETS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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.TicketCursor); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/todo.sr.ht/api/graph/model.TicketCursor`, 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.TicketCursor) - fc.Result = res - return ec.marshalNTicketCursor2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTicketCursor(ctx, field.Selections, res) -} - -func (ec *executionContext) _LabelCursor_results(ctx context.Context, field graphql.CollectedField, obj *model.LabelCursor) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "LabelCursor", - 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.Label) - fc.Result = res - return ec.marshalNLabel2ᚕᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐLabelᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) _LabelCursor_cursor(ctx context.Context, field graphql.CollectedField, obj *model.LabelCursor) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "LabelCursor", - 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) _LabelUpdate_eventType(ctx context.Context, field graphql.CollectedField, obj *model.LabelUpdate) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "LabelUpdate", - 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.EventType, 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.EventType) - fc.Result = res - return ec.marshalNEventType2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEventType(ctx, field.Selections, res) -} - -func (ec *executionContext) _LabelUpdate_ticket(ctx context.Context, field graphql.CollectedField, obj *model.LabelUpdate) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "LabelUpdate", - 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.LabelUpdate().Ticket(rctx, obj) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "TICKETS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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.Ticket); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/todo.sr.ht/api/graph/model.Ticket`, 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.Ticket) - fc.Result = res - return ec.marshalNTicket2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTicket(ctx, field.Selections, res) -} - -func (ec *executionContext) _LabelUpdate_labeler(ctx context.Context, field graphql.CollectedField, obj *model.LabelUpdate) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "LabelUpdate", - 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.LabelUpdate().Labeler(rctx, obj) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "PROFILE") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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/todo.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ᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEntity(ctx, field.Selections, res) -} - -func (ec *executionContext) _LabelUpdate_label(ctx context.Context, field graphql.CollectedField, obj *model.LabelUpdate) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "LabelUpdate", - 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.LabelUpdate().Label(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.Label) - fc.Result = res - return ec.marshalNLabel2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐLabel(ctx, field.Selections, res) -} - -func (ec *executionContext) _Mutation_createTracker(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_createTracker_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().CreateTracker(rctx, args["name"].(string), args["description"].(*string), args["visibility"].(model.Visibility), args["import"].(*graphql.Upload)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "TRACKERS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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.Tracker); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/todo.sr.ht/api/graph/model.Tracker`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.Tracker) - fc.Result = res - return ec.marshalOTracker2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTracker(ctx, field.Selections, res) -} - -func (ec *executionContext) _Mutation_updateTracker(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_updateTracker_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().UpdateTracker(rctx, args["id"].(int), args["input"].(map[string]interface{})) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "TRACKERS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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.Tracker); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/todo.sr.ht/api/graph/model.Tracker`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.Tracker) - fc.Result = res - return ec.marshalOTracker2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTracker(ctx, field.Selections, res) -} - -func (ec *executionContext) _Mutation_deleteTracker(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_deleteTracker_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().DeleteTracker(rctx, args["id"].(int)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "TRACKERS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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.Tracker); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/todo.sr.ht/api/graph/model.Tracker`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.Tracker) - fc.Result = res - return ec.marshalOTracker2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTracker(ctx, field.Selections, res) -} - -func (ec *executionContext) _Mutation_updateUserACL(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_updateUserACL_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().UpdateUserACL(rctx, args["trackerId"].(int), args["userId"].(int), args["input"].(model.ACLInput)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "ACLS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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.TrackerACL); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/todo.sr.ht/api/graph/model.TrackerACL`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.TrackerACL) - fc.Result = res - return ec.marshalOTrackerACL2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTrackerACL(ctx, field.Selections, res) -} - -func (ec *executionContext) _Mutation_updateTrackerACL(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_updateTrackerACL_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().UpdateTrackerACL(rctx, args["trackerId"].(int), args["input"].(model.ACLInput)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "ACLS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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.DefaultACL); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/todo.sr.ht/api/graph/model.DefaultACL`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.DefaultACL) - fc.Result = res - return ec.marshalODefaultACL2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐDefaultACL(ctx, field.Selections, res) -} - -func (ec *executionContext) _Mutation_deleteACL(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_deleteACL_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().DeleteACL(rctx, args["id"].(int)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "ACLS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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.TrackerACL); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/todo.sr.ht/api/graph/model.TrackerACL`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.TrackerACL) - fc.Result = res - return ec.marshalOTrackerACL2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTrackerACL(ctx, field.Selections, res) -} - -func (ec *executionContext) _Mutation_trackerSubscribe(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_trackerSubscribe_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().TrackerSubscribe(rctx, args["trackerId"].(int)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "SUBSCRIPTIONS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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.TrackerSubscription); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/todo.sr.ht/api/graph/model.TrackerSubscription`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.TrackerSubscription) - fc.Result = res - return ec.marshalOTrackerSubscription2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTrackerSubscription(ctx, field.Selections, res) -} - -func (ec *executionContext) _Mutation_trackerUnsubscribe(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_trackerUnsubscribe_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().TrackerUnsubscribe(rctx, args["trackerId"].(int), args["tickets"].(bool)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "SUBSCRIPTIONS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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.TrackerSubscription); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/todo.sr.ht/api/graph/model.TrackerSubscription`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.TrackerSubscription) - fc.Result = res - return ec.marshalOTrackerSubscription2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTrackerSubscription(ctx, field.Selections, res) -} - -func (ec *executionContext) _Mutation_ticketSubscribe(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_ticketSubscribe_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().TicketSubscribe(rctx, args["trackerId"].(int), args["ticketId"].(int)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "SUBSCRIPTIONS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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.TicketSubscription); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/todo.sr.ht/api/graph/model.TicketSubscription`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.TicketSubscription) - fc.Result = res - return ec.marshalOTicketSubscription2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTicketSubscription(ctx, field.Selections, res) -} - -func (ec *executionContext) _Mutation_ticketUnsubscribe(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_ticketUnsubscribe_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().TicketUnsubscribe(rctx, args["trackerId"].(int), args["ticketId"].(int)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "SUBSCRIPTIONS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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.TicketSubscription); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/todo.sr.ht/api/graph/model.TicketSubscription`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.TicketSubscription) - fc.Result = res - return ec.marshalOTicketSubscription2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTicketSubscription(ctx, field.Selections, res) -} - -func (ec *executionContext) _Mutation_createLabel(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_createLabel_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().CreateLabel(rctx, args["trackerId"].(int), args["name"].(string), args["foreground"].(string), args["background"].(string)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "TRACKERS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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.Label); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/todo.sr.ht/api/graph/model.Label`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.Label) - fc.Result = res - return ec.marshalOLabel2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐLabel(ctx, field.Selections, res) -} - -func (ec *executionContext) _Mutation_updateLabel(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_updateLabel_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().UpdateLabel(rctx, args["id"].(int), args["input"].(map[string]interface{})) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "TRACKERS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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.Label); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/todo.sr.ht/api/graph/model.Label`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.Label) - fc.Result = res - return ec.marshalOLabel2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐLabel(ctx, field.Selections, res) -} - -func (ec *executionContext) _Mutation_deleteLabel(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_deleteLabel_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().DeleteLabel(rctx, args["id"].(int)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "TRACKERS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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.Label); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/todo.sr.ht/api/graph/model.Label`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.Label) - fc.Result = res - return ec.marshalOLabel2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐLabel(ctx, field.Selections, res) -} - -func (ec *executionContext) _Mutation_submitTicket(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_submitTicket_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().SubmitTicket(rctx, args["trackerId"].(int), args["input"].(model.SubmitTicketInput)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "TICKETS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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.Ticket); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/todo.sr.ht/api/graph/model.Ticket`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.Ticket) - fc.Result = res - return ec.marshalOTicket2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTicket(ctx, field.Selections, res) -} - -func (ec *executionContext) _Mutation_updateTicket(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_updateTicket_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().UpdateTicket(rctx, args["trackerId"].(int), args["ticketId"].(int), args["input"].(map[string]interface{})) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "TICKETS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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.Ticket); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/todo.sr.ht/api/graph/model.Ticket`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.Ticket) - fc.Result = res - return ec.marshalOTicket2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTicket(ctx, field.Selections, res) -} - -func (ec *executionContext) _Mutation_updateTicketStatus(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_updateTicketStatus_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().UpdateTicketStatus(rctx, args["trackerId"].(int), args["ticketId"].(int), args["input"].(model.UpdateStatusInput)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "TICKETS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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.Event); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/todo.sr.ht/api/graph/model.Event`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.Event) - fc.Result = res - return ec.marshalOEvent2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEvent(ctx, field.Selections, res) -} - -func (ec *executionContext) _Mutation_submitComment(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_submitComment_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().SubmitComment(rctx, args["trackerId"].(int), args["ticketId"].(int), args["input"].(model.SubmitCommentInput)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "TICKETS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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.Event); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/todo.sr.ht/api/graph/model.Event`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.Event) - fc.Result = res - return ec.marshalOEvent2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEvent(ctx, field.Selections, res) -} - -func (ec *executionContext) _Mutation_assignUser(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_assignUser_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().AssignUser(rctx, args["trackerId"].(int), args["ticketId"].(int), args["userId"].(int)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "TICKETS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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.Event); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/todo.sr.ht/api/graph/model.Event`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.Event) - fc.Result = res - return ec.marshalOEvent2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEvent(ctx, field.Selections, res) -} - -func (ec *executionContext) _Mutation_unassignUser(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_unassignUser_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().UnassignUser(rctx, args["trackerId"].(int), args["ticketId"].(int), args["userId"].(int)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "TICKETS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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.Event); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/todo.sr.ht/api/graph/model.Event`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.Event) - fc.Result = res - return ec.marshalOEvent2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEvent(ctx, field.Selections, res) -} - -func (ec *executionContext) _Mutation_labelTicket(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_labelTicket_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().LabelTicket(rctx, args["trackerId"].(int), args["ticketId"].(int), args["labelId"].(int)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "TICKETS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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.Event); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/todo.sr.ht/api/graph/model.Event`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.Event) - fc.Result = res - return ec.marshalOEvent2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEvent(ctx, field.Selections, res) -} - -func (ec *executionContext) _Mutation_unlabelTicket(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_unlabelTicket_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().UnlabelTicket(rctx, args["trackerId"].(int), args["ticketId"].(int), args["labelId"].(int)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "TICKETS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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.Event); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/todo.sr.ht/api/graph/model.Event`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.Event) - fc.Result = res - return ec.marshalOEvent2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEvent(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ᚋtodoᚗ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ᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "PROFILE") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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/todo.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ᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐUser(ctx, field.Selections, res) -} - -func (ec *executionContext) _Query_user(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_user_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().User(rctx, args["username"].(string)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "PROFILE") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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/todo.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ᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐUser(ctx, field.Selections, res) -} - -func (ec *executionContext) _Query_trackers(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_trackers_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().Trackers(rctx, args["cursor"].(*model1.Cursor)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "TRACKERS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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.TrackerCursor); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/todo.sr.ht/api/graph/model.TrackerCursor`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.TrackerCursor) - fc.Result = res - return ec.marshalOTrackerCursor2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTrackerCursor(ctx, field.Selections, res) -} - -func (ec *executionContext) _Query_tracker(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_tracker_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().Tracker(rctx, args["id"].(int)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "TRACKERS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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.Tracker); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/todo.sr.ht/api/graph/model.Tracker`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.Tracker) - fc.Result = res - return ec.marshalOTracker2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTracker(ctx, field.Selections, res) -} - -func (ec *executionContext) _Query_trackerByName(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_trackerByName_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().TrackerByName(rctx, args["name"].(string)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "TRACKERS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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.Tracker); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/todo.sr.ht/api/graph/model.Tracker`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.Tracker) - fc.Result = res - return ec.marshalOTracker2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTracker(ctx, field.Selections, res) -} - -func (ec *executionContext) _Query_trackerByOwner(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_trackerByOwner_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().TrackerByOwner(rctx, args["owner"].(string), args["tracker"].(string)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "TRACKERS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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.Tracker); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/todo.sr.ht/api/graph/model.Tracker`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.Tracker) - fc.Result = res - return ec.marshalOTracker2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTracker(ctx, field.Selections, res) -} - -func (ec *executionContext) _Query_events(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_events_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().Events(rctx, args["cursor"].(*model1.Cursor)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "EVENTS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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.EventCursor); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/todo.sr.ht/api/graph/model.EventCursor`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.EventCursor) - fc.Result = res - return ec.marshalOEventCursor2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEventCursor(ctx, field.Selections, res) -} - -func (ec *executionContext) _Query_subscriptions(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_subscriptions_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().Subscriptions(rctx, args["cursor"].(*model1.Cursor)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "SUBSCRIPTIONS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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.ActivitySubscriptionCursor); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/todo.sr.ht/api/graph/model.ActivitySubscriptionCursor`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.ActivitySubscriptionCursor) - fc.Result = res - return ec.marshalOActivitySubscriptionCursor2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐActivitySubscriptionCursor(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) _StatusChange_eventType(ctx context.Context, field graphql.CollectedField, obj *model.StatusChange) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "StatusChange", - 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.EventType, 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.EventType) - fc.Result = res - return ec.marshalNEventType2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEventType(ctx, field.Selections, res) -} - -func (ec *executionContext) _StatusChange_ticket(ctx context.Context, field graphql.CollectedField, obj *model.StatusChange) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "StatusChange", - 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.StatusChange().Ticket(rctx, obj) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "TICKETS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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.Ticket); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/todo.sr.ht/api/graph/model.Ticket`, 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.Ticket) - fc.Result = res - return ec.marshalNTicket2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTicket(ctx, field.Selections, res) -} - -func (ec *executionContext) _StatusChange_editor(ctx context.Context, field graphql.CollectedField, obj *model.StatusChange) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "StatusChange", - 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.StatusChange().Editor(rctx, obj) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "PROFILE") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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/todo.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ᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEntity(ctx, field.Selections, res) -} - -func (ec *executionContext) _StatusChange_oldStatus(ctx context.Context, field graphql.CollectedField, obj *model.StatusChange) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "StatusChange", - 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.OldStatus, 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.TicketStatus) - fc.Result = res - return ec.marshalNTicketStatus2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTicketStatus(ctx, field.Selections, res) -} - -func (ec *executionContext) _StatusChange_newStatus(ctx context.Context, field graphql.CollectedField, obj *model.StatusChange) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "StatusChange", - 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.NewStatus, 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.TicketStatus) - fc.Result = res - return ec.marshalNTicketStatus2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTicketStatus(ctx, field.Selections, res) -} - -func (ec *executionContext) _StatusChange_oldResolution(ctx context.Context, field graphql.CollectedField, obj *model.StatusChange) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "StatusChange", - 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.OldResolution, 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.TicketResolution) - fc.Result = res - return ec.marshalNTicketResolution2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTicketResolution(ctx, field.Selections, res) -} - -func (ec *executionContext) _StatusChange_newResolution(ctx context.Context, field graphql.CollectedField, obj *model.StatusChange) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "StatusChange", - 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.NewResolution, 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.TicketResolution) - fc.Result = res - return ec.marshalNTicketResolution2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTicketResolution(ctx, field.Selections, res) -} - -func (ec *executionContext) _Ticket_id(ctx context.Context, field graphql.CollectedField, obj *model.Ticket) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Ticket", - 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) _Ticket_created(ctx context.Context, field graphql.CollectedField, obj *model.Ticket) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Ticket", - 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) _Ticket_updated(ctx context.Context, field graphql.CollectedField, obj *model.Ticket) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Ticket", - 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) _Ticket_submitter(ctx context.Context, field graphql.CollectedField, obj *model.Ticket) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Ticket", - 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.Ticket().Submitter(rctx, obj) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "PROFILE") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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/todo.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ᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEntity(ctx, field.Selections, res) -} - -func (ec *executionContext) _Ticket_tracker(ctx context.Context, field graphql.CollectedField, obj *model.Ticket) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Ticket", - 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.Ticket().Tracker(rctx, obj) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "TRACKERS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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.Tracker); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/todo.sr.ht/api/graph/model.Tracker`, 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.Tracker) - fc.Result = res - return ec.marshalNTracker2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTracker(ctx, field.Selections, res) -} - -func (ec *executionContext) _Ticket_ref(ctx context.Context, field graphql.CollectedField, obj *model.Ticket) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Ticket", - 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.Ref(), 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) _Ticket_subject(ctx context.Context, field graphql.CollectedField, obj *model.Ticket) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Ticket", - 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.Subject, 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) _Ticket_body(ctx context.Context, field graphql.CollectedField, obj *model.Ticket) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Ticket", - 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.Body, 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) _Ticket_status(ctx context.Context, field graphql.CollectedField, obj *model.Ticket) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Ticket", - 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.TicketStatus) - fc.Result = res - return ec.marshalNTicketStatus2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTicketStatus(ctx, field.Selections, res) -} - -func (ec *executionContext) _Ticket_resolution(ctx context.Context, field graphql.CollectedField, obj *model.Ticket) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Ticket", - 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.Resolution(), 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.TicketResolution) - fc.Result = res - return ec.marshalNTicketResolution2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTicketResolution(ctx, field.Selections, res) -} - -func (ec *executionContext) _Ticket_authenticity(ctx context.Context, field graphql.CollectedField, obj *model.Ticket) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Ticket", - 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.Authenticity(), 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.Authenticity) - fc.Result = res - return ec.marshalNAuthenticity2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAuthenticity(ctx, field.Selections, res) -} - -func (ec *executionContext) _Ticket_labels(ctx context.Context, field graphql.CollectedField, obj *model.Ticket) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Ticket", - 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.Ticket().Labels(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.Label) - fc.Result = res - return ec.marshalNLabel2ᚕᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐLabelᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) _Ticket_assignees(ctx context.Context, field graphql.CollectedField, obj *model.Ticket) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Ticket", - 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.Ticket().Assignees(rctx, obj) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "PROFILE") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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/todo.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.marshalNEntity2ᚕgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEntityᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) _Ticket_events(ctx context.Context, field graphql.CollectedField, obj *model.Ticket) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Ticket", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: true, - } - - ctx = graphql.WithFieldContext(ctx, fc) - rawArgs := field.ArgumentMap(ec.Variables) - args, err := ec.field_Ticket_events_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.Ticket().Events(rctx, obj, args["cursor"].(*model1.Cursor)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "EVENTS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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.EventCursor); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/todo.sr.ht/api/graph/model.EventCursor`, 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.EventCursor) - fc.Result = res - return ec.marshalNEventCursor2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEventCursor(ctx, field.Selections, res) -} - -func (ec *executionContext) _Ticket_subscription(ctx context.Context, field graphql.CollectedField, obj *model.Ticket) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Ticket", - 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.Ticket().Subscription(rctx, obj) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "SUBSCRIPTIONS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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.TicketSubscription); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/todo.sr.ht/api/graph/model.TicketSubscription`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.TicketSubscription) - fc.Result = res - return ec.marshalOTicketSubscription2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTicketSubscription(ctx, field.Selections, res) -} - -func (ec *executionContext) _TicketCursor_results(ctx context.Context, field graphql.CollectedField, obj *model.TicketCursor) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "TicketCursor", - 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.Ticket) - fc.Result = res - return ec.marshalNTicket2ᚕᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTicketᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) _TicketCursor_cursor(ctx context.Context, field graphql.CollectedField, obj *model.TicketCursor) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "TicketCursor", - 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) _TicketMention_eventType(ctx context.Context, field graphql.CollectedField, obj *model.TicketMention) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "TicketMention", - 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.EventType, 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.EventType) - fc.Result = res - return ec.marshalNEventType2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEventType(ctx, field.Selections, res) -} - -func (ec *executionContext) _TicketMention_ticket(ctx context.Context, field graphql.CollectedField, obj *model.TicketMention) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "TicketMention", - 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.TicketMention().Ticket(rctx, obj) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "TICKETS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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.Ticket); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/todo.sr.ht/api/graph/model.Ticket`, 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.Ticket) - fc.Result = res - return ec.marshalNTicket2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTicket(ctx, field.Selections, res) -} - -func (ec *executionContext) _TicketMention_author(ctx context.Context, field graphql.CollectedField, obj *model.TicketMention) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "TicketMention", - 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.TicketMention().Author(rctx, obj) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "PROFILE") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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/todo.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ᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEntity(ctx, field.Selections, res) -} - -func (ec *executionContext) _TicketMention_mentioned(ctx context.Context, field graphql.CollectedField, obj *model.TicketMention) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "TicketMention", - 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.TicketMention().Mentioned(rctx, obj) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "TICKETS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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.Ticket); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/todo.sr.ht/api/graph/model.Ticket`, 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.Ticket) - fc.Result = res - return ec.marshalNTicket2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTicket(ctx, field.Selections, res) -} - -func (ec *executionContext) _TicketSubscription_id(ctx context.Context, field graphql.CollectedField, obj *model.TicketSubscription) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "TicketSubscription", - 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) _TicketSubscription_created(ctx context.Context, field graphql.CollectedField, obj *model.TicketSubscription) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "TicketSubscription", - 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) _TicketSubscription_ticket(ctx context.Context, field graphql.CollectedField, obj *model.TicketSubscription) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "TicketSubscription", - 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.TicketSubscription().Ticket(rctx, obj) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "TICKETS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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.Ticket); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/todo.sr.ht/api/graph/model.Ticket`, 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.Ticket) - fc.Result = res - return ec.marshalNTicket2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTicket(ctx, field.Selections, res) -} - -func (ec *executionContext) _Tracker_id(ctx context.Context, field graphql.CollectedField, obj *model.Tracker) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Tracker", - 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) _Tracker_created(ctx context.Context, field graphql.CollectedField, obj *model.Tracker) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Tracker", - 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) _Tracker_updated(ctx context.Context, field graphql.CollectedField, obj *model.Tracker) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Tracker", - 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) _Tracker_owner(ctx context.Context, field graphql.CollectedField, obj *model.Tracker) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Tracker", - 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.Tracker().Owner(rctx, obj) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "PROFILE") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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/todo.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ᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEntity(ctx, field.Selections, res) -} - -func (ec *executionContext) _Tracker_name(ctx context.Context, field graphql.CollectedField, obj *model.Tracker) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Tracker", - 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) _Tracker_description(ctx context.Context, field graphql.CollectedField, obj *model.Tracker) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Tracker", - 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.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) _Tracker_visibility(ctx context.Context, field graphql.CollectedField, obj *model.Tracker) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Tracker", - 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.Visibility, 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.Visibility) - fc.Result = res - return ec.marshalNVisibility2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐVisibility(ctx, field.Selections, res) -} - -func (ec *executionContext) _Tracker_ticket(ctx context.Context, field graphql.CollectedField, obj *model.Tracker) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Tracker", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: true, - } - - ctx = graphql.WithFieldContext(ctx, fc) - rawArgs := field.ArgumentMap(ec.Variables) - args, err := ec.field_Tracker_ticket_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.Tracker().Ticket(rctx, obj, args["id"].(int)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "TICKETS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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.Ticket); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/todo.sr.ht/api/graph/model.Ticket`, 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.Ticket) - fc.Result = res - return ec.marshalNTicket2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTicket(ctx, field.Selections, res) -} - -func (ec *executionContext) _Tracker_tickets(ctx context.Context, field graphql.CollectedField, obj *model.Tracker) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Tracker", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: true, - } - - ctx = graphql.WithFieldContext(ctx, fc) - rawArgs := field.ArgumentMap(ec.Variables) - args, err := ec.field_Tracker_tickets_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.Tracker().Tickets(rctx, obj, args["cursor"].(*model1.Cursor)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "TICKETS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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.TicketCursor); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/todo.sr.ht/api/graph/model.TicketCursor`, 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.TicketCursor) - fc.Result = res - return ec.marshalNTicketCursor2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTicketCursor(ctx, field.Selections, res) -} - -func (ec *executionContext) _Tracker_labels(ctx context.Context, field graphql.CollectedField, obj *model.Tracker) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Tracker", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: true, - } - - ctx = graphql.WithFieldContext(ctx, fc) - rawArgs := field.ArgumentMap(ec.Variables) - args, err := ec.field_Tracker_labels_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.resolvers.Tracker().Labels(rctx, obj, args["cursor"].(*model1.Cursor)) - }) - 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.LabelCursor) - fc.Result = res - return ec.marshalNLabelCursor2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐLabelCursor(ctx, field.Selections, res) -} - -func (ec *executionContext) _Tracker_subscription(ctx context.Context, field graphql.CollectedField, obj *model.Tracker) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Tracker", - 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.Tracker().Subscription(rctx, obj) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "SUBSCRIPTIONS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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.TrackerSubscription); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/todo.sr.ht/api/graph/model.TrackerSubscription`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.TrackerSubscription) - fc.Result = res - return ec.marshalOTrackerSubscription2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTrackerSubscription(ctx, field.Selections, res) -} - -func (ec *executionContext) _Tracker_acl(ctx context.Context, field graphql.CollectedField, obj *model.Tracker) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Tracker", - 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.Tracker().ACL(rctx, obj) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(model.ACL) - fc.Result = res - return ec.marshalOACL2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐACL(ctx, field.Selections, res) -} - -func (ec *executionContext) _Tracker_defaultACL(ctx context.Context, field graphql.CollectedField, obj *model.Tracker) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Tracker", - 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.Tracker().DefaultACL(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.DefaultACL) - fc.Result = res - return ec.marshalNDefaultACL2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐDefaultACL(ctx, field.Selections, res) -} - -func (ec *executionContext) _Tracker_acls(ctx context.Context, field graphql.CollectedField, obj *model.Tracker) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Tracker", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: true, - } - - ctx = graphql.WithFieldContext(ctx, fc) - rawArgs := field.ArgumentMap(ec.Variables) - args, err := ec.field_Tracker_acls_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.Tracker().Acls(rctx, obj, args["cursor"].(*model1.Cursor)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "ACLS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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.ACLCursor); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/todo.sr.ht/api/graph/model.ACLCursor`, 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.ACLCursor) - fc.Result = res - return ec.marshalNACLCursor2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐACLCursor(ctx, field.Selections, res) -} - -func (ec *executionContext) _Tracker_export(ctx context.Context, field graphql.CollectedField, obj *model.Tracker) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Tracker", - 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.Tracker().Export(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.(string) - fc.Result = res - return ec.marshalNURL2string(ctx, field.Selections, res) -} - -func (ec *executionContext) _TrackerACL_id(ctx context.Context, field graphql.CollectedField, obj *model.TrackerACL) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "TrackerACL", - 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) _TrackerACL_created(ctx context.Context, field graphql.CollectedField, obj *model.TrackerACL) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "TrackerACL", - 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) _TrackerACL_tracker(ctx context.Context, field graphql.CollectedField, obj *model.TrackerACL) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "TrackerACL", - 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.TrackerACL().Tracker(rctx, obj) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "TRACKERS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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.Tracker); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/todo.sr.ht/api/graph/model.Tracker`, 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.Tracker) - fc.Result = res - return ec.marshalNTracker2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTracker(ctx, field.Selections, res) -} - -func (ec *executionContext) _TrackerACL_entity(ctx context.Context, field graphql.CollectedField, obj *model.TrackerACL) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "TrackerACL", - 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.TrackerACL().Entity(rctx, obj) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "PROFILE") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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/todo.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ᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEntity(ctx, field.Selections, res) -} - -func (ec *executionContext) _TrackerACL_browse(ctx context.Context, field graphql.CollectedField, obj *model.TrackerACL) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "TrackerACL", - 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.Browse, 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) _TrackerACL_submit(ctx context.Context, field graphql.CollectedField, obj *model.TrackerACL) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "TrackerACL", - 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.Submit, 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) _TrackerACL_comment(ctx context.Context, field graphql.CollectedField, obj *model.TrackerACL) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "TrackerACL", - 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.Comment, 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) _TrackerACL_edit(ctx context.Context, field graphql.CollectedField, obj *model.TrackerACL) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "TrackerACL", - 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.Edit, 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) _TrackerACL_triage(ctx context.Context, field graphql.CollectedField, obj *model.TrackerACL) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "TrackerACL", - 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.Triage, 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) _TrackerCursor_results(ctx context.Context, field graphql.CollectedField, obj *model.TrackerCursor) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "TrackerCursor", - 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.Tracker) - fc.Result = res - return ec.marshalNTracker2ᚕᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTrackerᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) _TrackerCursor_cursor(ctx context.Context, field graphql.CollectedField, obj *model.TrackerCursor) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "TrackerCursor", - 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) _TrackerSubscription_id(ctx context.Context, field graphql.CollectedField, obj *model.TrackerSubscription) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "TrackerSubscription", - 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) _TrackerSubscription_created(ctx context.Context, field graphql.CollectedField, obj *model.TrackerSubscription) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "TrackerSubscription", - 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) _TrackerSubscription_tracker(ctx context.Context, field graphql.CollectedField, obj *model.TrackerSubscription) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "TrackerSubscription", - 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.TrackerSubscription().Tracker(rctx, obj) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "TRACKERS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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.Tracker); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/todo.sr.ht/api/graph/model.Tracker`, 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.Tracker) - fc.Result = res - return ec.marshalNTracker2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTracker(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_trackers(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_trackers_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().Trackers(rctx, obj, args["cursor"].(*model1.Cursor)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "TRACKERS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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.TrackerCursor); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/todo.sr.ht/api/graph/model.TrackerCursor`, 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.TrackerCursor) - fc.Result = res - return ec.marshalNTrackerCursor2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTrackerCursor(ctx, field.Selections, res) -} - -func (ec *executionContext) _UserMention_eventType(ctx context.Context, field graphql.CollectedField, obj *model.UserMention) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "UserMention", - 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.EventType, 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.EventType) - fc.Result = res - return ec.marshalNEventType2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEventType(ctx, field.Selections, res) -} - -func (ec *executionContext) _UserMention_ticket(ctx context.Context, field graphql.CollectedField, obj *model.UserMention) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "UserMention", - 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.UserMention().Ticket(rctx, obj) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "TICKETS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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.Ticket); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/todo.sr.ht/api/graph/model.Ticket`, 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.Ticket) - fc.Result = res - return ec.marshalNTicket2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTicket(ctx, field.Selections, res) -} - -func (ec *executionContext) _UserMention_author(ctx context.Context, field graphql.CollectedField, obj *model.UserMention) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "UserMention", - 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.UserMention().Author(rctx, obj) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "PROFILE") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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/todo.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ᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEntity(ctx, field.Selections, res) -} - -func (ec *executionContext) _UserMention_mentioned(ctx context.Context, field graphql.CollectedField, obj *model.UserMention) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "UserMention", - 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.UserMention().Mentioned(rctx, obj) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "PROFILE") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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/todo.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ᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEntity(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) ___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: 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.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.marshalOString2string(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: 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.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.marshalOString2string(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: 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.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.marshalOString2string(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: 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.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.marshalOString2string(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_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.marshalOString2string(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) -} - -// endregion **************************** field.gotpl ***************************** - -// region **************************** input.gotpl ***************************** - -func (ec *executionContext) unmarshalInputACLInput(ctx context.Context, obj interface{}) (model.ACLInput, error) { - var it model.ACLInput - asMap := map[string]interface{}{} - for k, v := range obj.(map[string]interface{}) { - asMap[k] = v - } - - for k, v := range asMap { - switch k { - case "browse": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("browse")) - it.Browse, err = ec.unmarshalNBoolean2bool(ctx, v) - if err != nil { - return it, err - } - case "submit": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("submit")) - it.Submit, err = ec.unmarshalNBoolean2bool(ctx, v) - if err != nil { - return it, err - } - case "comment": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("comment")) - it.Comment, err = ec.unmarshalNBoolean2bool(ctx, v) - if err != nil { - return it, err - } - case "edit": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("edit")) - it.Edit, err = ec.unmarshalNBoolean2bool(ctx, v) - if err != nil { - return it, err - } - case "triage": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("triage")) - it.Triage, err = ec.unmarshalNBoolean2bool(ctx, v) - if err != nil { - return it, err - } - } - } - - return it, nil -} - -func (ec *executionContext) unmarshalInputImportInput(ctx context.Context, obj interface{}) (model.ImportInput, error) { - var it model.ImportInput - asMap := map[string]interface{}{} - for k, v := range obj.(map[string]interface{}) { - asMap[k] = v - } - - for k, v := range asMap { - switch k { - case "created": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("created")) - it.Created, err = ec.unmarshalNTime2timeᚐTime(ctx, v) - if err != nil { - return it, err - } - case "externalId": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("externalId")) - it.ExternalID, err = ec.unmarshalNString2string(ctx, v) - if err != nil { - return it, err - } - case "externalUrl": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("externalUrl")) - it.ExternalURL, err = ec.unmarshalNString2string(ctx, v) - if err != nil { - return it, err - } - } - } - - return it, nil -} - -func (ec *executionContext) unmarshalInputSubmitCommentInput(ctx context.Context, obj interface{}) (model.SubmitCommentInput, error) { - var it model.SubmitCommentInput - asMap := map[string]interface{}{} - for k, v := range obj.(map[string]interface{}) { - asMap[k] = v - } - - for k, v := range asMap { - switch k { - case "text": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("text")) - it.Text, err = ec.unmarshalNString2string(ctx, v) - if err != nil { - return it, err - } - case "status": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("status")) - it.Status, err = ec.unmarshalOTicketStatus2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTicketStatus(ctx, v) - if err != nil { - return it, err - } - case "resolution": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("resolution")) - it.Resolution, err = ec.unmarshalOTicketResolution2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTicketResolution(ctx, v) - if err != nil { - return it, err - } - case "import": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("import")) - it.Import, err = ec.unmarshalOImportInput2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐImportInput(ctx, v) - if err != nil { - return it, err - } - } - } - - return it, nil -} - -func (ec *executionContext) unmarshalInputSubmitTicketInput(ctx context.Context, obj interface{}) (model.SubmitTicketInput, error) { - var it model.SubmitTicketInput - asMap := map[string]interface{}{} - for k, v := range obj.(map[string]interface{}) { - asMap[k] = v - } - - for k, v := range asMap { - switch k { - case "subject": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("subject")) - it.Subject, err = ec.unmarshalNString2string(ctx, v) - if err != nil { - return it, err - } - case "body": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("body")) - it.Body, err = ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - case "created": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("created")) - it.Created, err = ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) - if err != nil { - return it, err - } - case "externalId": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("externalId")) - it.ExternalID, err = ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - case "externalUrl": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("externalUrl")) - it.ExternalURL, err = ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - } - } - - return it, nil -} - -func (ec *executionContext) unmarshalInputUpdateStatusInput(ctx context.Context, obj interface{}) (model.UpdateStatusInput, error) { - var it model.UpdateStatusInput - asMap := map[string]interface{}{} - for k, v := range obj.(map[string]interface{}) { - asMap[k] = v - } - - for k, v := range asMap { - switch k { - case "status": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("status")) - it.Status, err = ec.unmarshalNTicketStatus2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTicketStatus(ctx, v) - if err != nil { - return it, err - } - case "resolution": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("resolution")) - it.Resolution, err = ec.unmarshalOTicketResolution2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTicketResolution(ctx, v) - if err != nil { - return it, err - } - case "import": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("import")) - it.Import, err = ec.unmarshalOImportInput2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐImportInput(ctx, v) - if err != nil { - return it, err - } - } - } - - return it, nil -} - -// endregion **************************** input.gotpl ***************************** - -// region ************************** interface.gotpl *************************** - -func (ec *executionContext) _ACL(ctx context.Context, sel ast.SelectionSet, obj model.ACL) graphql.Marshaler { - switch obj := (obj).(type) { - case nil: - return graphql.Null - case model.TrackerACL: - return ec._TrackerACL(ctx, sel, &obj) - case *model.TrackerACL: - if obj == nil { - return graphql.Null - } - return ec._TrackerACL(ctx, sel, obj) - case model.DefaultACL: - return ec._DefaultACL(ctx, sel, &obj) - case *model.DefaultACL: - if obj == nil { - return graphql.Null - } - return ec._DefaultACL(ctx, sel, obj) - default: - panic(fmt.Errorf("unexpected type %T", obj)) - } -} - -func (ec *executionContext) _ActivitySubscription(ctx context.Context, sel ast.SelectionSet, obj model.ActivitySubscription) graphql.Marshaler { - switch obj := (obj).(type) { - case nil: - return graphql.Null - case model.TrackerSubscription: - return ec._TrackerSubscription(ctx, sel, &obj) - case *model.TrackerSubscription: - if obj == nil { - return graphql.Null - } - return ec._TrackerSubscription(ctx, sel, obj) - case model.TicketSubscription: - return ec._TicketSubscription(ctx, sel, &obj) - case *model.TicketSubscription: - if obj == nil { - return graphql.Null - } - return ec._TicketSubscription(ctx, sel, obj) - default: - panic(fmt.Errorf("unexpected type %T", obj)) - } -} - -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) - case model.EmailAddress: - return ec._EmailAddress(ctx, sel, &obj) - case *model.EmailAddress: - if obj == nil { - return graphql.Null - } - return ec._EmailAddress(ctx, sel, obj) - case model.ExternalUser: - return ec._ExternalUser(ctx, sel, &obj) - case *model.ExternalUser: - if obj == nil { - return graphql.Null - } - return ec._ExternalUser(ctx, sel, obj) - default: - panic(fmt.Errorf("unexpected type %T", obj)) - } -} - -func (ec *executionContext) _EventDetail(ctx context.Context, sel ast.SelectionSet, obj model.EventDetail) graphql.Marshaler { - switch obj := (obj).(type) { - case nil: - return graphql.Null - case model.Created: - return ec._Created(ctx, sel, &obj) - case *model.Created: - if obj == nil { - return graphql.Null - } - return ec._Created(ctx, sel, obj) - case model.Assignment: - return ec._Assignment(ctx, sel, &obj) - case *model.Assignment: - if obj == nil { - return graphql.Null - } - return ec._Assignment(ctx, sel, obj) - case model.Comment: - return ec._Comment(ctx, sel, &obj) - case *model.Comment: - if obj == nil { - return graphql.Null - } - return ec._Comment(ctx, sel, obj) - case model.LabelUpdate: - return ec._LabelUpdate(ctx, sel, &obj) - case *model.LabelUpdate: - if obj == nil { - return graphql.Null - } - return ec._LabelUpdate(ctx, sel, obj) - case model.StatusChange: - return ec._StatusChange(ctx, sel, &obj) - case *model.StatusChange: - if obj == nil { - return graphql.Null - } - return ec._StatusChange(ctx, sel, obj) - case model.UserMention: - return ec._UserMention(ctx, sel, &obj) - case *model.UserMention: - if obj == nil { - return graphql.Null - } - return ec._UserMention(ctx, sel, obj) - case model.TicketMention: - return ec._TicketMention(ctx, sel, &obj) - case *model.TicketMention: - if obj == nil { - return graphql.Null - } - return ec._TicketMention(ctx, sel, obj) - default: - panic(fmt.Errorf("unexpected type %T", obj)) - } -} - -// endregion ************************** interface.gotpl *************************** - -// region **************************** object.gotpl **************************** - -var aCLCursorImplementors = []string{"ACLCursor"} - -func (ec *executionContext) _ACLCursor(ctx context.Context, sel ast.SelectionSet, obj *model.ACLCursor) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, aCLCursorImplementors) - - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("ACLCursor") - case "results": - out.Values[i] = ec._ACLCursor_results(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalids++ - } - case "cursor": - out.Values[i] = ec._ACLCursor_cursor(ctx, field, obj) - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch() - if invalids > 0 { - return graphql.Null - } - return out -} - -var activitySubscriptionCursorImplementors = []string{"ActivitySubscriptionCursor"} - -func (ec *executionContext) _ActivitySubscriptionCursor(ctx context.Context, sel ast.SelectionSet, obj *model.ActivitySubscriptionCursor) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, activitySubscriptionCursorImplementors) - - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("ActivitySubscriptionCursor") - case "results": - out.Values[i] = ec._ActivitySubscriptionCursor_results(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalids++ - } - case "cursor": - out.Values[i] = ec._ActivitySubscriptionCursor_cursor(ctx, field, obj) - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch() - if invalids > 0 { - return graphql.Null - } - return out -} - -var assignmentImplementors = []string{"Assignment", "EventDetail"} - -func (ec *executionContext) _Assignment(ctx context.Context, sel ast.SelectionSet, obj *model.Assignment) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, assignmentImplementors) - - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("Assignment") - case "eventType": - out.Values[i] = ec._Assignment_eventType(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "ticket": - field := field - out.Concurrently(i, func() (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Assignment_ticket(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - case "assigner": - field := field - out.Concurrently(i, func() (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Assignment_assigner(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - case "assignee": - field := field - out.Concurrently(i, func() (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Assignment_assignee(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch() - if invalids > 0 { - return graphql.Null - } - return out -} - -var commentImplementors = []string{"Comment", "EventDetail"} - -func (ec *executionContext) _Comment(ctx context.Context, sel ast.SelectionSet, obj *model.Comment) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, commentImplementors) - - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("Comment") - case "eventType": - out.Values[i] = ec._Comment_eventType(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "ticket": - field := field - out.Concurrently(i, func() (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Comment_ticket(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - case "author": - field := field - out.Concurrently(i, func() (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Comment_author(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - case "text": - field := field - out.Concurrently(i, func() (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Comment_text(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - case "authenticity": - field := field - out.Concurrently(i, func() (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Comment_authenticity(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - case "supersededBy": - field := field - out.Concurrently(i, func() (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Comment_supersededBy(ctx, field, obj) - return res - }) - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch() - if invalids > 0 { - return graphql.Null - } - return out -} - -var createdImplementors = []string{"Created", "EventDetail"} - -func (ec *executionContext) _Created(ctx context.Context, sel ast.SelectionSet, obj *model.Created) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, createdImplementors) - - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("Created") - case "eventType": - out.Values[i] = ec._Created_eventType(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "ticket": - field := field - out.Concurrently(i, func() (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Created_ticket(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - case "author": - field := field - out.Concurrently(i, func() (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Created_author(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch() - if invalids > 0 { - return graphql.Null - } - return out -} - -var defaultACLImplementors = []string{"DefaultACL", "ACL"} - -func (ec *executionContext) _DefaultACL(ctx context.Context, sel ast.SelectionSet, obj *model.DefaultACL) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, defaultACLImplementors) - - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("DefaultACL") - case "browse": - out.Values[i] = ec._DefaultACL_browse(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalids++ - } - case "submit": - out.Values[i] = ec._DefaultACL_submit(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalids++ - } - case "comment": - out.Values[i] = ec._DefaultACL_comment(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalids++ - } - case "edit": - out.Values[i] = ec._DefaultACL_edit(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalids++ - } - case "triage": - out.Values[i] = ec._DefaultACL_triage(ctx, field, obj) - 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 emailAddressImplementors = []string{"EmailAddress", "Entity"} - -func (ec *executionContext) _EmailAddress(ctx context.Context, sel ast.SelectionSet, obj *model.EmailAddress) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, emailAddressImplementors) - - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("EmailAddress") - case "canonicalName": - out.Values[i] = ec._EmailAddress_canonicalName(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalids++ - } - case "mailbox": - out.Values[i] = ec._EmailAddress_mailbox(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalids++ - } - case "name": - out.Values[i] = ec._EmailAddress_name(ctx, field, obj) - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch() - if invalids > 0 { - return graphql.Null - } - return out -} - -var eventImplementors = []string{"Event"} - -func (ec *executionContext) _Event(ctx context.Context, sel ast.SelectionSet, obj *model.Event) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, eventImplementors) - - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("Event") - case "id": - out.Values[i] = ec._Event_id(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "created": - out.Values[i] = ec._Event_created(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "changes": - out.Values[i] = ec._Event_changes(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "ticket": - field := field - out.Concurrently(i, func() (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Event_ticket(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch() - if invalids > 0 { - return graphql.Null - } - return out -} - -var eventCursorImplementors = []string{"EventCursor"} - -func (ec *executionContext) _EventCursor(ctx context.Context, sel ast.SelectionSet, obj *model.EventCursor) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, eventCursorImplementors) - - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("EventCursor") - case "results": - out.Values[i] = ec._EventCursor_results(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalids++ - } - case "cursor": - out.Values[i] = ec._EventCursor_cursor(ctx, field, obj) - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch() - if invalids > 0 { - return graphql.Null - } - return out -} - -var externalUserImplementors = []string{"ExternalUser", "Entity"} - -func (ec *executionContext) _ExternalUser(ctx context.Context, sel ast.SelectionSet, obj *model.ExternalUser) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, externalUserImplementors) - - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("ExternalUser") - case "canonicalName": - out.Values[i] = ec._ExternalUser_canonicalName(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalids++ - } - case "externalId": - out.Values[i] = ec._ExternalUser_externalId(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalids++ - } - case "externalUrl": - out.Values[i] = ec._ExternalUser_externalUrl(ctx, field, obj) - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch() - if invalids > 0 { - return graphql.Null - } - return out -} - -var labelImplementors = []string{"Label"} - -func (ec *executionContext) _Label(ctx context.Context, sel ast.SelectionSet, obj *model.Label) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, labelImplementors) - - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("Label") - case "id": - out.Values[i] = ec._Label_id(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "created": - out.Values[i] = ec._Label_created(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "name": - out.Values[i] = ec._Label_name(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "tracker": - field := field - out.Concurrently(i, func() (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Label_tracker(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - case "backgroundColor": - out.Values[i] = ec._Label_backgroundColor(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "foregroundColor": - out.Values[i] = ec._Label_foregroundColor(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "tickets": - field := field - out.Concurrently(i, func() (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Label_tickets(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch() - if invalids > 0 { - return graphql.Null - } - return out -} - -var labelCursorImplementors = []string{"LabelCursor"} - -func (ec *executionContext) _LabelCursor(ctx context.Context, sel ast.SelectionSet, obj *model.LabelCursor) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, labelCursorImplementors) - - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("LabelCursor") - case "results": - out.Values[i] = ec._LabelCursor_results(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalids++ - } - case "cursor": - out.Values[i] = ec._LabelCursor_cursor(ctx, field, obj) - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch() - if invalids > 0 { - return graphql.Null - } - return out -} - -var labelUpdateImplementors = []string{"LabelUpdate", "EventDetail"} - -func (ec *executionContext) _LabelUpdate(ctx context.Context, sel ast.SelectionSet, obj *model.LabelUpdate) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, labelUpdateImplementors) - - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("LabelUpdate") - case "eventType": - out.Values[i] = ec._LabelUpdate_eventType(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "ticket": - field := field - out.Concurrently(i, func() (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._LabelUpdate_ticket(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - case "labeler": - field := field - out.Concurrently(i, func() (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._LabelUpdate_labeler(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - case "label": - field := field - out.Concurrently(i, func() (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._LabelUpdate_label(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - 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 { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("Mutation") - case "createTracker": - out.Values[i] = ec._Mutation_createTracker(ctx, field) - case "updateTracker": - out.Values[i] = ec._Mutation_updateTracker(ctx, field) - case "deleteTracker": - out.Values[i] = ec._Mutation_deleteTracker(ctx, field) - case "updateUserACL": - out.Values[i] = ec._Mutation_updateUserACL(ctx, field) - case "updateTrackerACL": - out.Values[i] = ec._Mutation_updateTrackerACL(ctx, field) - case "deleteACL": - out.Values[i] = ec._Mutation_deleteACL(ctx, field) - case "trackerSubscribe": - out.Values[i] = ec._Mutation_trackerSubscribe(ctx, field) - case "trackerUnsubscribe": - out.Values[i] = ec._Mutation_trackerUnsubscribe(ctx, field) - case "ticketSubscribe": - out.Values[i] = ec._Mutation_ticketSubscribe(ctx, field) - case "ticketUnsubscribe": - out.Values[i] = ec._Mutation_ticketUnsubscribe(ctx, field) - case "createLabel": - out.Values[i] = ec._Mutation_createLabel(ctx, field) - case "updateLabel": - out.Values[i] = ec._Mutation_updateLabel(ctx, field) - case "deleteLabel": - out.Values[i] = ec._Mutation_deleteLabel(ctx, field) - case "submitTicket": - out.Values[i] = ec._Mutation_submitTicket(ctx, field) - case "updateTicket": - out.Values[i] = ec._Mutation_updateTicket(ctx, field) - case "updateTicketStatus": - out.Values[i] = ec._Mutation_updateTicketStatus(ctx, field) - case "submitComment": - out.Values[i] = ec._Mutation_submitComment(ctx, field) - case "assignUser": - out.Values[i] = ec._Mutation_assignUser(ctx, field) - case "unassignUser": - out.Values[i] = ec._Mutation_unassignUser(ctx, field) - case "labelTicket": - out.Values[i] = ec._Mutation_labelTicket(ctx, field) - case "unlabelTicket": - out.Values[i] = ec._Mutation_unlabelTicket(ctx, field) - 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 { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("Query") - case "version": - field := field - out.Concurrently(i, func() (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Query_version(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - case "me": - field := field - out.Concurrently(i, func() (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Query_me(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - case "user": - field := field - out.Concurrently(i, func() (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Query_user(ctx, field) - return res - }) - case "trackers": - field := field - out.Concurrently(i, func() (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Query_trackers(ctx, field) - return res - }) - case "tracker": - field := field - out.Concurrently(i, func() (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Query_tracker(ctx, field) - return res - }) - case "trackerByName": - field := field - out.Concurrently(i, func() (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Query_trackerByName(ctx, field) - return res - }) - case "trackerByOwner": - field := field - out.Concurrently(i, func() (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Query_trackerByOwner(ctx, field) - return res - }) - case "events": - field := field - out.Concurrently(i, func() (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Query_events(ctx, field) - return res - }) - case "subscriptions": - field := field - out.Concurrently(i, func() (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Query_subscriptions(ctx, field) - return res - }) - case "__type": - out.Values[i] = ec._Query___type(ctx, field) - case "__schema": - out.Values[i] = ec._Query___schema(ctx, field) - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch() - if invalids > 0 { - return graphql.Null - } - return out -} - -var statusChangeImplementors = []string{"StatusChange", "EventDetail"} - -func (ec *executionContext) _StatusChange(ctx context.Context, sel ast.SelectionSet, obj *model.StatusChange) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, statusChangeImplementors) - - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("StatusChange") - case "eventType": - out.Values[i] = ec._StatusChange_eventType(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "ticket": - field := field - out.Concurrently(i, func() (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._StatusChange_ticket(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - case "editor": - field := field - out.Concurrently(i, func() (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._StatusChange_editor(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - case "oldStatus": - out.Values[i] = ec._StatusChange_oldStatus(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "newStatus": - out.Values[i] = ec._StatusChange_newStatus(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "oldResolution": - out.Values[i] = ec._StatusChange_oldResolution(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "newResolution": - out.Values[i] = ec._StatusChange_newResolution(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch() - if invalids > 0 { - return graphql.Null - } - return out -} - -var ticketImplementors = []string{"Ticket"} - -func (ec *executionContext) _Ticket(ctx context.Context, sel ast.SelectionSet, obj *model.Ticket) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, ticketImplementors) - - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("Ticket") - case "id": - out.Values[i] = ec._Ticket_id(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "created": - out.Values[i] = ec._Ticket_created(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "updated": - out.Values[i] = ec._Ticket_updated(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "submitter": - field := field - out.Concurrently(i, func() (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Ticket_submitter(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - case "tracker": - field := field - out.Concurrently(i, func() (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Ticket_tracker(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - case "ref": - out.Values[i] = ec._Ticket_ref(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "subject": - out.Values[i] = ec._Ticket_subject(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "body": - out.Values[i] = ec._Ticket_body(ctx, field, obj) - case "status": - out.Values[i] = ec._Ticket_status(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "resolution": - out.Values[i] = ec._Ticket_resolution(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "authenticity": - out.Values[i] = ec._Ticket_authenticity(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "labels": - field := field - out.Concurrently(i, func() (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Ticket_labels(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - case "assignees": - field := field - out.Concurrently(i, func() (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Ticket_assignees(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - case "events": - field := field - out.Concurrently(i, func() (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Ticket_events(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - case "subscription": - field := field - out.Concurrently(i, func() (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Ticket_subscription(ctx, field, obj) - return res - }) - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch() - if invalids > 0 { - return graphql.Null - } - return out -} - -var ticketCursorImplementors = []string{"TicketCursor"} - -func (ec *executionContext) _TicketCursor(ctx context.Context, sel ast.SelectionSet, obj *model.TicketCursor) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, ticketCursorImplementors) - - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("TicketCursor") - case "results": - out.Values[i] = ec._TicketCursor_results(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalids++ - } - case "cursor": - out.Values[i] = ec._TicketCursor_cursor(ctx, field, obj) - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch() - if invalids > 0 { - return graphql.Null - } - return out -} - -var ticketMentionImplementors = []string{"TicketMention", "EventDetail"} - -func (ec *executionContext) _TicketMention(ctx context.Context, sel ast.SelectionSet, obj *model.TicketMention) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, ticketMentionImplementors) - - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("TicketMention") - case "eventType": - out.Values[i] = ec._TicketMention_eventType(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "ticket": - field := field - out.Concurrently(i, func() (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._TicketMention_ticket(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - case "author": - field := field - out.Concurrently(i, func() (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._TicketMention_author(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - case "mentioned": - field := field - out.Concurrently(i, func() (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._TicketMention_mentioned(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch() - if invalids > 0 { - return graphql.Null - } - return out -} - -var ticketSubscriptionImplementors = []string{"TicketSubscription", "ActivitySubscription"} - -func (ec *executionContext) _TicketSubscription(ctx context.Context, sel ast.SelectionSet, obj *model.TicketSubscription) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, ticketSubscriptionImplementors) - - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("TicketSubscription") - case "id": - out.Values[i] = ec._TicketSubscription_id(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "created": - out.Values[i] = ec._TicketSubscription_created(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "ticket": - field := field - out.Concurrently(i, func() (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._TicketSubscription_ticket(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch() - if invalids > 0 { - return graphql.Null - } - return out -} - -var trackerImplementors = []string{"Tracker"} - -func (ec *executionContext) _Tracker(ctx context.Context, sel ast.SelectionSet, obj *model.Tracker) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, trackerImplementors) - - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("Tracker") - case "id": - out.Values[i] = ec._Tracker_id(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "created": - out.Values[i] = ec._Tracker_created(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "updated": - out.Values[i] = ec._Tracker_updated(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "owner": - field := field - out.Concurrently(i, func() (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Tracker_owner(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - case "name": - out.Values[i] = ec._Tracker_name(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "description": - out.Values[i] = ec._Tracker_description(ctx, field, obj) - case "visibility": - out.Values[i] = ec._Tracker_visibility(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "ticket": - field := field - out.Concurrently(i, func() (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Tracker_ticket(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - case "tickets": - field := field - out.Concurrently(i, func() (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Tracker_tickets(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - case "labels": - field := field - out.Concurrently(i, func() (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Tracker_labels(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - case "subscription": - field := field - out.Concurrently(i, func() (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Tracker_subscription(ctx, field, obj) - return res - }) - case "acl": - field := field - out.Concurrently(i, func() (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Tracker_acl(ctx, field, obj) - return res - }) - case "defaultACL": - field := field - out.Concurrently(i, func() (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Tracker_defaultACL(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - case "acls": - field := field - out.Concurrently(i, func() (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Tracker_acls(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - case "export": - field := field - out.Concurrently(i, func() (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Tracker_export(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch() - if invalids > 0 { - return graphql.Null - } - return out -} - -var trackerACLImplementors = []string{"TrackerACL", "ACL"} - -func (ec *executionContext) _TrackerACL(ctx context.Context, sel ast.SelectionSet, obj *model.TrackerACL) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, trackerACLImplementors) - - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("TrackerACL") - case "id": - out.Values[i] = ec._TrackerACL_id(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "created": - out.Values[i] = ec._TrackerACL_created(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "tracker": - field := field - out.Concurrently(i, func() (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._TrackerACL_tracker(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - case "entity": - field := field - out.Concurrently(i, func() (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._TrackerACL_entity(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - case "browse": - out.Values[i] = ec._TrackerACL_browse(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "submit": - out.Values[i] = ec._TrackerACL_submit(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "comment": - out.Values[i] = ec._TrackerACL_comment(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "edit": - out.Values[i] = ec._TrackerACL_edit(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "triage": - out.Values[i] = ec._TrackerACL_triage(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch() - if invalids > 0 { - return graphql.Null - } - return out -} - -var trackerCursorImplementors = []string{"TrackerCursor"} - -func (ec *executionContext) _TrackerCursor(ctx context.Context, sel ast.SelectionSet, obj *model.TrackerCursor) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, trackerCursorImplementors) - - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("TrackerCursor") - case "results": - out.Values[i] = ec._TrackerCursor_results(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalids++ - } - case "cursor": - out.Values[i] = ec._TrackerCursor_cursor(ctx, field, obj) - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch() - if invalids > 0 { - return graphql.Null - } - return out -} - -var trackerSubscriptionImplementors = []string{"TrackerSubscription", "ActivitySubscription"} - -func (ec *executionContext) _TrackerSubscription(ctx context.Context, sel ast.SelectionSet, obj *model.TrackerSubscription) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, trackerSubscriptionImplementors) - - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("TrackerSubscription") - case "id": - out.Values[i] = ec._TrackerSubscription_id(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "created": - out.Values[i] = ec._TrackerSubscription_created(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "tracker": - field := field - out.Concurrently(i, func() (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._TrackerSubscription_tracker(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - 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": - out.Values[i] = ec._User_id(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "created": - out.Values[i] = ec._User_created(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "updated": - out.Values[i] = ec._User_updated(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "canonicalName": - out.Values[i] = ec._User_canonicalName(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "username": - out.Values[i] = ec._User_username(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "email": - out.Values[i] = ec._User_email(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "url": - out.Values[i] = ec._User_url(ctx, field, obj) - case "location": - out.Values[i] = ec._User_location(ctx, field, obj) - case "bio": - out.Values[i] = ec._User_bio(ctx, field, obj) - case "trackers": - field := field - out.Concurrently(i, func() (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._User_trackers(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch() - if invalids > 0 { - return graphql.Null - } - return out -} - -var userMentionImplementors = []string{"UserMention", "EventDetail"} - -func (ec *executionContext) _UserMention(ctx context.Context, sel ast.SelectionSet, obj *model.UserMention) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, userMentionImplementors) - - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("UserMention") - case "eventType": - out.Values[i] = ec._UserMention_eventType(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "ticket": - field := field - out.Concurrently(i, func() (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._UserMention_ticket(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - case "author": - field := field - out.Concurrently(i, func() (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._UserMention_author(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - case "mentioned": - field := field - out.Concurrently(i, func() (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._UserMention_mentioned(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - 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": - out.Values[i] = ec._Version_major(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalids++ - } - case "minor": - out.Values[i] = ec._Version_minor(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalids++ - } - case "patch": - out.Values[i] = ec._Version_patch(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalids++ - } - case "deprecationDate": - out.Values[i] = ec._Version_deprecationDate(ctx, field, obj) - 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": - out.Values[i] = ec.___Directive_name(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalids++ - } - case "description": - out.Values[i] = ec.___Directive_description(ctx, field, obj) - case "locations": - out.Values[i] = ec.___Directive_locations(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalids++ - } - case "args": - out.Values[i] = ec.___Directive_args(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalids++ - } - case "isRepeatable": - out.Values[i] = ec.___Directive_isRepeatable(ctx, field, obj) - 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": - out.Values[i] = ec.___EnumValue_name(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalids++ - } - case "description": - out.Values[i] = ec.___EnumValue_description(ctx, field, obj) - case "isDeprecated": - out.Values[i] = ec.___EnumValue_isDeprecated(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalids++ - } - case "deprecationReason": - out.Values[i] = ec.___EnumValue_deprecationReason(ctx, field, obj) - 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": - out.Values[i] = ec.___Field_name(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalids++ - } - case "description": - out.Values[i] = ec.___Field_description(ctx, field, obj) - case "args": - out.Values[i] = ec.___Field_args(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalids++ - } - case "type": - out.Values[i] = ec.___Field_type(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalids++ - } - case "isDeprecated": - out.Values[i] = ec.___Field_isDeprecated(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalids++ - } - case "deprecationReason": - out.Values[i] = ec.___Field_deprecationReason(ctx, field, obj) - 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": - out.Values[i] = ec.___InputValue_name(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalids++ - } - case "description": - out.Values[i] = ec.___InputValue_description(ctx, field, obj) - case "type": - out.Values[i] = ec.___InputValue_type(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalids++ - } - case "defaultValue": - out.Values[i] = ec.___InputValue_defaultValue(ctx, field, obj) - 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 "types": - out.Values[i] = ec.___Schema_types(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalids++ - } - case "queryType": - out.Values[i] = ec.___Schema_queryType(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalids++ - } - case "mutationType": - out.Values[i] = ec.___Schema_mutationType(ctx, field, obj) - case "subscriptionType": - out.Values[i] = ec.___Schema_subscriptionType(ctx, field, obj) - case "directives": - out.Values[i] = ec.___Schema_directives(ctx, field, obj) - 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": - out.Values[i] = ec.___Type_kind(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalids++ - } - case "name": - out.Values[i] = ec.___Type_name(ctx, field, obj) - case "description": - out.Values[i] = ec.___Type_description(ctx, field, obj) - case "fields": - out.Values[i] = ec.___Type_fields(ctx, field, obj) - case "interfaces": - out.Values[i] = ec.___Type_interfaces(ctx, field, obj) - case "possibleTypes": - out.Values[i] = ec.___Type_possibleTypes(ctx, field, obj) - case "enumValues": - out.Values[i] = ec.___Type_enumValues(ctx, field, obj) - case "inputFields": - out.Values[i] = ec.___Type_inputFields(ctx, field, obj) - case "ofType": - out.Values[i] = ec.___Type_ofType(ctx, field, obj) - 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) marshalNACLCursor2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐACLCursor(ctx context.Context, sel ast.SelectionSet, v model.ACLCursor) graphql.Marshaler { - return ec._ACLCursor(ctx, sel, &v) -} - -func (ec *executionContext) marshalNACLCursor2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐACLCursor(ctx context.Context, sel ast.SelectionSet, v *model.ACLCursor) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - return ec._ACLCursor(ctx, sel, v) -} - -func (ec *executionContext) unmarshalNACLInput2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐACLInput(ctx context.Context, v interface{}) (model.ACLInput, error) { - res, err := ec.unmarshalInputACLInput(ctx, v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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ᚋtodoᚗ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ᚋtodoᚗ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ᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx context.Context, sel ast.SelectionSet, v model.AccessScope) graphql.Marshaler { - return v -} - -func (ec *executionContext) marshalNActivitySubscription2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐActivitySubscription(ctx context.Context, sel ast.SelectionSet, v model.ActivitySubscription) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - return ec._ActivitySubscription(ctx, sel, v) -} - -func (ec *executionContext) marshalNActivitySubscription2ᚕgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐActivitySubscriptionᚄ(ctx context.Context, sel ast.SelectionSet, v []model.ActivitySubscription) 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.marshalNActivitySubscription2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐActivitySubscription(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) unmarshalNAuthenticity2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAuthenticity(ctx context.Context, v interface{}) (model.Authenticity, error) { - var res model.Authenticity - err := res.UnmarshalGQL(v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalNAuthenticity2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAuthenticity(ctx context.Context, sel ast.SelectionSet, v model.Authenticity) graphql.Marshaler { - return v -} - -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) marshalNDefaultACL2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐDefaultACL(ctx context.Context, sel ast.SelectionSet, v model.DefaultACL) graphql.Marshaler { - return ec._DefaultACL(ctx, sel, &v) -} - -func (ec *executionContext) marshalNDefaultACL2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐDefaultACL(ctx context.Context, sel ast.SelectionSet, v *model.DefaultACL) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - return ec._DefaultACL(ctx, sel, v) -} - -func (ec *executionContext) marshalNEntity2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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) marshalNEntity2ᚕgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEntityᚄ(ctx context.Context, sel ast.SelectionSet, v []model.Entity) 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.marshalNEntity2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEntity(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) marshalNEvent2ᚕᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEventᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.Event) 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.marshalNEvent2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEvent(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) marshalNEvent2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEvent(ctx context.Context, sel ast.SelectionSet, v *model.Event) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - return ec._Event(ctx, sel, v) -} - -func (ec *executionContext) marshalNEventCursor2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEventCursor(ctx context.Context, sel ast.SelectionSet, v model.EventCursor) graphql.Marshaler { - return ec._EventCursor(ctx, sel, &v) -} - -func (ec *executionContext) marshalNEventCursor2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEventCursor(ctx context.Context, sel ast.SelectionSet, v *model.EventCursor) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - return ec._EventCursor(ctx, sel, v) -} - -func (ec *executionContext) marshalNEventDetail2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEventDetail(ctx context.Context, sel ast.SelectionSet, v model.EventDetail) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - return ec._EventDetail(ctx, sel, v) -} - -func (ec *executionContext) marshalNEventDetail2ᚕgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEventDetailᚄ(ctx context.Context, sel ast.SelectionSet, v []model.EventDetail) 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.marshalNEventDetail2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEventDetail(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) unmarshalNEventType2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEventType(ctx context.Context, v interface{}) (model.EventType, error) { - var res model.EventType - err := res.UnmarshalGQL(v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalNEventType2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEventType(ctx context.Context, sel ast.SelectionSet, v model.EventType) graphql.Marshaler { - return v -} - -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) marshalNLabel2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐLabel(ctx context.Context, sel ast.SelectionSet, v model.Label) graphql.Marshaler { - return ec._Label(ctx, sel, &v) -} - -func (ec *executionContext) marshalNLabel2ᚕᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐLabelᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.Label) 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.marshalNLabel2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐLabel(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) marshalNLabel2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐLabel(ctx context.Context, sel ast.SelectionSet, v *model.Label) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - return ec._Label(ctx, sel, v) -} - -func (ec *executionContext) marshalNLabelCursor2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐLabelCursor(ctx context.Context, sel ast.SelectionSet, v model.LabelCursor) graphql.Marshaler { - return ec._LabelCursor(ctx, sel, &v) -} - -func (ec *executionContext) marshalNLabelCursor2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐLabelCursor(ctx context.Context, sel ast.SelectionSet, v *model.LabelCursor) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - return ec._LabelCursor(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) unmarshalNSubmitCommentInput2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐSubmitCommentInput(ctx context.Context, v interface{}) (model.SubmitCommentInput, error) { - res, err := ec.unmarshalInputSubmitCommentInput(ctx, v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) unmarshalNSubmitTicketInput2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐSubmitTicketInput(ctx context.Context, v interface{}) (model.SubmitTicketInput, error) { - res, err := ec.unmarshalInputSubmitTicketInput(ctx, v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalNTicket2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTicket(ctx context.Context, sel ast.SelectionSet, v model.Ticket) graphql.Marshaler { - return ec._Ticket(ctx, sel, &v) -} - -func (ec *executionContext) marshalNTicket2ᚕᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTicketᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.Ticket) 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.marshalNTicket2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTicket(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) marshalNTicket2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTicket(ctx context.Context, sel ast.SelectionSet, v *model.Ticket) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - return ec._Ticket(ctx, sel, v) -} - -func (ec *executionContext) marshalNTicketCursor2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTicketCursor(ctx context.Context, sel ast.SelectionSet, v model.TicketCursor) graphql.Marshaler { - return ec._TicketCursor(ctx, sel, &v) -} - -func (ec *executionContext) marshalNTicketCursor2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTicketCursor(ctx context.Context, sel ast.SelectionSet, v *model.TicketCursor) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - return ec._TicketCursor(ctx, sel, v) -} - -func (ec *executionContext) unmarshalNTicketResolution2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTicketResolution(ctx context.Context, v interface{}) (model.TicketResolution, error) { - var res model.TicketResolution - err := res.UnmarshalGQL(v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalNTicketResolution2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTicketResolution(ctx context.Context, sel ast.SelectionSet, v model.TicketResolution) graphql.Marshaler { - return v -} - -func (ec *executionContext) unmarshalNTicketStatus2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTicketStatus(ctx context.Context, v interface{}) (model.TicketStatus, error) { - var res model.TicketStatus - err := res.UnmarshalGQL(v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalNTicketStatus2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTicketStatus(ctx context.Context, sel ast.SelectionSet, v model.TicketStatus) 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) marshalNTracker2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTracker(ctx context.Context, sel ast.SelectionSet, v model.Tracker) graphql.Marshaler { - return ec._Tracker(ctx, sel, &v) -} - -func (ec *executionContext) marshalNTracker2ᚕᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTrackerᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.Tracker) 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.marshalNTracker2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTracker(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) marshalNTracker2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTracker(ctx context.Context, sel ast.SelectionSet, v *model.Tracker) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - return ec._Tracker(ctx, sel, v) -} - -func (ec *executionContext) marshalNTrackerACL2ᚕᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTrackerACLᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.TrackerACL) 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.marshalNTrackerACL2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTrackerACL(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) marshalNTrackerACL2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTrackerACL(ctx context.Context, sel ast.SelectionSet, v *model.TrackerACL) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - return ec._TrackerACL(ctx, sel, v) -} - -func (ec *executionContext) marshalNTrackerCursor2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTrackerCursor(ctx context.Context, sel ast.SelectionSet, v model.TrackerCursor) graphql.Marshaler { - return ec._TrackerCursor(ctx, sel, &v) -} - -func (ec *executionContext) marshalNTrackerCursor2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTrackerCursor(ctx context.Context, sel ast.SelectionSet, v *model.TrackerCursor) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - return ec._TrackerCursor(ctx, sel, v) -} - -func (ec *executionContext) unmarshalNTrackerInput2map(ctx context.Context, v interface{}) (map[string]interface{}, error) { - return v.(map[string]interface{}), nil -} - -func (ec *executionContext) unmarshalNURL2string(ctx context.Context, v interface{}) (string, error) { - res, err := graphql.UnmarshalString(v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalNURL2string(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) unmarshalNUpdateLabelInput2map(ctx context.Context, v interface{}) (map[string]interface{}, error) { - return v.(map[string]interface{}), nil -} - -func (ec *executionContext) unmarshalNUpdateStatusInput2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐUpdateStatusInput(ctx context.Context, v interface{}) (model.UpdateStatusInput, error) { - res, err := ec.unmarshalInputUpdateStatusInput(ctx, v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) unmarshalNUpdateTicketInput2map(ctx context.Context, v interface{}) (map[string]interface{}, error) { - return v.(map[string]interface{}), nil -} - -func (ec *executionContext) marshalNUser2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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ᚋtodoᚗ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ᚋtodoᚗ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ᚋtodoᚗ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) unmarshalNVisibility2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐVisibility(ctx context.Context, v interface{}) (model.Visibility, error) { - var res model.Visibility - err := res.UnmarshalGQL(v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalNVisibility2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐVisibility(ctx context.Context, sel ast.SelectionSet, v model.Visibility) graphql.Marshaler { - return 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 { - if tmp1, ok := v.([]interface{}); ok { - vSlice = tmp1 - } else { - vSlice = []interface{}{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) marshalOACL2gitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐACL(ctx context.Context, sel ast.SelectionSet, v model.ACL) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return ec._ACL(ctx, sel, v) -} - -func (ec *executionContext) marshalOActivitySubscriptionCursor2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐActivitySubscriptionCursor(ctx context.Context, sel ast.SelectionSet, v *model.ActivitySubscriptionCursor) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return ec._ActivitySubscriptionCursor(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 { - return graphql.MarshalBoolean(v) -} - -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 - } - return graphql.MarshalBoolean(*v) -} - -func (ec *executionContext) marshalOComment2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐComment(ctx context.Context, sel ast.SelectionSet, v *model.Comment) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return ec._Comment(ctx, sel, v) -} - -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) marshalODefaultACL2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐDefaultACL(ctx context.Context, sel ast.SelectionSet, v *model.DefaultACL) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return ec._DefaultACL(ctx, sel, v) -} - -func (ec *executionContext) marshalOEvent2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEvent(ctx context.Context, sel ast.SelectionSet, v *model.Event) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return ec._Event(ctx, sel, v) -} - -func (ec *executionContext) marshalOEventCursor2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEventCursor(ctx context.Context, sel ast.SelectionSet, v *model.EventCursor) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return ec._EventCursor(ctx, sel, v) -} - -func (ec *executionContext) unmarshalOImportInput2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐImportInput(ctx context.Context, v interface{}) (*model.ImportInput, error) { - if v == nil { - return nil, nil - } - res, err := ec.unmarshalInputImportInput(ctx, v) - return &res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalOLabel2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐLabel(ctx context.Context, sel ast.SelectionSet, v *model.Label) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return ec._Label(ctx, sel, v) -} - -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 { - return graphql.MarshalString(v) -} - -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 - } - return graphql.MarshalString(*v) -} - -func (ec *executionContext) marshalOTicket2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTicket(ctx context.Context, sel ast.SelectionSet, v *model.Ticket) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return ec._Ticket(ctx, sel, v) -} - -func (ec *executionContext) unmarshalOTicketResolution2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTicketResolution(ctx context.Context, v interface{}) (*model.TicketResolution, error) { - if v == nil { - return nil, nil - } - var res = new(model.TicketResolution) - err := res.UnmarshalGQL(v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalOTicketResolution2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTicketResolution(ctx context.Context, sel ast.SelectionSet, v *model.TicketResolution) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return v -} - -func (ec *executionContext) unmarshalOTicketStatus2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTicketStatus(ctx context.Context, v interface{}) (*model.TicketStatus, error) { - if v == nil { - return nil, nil - } - var res = new(model.TicketStatus) - err := res.UnmarshalGQL(v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalOTicketStatus2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTicketStatus(ctx context.Context, sel ast.SelectionSet, v *model.TicketStatus) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return v -} - -func (ec *executionContext) marshalOTicketSubscription2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTicketSubscription(ctx context.Context, sel ast.SelectionSet, v *model.TicketSubscription) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return ec._TicketSubscription(ctx, sel, v) -} - -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 - } - return graphql.MarshalTime(*v) -} - -func (ec *executionContext) marshalOTracker2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTracker(ctx context.Context, sel ast.SelectionSet, v *model.Tracker) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return ec._Tracker(ctx, sel, v) -} - -func (ec *executionContext) marshalOTrackerACL2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTrackerACL(ctx context.Context, sel ast.SelectionSet, v *model.TrackerACL) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return ec._TrackerACL(ctx, sel, v) -} - -func (ec *executionContext) marshalOTrackerCursor2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTrackerCursor(ctx context.Context, sel ast.SelectionSet, v *model.TrackerCursor) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return ec._TrackerCursor(ctx, sel, v) -} - -func (ec *executionContext) marshalOTrackerSubscription2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐTrackerSubscription(ctx context.Context, sel ast.SelectionSet, v *model.TrackerSubscription) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return ec._TrackerSubscription(ctx, sel, v) -} - -func (ec *executionContext) unmarshalOUpload2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚐUpload(ctx context.Context, v interface{}) (*graphql.Upload, error) { - if v == nil { - return nil, nil - } - res, err := graphql.UnmarshalUpload(v) - return &res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalOUpload2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚐUpload(ctx context.Context, sel ast.SelectionSet, v *graphql.Upload) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return graphql.MarshalUpload(*v) -} - -func (ec *executionContext) marshalOUser2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗ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) unmarshalOVisibility2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐVisibility(ctx context.Context, v interface{}) (*model.Visibility, error) { - if v == nil { - return nil, nil - } - var res = new(model.Visibility) - err := res.UnmarshalGQL(v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalOVisibility2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋtodoᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐVisibility(ctx context.Context, sel ast.SelectionSet, v *model.Visibility) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return v -} - -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/commentsbyidloader_gen.go b/api/loaders/commentsbyidloader_gen.go deleted file mode 100644 index 2635a5f..0000000 --- a/api/loaders/commentsbyidloader_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/todo.sr.ht/api/graph/model" -) - -// CommentsByIDLoaderConfig captures the config to create a new CommentsByIDLoader -type CommentsByIDLoaderConfig struct { - // Fetch is a method that provides the data for the loader - Fetch func(keys []int) ([]*model.Comment, []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 -} - -// NewCommentsByIDLoader creates a new CommentsByIDLoader given a fetch, wait, and maxBatch -func NewCommentsByIDLoader(config CommentsByIDLoaderConfig) *CommentsByIDLoader { - return &CommentsByIDLoader{ - fetch: config.Fetch, - wait: config.Wait, - maxBatch: config.MaxBatch, - } -} - -// CommentsByIDLoader batches and caches requests -type CommentsByIDLoader struct { - // this method provides the data for the loader - fetch func(keys []int) ([]*model.Comment, []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.Comment - - // 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 *commentsByIDLoaderBatch - - // mutex to prevent races - mu sync.Mutex -} - -type commentsByIDLoaderBatch struct { - keys []int - data []*model.Comment - error []error - closing bool - done chan struct{} -} - -// Load a Comment by key, batching and caching will be applied automatically -func (l *CommentsByIDLoader) Load(key int) (*model.Comment, error) { - return l.LoadThunk(key)() -} - -// LoadThunk returns a function that when called will block waiting for a Comment. -// 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 *CommentsByIDLoader) LoadThunk(key int) func() (*model.Comment, error) { - l.mu.Lock() - if it, ok := l.cache[key]; ok { - l.mu.Unlock() - return func() (*model.Comment, error) { - return it, nil - } - } - if l.batch == nil { - l.batch = &commentsByIDLoaderBatch{done: make(chan struct{})} - } - batch := l.batch - pos := batch.keyIndex(l, key) - l.mu.Unlock() - - return func() (*model.Comment, error) { - <-batch.done - - var data *model.Comment - 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 *CommentsByIDLoader) LoadAll(keys []int) ([]*model.Comment, []error) { - results := make([]func() (*model.Comment, error), len(keys)) - - for i, key := range keys { - results[i] = l.LoadThunk(key) - } - - comments := make([]*model.Comment, len(keys)) - errors := make([]error, len(keys)) - for i, thunk := range results { - comments[i], errors[i] = thunk() - } - return comments, errors -} - -// LoadAllThunk returns a function that when called will block waiting for a Comments. -// 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 *CommentsByIDLoader) LoadAllThunk(keys []int) func() ([]*model.Comment, []error) { - results := make([]func() (*model.Comment, error), len(keys)) - for i, key := range keys { - results[i] = l.LoadThunk(key) - } - return func() ([]*model.Comment, []error) { - comments := make([]*model.Comment, len(keys)) - errors := make([]error, len(keys)) - for i, thunk := range results { - comments[i], errors[i] = thunk() - } - return comments, 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 *CommentsByIDLoader) Prime(key int, value *model.Comment) 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 *CommentsByIDLoader) Clear(key int) { - l.mu.Lock() - delete(l.cache, key) - l.mu.Unlock() -} - -func (l *CommentsByIDLoader) unsafeSet(key int, value *model.Comment) { - if l.cache == nil { - l.cache = map[int]*model.Comment{} - } - 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 *commentsByIDLoaderBatch) keyIndex(l *CommentsByIDLoader, 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 *commentsByIDLoaderBatch) startTimer(l *CommentsByIDLoader) { - 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 *commentsByIDLoaderBatch) end(l *CommentsByIDLoader) { - b.data, b.error = l.fetch(b.keys) - close(b.done) -} diff --git a/api/loaders/entitiesbyparticipantidloader_gen.go b/api/loaders/entitiesbyparticipantidloader_gen.go deleted file mode 100644 index e77a4a2..0000000 --- a/api/loaders/entitiesbyparticipantidloader_gen.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by github.com/vektah/dataloaden, DO NOT EDIT. - -package loaders - -import ( - "sync" - "time" - - "git.sr.ht/~sircmpwn/todo.sr.ht/api/graph/model" -) - -// EntitiesByParticipantIDLoaderConfig captures the config to create a new EntitiesByParticipantIDLoader -type EntitiesByParticipantIDLoaderConfig struct { - // Fetch is a method that provides the data for the loader - Fetch func(keys []int) ([]model.Entity, []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 -} - -// NewEntitiesByParticipantIDLoader creates a new EntitiesByParticipantIDLoader given a fetch, wait, and maxBatch -func NewEntitiesByParticipantIDLoader(config EntitiesByParticipantIDLoaderConfig) *EntitiesByParticipantIDLoader { - return &EntitiesByParticipantIDLoader{ - fetch: config.Fetch, - wait: config.Wait, - maxBatch: config.MaxBatch, - } -} - -// EntitiesByParticipantIDLoader batches and caches requests -type EntitiesByParticipantIDLoader struct { - // this method provides the data for the loader - fetch func(keys []int) ([]model.Entity, []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.Entity - - // 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 *entitiesByParticipantIDLoaderBatch - - // mutex to prevent races - mu sync.Mutex -} - -type entitiesByParticipantIDLoaderBatch struct { - keys []int - data []model.Entity - error []error - closing bool - done chan struct{} -} - -// Load a Entity by key, batching and caching will be applied automatically -func (l *EntitiesByParticipantIDLoader) Load(key int) (model.Entity, error) { - return l.LoadThunk(key)() -} - -// LoadThunk returns a function that when called will block waiting for a Entity. -// 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 *EntitiesByParticipantIDLoader) LoadThunk(key int) func() (model.Entity, error) { - l.mu.Lock() - if it, ok := l.cache[key]; ok { - l.mu.Unlock() - return func() (model.Entity, error) { - return it, nil - } - } - if l.batch == nil { - l.batch = &entitiesByParticipantIDLoaderBatch{done: make(chan struct{})} - } - batch := l.batch - pos := batch.keyIndex(l, key) - l.mu.Unlock() - - return func() (model.Entity, error) { - <-batch.done - - var data model.Entity - 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 *EntitiesByParticipantIDLoader) LoadAll(keys []int) ([]model.Entity, []error) { - results := make([]func() (model.Entity, error), len(keys)) - - for i, key := range keys { - results[i] = l.LoadThunk(key) - } - - entitys := make([]model.Entity, len(keys)) - errors := make([]error, len(keys)) - for i, thunk := range results { - entitys[i], errors[i] = thunk() - } - return entitys, errors -} - -// LoadAllThunk returns a function that when called will block waiting for a Entitys. -// 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 *EntitiesByParticipantIDLoader) LoadAllThunk(keys []int) func() ([]model.Entity, []error) { - results := make([]func() (model.Entity, error), len(keys)) - for i, key := range keys { - results[i] = l.LoadThunk(key) - } - return func() ([]model.Entity, []error) { - entitys := make([]model.Entity, len(keys)) - errors := make([]error, len(keys)) - for i, thunk := range results { - entitys[i], errors[i] = thunk() - } - return entitys, 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 *EntitiesByParticipantIDLoader) Prime(key int, value model.Entity) bool { - l.mu.Lock() - var found bool - if _, found = l.cache[key]; !found { - l.unsafeSet(key, value) - } - l.mu.Unlock() - return !found -} - -// Clear the value at key from the cache, if it exists -func (l *EntitiesByParticipantIDLoader) Clear(key int) { - l.mu.Lock() - delete(l.cache, key) - l.mu.Unlock() -} - -func (l *EntitiesByParticipantIDLoader) unsafeSet(key int, value model.Entity) { - if l.cache == nil { - l.cache = map[int]model.Entity{} - } - 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 *entitiesByParticipantIDLoaderBatch) keyIndex(l *EntitiesByParticipantIDLoader, 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 *entitiesByParticipantIDLoaderBatch) startTimer(l *EntitiesByParticipantIDLoader) { - 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 *entitiesByParticipantIDLoaderBatch) end(l *EntitiesByParticipantIDLoader) { - b.data, b.error = l.fetch(b.keys) - close(b.done) -} diff --git a/api/loaders/generate.go b/api/loaders/generate.go new file mode 100644 index 0000000..d6cc466 --- /dev/null +++ b/api/loaders/generate.go @@ -0,0 +1,23 @@ +//go:build generate +// +build generate + +package loaders + +import ( + _ "github.com/vektah/dataloaden" +) + +//go:generate go run github.com/vektah/dataloaden EntitiesByParticipantIDLoader int git.sr.ht/~sircmpwn/todo.sr.ht/api/graph/model.Entity +//go:generate ./gen UsersByIDLoader int api/graph/model.User +//go:generate ./gen UsersByNameLoader string api/graph/model.User +//go:generate ./gen TrackersByIDLoader int api/graph/model.Tracker +//go:generate ./gen TrackersByNameLoader string api/graph/model.Tracker +//go:generate ./gen TrackersByOwnerNameLoader [2]string api/graph/model.Tracker +//go:generate ./gen TicketsByIDLoader int api/graph/model.Ticket +//go:generate ./gen TicketsByTrackerIDLoader [2]int api/graph/model.Ticket +//go:generate ./gen CommentsByIDLoader int api/graph/model.Comment +//go:generate ./gen LabelsByIDLoader int api/graph/model.Label +//go:generate ./gen SubsByTicketIDLoader int api/graph/model.TicketSubscription +//go:generate ./gen SubsByTrackerIDLoader int api/graph/model.TrackerSubscription +//go:generate ./gen ParticipantsByUserIDLoader int api/graph/model.Participant +//go:generate ./gen ParticipantsByUsernameLoader string api/graph/model.Participant diff --git a/api/loaders/labelsbyidloader_gen.go b/api/loaders/labelsbyidloader_gen.go deleted file mode 100644 index b1862c1..0000000 --- a/api/loaders/labelsbyidloader_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/todo.sr.ht/api/graph/model" -) - -// LabelsByIDLoaderConfig captures the config to create a new LabelsByIDLoader -type LabelsByIDLoaderConfig struct { - // Fetch is a method that provides the data for the loader - Fetch func(keys []int) ([]*model.Label, []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 -} - -// NewLabelsByIDLoader creates a new LabelsByIDLoader given a fetch, wait, and maxBatch -func NewLabelsByIDLoader(config LabelsByIDLoaderConfig) *LabelsByIDLoader { - return &LabelsByIDLoader{ - fetch: config.Fetch, - wait: config.Wait, - maxBatch: config.MaxBatch, - } -} - -// LabelsByIDLoader batches and caches requests -type LabelsByIDLoader struct { - // this method provides the data for the loader - fetch func(keys []int) ([]*model.Label, []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.Label - - // 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 *labelsByIDLoaderBatch - - // mutex to prevent races - mu sync.Mutex -} - -type labelsByIDLoaderBatch struct { - keys []int - data []*model.Label - error []error - closing bool - done chan struct{} -} - -// Load a Label by key, batching and caching will be applied automatically -func (l *LabelsByIDLoader) Load(key int) (*model.Label, error) { - return l.LoadThunk(key)() -} - -// LoadThunk returns a function that when called will block waiting for a Label. -// 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 *LabelsByIDLoader) LoadThunk(key int) func() (*model.Label, error) { - l.mu.Lock() - if it, ok := l.cache[key]; ok { - l.mu.Unlock() - return func() (*model.Label, error) { - return it, nil - } - } - if l.batch == nil { - l.batch = &labelsByIDLoaderBatch{done: make(chan struct{})} - } - batch := l.batch - pos := batch.keyIndex(l, key) - l.mu.Unlock() - - return func() (*model.Label, error) { - <-batch.done - - var data *model.Label - 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 *LabelsByIDLoader) LoadAll(keys []int) ([]*model.Label, []error) { - results := make([]func() (*model.Label, error), len(keys)) - - for i, key := range keys { - results[i] = l.LoadThunk(key) - } - - labels := make([]*model.Label, len(keys)) - errors := make([]error, len(keys)) - for i, thunk := range results { - labels[i], errors[i] = thunk() - } - return labels, errors -} - -// LoadAllThunk returns a function that when called will block waiting for a Labels. -// 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 *LabelsByIDLoader) LoadAllThunk(keys []int) func() ([]*model.Label, []error) { - results := make([]func() (*model.Label, error), len(keys)) - for i, key := range keys { - results[i] = l.LoadThunk(key) - } - return func() ([]*model.Label, []error) { - labels := make([]*model.Label, len(keys)) - errors := make([]error, len(keys)) - for i, thunk := range results { - labels[i], errors[i] = thunk() - } - return labels, 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 *LabelsByIDLoader) Prime(key int, value *model.Label) 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 *LabelsByIDLoader) Clear(key int) { - l.mu.Lock() - delete(l.cache, key) - l.mu.Unlock() -} - -func (l *LabelsByIDLoader) unsafeSet(key int, value *model.Label) { - if l.cache == nil { - l.cache = map[int]*model.Label{} - } - 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 *labelsByIDLoaderBatch) keyIndex(l *LabelsByIDLoader, 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 *labelsByIDLoaderBatch) startTimer(l *LabelsByIDLoader) { - 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 *labelsByIDLoaderBatch) end(l *LabelsByIDLoader) { - b.data, b.error = l.fetch(b.keys) - close(b.done) -} diff --git a/api/loaders/middleware.go b/api/loaders/middleware.go index 4bc010d..be4da86 100644 --- a/api/loaders/middleware.go +++ b/api/loaders/middleware.go @@ -1,20 +1,5 @@ package loaders -//go:generate go run github.com/vektah/dataloaden EntitiesByParticipantIDLoader int git.sr.ht/~sircmpwn/todo.sr.ht/api/graph/model.Entity -//go:generate ./gen UsersByIDLoader int api/graph/model.User -//go:generate ./gen UsersByNameLoader string api/graph/model.User -//go:generate ./gen TrackersByIDLoader int api/graph/model.Tracker -//go:generate ./gen TrackersByNameLoader string api/graph/model.Tracker -//go:generate ./gen TrackersByOwnerNameLoader [2]string api/graph/model.Tracker -//go:generate ./gen TicketsByIDLoader int api/graph/model.Ticket -//go:generate ./gen TicketsByTrackerIDLoader [2]int api/graph/model.Ticket -//go:generate ./gen CommentsByIDLoader int api/graph/model.Comment -//go:generate ./gen LabelsByIDLoader int api/graph/model.Label -//go:generate ./gen SubsByTicketIDLoader int api/graph/model.TicketSubscription -//go:generate ./gen SubsByTrackerIDLoader int api/graph/model.TrackerSubscription -//go:generate ./gen ParticipantsByUserIDLoader int api/graph/model.Participant -//go:generate ./gen ParticipantsByUsernameLoader string api/graph/model.Participant - import ( "bytes" "context" diff --git a/api/loaders/participantsbyuseridloader_gen.go b/api/loaders/participantsbyuseridloader_gen.go deleted file mode 100644 index 2f71996..0000000 --- a/api/loaders/participantsbyuseridloader_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/todo.sr.ht/api/graph/model" -) - -// ParticipantsByUserIDLoaderConfig captures the config to create a new ParticipantsByUserIDLoader -type ParticipantsByUserIDLoaderConfig struct { - // Fetch is a method that provides the data for the loader - Fetch func(keys []int) ([]*model.Participant, []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 -} - -// NewParticipantsByUserIDLoader creates a new ParticipantsByUserIDLoader given a fetch, wait, and maxBatch -func NewParticipantsByUserIDLoader(config ParticipantsByUserIDLoaderConfig) *ParticipantsByUserIDLoader { - return &ParticipantsByUserIDLoader{ - fetch: config.Fetch, - wait: config.Wait, - maxBatch: config.MaxBatch, - } -} - -// ParticipantsByUserIDLoader batches and caches requests -type ParticipantsByUserIDLoader struct { - // this method provides the data for the loader - fetch func(keys []int) ([]*model.Participant, []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.Participant - - // 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 *participantsByUserIDLoaderBatch - - // mutex to prevent races - mu sync.Mutex -} - -type participantsByUserIDLoaderBatch struct { - keys []int - data []*model.Participant - error []error - closing bool - done chan struct{} -} - -// Load a Participant by key, batching and caching will be applied automatically -func (l *ParticipantsByUserIDLoader) Load(key int) (*model.Participant, error) { - return l.LoadThunk(key)() -} - -// LoadThunk returns a function that when called will block waiting for a Participant. -// 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 *ParticipantsByUserIDLoader) LoadThunk(key int) func() (*model.Participant, error) { - l.mu.Lock() - if it, ok := l.cache[key]; ok { - l.mu.Unlock() - return func() (*model.Participant, error) { - return it, nil - } - } - if l.batch == nil { - l.batch = &participantsByUserIDLoaderBatch{done: make(chan struct{})} - } - batch := l.batch - pos := batch.keyIndex(l, key) - l.mu.Unlock() - - return func() (*model.Participant, error) { - <-batch.done - - var data *model.Participant - 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 *ParticipantsByUserIDLoader) LoadAll(keys []int) ([]*model.Participant, []error) { - results := make([]func() (*model.Participant, error), len(keys)) - - for i, key := range keys { - results[i] = l.LoadThunk(key) - } - - participants := make([]*model.Participant, len(keys)) - errors := make([]error, len(keys)) - for i, thunk := range results { - participants[i], errors[i] = thunk() - } - return participants, errors -} - -// LoadAllThunk returns a function that when called will block waiting for a Participants. -// 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 *ParticipantsByUserIDLoader) LoadAllThunk(keys []int) func() ([]*model.Participant, []error) { - results := make([]func() (*model.Participant, error), len(keys)) - for i, key := range keys { - results[i] = l.LoadThunk(key) - } - return func() ([]*model.Participant, []error) { - participants := make([]*model.Participant, len(keys)) - errors := make([]error, len(keys)) - for i, thunk := range results { - participants[i], errors[i] = thunk() - } - return participants, 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 *ParticipantsByUserIDLoader) Prime(key int, value *model.Participant) 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 *ParticipantsByUserIDLoader) Clear(key int) { - l.mu.Lock() - delete(l.cache, key) - l.mu.Unlock() -} - -func (l *ParticipantsByUserIDLoader) unsafeSet(key int, value *model.Participant) { - if l.cache == nil { - l.cache = map[int]*model.Participant{} - } - 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 *participantsByUserIDLoaderBatch) keyIndex(l *ParticipantsByUserIDLoader, 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 *participantsByUserIDLoaderBatch) startTimer(l *ParticipantsByUserIDLoader) { - 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 *participantsByUserIDLoaderBatch) end(l *ParticipantsByUserIDLoader) { - b.data, b.error = l.fetch(b.keys) - close(b.done) -} diff --git a/api/loaders/participantsbyusernameloader_gen.go b/api/loaders/participantsbyusernameloader_gen.go deleted file mode 100644 index 7fac467..0000000 --- a/api/loaders/participantsbyusernameloader_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/todo.sr.ht/api/graph/model" -) - -// ParticipantsByUsernameLoaderConfig captures the config to create a new ParticipantsByUsernameLoader -type ParticipantsByUsernameLoaderConfig struct { - // Fetch is a method that provides the data for the loader - Fetch func(keys []string) ([]*model.Participant, []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 -} - -// NewParticipantsByUsernameLoader creates a new ParticipantsByUsernameLoader given a fetch, wait, and maxBatch -func NewParticipantsByUsernameLoader(config ParticipantsByUsernameLoaderConfig) *ParticipantsByUsernameLoader { - return &ParticipantsByUsernameLoader{ - fetch: config.Fetch, - wait: config.Wait, - maxBatch: config.MaxBatch, - } -} - -// ParticipantsByUsernameLoader batches and caches requests -type ParticipantsByUsernameLoader struct { - // this method provides the data for the loader - fetch func(keys []string) ([]*model.Participant, []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.Participant - - // 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 *participantsByUsernameLoaderBatch - - // mutex to prevent races - mu sync.Mutex -} - -type participantsByUsernameLoaderBatch struct { - keys []string - data []*model.Participant - error []error - closing bool - done chan struct{} -} - -// Load a Participant by key, batching and caching will be applied automatically -func (l *ParticipantsByUsernameLoader) Load(key string) (*model.Participant, error) { - return l.LoadThunk(key)() -} - -// LoadThunk returns a function that when called will block waiting for a Participant. -// 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 *ParticipantsByUsernameLoader) LoadThunk(key string) func() (*model.Participant, error) { - l.mu.Lock() - if it, ok := l.cache[key]; ok { - l.mu.Unlock() - return func() (*model.Participant, error) { - return it, nil - } - } - if l.batch == nil { - l.batch = &participantsByUsernameLoaderBatch{done: make(chan struct{})} - } - batch := l.batch - pos := batch.keyIndex(l, key) - l.mu.Unlock() - - return func() (*model.Participant, error) { - <-batch.done - - var data *model.Participant - 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 *ParticipantsByUsernameLoader) LoadAll(keys []string) ([]*model.Participant, []error) { - results := make([]func() (*model.Participant, error), len(keys)) - - for i, key := range keys { - results[i] = l.LoadThunk(key) - } - - participants := make([]*model.Participant, len(keys)) - errors := make([]error, len(keys)) - for i, thunk := range results { - participants[i], errors[i] = thunk() - } - return participants, errors -} - -// LoadAllThunk returns a function that when called will block waiting for a Participants. -// 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 *ParticipantsByUsernameLoader) LoadAllThunk(keys []string) func() ([]*model.Participant, []error) { - results := make([]func() (*model.Participant, error), len(keys)) - for i, key := range keys { - results[i] = l.LoadThunk(key) - } - return func() ([]*model.Participant, []error) { - participants := make([]*model.Participant, len(keys)) - errors := make([]error, len(keys)) - for i, thunk := range results { - participants[i], errors[i] = thunk() - } - return participants, 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 *ParticipantsByUsernameLoader) Prime(key string, value *model.Participant) 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 *ParticipantsByUsernameLoader) Clear(key string) { - l.mu.Lock() - delete(l.cache, key) - l.mu.Unlock() -} - -func (l *ParticipantsByUsernameLoader) unsafeSet(key string, value *model.Participant) { - if l.cache == nil { - l.cache = map[string]*model.Participant{} - } - 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 *participantsByUsernameLoaderBatch) keyIndex(l *ParticipantsByUsernameLoader, 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 *participantsByUsernameLoaderBatch) startTimer(l *ParticipantsByUsernameLoader) { - 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 *participantsByUsernameLoaderBatch) end(l *ParticipantsByUsernameLoader) { - b.data, b.error = l.fetch(b.keys) - close(b.done) -} diff --git a/api/loaders/subsbyticketidloader_gen.go b/api/loaders/subsbyticketidloader_gen.go deleted file mode 100644 index 09afe4c..0000000 --- a/api/loaders/subsbyticketidloader_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/todo.sr.ht/api/graph/model" -) - -// SubsByTicketIDLoaderConfig captures the config to create a new SubsByTicketIDLoader -type SubsByTicketIDLoaderConfig struct { - // Fetch is a method that provides the data for the loader - Fetch func(keys []int) ([]*model.TicketSubscription, []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 -} - -// NewSubsByTicketIDLoader creates a new SubsByTicketIDLoader given a fetch, wait, and maxBatch -func NewSubsByTicketIDLoader(config SubsByTicketIDLoaderConfig) *SubsByTicketIDLoader { - return &SubsByTicketIDLoader{ - fetch: config.Fetch, - wait: config.Wait, - maxBatch: config.MaxBatch, - } -} - -// SubsByTicketIDLoader batches and caches requests -type SubsByTicketIDLoader struct { - // this method provides the data for the loader - fetch func(keys []int) ([]*model.TicketSubscription, []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.TicketSubscription - - // 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 *subsByTicketIDLoaderBatch - - // mutex to prevent races - mu sync.Mutex -} - -type subsByTicketIDLoaderBatch struct { - keys []int - data []*model.TicketSubscription - error []error - closing bool - done chan struct{} -} - -// Load a TicketSubscription by key, batching and caching will be applied automatically -func (l *SubsByTicketIDLoader) Load(key int) (*model.TicketSubscription, error) { - return l.LoadThunk(key)() -} - -// LoadThunk returns a function that when called will block waiting for a TicketSubscription. -// 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 *SubsByTicketIDLoader) LoadThunk(key int) func() (*model.TicketSubscription, error) { - l.mu.Lock() - if it, ok := l.cache[key]; ok { - l.mu.Unlock() - return func() (*model.TicketSubscription, error) { - return it, nil - } - } - if l.batch == nil { - l.batch = &subsByTicketIDLoaderBatch{done: make(chan struct{})} - } - batch := l.batch - pos := batch.keyIndex(l, key) - l.mu.Unlock() - - return func() (*model.TicketSubscription, error) { - <-batch.done - - var data *model.TicketSubscription - 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 *SubsByTicketIDLoader) LoadAll(keys []int) ([]*model.TicketSubscription, []error) { - results := make([]func() (*model.TicketSubscription, error), len(keys)) - - for i, key := range keys { - results[i] = l.LoadThunk(key) - } - - ticketSubscriptions := make([]*model.TicketSubscription, len(keys)) - errors := make([]error, len(keys)) - for i, thunk := range results { - ticketSubscriptions[i], errors[i] = thunk() - } - return ticketSubscriptions, errors -} - -// LoadAllThunk returns a function that when called will block waiting for a TicketSubscriptions. -// 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 *SubsByTicketIDLoader) LoadAllThunk(keys []int) func() ([]*model.TicketSubscription, []error) { - results := make([]func() (*model.TicketSubscription, error), len(keys)) - for i, key := range keys { - results[i] = l.LoadThunk(key) - } - return func() ([]*model.TicketSubscription, []error) { - ticketSubscriptions := make([]*model.TicketSubscription, len(keys)) - errors := make([]error, len(keys)) - for i, thunk := range results { - ticketSubscriptions[i], errors[i] = thunk() - } - return ticketSubscriptions, 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 *SubsByTicketIDLoader) Prime(key int, value *model.TicketSubscription) 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 *SubsByTicketIDLoader) Clear(key int) { - l.mu.Lock() - delete(l.cache, key) - l.mu.Unlock() -} - -func (l *SubsByTicketIDLoader) unsafeSet(key int, value *model.TicketSubscription) { - if l.cache == nil { - l.cache = map[int]*model.TicketSubscription{} - } - 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 *subsByTicketIDLoaderBatch) keyIndex(l *SubsByTicketIDLoader, 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 *subsByTicketIDLoaderBatch) startTimer(l *SubsByTicketIDLoader) { - 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 *subsByTicketIDLoaderBatch) end(l *SubsByTicketIDLoader) { - b.data, b.error = l.fetch(b.keys) - close(b.done) -} diff --git a/api/loaders/subsbytrackeridloader_gen.go b/api/loaders/subsbytrackeridloader_gen.go deleted file mode 100644 index f5a64b3..0000000 --- a/api/loaders/subsbytrackeridloader_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/todo.sr.ht/api/graph/model" -) - -// SubsByTrackerIDLoaderConfig captures the config to create a new SubsByTrackerIDLoader -type SubsByTrackerIDLoaderConfig struct { - // Fetch is a method that provides the data for the loader - Fetch func(keys []int) ([]*model.TrackerSubscription, []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 -} - -// NewSubsByTrackerIDLoader creates a new SubsByTrackerIDLoader given a fetch, wait, and maxBatch -func NewSubsByTrackerIDLoader(config SubsByTrackerIDLoaderConfig) *SubsByTrackerIDLoader { - return &SubsByTrackerIDLoader{ - fetch: config.Fetch, - wait: config.Wait, - maxBatch: config.MaxBatch, - } -} - -// SubsByTrackerIDLoader batches and caches requests -type SubsByTrackerIDLoader struct { - // this method provides the data for the loader - fetch func(keys []int) ([]*model.TrackerSubscription, []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.TrackerSubscription - - // 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 *subsByTrackerIDLoaderBatch - - // mutex to prevent races - mu sync.Mutex -} - -type subsByTrackerIDLoaderBatch struct { - keys []int - data []*model.TrackerSubscription - error []error - closing bool - done chan struct{} -} - -// Load a TrackerSubscription by key, batching and caching will be applied automatically -func (l *SubsByTrackerIDLoader) Load(key int) (*model.TrackerSubscription, error) { - return l.LoadThunk(key)() -} - -// LoadThunk returns a function that when called will block waiting for a TrackerSubscription. -// 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 *SubsByTrackerIDLoader) LoadThunk(key int) func() (*model.TrackerSubscription, error) { - l.mu.Lock() - if it, ok := l.cache[key]; ok { - l.mu.Unlock() - return func() (*model.TrackerSubscription, error) { - return it, nil - } - } - if l.batch == nil { - l.batch = &subsByTrackerIDLoaderBatch{done: make(chan struct{})} - } - batch := l.batch - pos := batch.keyIndex(l, key) - l.mu.Unlock() - - return func() (*model.TrackerSubscription, error) { - <-batch.done - - var data *model.TrackerSubscription - 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 *SubsByTrackerIDLoader) LoadAll(keys []int) ([]*model.TrackerSubscription, []error) { - results := make([]func() (*model.TrackerSubscription, error), len(keys)) - - for i, key := range keys { - results[i] = l.LoadThunk(key) - } - - trackerSubscriptions := make([]*model.TrackerSubscription, len(keys)) - errors := make([]error, len(keys)) - for i, thunk := range results { - trackerSubscriptions[i], errors[i] = thunk() - } - return trackerSubscriptions, errors -} - -// LoadAllThunk returns a function that when called will block waiting for a TrackerSubscriptions. -// 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 *SubsByTrackerIDLoader) LoadAllThunk(keys []int) func() ([]*model.TrackerSubscription, []error) { - results := make([]func() (*model.TrackerSubscription, error), len(keys)) - for i, key := range keys { - results[i] = l.LoadThunk(key) - } - return func() ([]*model.TrackerSubscription, []error) { - trackerSubscriptions := make([]*model.TrackerSubscription, len(keys)) - errors := make([]error, len(keys)) - for i, thunk := range results { - trackerSubscriptions[i], errors[i] = thunk() - } - return trackerSubscriptions, 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 *SubsByTrackerIDLoader) Prime(key int, value *model.TrackerSubscription) 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 *SubsByTrackerIDLoader) Clear(key int) { - l.mu.Lock() - delete(l.cache, key) - l.mu.Unlock() -} - -func (l *SubsByTrackerIDLoader) unsafeSet(key int, value *model.TrackerSubscription) { - if l.cache == nil { - l.cache = map[int]*model.TrackerSubscription{} - } - 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 *subsByTrackerIDLoaderBatch) keyIndex(l *SubsByTrackerIDLoader, 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 *subsByTrackerIDLoaderBatch) startTimer(l *SubsByTrackerIDLoader) { - 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 *subsByTrackerIDLoaderBatch) end(l *SubsByTrackerIDLoader) { - b.data, b.error = l.fetch(b.keys) - close(b.done) -} diff --git a/api/loaders/ticketsbyidloader_gen.go b/api/loaders/ticketsbyidloader_gen.go deleted file mode 100644 index 751ce32..0000000 --- a/api/loaders/ticketsbyidloader_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/todo.sr.ht/api/graph/model" -) - -// TicketsByIDLoaderConfig captures the config to create a new TicketsByIDLoader -type TicketsByIDLoaderConfig struct { - // Fetch is a method that provides the data for the loader - Fetch func(keys []int) ([]*model.Ticket, []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 -} - -// NewTicketsByIDLoader creates a new TicketsByIDLoader given a fetch, wait, and maxBatch -func NewTicketsByIDLoader(config TicketsByIDLoaderConfig) *TicketsByIDLoader { - return &TicketsByIDLoader{ - fetch: config.Fetch, - wait: config.Wait, - maxBatch: config.MaxBatch, - } -} - -// TicketsByIDLoader batches and caches requests -type TicketsByIDLoader struct { - // this method provides the data for the loader - fetch func(keys []int) ([]*model.Ticket, []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.Ticket - - // 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 *ticketsByIDLoaderBatch - - // mutex to prevent races - mu sync.Mutex -} - -type ticketsByIDLoaderBatch struct { - keys []int - data []*model.Ticket - error []error - closing bool - done chan struct{} -} - -// Load a Ticket by key, batching and caching will be applied automatically -func (l *TicketsByIDLoader) Load(key int) (*model.Ticket, error) { - return l.LoadThunk(key)() -} - -// LoadThunk returns a function that when called will block waiting for a Ticket. -// 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 *TicketsByIDLoader) LoadThunk(key int) func() (*model.Ticket, error) { - l.mu.Lock() - if it, ok := l.cache[key]; ok { - l.mu.Unlock() - return func() (*model.Ticket, error) { - return it, nil - } - } - if l.batch == nil { - l.batch = &ticketsByIDLoaderBatch{done: make(chan struct{})} - } - batch := l.batch - pos := batch.keyIndex(l, key) - l.mu.Unlock() - - return func() (*model.Ticket, error) { - <-batch.done - - var data *model.Ticket - 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 *TicketsByIDLoader) LoadAll(keys []int) ([]*model.Ticket, []error) { - results := make([]func() (*model.Ticket, error), len(keys)) - - for i, key := range keys { - results[i] = l.LoadThunk(key) - } - - tickets := make([]*model.Ticket, len(keys)) - errors := make([]error, len(keys)) - for i, thunk := range results { - tickets[i], errors[i] = thunk() - } - return tickets, errors -} - -// LoadAllThunk returns a function that when called will block waiting for a Tickets. -// 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 *TicketsByIDLoader) LoadAllThunk(keys []int) func() ([]*model.Ticket, []error) { - results := make([]func() (*model.Ticket, error), len(keys)) - for i, key := range keys { - results[i] = l.LoadThunk(key) - } - return func() ([]*model.Ticket, []error) { - tickets := make([]*model.Ticket, len(keys)) - errors := make([]error, len(keys)) - for i, thunk := range results { - tickets[i], errors[i] = thunk() - } - return tickets, 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 *TicketsByIDLoader) Prime(key int, value *model.Ticket) 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 *TicketsByIDLoader) Clear(key int) { - l.mu.Lock() - delete(l.cache, key) - l.mu.Unlock() -} - -func (l *TicketsByIDLoader) unsafeSet(key int, value *model.Ticket) { - if l.cache == nil { - l.cache = map[int]*model.Ticket{} - } - 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 *ticketsByIDLoaderBatch) keyIndex(l *TicketsByIDLoader, 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 *ticketsByIDLoaderBatch) startTimer(l *TicketsByIDLoader) { - 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 *ticketsByIDLoaderBatch) end(l *TicketsByIDLoader) { - b.data, b.error = l.fetch(b.keys) - close(b.done) -} diff --git a/api/loaders/ticketsbytrackeridloader_gen.go b/api/loaders/ticketsbytrackeridloader_gen.go deleted file mode 100644 index 4cbc32a..0000000 --- a/api/loaders/ticketsbytrackeridloader_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/todo.sr.ht/api/graph/model" -) - -// TicketsByTrackerIDLoaderConfig captures the config to create a new TicketsByTrackerIDLoader -type TicketsByTrackerIDLoaderConfig struct { - // Fetch is a method that provides the data for the loader - Fetch func(keys [][2]int) ([]*model.Ticket, []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 -} - -// NewTicketsByTrackerIDLoader creates a new TicketsByTrackerIDLoader given a fetch, wait, and maxBatch -func NewTicketsByTrackerIDLoader(config TicketsByTrackerIDLoaderConfig) *TicketsByTrackerIDLoader { - return &TicketsByTrackerIDLoader{ - fetch: config.Fetch, - wait: config.Wait, - maxBatch: config.MaxBatch, - } -} - -// TicketsByTrackerIDLoader batches and caches requests -type TicketsByTrackerIDLoader struct { - // this method provides the data for the loader - fetch func(keys [][2]int) ([]*model.Ticket, []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[[2]int]*model.Ticket - - // 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 *ticketsByTrackerIDLoaderBatch - - // mutex to prevent races - mu sync.Mutex -} - -type ticketsByTrackerIDLoaderBatch struct { - keys [][2]int - data []*model.Ticket - error []error - closing bool - done chan struct{} -} - -// Load a Ticket by key, batching and caching will be applied automatically -func (l *TicketsByTrackerIDLoader) Load(key [2]int) (*model.Ticket, error) { - return l.LoadThunk(key)() -} - -// LoadThunk returns a function that when called will block waiting for a Ticket. -// 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 *TicketsByTrackerIDLoader) LoadThunk(key [2]int) func() (*model.Ticket, error) { - l.mu.Lock() - if it, ok := l.cache[key]; ok { - l.mu.Unlock() - return func() (*model.Ticket, error) { - return it, nil - } - } - if l.batch == nil { - l.batch = &ticketsByTrackerIDLoaderBatch{done: make(chan struct{})} - } - batch := l.batch - pos := batch.keyIndex(l, key) - l.mu.Unlock() - - return func() (*model.Ticket, error) { - <-batch.done - - var data *model.Ticket - 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 *TicketsByTrackerIDLoader) LoadAll(keys [][2]int) ([]*model.Ticket, []error) { - results := make([]func() (*model.Ticket, error), len(keys)) - - for i, key := range keys { - results[i] = l.LoadThunk(key) - } - - tickets := make([]*model.Ticket, len(keys)) - errors := make([]error, len(keys)) - for i, thunk := range results { - tickets[i], errors[i] = thunk() - } - return tickets, errors -} - -// LoadAllThunk returns a function that when called will block waiting for a Tickets. -// 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 *TicketsByTrackerIDLoader) LoadAllThunk(keys [][2]int) func() ([]*model.Ticket, []error) { - results := make([]func() (*model.Ticket, error), len(keys)) - for i, key := range keys { - results[i] = l.LoadThunk(key) - } - return func() ([]*model.Ticket, []error) { - tickets := make([]*model.Ticket, len(keys)) - errors := make([]error, len(keys)) - for i, thunk := range results { - tickets[i], errors[i] = thunk() - } - return tickets, 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 *TicketsByTrackerIDLoader) Prime(key [2]int, value *model.Ticket) 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 *TicketsByTrackerIDLoader) Clear(key [2]int) { - l.mu.Lock() - delete(l.cache, key) - l.mu.Unlock() -} - -func (l *TicketsByTrackerIDLoader) unsafeSet(key [2]int, value *model.Ticket) { - if l.cache == nil { - l.cache = map[[2]int]*model.Ticket{} - } - 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 *ticketsByTrackerIDLoaderBatch) keyIndex(l *TicketsByTrackerIDLoader, key [2]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 *ticketsByTrackerIDLoaderBatch) startTimer(l *TicketsByTrackerIDLoader) { - 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 *ticketsByTrackerIDLoaderBatch) end(l *TicketsByTrackerIDLoader) { - b.data, b.error = l.fetch(b.keys) - close(b.done) -} diff --git a/api/loaders/trackersbyidloader_gen.go b/api/loaders/trackersbyidloader_gen.go deleted file mode 100644 index 950595b..0000000 --- a/api/loaders/trackersbyidloader_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/todo.sr.ht/api/graph/model" -) - -// TrackersByIDLoaderConfig captures the config to create a new TrackersByIDLoader -type TrackersByIDLoaderConfig struct { - // Fetch is a method that provides the data for the loader - Fetch func(keys []int) ([]*model.Tracker, []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 -} - -// NewTrackersByIDLoader creates a new TrackersByIDLoader given a fetch, wait, and maxBatch -func NewTrackersByIDLoader(config TrackersByIDLoaderConfig) *TrackersByIDLoader { - return &TrackersByIDLoader{ - fetch: config.Fetch, - wait: config.Wait, - maxBatch: config.MaxBatch, - } -} - -// TrackersByIDLoader batches and caches requests -type TrackersByIDLoader struct { - // this method provides the data for the loader - fetch func(keys []int) ([]*model.Tracker, []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.Tracker - - // 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 *trackersByIDLoaderBatch - - // mutex to prevent races - mu sync.Mutex -} - -type trackersByIDLoaderBatch struct { - keys []int - data []*model.Tracker - error []error - closing bool - done chan struct{} -} - -// Load a Tracker by key, batching and caching will be applied automatically -func (l *TrackersByIDLoader) Load(key int) (*model.Tracker, error) { - return l.LoadThunk(key)() -} - -// LoadThunk returns a function that when called will block waiting for a Tracker. -// 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 *TrackersByIDLoader) LoadThunk(key int) func() (*model.Tracker, error) { - l.mu.Lock() - if it, ok := l.cache[key]; ok { - l.mu.Unlock() - return func() (*model.Tracker, error) { - return it, nil - } - } - if l.batch == nil { - l.batch = &trackersByIDLoaderBatch{done: make(chan struct{})} - } - batch := l.batch - pos := batch.keyIndex(l, key) - l.mu.Unlock() - - return func() (*model.Tracker, error) { - <-batch.done - - var data *model.Tracker - 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 *TrackersByIDLoader) LoadAll(keys []int) ([]*model.Tracker, []error) { - results := make([]func() (*model.Tracker, error), len(keys)) - - for i, key := range keys { - results[i] = l.LoadThunk(key) - } - - trackers := make([]*model.Tracker, len(keys)) - errors := make([]error, len(keys)) - for i, thunk := range results { - trackers[i], errors[i] = thunk() - } - return trackers, errors -} - -// LoadAllThunk returns a function that when called will block waiting for a Trackers. -// 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 *TrackersByIDLoader) LoadAllThunk(keys []int) func() ([]*model.Tracker, []error) { - results := make([]func() (*model.Tracker, error), len(keys)) - for i, key := range keys { - results[i] = l.LoadThunk(key) - } - return func() ([]*model.Tracker, []error) { - trackers := make([]*model.Tracker, len(keys)) - errors := make([]error, len(keys)) - for i, thunk := range results { - trackers[i], errors[i] = thunk() - } - return trackers, 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 *TrackersByIDLoader) Prime(key int, value *model.Tracker) 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 *TrackersByIDLoader) Clear(key int) { - l.mu.Lock() - delete(l.cache, key) - l.mu.Unlock() -} - -func (l *TrackersByIDLoader) unsafeSet(key int, value *model.Tracker) { - if l.cache == nil { - l.cache = map[int]*model.Tracker{} - } - 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 *trackersByIDLoaderBatch) keyIndex(l *TrackersByIDLoader, 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 *trackersByIDLoaderBatch) startTimer(l *TrackersByIDLoader) { - 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 *trackersByIDLoaderBatch) end(l *TrackersByIDLoader) { - b.data, b.error = l.fetch(b.keys) - close(b.done) -} diff --git a/api/loaders/trackersbynameloader_gen.go b/api/loaders/trackersbynameloader_gen.go deleted file mode 100644 index 21e51e6..0000000 --- a/api/loaders/trackersbynameloader_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/todo.sr.ht/api/graph/model" -) - -// TrackersByNameLoaderConfig captures the config to create a new TrackersByNameLoader -type TrackersByNameLoaderConfig struct { - // Fetch is a method that provides the data for the loader - Fetch func(keys []string) ([]*model.Tracker, []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 -} - -// NewTrackersByNameLoader creates a new TrackersByNameLoader given a fetch, wait, and maxBatch -func NewTrackersByNameLoader(config TrackersByNameLoaderConfig) *TrackersByNameLoader { - return &TrackersByNameLoader{ - fetch: config.Fetch, - wait: config.Wait, - maxBatch: config.MaxBatch, - } -} - -// TrackersByNameLoader batches and caches requests -type TrackersByNameLoader struct { - // this method provides the data for the loader - fetch func(keys []string) ([]*model.Tracker, []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.Tracker - - // 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 *trackersByNameLoaderBatch - - // mutex to prevent races - mu sync.Mutex -} - -type trackersByNameLoaderBatch struct { - keys []string - data []*model.Tracker - error []error - closing bool - done chan struct{} -} - -// Load a Tracker by key, batching and caching will be applied automatically -func (l *TrackersByNameLoader) Load(key string) (*model.Tracker, error) { - return l.LoadThunk(key)() -} - -// LoadThunk returns a function that when called will block waiting for a Tracker. -// 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 *TrackersByNameLoader) LoadThunk(key string) func() (*model.Tracker, error) { - l.mu.Lock() - if it, ok := l.cache[key]; ok { - l.mu.Unlock() - return func() (*model.Tracker, error) { - return it, nil - } - } - if l.batch == nil { - l.batch = &trackersByNameLoaderBatch{done: make(chan struct{})} - } - batch := l.batch - pos := batch.keyIndex(l, key) - l.mu.Unlock() - - return func() (*model.Tracker, error) { - <-batch.done - - var data *model.Tracker - 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 *TrackersByNameLoader) LoadAll(keys []string) ([]*model.Tracker, []error) { - results := make([]func() (*model.Tracker, error), len(keys)) - - for i, key := range keys { - results[i] = l.LoadThunk(key) - } - - trackers := make([]*model.Tracker, len(keys)) - errors := make([]error, len(keys)) - for i, thunk := range results { - trackers[i], errors[i] = thunk() - } - return trackers, errors -} - -// LoadAllThunk returns a function that when called will block waiting for a Trackers. -// 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 *TrackersByNameLoader) LoadAllThunk(keys []string) func() ([]*model.Tracker, []error) { - results := make([]func() (*model.Tracker, error), len(keys)) - for i, key := range keys { - results[i] = l.LoadThunk(key) - } - return func() ([]*model.Tracker, []error) { - trackers := make([]*model.Tracker, len(keys)) - errors := make([]error, len(keys)) - for i, thunk := range results { - trackers[i], errors[i] = thunk() - } - return trackers, 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 *TrackersByNameLoader) Prime(key string, value *model.Tracker) 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 *TrackersByNameLoader) Clear(key string) { - l.mu.Lock() - delete(l.cache, key) - l.mu.Unlock() -} - -func (l *TrackersByNameLoader) unsafeSet(key string, value *model.Tracker) { - if l.cache == nil { - l.cache = map[string]*model.Tracker{} - } - 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 *trackersByNameLoaderBatch) keyIndex(l *TrackersByNameLoader, 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 *trackersByNameLoaderBatch) startTimer(l *TrackersByNameLoader) { - 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 *trackersByNameLoaderBatch) end(l *TrackersByNameLoader) { - b.data, b.error = l.fetch(b.keys) - close(b.done) -} diff --git a/api/loaders/trackersbyownernameloader_gen.go b/api/loaders/trackersbyownernameloader_gen.go deleted file mode 100644 index 435a3c8..0000000 --- a/api/loaders/trackersbyownernameloader_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/todo.sr.ht/api/graph/model" -) - -// TrackersByOwnerNameLoaderConfig captures the config to create a new TrackersByOwnerNameLoader -type TrackersByOwnerNameLoaderConfig struct { - // Fetch is a method that provides the data for the loader - Fetch func(keys [][2]string) ([]*model.Tracker, []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 -} - -// NewTrackersByOwnerNameLoader creates a new TrackersByOwnerNameLoader given a fetch, wait, and maxBatch -func NewTrackersByOwnerNameLoader(config TrackersByOwnerNameLoaderConfig) *TrackersByOwnerNameLoader { - return &TrackersByOwnerNameLoader{ - fetch: config.Fetch, - wait: config.Wait, - maxBatch: config.MaxBatch, - } -} - -// TrackersByOwnerNameLoader batches and caches requests -type TrackersByOwnerNameLoader struct { - // this method provides the data for the loader - fetch func(keys [][2]string) ([]*model.Tracker, []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[[2]string]*model.Tracker - - // 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 *trackersByOwnerNameLoaderBatch - - // mutex to prevent races - mu sync.Mutex -} - -type trackersByOwnerNameLoaderBatch struct { - keys [][2]string - data []*model.Tracker - error []error - closing bool - done chan struct{} -} - -// Load a Tracker by key, batching and caching will be applied automatically -func (l *TrackersByOwnerNameLoader) Load(key [2]string) (*model.Tracker, error) { - return l.LoadThunk(key)() -} - -// LoadThunk returns a function that when called will block waiting for a Tracker. -// 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 *TrackersByOwnerNameLoader) LoadThunk(key [2]string) func() (*model.Tracker, error) { - l.mu.Lock() - if it, ok := l.cache[key]; ok { - l.mu.Unlock() - return func() (*model.Tracker, error) { - return it, nil - } - } - if l.batch == nil { - l.batch = &trackersByOwnerNameLoaderBatch{done: make(chan struct{})} - } - batch := l.batch - pos := batch.keyIndex(l, key) - l.mu.Unlock() - - return func() (*model.Tracker, error) { - <-batch.done - - var data *model.Tracker - 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 *TrackersByOwnerNameLoader) LoadAll(keys [][2]string) ([]*model.Tracker, []error) { - results := make([]func() (*model.Tracker, error), len(keys)) - - for i, key := range keys { - results[i] = l.LoadThunk(key) - } - - trackers := make([]*model.Tracker, len(keys)) - errors := make([]error, len(keys)) - for i, thunk := range results { - trackers[i], errors[i] = thunk() - } - return trackers, errors -} - -// LoadAllThunk returns a function that when called will block waiting for a Trackers. -// 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 *TrackersByOwnerNameLoader) LoadAllThunk(keys [][2]string) func() ([]*model.Tracker, []error) { - results := make([]func() (*model.Tracker, error), len(keys)) - for i, key := range keys { - results[i] = l.LoadThunk(key) - } - return func() ([]*model.Tracker, []error) { - trackers := make([]*model.Tracker, len(keys)) - errors := make([]error, len(keys)) - for i, thunk := range results { - trackers[i], errors[i] = thunk() - } - return trackers, 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 *TrackersByOwnerNameLoader) Prime(key [2]string, value *model.Tracker) 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 *TrackersByOwnerNameLoader) Clear(key [2]string) { - l.mu.Lock() - delete(l.cache, key) - l.mu.Unlock() -} - -func (l *TrackersByOwnerNameLoader) unsafeSet(key [2]string, value *model.Tracker) { - if l.cache == nil { - l.cache = map[[2]string]*model.Tracker{} - } - 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 *trackersByOwnerNameLoaderBatch) keyIndex(l *TrackersByOwnerNameLoader, key [2]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 *trackersByOwnerNameLoaderBatch) startTimer(l *TrackersByOwnerNameLoader) { - 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 *trackersByOwnerNameLoaderBatch) end(l *TrackersByOwnerNameLoader) { - 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 ce0448d..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/todo.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 8e6ab14..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/todo.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) -}