From b30051b461798b2598985d262e3803a6364f768b Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 24 Mar 2022 14:19:29 +0100 Subject: [PATCH] API: overhaul build --- .gitignore | 2 + Makefile | 11 +- api/go.mod | 13 +- api/go.sum | 22 + api/graph/api/generated.go | 13698 ---------------- api/loaders/aclsbyidloader_gen.go | 224 - api/loaders/emailsbyidloader_gen.go | 224 - api/loaders/emailsbymessageidloader_gen.go | 224 - api/loaders/generate.go | 20 + api/loaders/mailinglistsbyidloader_gen.go | 224 - api/loaders/mailinglistsbynameloader_gen.go | 224 - .../mailinglistsbyownernameloader_gen.go | 224 - api/loaders/middleware.go | 12 - api/loaders/patchsetsbyidloader_gen.go | 224 - api/loaders/subscriptionsbyidloader_gen.go | 221 - api/loaders/threadsbyidloader_gen.go | 224 - api/loaders/usersbyidloader_gen.go | 224 - api/loaders/usersbynameloader_gen.go | 224 - 18 files changed, 60 insertions(+), 16179 deletions(-) delete mode 100644 api/graph/api/generated.go delete mode 100644 api/loaders/aclsbyidloader_gen.go delete mode 100644 api/loaders/emailsbyidloader_gen.go delete mode 100644 api/loaders/emailsbymessageidloader_gen.go create mode 100644 api/loaders/generate.go delete mode 100644 api/loaders/mailinglistsbyidloader_gen.go delete mode 100644 api/loaders/mailinglistsbynameloader_gen.go delete mode 100644 api/loaders/mailinglistsbyownernameloader_gen.go delete mode 100644 api/loaders/patchsetsbyidloader_gen.go delete mode 100644 api/loaders/subscriptionsbyidloader_gen.go delete mode 100644 api/loaders/threadsbyidloader_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 6bd65f8..81d115b 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,5 @@ overrides/ .pgp build api/api +api/graph/api/generated.go +api/loaders/*_gen.go diff --git a/Makefile b/Makefile index 3db19e3..1d7a3f5 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=listssrht/ 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 64083b8..ef0b06c 100644 --- a/api/go.mod +++ b/api/go.mod @@ -6,7 +6,7 @@ require ( git.sr.ht/~sircmpwn/core-go v0.0.0-20220113153027-e7ae287d2fec git.sr.ht/~sircmpwn/getopt v1.0.0 // indirect git.sr.ht/~sircmpwn/go-bare v0.0.0-20210406120253-ab86bc2846d9 // indirect - github.com/99designs/gqlgen v0.14.0 + github.com/99designs/gqlgen v0.17.2 github.com/Masterminds/squirrel v1.5.2 github.com/ProtonMail/go-crypto v0.0.0-20220113124808-70ae35bab23f // indirect github.com/agnivade/levenshtein v1.1.1 // indirect @@ -19,13 +19,12 @@ require ( github.com/google/uuid v1.3.0 // indirect github.com/hashicorp/golang-lru v0.5.4 // indirect github.com/lib/pq v1.10.4 - github.com/matryer/moq v0.2.5 // indirect + github.com/matryer/moq v0.2.6 // indirect github.com/mitchellh/mapstructure v1.4.3 // indirect github.com/prometheus/common v0.32.1 // indirect - github.com/urfave/cli/v2 v2.3.0 // indirect - github.com/vektah/dataloaden v0.3.0 // indirect - github.com/vektah/gqlparser/v2 v2.2.0 + github.com/urfave/cli/v2 v2.4.0 // indirect + github.com/vektah/dataloaden v0.3.0 + github.com/vektah/gqlparser/v2 v2.4.1 golang.org/x/crypto v0.0.0-20220112180741-5e0467b6c7ce // indirect - golang.org/x/sys v0.0.0-20220111092808-5a964db01320 // indirect - golang.org/x/tools v0.1.8 // indirect + golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8 // indirect ) diff --git a/api/go.sum b/api/go.sum index f7e00a5..330f17f 100644 --- a/api/go.sum +++ b/api/go.sum @@ -43,6 +43,8 @@ git.sr.ht/~sircmpwn/go-bare v0.0.0-20210406120253-ab86bc2846d9 h1:Ahny8Ud1LjVMMA git.sr.ht/~sircmpwn/go-bare v0.0.0-20210406120253-ab86bc2846d9/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= @@ -206,6 +208,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= @@ -224,9 +227,13 @@ github.com/lib/pq v1.8.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/lib/pq v1.10.4 h1:SO9z7FRPzA03QhHKJrH5BXA6HU1rS4V2nIVrrNC1iYk= github.com/lib/pq v1.10.4/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/logrusorgru/aurora v0.0.0-20200102142835-e9ef32dff381/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= +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.5 h1:BGQISyhl7Gc9W/gMYmAJONh9mT6AYeyeTjNupNPknMs= github.com/matryer/moq v0.2.5/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= @@ -234,6 +241,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.4.3 h1:OVowDSCllw/YjdLkam3/sm7wEtOy59d8ndGgCcyj8cs= github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -308,6 +316,8 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/urfave/cli/v2 v2.1.1/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ= github.com/urfave/cli/v2 v2.3.0 h1:qph92Y649prgesehzOrQjdWyxFOp/QVM+6imKHad91M= 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/go.mod h1:/HUdMve7rvxZma+2ZELQeNh88+003LL7Pf/CZ089j8U= @@ -317,6 +327,9 @@ github.com/vektah/gqlparser v1.3.1 h1:8b0IcD3qZKWJQHSzynbDlrtP3IxVydZ2DZepCGofqf 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= @@ -334,6 +347,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/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220112180741-5e0467b6c7ce h1:Roh6XWxHFKrPgC/EQhVubSAGQ6Ozk6IdxHSzt1mR0EI= golang.org/x/crypto v0.0.0-20220112180741-5e0467b6c7ce/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= @@ -369,6 +383,8 @@ golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.5.1 h1:OJxoQ/rynoF0dcCdI7cLPktw/hR2cueqYfjm43oqK38= 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= @@ -471,6 +487,8 @@ golang.org/x/sys v0.0.0-20210820121016-41cdb8703e55/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220111092808-5a964db01320 h1:0jf+tOCoZ3LyutmCOWpVni1chK4VfFLhRsDK7MhqGRY= golang.org/x/sys v0.0.0-20220111092808-5a964db01320/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= @@ -531,6 +549,9 @@ golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.8 h1:P1HhGGuLW4aAclzjtmJdf0mJOjVUZUzOTqkAkWL+l6w= golang.org/x/tools v0.1.8/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= +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= @@ -627,6 +648,7 @@ 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 2bdcb6c..0000000 --- a/api/graph/api/generated.go +++ /dev/null @@ -1,13698 +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/lists.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 { - Email() EmailResolver - MailingList() MailingListResolver - MailingListACL() MailingListACLResolver - MailingListSubscription() MailingListSubscriptionResolver - Mutation() MutationResolver - Patchset() PatchsetResolver - PatchsetTool() PatchsetToolResolver - Query() QueryResolver - Thread() ThreadResolver - User() UserResolver -} - -type DirectiveRoot struct { - Access func(ctx context.Context, obj interface{}, next graphql.Resolver, scope model.AccessScope, kind model.AccessKind) (res interface{}, err error) - Scopehelp func(ctx context.Context, obj interface{}, next graphql.Resolver, details string) (res interface{}, err error) -} - -type ComplexityRoot struct { - ActivitySubscriptionCursor struct { - Cursor func(childComplexity int) int - Results func(childComplexity int) int - } - - Email struct { - AddressList func(childComplexity int, want string) int - Body func(childComplexity int) int - Date func(childComplexity int) int - Envelope func(childComplexity int) int - Header func(childComplexity int, want string) int - ID func(childComplexity int) int - InReplyTo func(childComplexity int) int - List func(childComplexity int) int - MessageID func(childComplexity int) int - Parent func(childComplexity int) int - Patch func(childComplexity int) int - Patchset func(childComplexity int) int - Received func(childComplexity int) int - Sender func(childComplexity int) int - Subject func(childComplexity int) int - Thread func(childComplexity int) int - } - - EmailCursor struct { - Cursor func(childComplexity int) int - Results func(childComplexity int) int - } - - GeneralACL struct { - Browse func(childComplexity int) int - Moderate func(childComplexity int) int - Post func(childComplexity int) int - Reply func(childComplexity int) int - } - - Mailbox struct { - Address func(childComplexity int) int - CanonicalName func(childComplexity int) int - Name func(childComplexity int) int - } - - MailingList struct { - ACL func(childComplexity int, cursor *model1.Cursor) int - Access func(childComplexity int) int - Archive func(childComplexity int) int - Created func(childComplexity int) int - Description func(childComplexity int) int - Emails func(childComplexity int, cursor *model1.Cursor) int - ID func(childComplexity int) int - Identified func(childComplexity int) int - Importing func(childComplexity int) int - Last30days func(childComplexity int) int - Name func(childComplexity int) int - Nonsubscriber func(childComplexity int) int - Owner func(childComplexity int) int - Patches func(childComplexity int, cursor *model1.Cursor) int - PermitMime func(childComplexity int) int - RejectMime func(childComplexity int) int - Subscriber func(childComplexity int) int - Subscription func(childComplexity int) int - Threads func(childComplexity int, cursor *model1.Cursor) int - Updated func(childComplexity int) int - } - - MailingListACL struct { - Browse func(childComplexity int) int - Created func(childComplexity int) int - Entity func(childComplexity int) int - ID func(childComplexity int) int - List func(childComplexity int) int - Moderate func(childComplexity int) int - Post func(childComplexity int) int - Reply func(childComplexity int) int - } - - MailingListACLCursor struct { - Cursor func(childComplexity int) int - Results func(childComplexity int) int - } - - MailingListCursor struct { - Cursor func(childComplexity int) int - Results func(childComplexity int) int - } - - MailingListSubscription struct { - Created func(childComplexity int) int - ID func(childComplexity int) int - List func(childComplexity int) int - } - - Mutation struct { - CreateMailingList func(childComplexity int, name string, description *string) int - CreateTool func(childComplexity int, patchsetID int, details string, icon model.ToolIcon) int - DeleteACL func(childComplexity int, id int) int - DeleteMailingList func(childComplexity int, id int) int - MailingListSubscribe func(childComplexity int, listID int) int - MailingListUnsubscribe func(childComplexity int, listID int) int - UpdateMailingList func(childComplexity int, id int, input map[string]interface{}) int - UpdateMailingListACL func(childComplexity int, listID int, input model.ACLInput) int - UpdatePatchset func(childComplexity int, id int, status model.PatchsetStatus) int - UpdateSenderACL func(childComplexity int, listID int, address string, input model.ACLInput) int - UpdateTool func(childComplexity int, id int, details *string, icon *model.ToolIcon) int - UpdateUserACL func(childComplexity int, listID int, userID int, input model.ACLInput) int - } - - Patch struct { - Count func(childComplexity int) int - Index func(childComplexity int) int - Prefix func(childComplexity int) int - Subject func(childComplexity int) int - Version func(childComplexity int) int - } - - Patchset struct { - CoverLetter func(childComplexity int) int - Created func(childComplexity int) int - ID func(childComplexity int) int - List func(childComplexity int) int - Mbox func(childComplexity int) int - Patches func(childComplexity int, cursor *model1.Cursor) int - Prefix func(childComplexity int) int - Status func(childComplexity int) int - Subject func(childComplexity int) int - Submitter func(childComplexity int) int - SupersededBy func(childComplexity int) int - Thread func(childComplexity int) int - Tools func(childComplexity int) int - Updated func(childComplexity int) int - Version func(childComplexity int) int - } - - PatchsetCursor struct { - Cursor func(childComplexity int) int - Results func(childComplexity int) int - } - - PatchsetTool struct { - Created func(childComplexity int) int - Details func(childComplexity int) int - ID func(childComplexity int) int - Icon func(childComplexity int) int - Patchset func(childComplexity int) int - Updated func(childComplexity int) int - } - - Query struct { - Email func(childComplexity int, id int) int - MailingList func(childComplexity int, id int) int - MailingListByName func(childComplexity int, name string) int - MailingListByOwner func(childComplexity int, ownerName string, listName string) int - MailingLists func(childComplexity int, cursor *model1.Cursor) int - Me func(childComplexity int) int - Message func(childComplexity int, messageID string) int - Patchset func(childComplexity int, id int) int - Subscriptions func(childComplexity int, cursor *model1.Cursor) int - User func(childComplexity int, id int) int - UserByName func(childComplexity int, username string) int - Version func(childComplexity int) int - } - - Thread struct { - Created func(childComplexity int) int - Descendants func(childComplexity int, cursor *model1.Cursor) int - List func(childComplexity int) int - Mailto func(childComplexity int) int - Mbox func(childComplexity int) int - Participants func(childComplexity int) int - Replies func(childComplexity int) int - Root func(childComplexity int) int - Sender func(childComplexity int) int - Subject func(childComplexity int) int - Updated func(childComplexity int) int - } - - ThreadCursor struct { - Cursor func(childComplexity int) int - Results 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 - Emails func(childComplexity int, cursor *model1.Cursor) int - ID func(childComplexity int) int - Lists func(childComplexity int, cursor *model1.Cursor) int - Location func(childComplexity int) int - Patches func(childComplexity int, cursor *model1.Cursor) int - Threads func(childComplexity int, cursor *model1.Cursor) int - URL func(childComplexity int) int - Updated func(childComplexity int) int - Username func(childComplexity int) int - } - - Version struct { - DeprecationDate func(childComplexity int) int - Major func(childComplexity int) int - Minor func(childComplexity int) int - Patch func(childComplexity int) int - } -} - -type EmailResolver interface { - Sender(ctx context.Context, obj *model.Email) (model.Entity, error) - - Date(ctx context.Context, obj *model.Email) (*time.Time, error) - - Header(ctx context.Context, obj *model.Email, want string) ([]string, error) - AddressList(ctx context.Context, obj *model.Email, want string) ([]*model.Mailbox, error) - - Envelope(ctx context.Context, obj *model.Email) (*model.URL, error) - Thread(ctx context.Context, obj *model.Email) (*model.Thread, error) - Parent(ctx context.Context, obj *model.Email) (*model.Email, error) - - Patchset(ctx context.Context, obj *model.Email) (*model.Patchset, error) - List(ctx context.Context, obj *model.Email) (*model.MailingList, error) -} -type MailingListResolver interface { - Owner(ctx context.Context, obj *model.MailingList) (model.Entity, error) - - Threads(ctx context.Context, obj *model.MailingList, cursor *model1.Cursor) (*model.ThreadCursor, error) - Emails(ctx context.Context, obj *model.MailingList, cursor *model1.Cursor) (*model.EmailCursor, error) - Patches(ctx context.Context, obj *model.MailingList, cursor *model1.Cursor) (*model.PatchsetCursor, error) - - Access(ctx context.Context, obj *model.MailingList) (model.ACL, error) - Subscription(ctx context.Context, obj *model.MailingList) (*model.MailingListSubscription, error) - Archive(ctx context.Context, obj *model.MailingList) (*model.URL, error) - Last30days(ctx context.Context, obj *model.MailingList) (*model.URL, error) - ACL(ctx context.Context, obj *model.MailingList, cursor *model1.Cursor) (*model.MailingListACLCursor, error) -} -type MailingListACLResolver interface { - List(ctx context.Context, obj *model.MailingListACL) (*model.MailingList, error) - Entity(ctx context.Context, obj *model.MailingListACL) (model.Entity, error) -} -type MailingListSubscriptionResolver interface { - List(ctx context.Context, obj *model.MailingListSubscription) (*model.MailingList, error) -} -type MutationResolver interface { - CreateMailingList(ctx context.Context, name string, description *string) (*model.MailingList, error) - UpdateMailingList(ctx context.Context, id int, input map[string]interface{}) (*model.MailingList, error) - DeleteMailingList(ctx context.Context, id int) (*model.MailingList, error) - UpdateUserACL(ctx context.Context, listID int, userID int, input model.ACLInput) (*model.MailingListACL, error) - UpdateSenderACL(ctx context.Context, listID int, address string, input model.ACLInput) (*model.MailingListACL, error) - UpdateMailingListACL(ctx context.Context, listID int, input model.ACLInput) (*model.MailingList, error) - DeleteACL(ctx context.Context, id int) (*model.MailingListACL, error) - UpdatePatchset(ctx context.Context, id int, status model.PatchsetStatus) (*model.Patchset, error) - CreateTool(ctx context.Context, patchsetID int, details string, icon model.ToolIcon) (*model.PatchsetTool, error) - UpdateTool(ctx context.Context, id int, details *string, icon *model.ToolIcon) (*model.PatchsetTool, error) - MailingListSubscribe(ctx context.Context, listID int) (*model.MailingListSubscription, error) - MailingListUnsubscribe(ctx context.Context, listID int) (*model.MailingListSubscription, error) -} -type PatchsetResolver interface { - Submitter(ctx context.Context, obj *model.Patchset) (model.Entity, error) - CoverLetter(ctx context.Context, obj *model.Patchset) (*model.Email, error) - Thread(ctx context.Context, obj *model.Patchset) (*model.Thread, error) - SupersededBy(ctx context.Context, obj *model.Patchset) (*model.Patchset, error) - List(ctx context.Context, obj *model.Patchset) (*model.MailingList, error) - Patches(ctx context.Context, obj *model.Patchset, cursor *model1.Cursor) (*model.EmailCursor, error) - Tools(ctx context.Context, obj *model.Patchset) ([]*model.PatchsetTool, error) - Mbox(ctx context.Context, obj *model.Patchset) (*model.URL, error) -} -type PatchsetToolResolver interface { - Patchset(ctx context.Context, obj *model.PatchsetTool) (*model.Patchset, error) -} -type QueryResolver interface { - Version(ctx context.Context) (*model.Version, error) - Me(ctx context.Context) (*model.User, error) - User(ctx context.Context, id int) (*model.User, error) - UserByName(ctx context.Context, username string) (*model.User, error) - MailingList(ctx context.Context, id int) (*model.MailingList, error) - MailingListByName(ctx context.Context, name string) (*model.MailingList, error) - MailingListByOwner(ctx context.Context, ownerName string, listName string) (*model.MailingList, error) - Email(ctx context.Context, id int) (*model.Email, error) - Message(ctx context.Context, messageID string) (*model.Email, error) - Patchset(ctx context.Context, id int) (*model.Patchset, error) - MailingLists(ctx context.Context, cursor *model1.Cursor) (*model.MailingListCursor, error) - Subscriptions(ctx context.Context, cursor *model1.Cursor) (*model.ActivitySubscriptionCursor, error) -} -type ThreadResolver interface { - Sender(ctx context.Context, obj *model.Thread) (model.Entity, error) - Root(ctx context.Context, obj *model.Thread) (*model.Email, error) - List(ctx context.Context, obj *model.Thread) (*model.MailingList, error) - Descendants(ctx context.Context, obj *model.Thread, cursor *model1.Cursor) (*model.EmailCursor, error) - Mailto(ctx context.Context, obj *model.Thread) (string, error) - Mbox(ctx context.Context, obj *model.Thread) (*model.URL, error) -} -type UserResolver interface { - Lists(ctx context.Context, obj *model.User, cursor *model1.Cursor) (*model.MailingListCursor, error) - Emails(ctx context.Context, obj *model.User, cursor *model1.Cursor) (*model.EmailCursor, error) - Threads(ctx context.Context, obj *model.User, cursor *model1.Cursor) (*model.ThreadCursor, error) - Patches(ctx context.Context, obj *model.User, cursor *model1.Cursor) (*model.PatchsetCursor, 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 "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 "Email.addressList": - if e.complexity.Email.AddressList == nil { - break - } - - args, err := ec.field_Email_addressList_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Email.AddressList(childComplexity, args["want"].(string)), true - - case "Email.body": - if e.complexity.Email.Body == nil { - break - } - - return e.complexity.Email.Body(childComplexity), true - - case "Email.date": - if e.complexity.Email.Date == nil { - break - } - - return e.complexity.Email.Date(childComplexity), true - - case "Email.envelope": - if e.complexity.Email.Envelope == nil { - break - } - - return e.complexity.Email.Envelope(childComplexity), true - - case "Email.header": - if e.complexity.Email.Header == nil { - break - } - - args, err := ec.field_Email_header_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Email.Header(childComplexity, args["want"].(string)), true - - case "Email.id": - if e.complexity.Email.ID == nil { - break - } - - return e.complexity.Email.ID(childComplexity), true - - case "Email.inReplyTo": - if e.complexity.Email.InReplyTo == nil { - break - } - - return e.complexity.Email.InReplyTo(childComplexity), true - - case "Email.list": - if e.complexity.Email.List == nil { - break - } - - return e.complexity.Email.List(childComplexity), true - - case "Email.messageID": - if e.complexity.Email.MessageID == nil { - break - } - - return e.complexity.Email.MessageID(childComplexity), true - - case "Email.parent": - if e.complexity.Email.Parent == nil { - break - } - - return e.complexity.Email.Parent(childComplexity), true - - case "Email.patch": - if e.complexity.Email.Patch == nil { - break - } - - return e.complexity.Email.Patch(childComplexity), true - - case "Email.patchset": - if e.complexity.Email.Patchset == nil { - break - } - - return e.complexity.Email.Patchset(childComplexity), true - - case "Email.received": - if e.complexity.Email.Received == nil { - break - } - - return e.complexity.Email.Received(childComplexity), true - - case "Email.sender": - if e.complexity.Email.Sender == nil { - break - } - - return e.complexity.Email.Sender(childComplexity), true - - case "Email.subject": - if e.complexity.Email.Subject == nil { - break - } - - return e.complexity.Email.Subject(childComplexity), true - - case "Email.thread": - if e.complexity.Email.Thread == nil { - break - } - - return e.complexity.Email.Thread(childComplexity), true - - case "EmailCursor.cursor": - if e.complexity.EmailCursor.Cursor == nil { - break - } - - return e.complexity.EmailCursor.Cursor(childComplexity), true - - case "EmailCursor.results": - if e.complexity.EmailCursor.Results == nil { - break - } - - return e.complexity.EmailCursor.Results(childComplexity), true - - case "GeneralACL.browse": - if e.complexity.GeneralACL.Browse == nil { - break - } - - return e.complexity.GeneralACL.Browse(childComplexity), true - - case "GeneralACL.moderate": - if e.complexity.GeneralACL.Moderate == nil { - break - } - - return e.complexity.GeneralACL.Moderate(childComplexity), true - - case "GeneralACL.post": - if e.complexity.GeneralACL.Post == nil { - break - } - - return e.complexity.GeneralACL.Post(childComplexity), true - - case "GeneralACL.reply": - if e.complexity.GeneralACL.Reply == nil { - break - } - - return e.complexity.GeneralACL.Reply(childComplexity), true - - case "Mailbox.address": - if e.complexity.Mailbox.Address == nil { - break - } - - return e.complexity.Mailbox.Address(childComplexity), true - - case "Mailbox.canonicalName": - if e.complexity.Mailbox.CanonicalName == nil { - break - } - - return e.complexity.Mailbox.CanonicalName(childComplexity), true - - case "Mailbox.name": - if e.complexity.Mailbox.Name == nil { - break - } - - return e.complexity.Mailbox.Name(childComplexity), true - - case "MailingList.acl": - if e.complexity.MailingList.ACL == nil { - break - } - - args, err := ec.field_MailingList_acl_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.MailingList.ACL(childComplexity, args["cursor"].(*model1.Cursor)), true - - case "MailingList.access": - if e.complexity.MailingList.Access == nil { - break - } - - return e.complexity.MailingList.Access(childComplexity), true - - case "MailingList.archive": - if e.complexity.MailingList.Archive == nil { - break - } - - return e.complexity.MailingList.Archive(childComplexity), true - - case "MailingList.created": - if e.complexity.MailingList.Created == nil { - break - } - - return e.complexity.MailingList.Created(childComplexity), true - - case "MailingList.description": - if e.complexity.MailingList.Description == nil { - break - } - - return e.complexity.MailingList.Description(childComplexity), true - - case "MailingList.emails": - if e.complexity.MailingList.Emails == nil { - break - } - - args, err := ec.field_MailingList_emails_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.MailingList.Emails(childComplexity, args["cursor"].(*model1.Cursor)), true - - case "MailingList.id": - if e.complexity.MailingList.ID == nil { - break - } - - return e.complexity.MailingList.ID(childComplexity), true - - case "MailingList.identified": - if e.complexity.MailingList.Identified == nil { - break - } - - return e.complexity.MailingList.Identified(childComplexity), true - - case "MailingList.importing": - if e.complexity.MailingList.Importing == nil { - break - } - - return e.complexity.MailingList.Importing(childComplexity), true - - case "MailingList.last30days": - if e.complexity.MailingList.Last30days == nil { - break - } - - return e.complexity.MailingList.Last30days(childComplexity), true - - case "MailingList.name": - if e.complexity.MailingList.Name == nil { - break - } - - return e.complexity.MailingList.Name(childComplexity), true - - case "MailingList.nonsubscriber": - if e.complexity.MailingList.Nonsubscriber == nil { - break - } - - return e.complexity.MailingList.Nonsubscriber(childComplexity), true - - case "MailingList.owner": - if e.complexity.MailingList.Owner == nil { - break - } - - return e.complexity.MailingList.Owner(childComplexity), true - - case "MailingList.patches": - if e.complexity.MailingList.Patches == nil { - break - } - - args, err := ec.field_MailingList_patches_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.MailingList.Patches(childComplexity, args["cursor"].(*model1.Cursor)), true - - case "MailingList.permitMime": - if e.complexity.MailingList.PermitMime == nil { - break - } - - return e.complexity.MailingList.PermitMime(childComplexity), true - - case "MailingList.rejectMime": - if e.complexity.MailingList.RejectMime == nil { - break - } - - return e.complexity.MailingList.RejectMime(childComplexity), true - - case "MailingList.subscriber": - if e.complexity.MailingList.Subscriber == nil { - break - } - - return e.complexity.MailingList.Subscriber(childComplexity), true - - case "MailingList.subscription": - if e.complexity.MailingList.Subscription == nil { - break - } - - return e.complexity.MailingList.Subscription(childComplexity), true - - case "MailingList.threads": - if e.complexity.MailingList.Threads == nil { - break - } - - args, err := ec.field_MailingList_threads_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.MailingList.Threads(childComplexity, args["cursor"].(*model1.Cursor)), true - - case "MailingList.updated": - if e.complexity.MailingList.Updated == nil { - break - } - - return e.complexity.MailingList.Updated(childComplexity), true - - case "MailingListACL.browse": - if e.complexity.MailingListACL.Browse == nil { - break - } - - return e.complexity.MailingListACL.Browse(childComplexity), true - - case "MailingListACL.created": - if e.complexity.MailingListACL.Created == nil { - break - } - - return e.complexity.MailingListACL.Created(childComplexity), true - - case "MailingListACL.entity": - if e.complexity.MailingListACL.Entity == nil { - break - } - - return e.complexity.MailingListACL.Entity(childComplexity), true - - case "MailingListACL.id": - if e.complexity.MailingListACL.ID == nil { - break - } - - return e.complexity.MailingListACL.ID(childComplexity), true - - case "MailingListACL.list": - if e.complexity.MailingListACL.List == nil { - break - } - - return e.complexity.MailingListACL.List(childComplexity), true - - case "MailingListACL.moderate": - if e.complexity.MailingListACL.Moderate == nil { - break - } - - return e.complexity.MailingListACL.Moderate(childComplexity), true - - case "MailingListACL.post": - if e.complexity.MailingListACL.Post == nil { - break - } - - return e.complexity.MailingListACL.Post(childComplexity), true - - case "MailingListACL.reply": - if e.complexity.MailingListACL.Reply == nil { - break - } - - return e.complexity.MailingListACL.Reply(childComplexity), true - - case "MailingListACLCursor.cursor": - if e.complexity.MailingListACLCursor.Cursor == nil { - break - } - - return e.complexity.MailingListACLCursor.Cursor(childComplexity), true - - case "MailingListACLCursor.results": - if e.complexity.MailingListACLCursor.Results == nil { - break - } - - return e.complexity.MailingListACLCursor.Results(childComplexity), true - - case "MailingListCursor.cursor": - if e.complexity.MailingListCursor.Cursor == nil { - break - } - - return e.complexity.MailingListCursor.Cursor(childComplexity), true - - case "MailingListCursor.results": - if e.complexity.MailingListCursor.Results == nil { - break - } - - return e.complexity.MailingListCursor.Results(childComplexity), true - - case "MailingListSubscription.created": - if e.complexity.MailingListSubscription.Created == nil { - break - } - - return e.complexity.MailingListSubscription.Created(childComplexity), true - - case "MailingListSubscription.id": - if e.complexity.MailingListSubscription.ID == nil { - break - } - - return e.complexity.MailingListSubscription.ID(childComplexity), true - - case "MailingListSubscription.list": - if e.complexity.MailingListSubscription.List == nil { - break - } - - return e.complexity.MailingListSubscription.List(childComplexity), true - - case "Mutation.createMailingList": - if e.complexity.Mutation.CreateMailingList == nil { - break - } - - args, err := ec.field_Mutation_createMailingList_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Mutation.CreateMailingList(childComplexity, args["name"].(string), args["description"].(*string)), true - - case "Mutation.createTool": - if e.complexity.Mutation.CreateTool == nil { - break - } - - args, err := ec.field_Mutation_createTool_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Mutation.CreateTool(childComplexity, args["patchsetID"].(int), args["details"].(string), args["icon"].(model.ToolIcon)), 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.deleteMailingList": - if e.complexity.Mutation.DeleteMailingList == nil { - break - } - - args, err := ec.field_Mutation_deleteMailingList_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Mutation.DeleteMailingList(childComplexity, args["id"].(int)), true - - case "Mutation.mailingListSubscribe": - if e.complexity.Mutation.MailingListSubscribe == nil { - break - } - - args, err := ec.field_Mutation_mailingListSubscribe_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Mutation.MailingListSubscribe(childComplexity, args["listID"].(int)), true - - case "Mutation.mailingListUnsubscribe": - if e.complexity.Mutation.MailingListUnsubscribe == nil { - break - } - - args, err := ec.field_Mutation_mailingListUnsubscribe_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Mutation.MailingListUnsubscribe(childComplexity, args["listID"].(int)), true - - case "Mutation.updateMailingList": - if e.complexity.Mutation.UpdateMailingList == nil { - break - } - - args, err := ec.field_Mutation_updateMailingList_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Mutation.UpdateMailingList(childComplexity, args["id"].(int), args["input"].(map[string]interface{})), true - - case "Mutation.updateMailingListACL": - if e.complexity.Mutation.UpdateMailingListACL == nil { - break - } - - args, err := ec.field_Mutation_updateMailingListACL_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Mutation.UpdateMailingListACL(childComplexity, args["listID"].(int), args["input"].(model.ACLInput)), true - - case "Mutation.updatePatchset": - if e.complexity.Mutation.UpdatePatchset == nil { - break - } - - args, err := ec.field_Mutation_updatePatchset_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Mutation.UpdatePatchset(childComplexity, args["id"].(int), args["status"].(model.PatchsetStatus)), true - - case "Mutation.updateSenderACL": - if e.complexity.Mutation.UpdateSenderACL == nil { - break - } - - args, err := ec.field_Mutation_updateSenderACL_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Mutation.UpdateSenderACL(childComplexity, args["listID"].(int), args["address"].(string), args["input"].(model.ACLInput)), true - - case "Mutation.updateTool": - if e.complexity.Mutation.UpdateTool == nil { - break - } - - args, err := ec.field_Mutation_updateTool_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Mutation.UpdateTool(childComplexity, args["id"].(int), args["details"].(*string), args["icon"].(*model.ToolIcon)), 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["listID"].(int), args["userID"].(int), args["input"].(model.ACLInput)), true - - case "Patch.count": - if e.complexity.Patch.Count == nil { - break - } - - return e.complexity.Patch.Count(childComplexity), true - - case "Patch.index": - if e.complexity.Patch.Index == nil { - break - } - - return e.complexity.Patch.Index(childComplexity), true - - case "Patch.prefix": - if e.complexity.Patch.Prefix == nil { - break - } - - return e.complexity.Patch.Prefix(childComplexity), true - - case "Patch.subject": - if e.complexity.Patch.Subject == nil { - break - } - - return e.complexity.Patch.Subject(childComplexity), true - - case "Patch.version": - if e.complexity.Patch.Version == nil { - break - } - - return e.complexity.Patch.Version(childComplexity), true - - case "Patchset.coverLetter": - if e.complexity.Patchset.CoverLetter == nil { - break - } - - return e.complexity.Patchset.CoverLetter(childComplexity), true - - case "Patchset.created": - if e.complexity.Patchset.Created == nil { - break - } - - return e.complexity.Patchset.Created(childComplexity), true - - case "Patchset.id": - if e.complexity.Patchset.ID == nil { - break - } - - return e.complexity.Patchset.ID(childComplexity), true - - case "Patchset.list": - if e.complexity.Patchset.List == nil { - break - } - - return e.complexity.Patchset.List(childComplexity), true - - case "Patchset.mbox": - if e.complexity.Patchset.Mbox == nil { - break - } - - return e.complexity.Patchset.Mbox(childComplexity), true - - case "Patchset.patches": - if e.complexity.Patchset.Patches == nil { - break - } - - args, err := ec.field_Patchset_patches_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Patchset.Patches(childComplexity, args["cursor"].(*model1.Cursor)), true - - case "Patchset.prefix": - if e.complexity.Patchset.Prefix == nil { - break - } - - return e.complexity.Patchset.Prefix(childComplexity), true - - case "Patchset.status": - if e.complexity.Patchset.Status == nil { - break - } - - return e.complexity.Patchset.Status(childComplexity), true - - case "Patchset.subject": - if e.complexity.Patchset.Subject == nil { - break - } - - return e.complexity.Patchset.Subject(childComplexity), true - - case "Patchset.submitter": - if e.complexity.Patchset.Submitter == nil { - break - } - - return e.complexity.Patchset.Submitter(childComplexity), true - - case "Patchset.supersededBy": - if e.complexity.Patchset.SupersededBy == nil { - break - } - - return e.complexity.Patchset.SupersededBy(childComplexity), true - - case "Patchset.thread": - if e.complexity.Patchset.Thread == nil { - break - } - - return e.complexity.Patchset.Thread(childComplexity), true - - case "Patchset.tools": - if e.complexity.Patchset.Tools == nil { - break - } - - return e.complexity.Patchset.Tools(childComplexity), true - - case "Patchset.updated": - if e.complexity.Patchset.Updated == nil { - break - } - - return e.complexity.Patchset.Updated(childComplexity), true - - case "Patchset.version": - if e.complexity.Patchset.Version == nil { - break - } - - return e.complexity.Patchset.Version(childComplexity), true - - case "PatchsetCursor.cursor": - if e.complexity.PatchsetCursor.Cursor == nil { - break - } - - return e.complexity.PatchsetCursor.Cursor(childComplexity), true - - case "PatchsetCursor.results": - if e.complexity.PatchsetCursor.Results == nil { - break - } - - return e.complexity.PatchsetCursor.Results(childComplexity), true - - case "PatchsetTool.created": - if e.complexity.PatchsetTool.Created == nil { - break - } - - return e.complexity.PatchsetTool.Created(childComplexity), true - - case "PatchsetTool.details": - if e.complexity.PatchsetTool.Details == nil { - break - } - - return e.complexity.PatchsetTool.Details(childComplexity), true - - case "PatchsetTool.id": - if e.complexity.PatchsetTool.ID == nil { - break - } - - return e.complexity.PatchsetTool.ID(childComplexity), true - - case "PatchsetTool.icon": - if e.complexity.PatchsetTool.Icon == nil { - break - } - - return e.complexity.PatchsetTool.Icon(childComplexity), true - - case "PatchsetTool.patchset": - if e.complexity.PatchsetTool.Patchset == nil { - break - } - - return e.complexity.PatchsetTool.Patchset(childComplexity), true - - case "PatchsetTool.updated": - if e.complexity.PatchsetTool.Updated == nil { - break - } - - return e.complexity.PatchsetTool.Updated(childComplexity), true - - case "Query.email": - if e.complexity.Query.Email == nil { - break - } - - args, err := ec.field_Query_email_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Query.Email(childComplexity, args["id"].(int)), true - - case "Query.mailingList": - if e.complexity.Query.MailingList == nil { - break - } - - args, err := ec.field_Query_mailingList_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Query.MailingList(childComplexity, args["id"].(int)), true - - case "Query.mailingListByName": - if e.complexity.Query.MailingListByName == nil { - break - } - - args, err := ec.field_Query_mailingListByName_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Query.MailingListByName(childComplexity, args["name"].(string)), true - - case "Query.mailingListByOwner": - if e.complexity.Query.MailingListByOwner == nil { - break - } - - args, err := ec.field_Query_mailingListByOwner_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Query.MailingListByOwner(childComplexity, args["ownerName"].(string), args["listName"].(string)), true - - case "Query.mailingLists": - if e.complexity.Query.MailingLists == nil { - break - } - - args, err := ec.field_Query_mailingLists_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Query.MailingLists(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.message": - if e.complexity.Query.Message == nil { - break - } - - args, err := ec.field_Query_message_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Query.Message(childComplexity, args["messageID"].(string)), true - - case "Query.patchset": - if e.complexity.Query.Patchset == nil { - break - } - - args, err := ec.field_Query_patchset_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Query.Patchset(childComplexity, args["id"].(int)), 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.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["id"].(int)), true - - case "Query.userByName": - if e.complexity.Query.UserByName == nil { - break - } - - args, err := ec.field_Query_userByName_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Query.UserByName(childComplexity, args["username"].(string)), true - - case "Query.version": - if e.complexity.Query.Version == nil { - break - } - - return e.complexity.Query.Version(childComplexity), true - - case "Thread.created": - if e.complexity.Thread.Created == nil { - break - } - - return e.complexity.Thread.Created(childComplexity), true - - case "Thread.descendants": - if e.complexity.Thread.Descendants == nil { - break - } - - args, err := ec.field_Thread_descendants_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Thread.Descendants(childComplexity, args["cursor"].(*model1.Cursor)), true - - case "Thread.list": - if e.complexity.Thread.List == nil { - break - } - - return e.complexity.Thread.List(childComplexity), true - - case "Thread.mailto": - if e.complexity.Thread.Mailto == nil { - break - } - - return e.complexity.Thread.Mailto(childComplexity), true - - case "Thread.mbox": - if e.complexity.Thread.Mbox == nil { - break - } - - return e.complexity.Thread.Mbox(childComplexity), true - - case "Thread.participants": - if e.complexity.Thread.Participants == nil { - break - } - - return e.complexity.Thread.Participants(childComplexity), true - - case "Thread.replies": - if e.complexity.Thread.Replies == nil { - break - } - - return e.complexity.Thread.Replies(childComplexity), true - - case "Thread.root": - if e.complexity.Thread.Root == nil { - break - } - - return e.complexity.Thread.Root(childComplexity), true - - case "Thread.sender": - if e.complexity.Thread.Sender == nil { - break - } - - return e.complexity.Thread.Sender(childComplexity), true - - case "Thread.subject": - if e.complexity.Thread.Subject == nil { - break - } - - return e.complexity.Thread.Subject(childComplexity), true - - case "Thread.updated": - if e.complexity.Thread.Updated == nil { - break - } - - return e.complexity.Thread.Updated(childComplexity), true - - case "ThreadCursor.cursor": - if e.complexity.ThreadCursor.Cursor == nil { - break - } - - return e.complexity.ThreadCursor.Cursor(childComplexity), true - - case "ThreadCursor.results": - if e.complexity.ThreadCursor.Results == nil { - break - } - - return e.complexity.ThreadCursor.Results(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.emails": - if e.complexity.User.Emails == nil { - break - } - - args, err := ec.field_User_emails_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.User.Emails(childComplexity, args["cursor"].(*model1.Cursor)), true - - case "User.id": - if e.complexity.User.ID == nil { - break - } - - return e.complexity.User.ID(childComplexity), true - - case "User.lists": - if e.complexity.User.Lists == nil { - break - } - - args, err := ec.field_User_lists_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.User.Lists(childComplexity, args["cursor"].(*model1.Cursor)), true - - case "User.location": - if e.complexity.User.Location == nil { - break - } - - return e.complexity.User.Location(childComplexity), true - - case "User.patches": - if e.complexity.User.Patches == nil { - break - } - - args, err := ec.field_User_patches_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.User.Patches(childComplexity, args["cursor"].(*model1.Cursor)), true - - case "User.threads": - if e.complexity.User.Threads == nil { - break - } - - args, err := ec.field_User_threads_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.User.Threads(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 "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. - -"String of the format %Y-%m-%dT%H:%M:%SZ" -scalar Time -"Opaque string" -scalar Cursor -""" -URL from which some secondary data may be retrieved. You must provide the -same Authentication header to this address as you did to the GraphQL resolver -which provided it. The URL is not guaranteed to be consistent for an extended -length of time; applications should submit a new GraphQL query each time they -wish to access the data at the provided URL. -""" -scalar URL - -"Used to provide a human-friendly description of an access scope" -directive @scopehelp(details: String!) on ENUM_VALUE - -enum AccessScope { - ACLS @scopehelp(details: "access control lists") - EMAILS @scopehelp(details: "emails") - LISTS @scopehelp(details: "mailing lists") - PATCHES @scopehelp(details: "patches") - PROFILE @scopehelp(details: "profile information") - 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! -} - -"A registered user" -type User implements Entity { - id: Int! - created: Time! - updated: Time! - canonicalName: String! - username: String! - email: String! - url: String - location: String - bio: String - - lists(cursor: Cursor): MailingListCursor @access(scope: LISTS, kind: RO) - emails(cursor: Cursor): EmailCursor @access(scope: EMAILS, kind: RO) - threads(cursor: Cursor): ThreadCursor @access(scope: EMAILS, kind: RO) - patches(cursor: Cursor): PatchsetCursor @access(scope: PATCHES, kind: RO) -} - -"A mailbox not associated with a registered user" -type Mailbox implements Entity { - canonicalName: String! - name: String! - address: String! -} - -type MailingList { - id: Int! - created: Time! - updated: Time! - name: String! - owner: Entity! @access(scope: PROFILE, kind: RO) - - # Markdown - description: String - - """ - List of globs for permitted or rejected mimetypes on this list - e.g. text/* - """ - permitMime: [String!]! - rejectMime: [String!]! - - "List of threads on this list in order of most recently bumped" - threads(cursor: Cursor): ThreadCursor! @access(scope: EMAILS, kind: RO) - "List of emails received on this list in reverse chronological order" - emails(cursor: Cursor): EmailCursor! @access(scope: EMAILS, kind: RO) - "List of patches received on this list in order of most recently bumped" - patches(cursor: Cursor): PatchsetCursor! @access(scope: PATCHES, kind: RO) - - "True if an import operation is underway for this list" - importing: Boolean! - - "The access that applies to this user for this list" - access: ACL! @access(scope: ACLS, kind: RO) - - "The user's subscription for this list, if any" - subscription: MailingListSubscription @access(scope: SUBSCRIPTIONS, kind: RO) - - "URLs to application/mbox archives for this mailing list" - archive: URL! - last30days: URL! - - # - # The following resolvers are only available to the list owner: - - "Access control list entries for this mailing list" - acl(cursor: Cursor): MailingListACLCursor! @access(scope: ACLS, kind: RO) - "Permissions which apply to any non-subscriber" - nonsubscriber: GeneralACL! - "Permissions which apply to any subscriber" - subscriber: GeneralACL! - "Permissions which apply to any authenticated account holder" - identified: GeneralACL! -} - -interface ACL { - "Permission to browse or subscribe to emails" - browse: Boolean! - "Permission to reply to existing threads" - reply: Boolean! - "Permission to start new threads" - post: Boolean! - "Permission to moderate the list" - moderate: Boolean! -} - -""" -These ACLs are configured for specific entities, and may be used to expand or -constrain the rights of a participant. -""" -type MailingListACL implements ACL { - id: Int! - created: Time! - list: MailingList! @access(scope: LISTS, kind: RO) - entity: Entity! @access(scope: PROFILE, kind: RO) - - browse: Boolean! - reply: Boolean! - post: Boolean! - moderate: Boolean! -} - -""" -An ACL entry that applies "generally", for example the rights which apply to -all subscribers to a list. -""" -type GeneralACL implements ACL { - browse: Boolean! - reply: Boolean! - post: Boolean! - moderate: Boolean! -} - -type Thread { - created: Time! - updated: Time! - subject: String! - replies: Int! - participants: Int! - sender: Entity! - - root: Email! - - list: MailingList! @access(scope: LISTS, kind: RO) - - "Replies to this thread, in chronological order" - descendants(cursor: Cursor): EmailCursor! - - "A mailto: URI for replying to the latest message in this thread" - mailto: String! - - "URL to an application/mbox archive of this thread" - mbox: URL! -} - -type Email { - id: Int! - - """ - The entity which sent this email. Will be a User if it can be associated - with an account, or a Mailbox otherwise. - """ - sender: Entity! - "Time we received this email (non-forgable)." - received: Time! - "Time given by Date header (forgable)." - date: Time - "The Subject header." - subject: String! - "The Message-ID header, without angle brackets." - messageID: String! - "The In-Reply-To header, if present, without angle brackets." - inReplyTo: String - - """ - Provides the value (or values) of a specific header from this email. Note - that the returned value is coerced to UTF-8 and may be lossy under certain - circumstances. - """ - header(want: String!): [String!]! - "Retrieves the value of an address list header, such as To or Cc." - addressList(want: String!): [Mailbox!]! - "The decoded text/plain message part of the email, i.e. email body." - body: String! - "A URL from which the full raw message envelope may be downloaded." - envelope: URL! - - thread: Thread! - parent: Email - patch: Patch - - patchset: Patchset @access(scope: PATCHES, kind: RO) - list: MailingList! @access(scope: LISTS, kind: RO) -} - -""" -Information parsed from the subject line of a patch, such that the following: - - [PATCH myproject v2 3/4] Add foo to bar - -Will produce: - - index: 3 - count: 4 - version: 2 - prefix: "myproject" - subject: "Add foo to bar" -""" -type Patch { - index: Int - count: Int - version: Int - prefix: String - subject: String -} - -enum PatchsetStatus { - UNKNOWN - PROPOSED - NEEDS_REVISION - SUPERSEDED - APPROVED - REJECTED - APPLIED -} - -type Patchset { - id: Int! - created: Time! - updated: Time! - subject: String! - version: Int! - prefix: String - status: PatchsetStatus! - submitter: Entity! - - coverLetter: Email @access(scope: EMAILS, kind: RO) - thread: Thread! @access(scope: EMAILS, kind: RO) - supersededBy: Patchset - list: MailingList! @access(scope: LISTS, kind: RO) - patches(cursor: Cursor): EmailCursor! @access(scope: EMAILS, kind: RO) - tools: [PatchsetTool!]! - - "URL to an application/mbox archive of only the patches in this thread" - mbox: URL! -} - -enum ToolIcon { - PENDING - WAITING - SUCCESS - FAILED - CANCELLED -} - -""" -Used to add some kind of indicator for a third-party process associated with -a patchset, such as a CI service validating the change. -""" -type PatchsetTool { - id: Int! - created: Time! - updated: Time! - icon: ToolIcon! - details: String! - patchset: Patchset! -} - -interface ActivitySubscription { - id: Int! - created: Time! -} - -type MailingListSubscription implements ActivitySubscription { - id: Int! - created: Time! - list: MailingList! @access(scope: LISTS, kind: RO) -} - -""" -A cursor for enumerating ACL 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 MailingListACLCursor { - results: [MailingListACL!]! - cursor: Cursor -} - -""" -A cursor for enumerating mailing lists - -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 MailingListCursor { - results: [MailingList!]! - cursor: Cursor -} - -""" -A cursor for enumerating threads - -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 ThreadCursor { - results: [Thread!]! - cursor: Cursor -} - -""" -A cursor for enumerating emails - -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 EmailCursor { - results: [Email!]! - cursor: Cursor -} - -""" -A cursor for enumerating patchsets - -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 PatchsetCursor { - results: [Patchset!]! - 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) - - "Looks up a specific user" - user(id: Int!): User @access(scope: PROFILE, kind: RO) - userByName(username: String!): User @access(scope: PROFILE, kind: RO) - - "Looks up a specific mailing list" - mailingList(id: Int!): MailingList @access(scope: LISTS, kind: RO) - mailingListByName(name: String!): MailingList @access(scope: LISTS, kind: RO) - mailingListByOwner(ownerName: String!, listName: String!): MailingList @access(scope: LISTS, kind: RO) - - "Looks up a specific email by its ID" - email(id: Int!): Email @access(scope: EMAILS, kind: RO) - """ - Looks up a specific email by its Message-ID header, including the angle - brackets ('<' and '>'). - """ - message(messageID: String!): Email @access(scope: EMAILS, kind: RO) - "Looks up a patchset by ID" - patchset(id: Int!): Patchset @access(scope: EMAILS, kind: RO) - - "List of mailing lists that the authenticated user has ownership of" - mailingLists(cursor: Cursor): MailingListCursor! @access(scope: LISTS, 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 mailing list -input MailingListInput { - description: String - - """ - List of globs for permitted or rejected mimetypes on this list - e.g. text/* - """ - permitMime: [String!] - rejectMime: [String!] -} - -# All fields are required -input ACLInput { - browse: Boolean! - reply: Boolean! - post: Boolean! - moderate: Boolean! -} - -type Mutation { - "Creates a new mailing list" - createMailingList( - name: String!, - description: String): MailingList! @access(scope: LISTS, kind: RW) - - "Updates a mailing list." - updateMailingList( - id: Int!, - input: MailingListInput!): MailingList @access(scope: LISTS, kind: RW) - - "Deletes a mailing list" - deleteMailingList(id: Int!): MailingList @access(scope: LISTS, kind: RW) - - "Adds or updates the ACL for a user on a mailing list" - updateUserACL( - listID: Int!, - userID: Int!, - input: ACLInput!): MailingListACL @access(scope: ACLS, kind: RW) - - "Adds or updates the ACL for an email address on a mailing list" - updateSenderACL( - listID: Int!, - address: String!, - input: ACLInput!): MailingListACL @access(scope: ACLS, kind: RW) - - """ - Updates the default ACL for a mailing list, which applies to users and - senders for whom a more specific ACL does not exist. - """ - updateMailingListACL( - listID: Int!, - input: ACLInput!): MailingList @access(scope: ACLS, kind: RW) - - """ - Removes a mailing list ACL. Following this, the default mailing list ACL will - apply to this user. - """ - deleteACL(id: Int!): MailingListACL @access(scope: ACLS, kind: RW) - - "Updates the status of a patchset" - updatePatchset(id: Int!, status: PatchsetStatus!): Patchset @access(scope: PATCHES, kind: RW) - - "Create a new patchset tool" - createTool(patchsetID: Int!, details: String!, icon: ToolIcon!): PatchsetTool @access(scope: PATCHES, kind: RW) - - "Updates the status of a patchset tool by its ID" - updateTool(id: Int!, details: String, icon: ToolIcon): PatchsetTool @access(scope: PATCHES, kind: RW) - - "Creates a mailing list subscription" - mailingListSubscribe(listID: Int!): MailingListSubscription @access(scope: SUBSCRIPTIONS, kind: RW) - - "Deletes a mailing list subscription" - mailingListUnsubscribe(listID: Int!): MailingListSubscription @access(scope: SUBSCRIPTIONS, 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ᚋlistsᚗ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ᚋlistsᚗ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_Email_addressList_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["want"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("want")) - arg0, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } - } - args["want"] = arg0 - return args, nil -} - -func (ec *executionContext) field_Email_header_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["want"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("want")) - arg0, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } - } - args["want"] = arg0 - return args, nil -} - -func (ec *executionContext) field_MailingList_acl_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_MailingList_emails_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_MailingList_patches_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_MailingList_threads_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_createMailingList_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 - return args, nil -} - -func (ec *executionContext) field_Mutation_createTool_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["patchsetID"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("patchsetID")) - arg0, err = ec.unmarshalNInt2int(ctx, tmp) - if err != nil { - return nil, err - } - } - args["patchsetID"] = arg0 - var arg1 string - if tmp, ok := rawArgs["details"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("details")) - arg1, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } - } - args["details"] = arg1 - var arg2 model.ToolIcon - if tmp, ok := rawArgs["icon"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("icon")) - arg2, err = ec.unmarshalNToolIcon2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐToolIcon(ctx, tmp) - if err != nil { - return nil, err - } - } - args["icon"] = arg2 - 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_deleteMailingList_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_mailingListSubscribe_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["listID"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("listID")) - arg0, err = ec.unmarshalNInt2int(ctx, tmp) - if err != nil { - return nil, err - } - } - args["listID"] = arg0 - return args, nil -} - -func (ec *executionContext) field_Mutation_mailingListUnsubscribe_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["listID"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("listID")) - arg0, err = ec.unmarshalNInt2int(ctx, tmp) - if err != nil { - return nil, err - } - } - args["listID"] = arg0 - return args, nil -} - -func (ec *executionContext) field_Mutation_updateMailingListACL_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["listID"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("listID")) - arg0, err = ec.unmarshalNInt2int(ctx, tmp) - if err != nil { - return nil, err - } - } - args["listID"] = 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ᚋlistsᚗ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_updateMailingList_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.unmarshalNMailingListInput2map(ctx, tmp) - if err != nil { - return nil, err - } - } - args["input"] = arg1 - return args, nil -} - -func (ec *executionContext) field_Mutation_updatePatchset_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 model.PatchsetStatus - if tmp, ok := rawArgs["status"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("status")) - arg1, err = ec.unmarshalNPatchsetStatus2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐPatchsetStatus(ctx, tmp) - if err != nil { - return nil, err - } - } - args["status"] = arg1 - return args, nil -} - -func (ec *executionContext) field_Mutation_updateSenderACL_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["listID"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("listID")) - arg0, err = ec.unmarshalNInt2int(ctx, tmp) - if err != nil { - return nil, err - } - } - args["listID"] = arg0 - var arg1 string - if tmp, ok := rawArgs["address"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("address")) - arg1, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } - } - args["address"] = 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ᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐACLInput(ctx, tmp) - if err != nil { - return nil, err - } - } - args["input"] = arg2 - return args, nil -} - -func (ec *executionContext) field_Mutation_updateTool_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 *string - if tmp, ok := rawArgs["details"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("details")) - arg1, err = ec.unmarshalOString2ᚖstring(ctx, tmp) - if err != nil { - return nil, err - } - } - args["details"] = arg1 - var arg2 *model.ToolIcon - if tmp, ok := rawArgs["icon"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("icon")) - arg2, err = ec.unmarshalOToolIcon2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐToolIcon(ctx, tmp) - if err != nil { - return nil, err - } - } - args["icon"] = arg2 - 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["listID"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("listID")) - arg0, err = ec.unmarshalNInt2int(ctx, tmp) - if err != nil { - return nil, err - } - } - args["listID"] = 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ᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐACLInput(ctx, tmp) - if err != nil { - return nil, err - } - } - args["input"] = arg2 - return args, nil -} - -func (ec *executionContext) field_Patchset_patches_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___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_email_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_mailingListByName_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_mailingListByOwner_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["ownerName"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ownerName")) - arg0, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } - } - args["ownerName"] = arg0 - var arg1 string - if tmp, ok := rawArgs["listName"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("listName")) - arg1, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } - } - args["listName"] = arg1 - return args, nil -} - -func (ec *executionContext) field_Query_mailingList_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_mailingLists_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_message_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["messageID"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("messageID")) - arg0, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } - } - args["messageID"] = arg0 - return args, nil -} - -func (ec *executionContext) field_Query_patchset_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_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_userByName_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { - var err error - args := map[string]interface{}{} - var arg0 string - if tmp, ok := rawArgs["username"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("username")) - arg0, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } - } - args["username"] = arg0 - return args, nil -} - -func (ec *executionContext) field_Query_user_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_Thread_descendants_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_emails_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_lists_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_patches_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_threads_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) _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ᚋlistsᚗ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) _Email_id(ctx context.Context, field graphql.CollectedField, obj *model.Email) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Email", - 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) _Email_sender(ctx context.Context, field graphql.CollectedField, obj *model.Email) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Email", - 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.Email().Sender(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.Entity) - fc.Result = res - return ec.marshalNEntity2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEntity(ctx, field.Selections, res) -} - -func (ec *executionContext) _Email_received(ctx context.Context, field graphql.CollectedField, obj *model.Email) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Email", - 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.Received, 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) _Email_date(ctx context.Context, field graphql.CollectedField, obj *model.Email) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Email", - 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.Email().Date(rctx, obj) - }) - 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) _Email_subject(ctx context.Context, field graphql.CollectedField, obj *model.Email) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Email", - 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) _Email_messageID(ctx context.Context, field graphql.CollectedField, obj *model.Email) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Email", - 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.MessageID, 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) _Email_inReplyTo(ctx context.Context, field graphql.CollectedField, obj *model.Email) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Email", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.InReplyTo, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) _Email_header(ctx context.Context, field graphql.CollectedField, obj *model.Email) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Email", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: true, - } - - ctx = graphql.WithFieldContext(ctx, fc) - rawArgs := field.ArgumentMap(ec.Variables) - args, err := ec.field_Email_header_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.Email().Header(rctx, obj, args["want"].(string)) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.([]string) - fc.Result = res - return ec.marshalNString2ᚕstringᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) _Email_addressList(ctx context.Context, field graphql.CollectedField, obj *model.Email) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Email", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: true, - } - - ctx = graphql.WithFieldContext(ctx, fc) - rawArgs := field.ArgumentMap(ec.Variables) - args, err := ec.field_Email_addressList_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.Email().AddressList(rctx, obj, args["want"].(string)) - }) - 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.Mailbox) - fc.Result = res - return ec.marshalNMailbox2ᚕᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐMailboxᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) _Email_body(ctx context.Context, field graphql.CollectedField, obj *model.Email) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Email", - 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 { - 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) _Email_envelope(ctx context.Context, field graphql.CollectedField, obj *model.Email) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Email", - 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.Email().Envelope(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.URL) - fc.Result = res - return ec.marshalNURL2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐURL(ctx, field.Selections, res) -} - -func (ec *executionContext) _Email_thread(ctx context.Context, field graphql.CollectedField, obj *model.Email) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Email", - 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.Email().Thread(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.Thread) - fc.Result = res - return ec.marshalNThread2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐThread(ctx, field.Selections, res) -} - -func (ec *executionContext) _Email_parent(ctx context.Context, field graphql.CollectedField, obj *model.Email) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Email", - 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.Email().Parent(rctx, obj) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.Email) - fc.Result = res - return ec.marshalOEmail2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEmail(ctx, field.Selections, res) -} - -func (ec *executionContext) _Email_patch(ctx context.Context, field graphql.CollectedField, obj *model.Email) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Email", - 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 { - return graphql.Null - } - res := resTmp.(model.Patch) - fc.Result = res - return ec.marshalOPatch2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐPatch(ctx, field.Selections, res) -} - -func (ec *executionContext) _Email_patchset(ctx context.Context, field graphql.CollectedField, obj *model.Email) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Email", - 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.Email().Patchset(rctx, obj) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "PATCHES") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗ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.Patchset); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/lists.sr.ht/api/graph/model.Patchset`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.Patchset) - fc.Result = res - return ec.marshalOPatchset2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐPatchset(ctx, field.Selections, res) -} - -func (ec *executionContext) _Email_list(ctx context.Context, field graphql.CollectedField, obj *model.Email) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Email", - 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.Email().List(rctx, obj) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "LISTS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗ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.MailingList); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/lists.sr.ht/api/graph/model.MailingList`, 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.MailingList) - fc.Result = res - return ec.marshalNMailingList2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐMailingList(ctx, field.Selections, res) -} - -func (ec *executionContext) _EmailCursor_results(ctx context.Context, field graphql.CollectedField, obj *model.EmailCursor) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "EmailCursor", - 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.Email) - fc.Result = res - return ec.marshalNEmail2ᚕᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEmailᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) _EmailCursor_cursor(ctx context.Context, field graphql.CollectedField, obj *model.EmailCursor) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "EmailCursor", - 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) _GeneralACL_browse(ctx context.Context, field graphql.CollectedField, obj *model.GeneralACL) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "GeneralACL", - 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) _GeneralACL_reply(ctx context.Context, field graphql.CollectedField, obj *model.GeneralACL) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "GeneralACL", - 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.Reply, 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) _GeneralACL_post(ctx context.Context, field graphql.CollectedField, obj *model.GeneralACL) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "GeneralACL", - 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.Post, 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) _GeneralACL_moderate(ctx context.Context, field graphql.CollectedField, obj *model.GeneralACL) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "GeneralACL", - 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.Moderate, 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) _Mailbox_canonicalName(ctx context.Context, field graphql.CollectedField, obj *model.Mailbox) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Mailbox", - 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) _Mailbox_name(ctx context.Context, field graphql.CollectedField, obj *model.Mailbox) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Mailbox", - 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) _Mailbox_address(ctx context.Context, field graphql.CollectedField, obj *model.Mailbox) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Mailbox", - 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.Address, 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) _MailingList_id(ctx context.Context, field graphql.CollectedField, obj *model.MailingList) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "MailingList", - 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) _MailingList_created(ctx context.Context, field graphql.CollectedField, obj *model.MailingList) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "MailingList", - 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) _MailingList_updated(ctx context.Context, field graphql.CollectedField, obj *model.MailingList) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "MailingList", - 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) _MailingList_name(ctx context.Context, field graphql.CollectedField, obj *model.MailingList) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "MailingList", - 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) _MailingList_owner(ctx context.Context, field graphql.CollectedField, obj *model.MailingList) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "MailingList", - 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.MailingList().Owner(rctx, obj) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "PROFILE") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗ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/lists.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ᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEntity(ctx, field.Selections, res) -} - -func (ec *executionContext) _MailingList_description(ctx context.Context, field graphql.CollectedField, obj *model.MailingList) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "MailingList", - 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) _MailingList_permitMime(ctx context.Context, field graphql.CollectedField, obj *model.MailingList) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "MailingList", - 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.PermitMime(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.([]string) - fc.Result = res - return ec.marshalNString2ᚕstringᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) _MailingList_rejectMime(ctx context.Context, field graphql.CollectedField, obj *model.MailingList) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "MailingList", - 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.RejectMime(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.([]string) - fc.Result = res - return ec.marshalNString2ᚕstringᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) _MailingList_threads(ctx context.Context, field graphql.CollectedField, obj *model.MailingList) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "MailingList", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: true, - } - - ctx = graphql.WithFieldContext(ctx, fc) - rawArgs := field.ArgumentMap(ec.Variables) - args, err := ec.field_MailingList_threads_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.MailingList().Threads(rctx, obj, args["cursor"].(*model1.Cursor)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "EMAILS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗ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.ThreadCursor); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/lists.sr.ht/api/graph/model.ThreadCursor`, 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.ThreadCursor) - fc.Result = res - return ec.marshalNThreadCursor2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐThreadCursor(ctx, field.Selections, res) -} - -func (ec *executionContext) _MailingList_emails(ctx context.Context, field graphql.CollectedField, obj *model.MailingList) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "MailingList", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: true, - } - - ctx = graphql.WithFieldContext(ctx, fc) - rawArgs := field.ArgumentMap(ec.Variables) - args, err := ec.field_MailingList_emails_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.MailingList().Emails(rctx, obj, args["cursor"].(*model1.Cursor)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "EMAILS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗ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.EmailCursor); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/lists.sr.ht/api/graph/model.EmailCursor`, 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.EmailCursor) - fc.Result = res - return ec.marshalNEmailCursor2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEmailCursor(ctx, field.Selections, res) -} - -func (ec *executionContext) _MailingList_patches(ctx context.Context, field graphql.CollectedField, obj *model.MailingList) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "MailingList", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: true, - } - - ctx = graphql.WithFieldContext(ctx, fc) - rawArgs := field.ArgumentMap(ec.Variables) - args, err := ec.field_MailingList_patches_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.MailingList().Patches(rctx, obj, args["cursor"].(*model1.Cursor)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "PATCHES") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗ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.PatchsetCursor); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/lists.sr.ht/api/graph/model.PatchsetCursor`, 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.PatchsetCursor) - fc.Result = res - return ec.marshalNPatchsetCursor2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐPatchsetCursor(ctx, field.Selections, res) -} - -func (ec *executionContext) _MailingList_importing(ctx context.Context, field graphql.CollectedField, obj *model.MailingList) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "MailingList", - 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.Importing, 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) _MailingList_access(ctx context.Context, field graphql.CollectedField, obj *model.MailingList) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "MailingList", - 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.MailingList().Access(rctx, obj) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "ACLS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗ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.ACL); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be git.sr.ht/~sircmpwn/lists.sr.ht/api/graph/model.ACL`, 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.ACL) - fc.Result = res - return ec.marshalNACL2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐACL(ctx, field.Selections, res) -} - -func (ec *executionContext) _MailingList_subscription(ctx context.Context, field graphql.CollectedField, obj *model.MailingList) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "MailingList", - 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.MailingList().Subscription(rctx, obj) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "SUBSCRIPTIONS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗ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.MailingListSubscription); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/lists.sr.ht/api/graph/model.MailingListSubscription`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.MailingListSubscription) - fc.Result = res - return ec.marshalOMailingListSubscription2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐMailingListSubscription(ctx, field.Selections, res) -} - -func (ec *executionContext) _MailingList_archive(ctx context.Context, field graphql.CollectedField, obj *model.MailingList) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "MailingList", - 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.MailingList().Archive(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.URL) - fc.Result = res - return ec.marshalNURL2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐURL(ctx, field.Selections, res) -} - -func (ec *executionContext) _MailingList_last30days(ctx context.Context, field graphql.CollectedField, obj *model.MailingList) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "MailingList", - 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.MailingList().Last30days(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.URL) - fc.Result = res - return ec.marshalNURL2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐURL(ctx, field.Selections, res) -} - -func (ec *executionContext) _MailingList_acl(ctx context.Context, field graphql.CollectedField, obj *model.MailingList) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "MailingList", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: true, - } - - ctx = graphql.WithFieldContext(ctx, fc) - rawArgs := field.ArgumentMap(ec.Variables) - args, err := ec.field_MailingList_acl_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.MailingList().ACL(rctx, obj, args["cursor"].(*model1.Cursor)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "ACLS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗ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.MailingListACLCursor); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/lists.sr.ht/api/graph/model.MailingListACLCursor`, 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.MailingListACLCursor) - fc.Result = res - return ec.marshalNMailingListACLCursor2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐMailingListACLCursor(ctx, field.Selections, res) -} - -func (ec *executionContext) _MailingList_nonsubscriber(ctx context.Context, field graphql.CollectedField, obj *model.MailingList) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "MailingList", - 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.Nonsubscriber(), 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.GeneralACL) - fc.Result = res - return ec.marshalNGeneralACL2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐGeneralACL(ctx, field.Selections, res) -} - -func (ec *executionContext) _MailingList_subscriber(ctx context.Context, field graphql.CollectedField, obj *model.MailingList) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "MailingList", - 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.Subscriber(), 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.GeneralACL) - fc.Result = res - return ec.marshalNGeneralACL2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐGeneralACL(ctx, field.Selections, res) -} - -func (ec *executionContext) _MailingList_identified(ctx context.Context, field graphql.CollectedField, obj *model.MailingList) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "MailingList", - 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.Identified(), 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.GeneralACL) - fc.Result = res - return ec.marshalNGeneralACL2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐGeneralACL(ctx, field.Selections, res) -} - -func (ec *executionContext) _MailingListACL_id(ctx context.Context, field graphql.CollectedField, obj *model.MailingListACL) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "MailingListACL", - 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) _MailingListACL_created(ctx context.Context, field graphql.CollectedField, obj *model.MailingListACL) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "MailingListACL", - 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) _MailingListACL_list(ctx context.Context, field graphql.CollectedField, obj *model.MailingListACL) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "MailingListACL", - 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.MailingListACL().List(rctx, obj) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "LISTS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗ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.MailingList); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/lists.sr.ht/api/graph/model.MailingList`, 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.MailingList) - fc.Result = res - return ec.marshalNMailingList2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐMailingList(ctx, field.Selections, res) -} - -func (ec *executionContext) _MailingListACL_entity(ctx context.Context, field graphql.CollectedField, obj *model.MailingListACL) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "MailingListACL", - 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.MailingListACL().Entity(rctx, obj) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "PROFILE") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗ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/lists.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ᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEntity(ctx, field.Selections, res) -} - -func (ec *executionContext) _MailingListACL_browse(ctx context.Context, field graphql.CollectedField, obj *model.MailingListACL) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "MailingListACL", - 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.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) _MailingListACL_reply(ctx context.Context, field graphql.CollectedField, obj *model.MailingListACL) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "MailingListACL", - 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.Reply(), 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) _MailingListACL_post(ctx context.Context, field graphql.CollectedField, obj *model.MailingListACL) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "MailingListACL", - 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.Post(), 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) _MailingListACL_moderate(ctx context.Context, field graphql.CollectedField, obj *model.MailingListACL) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "MailingListACL", - 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.Moderate(), 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) _MailingListACLCursor_results(ctx context.Context, field graphql.CollectedField, obj *model.MailingListACLCursor) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "MailingListACLCursor", - 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.MailingListACL) - fc.Result = res - return ec.marshalNMailingListACL2ᚕᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐMailingListACLᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) _MailingListACLCursor_cursor(ctx context.Context, field graphql.CollectedField, obj *model.MailingListACLCursor) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "MailingListACLCursor", - 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) _MailingListCursor_results(ctx context.Context, field graphql.CollectedField, obj *model.MailingListCursor) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "MailingListCursor", - 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.MailingList) - fc.Result = res - return ec.marshalNMailingList2ᚕᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐMailingListᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) _MailingListCursor_cursor(ctx context.Context, field graphql.CollectedField, obj *model.MailingListCursor) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "MailingListCursor", - 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) _MailingListSubscription_id(ctx context.Context, field graphql.CollectedField, obj *model.MailingListSubscription) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "MailingListSubscription", - 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) _MailingListSubscription_created(ctx context.Context, field graphql.CollectedField, obj *model.MailingListSubscription) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "MailingListSubscription", - 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) _MailingListSubscription_list(ctx context.Context, field graphql.CollectedField, obj *model.MailingListSubscription) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "MailingListSubscription", - 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.MailingListSubscription().List(rctx, obj) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "LISTS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗ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.MailingList); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/lists.sr.ht/api/graph/model.MailingList`, 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.MailingList) - fc.Result = res - return ec.marshalNMailingList2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐMailingList(ctx, field.Selections, res) -} - -func (ec *executionContext) _Mutation_createMailingList(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_createMailingList_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().CreateMailingList(rctx, args["name"].(string), args["description"].(*string)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "LISTS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗ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.MailingList); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/lists.sr.ht/api/graph/model.MailingList`, 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.MailingList) - fc.Result = res - return ec.marshalNMailingList2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐMailingList(ctx, field.Selections, res) -} - -func (ec *executionContext) _Mutation_updateMailingList(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_updateMailingList_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().UpdateMailingList(rctx, args["id"].(int), args["input"].(map[string]interface{})) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "LISTS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗ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.MailingList); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/lists.sr.ht/api/graph/model.MailingList`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.MailingList) - fc.Result = res - return ec.marshalOMailingList2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐMailingList(ctx, field.Selections, res) -} - -func (ec *executionContext) _Mutation_deleteMailingList(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_deleteMailingList_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().DeleteMailingList(rctx, args["id"].(int)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "LISTS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗ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.MailingList); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/lists.sr.ht/api/graph/model.MailingList`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.MailingList) - fc.Result = res - return ec.marshalOMailingList2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐMailingList(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["listID"].(int), args["userID"].(int), args["input"].(model.ACLInput)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "ACLS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗ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.MailingListACL); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/lists.sr.ht/api/graph/model.MailingListACL`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.MailingListACL) - fc.Result = res - return ec.marshalOMailingListACL2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐMailingListACL(ctx, field.Selections, res) -} - -func (ec *executionContext) _Mutation_updateSenderACL(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_updateSenderACL_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().UpdateSenderACL(rctx, args["listID"].(int), args["address"].(string), args["input"].(model.ACLInput)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "ACLS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗ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.MailingListACL); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/lists.sr.ht/api/graph/model.MailingListACL`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.MailingListACL) - fc.Result = res - return ec.marshalOMailingListACL2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐMailingListACL(ctx, field.Selections, res) -} - -func (ec *executionContext) _Mutation_updateMailingListACL(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_updateMailingListACL_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().UpdateMailingListACL(rctx, args["listID"].(int), args["input"].(model.ACLInput)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "ACLS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗ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.MailingList); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/lists.sr.ht/api/graph/model.MailingList`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.MailingList) - fc.Result = res - return ec.marshalOMailingList2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐMailingList(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ᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "ACLS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗ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.MailingListACL); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/lists.sr.ht/api/graph/model.MailingListACL`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.MailingListACL) - fc.Result = res - return ec.marshalOMailingListACL2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐMailingListACL(ctx, field.Selections, res) -} - -func (ec *executionContext) _Mutation_updatePatchset(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_updatePatchset_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().UpdatePatchset(rctx, args["id"].(int), args["status"].(model.PatchsetStatus)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "PATCHES") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗ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.Patchset); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/lists.sr.ht/api/graph/model.Patchset`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.Patchset) - fc.Result = res - return ec.marshalOPatchset2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐPatchset(ctx, field.Selections, res) -} - -func (ec *executionContext) _Mutation_createTool(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_createTool_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().CreateTool(rctx, args["patchsetID"].(int), args["details"].(string), args["icon"].(model.ToolIcon)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "PATCHES") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗ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.PatchsetTool); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/lists.sr.ht/api/graph/model.PatchsetTool`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.PatchsetTool) - fc.Result = res - return ec.marshalOPatchsetTool2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐPatchsetTool(ctx, field.Selections, res) -} - -func (ec *executionContext) _Mutation_updateTool(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_updateTool_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().UpdateTool(rctx, args["id"].(int), args["details"].(*string), args["icon"].(*model.ToolIcon)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "PATCHES") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗ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.PatchsetTool); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/lists.sr.ht/api/graph/model.PatchsetTool`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.PatchsetTool) - fc.Result = res - return ec.marshalOPatchsetTool2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐPatchsetTool(ctx, field.Selections, res) -} - -func (ec *executionContext) _Mutation_mailingListSubscribe(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_mailingListSubscribe_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().MailingListSubscribe(rctx, args["listID"].(int)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "SUBSCRIPTIONS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗ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.MailingListSubscription); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/lists.sr.ht/api/graph/model.MailingListSubscription`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.MailingListSubscription) - fc.Result = res - return ec.marshalOMailingListSubscription2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐMailingListSubscription(ctx, field.Selections, res) -} - -func (ec *executionContext) _Mutation_mailingListUnsubscribe(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_mailingListUnsubscribe_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().MailingListUnsubscribe(rctx, args["listID"].(int)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "SUBSCRIPTIONS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗ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.MailingListSubscription); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/lists.sr.ht/api/graph/model.MailingListSubscription`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.MailingListSubscription) - fc.Result = res - return ec.marshalOMailingListSubscription2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐMailingListSubscription(ctx, field.Selections, res) -} - -func (ec *executionContext) _Patch_index(ctx context.Context, field graphql.CollectedField, obj *model.Patch) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Patch", - 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.Index, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*int) - fc.Result = res - return ec.marshalOInt2ᚖint(ctx, field.Selections, res) -} - -func (ec *executionContext) _Patch_count(ctx context.Context, field graphql.CollectedField, obj *model.Patch) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Patch", - 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.Count, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*int) - fc.Result = res - return ec.marshalOInt2ᚖint(ctx, field.Selections, res) -} - -func (ec *executionContext) _Patch_version(ctx context.Context, field graphql.CollectedField, obj *model.Patch) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Patch", - 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.Version, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*int) - fc.Result = res - return ec.marshalOInt2ᚖint(ctx, field.Selections, res) -} - -func (ec *executionContext) _Patch_prefix(ctx context.Context, field graphql.CollectedField, obj *model.Patch) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Patch", - 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.Prefix, 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) _Patch_subject(ctx context.Context, field graphql.CollectedField, obj *model.Patch) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Patch", - 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 { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) _Patchset_id(ctx context.Context, field graphql.CollectedField, obj *model.Patchset) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Patchset", - 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) _Patchset_created(ctx context.Context, field graphql.CollectedField, obj *model.Patchset) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Patchset", - 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) _Patchset_updated(ctx context.Context, field graphql.CollectedField, obj *model.Patchset) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Patchset", - 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) _Patchset_subject(ctx context.Context, field graphql.CollectedField, obj *model.Patchset) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Patchset", - 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) _Patchset_version(ctx context.Context, field graphql.CollectedField, obj *model.Patchset) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Patchset", - 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.Version, 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) _Patchset_prefix(ctx context.Context, field graphql.CollectedField, obj *model.Patchset) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Patchset", - 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.Prefix, 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) _Patchset_status(ctx context.Context, field graphql.CollectedField, obj *model.Patchset) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Patchset", - 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.PatchsetStatus) - fc.Result = res - return ec.marshalNPatchsetStatus2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐPatchsetStatus(ctx, field.Selections, res) -} - -func (ec *executionContext) _Patchset_submitter(ctx context.Context, field graphql.CollectedField, obj *model.Patchset) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Patchset", - 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.Patchset().Submitter(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.Entity) - fc.Result = res - return ec.marshalNEntity2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEntity(ctx, field.Selections, res) -} - -func (ec *executionContext) _Patchset_coverLetter(ctx context.Context, field graphql.CollectedField, obj *model.Patchset) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Patchset", - 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.Patchset().CoverLetter(rctx, obj) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "EMAILS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗ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.Email); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/lists.sr.ht/api/graph/model.Email`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.Email) - fc.Result = res - return ec.marshalOEmail2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEmail(ctx, field.Selections, res) -} - -func (ec *executionContext) _Patchset_thread(ctx context.Context, field graphql.CollectedField, obj *model.Patchset) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Patchset", - 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.Patchset().Thread(rctx, obj) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "EMAILS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗ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.Thread); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/lists.sr.ht/api/graph/model.Thread`, 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.Thread) - fc.Result = res - return ec.marshalNThread2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐThread(ctx, field.Selections, res) -} - -func (ec *executionContext) _Patchset_supersededBy(ctx context.Context, field graphql.CollectedField, obj *model.Patchset) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Patchset", - 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.Patchset().SupersededBy(rctx, obj) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.Patchset) - fc.Result = res - return ec.marshalOPatchset2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐPatchset(ctx, field.Selections, res) -} - -func (ec *executionContext) _Patchset_list(ctx context.Context, field graphql.CollectedField, obj *model.Patchset) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Patchset", - 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.Patchset().List(rctx, obj) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "LISTS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗ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.MailingList); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/lists.sr.ht/api/graph/model.MailingList`, 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.MailingList) - fc.Result = res - return ec.marshalNMailingList2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐMailingList(ctx, field.Selections, res) -} - -func (ec *executionContext) _Patchset_patches(ctx context.Context, field graphql.CollectedField, obj *model.Patchset) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Patchset", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: true, - } - - ctx = graphql.WithFieldContext(ctx, fc) - rawArgs := field.ArgumentMap(ec.Variables) - args, err := ec.field_Patchset_patches_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.Patchset().Patches(rctx, obj, args["cursor"].(*model1.Cursor)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "EMAILS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗ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.EmailCursor); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/lists.sr.ht/api/graph/model.EmailCursor`, 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.EmailCursor) - fc.Result = res - return ec.marshalNEmailCursor2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEmailCursor(ctx, field.Selections, res) -} - -func (ec *executionContext) _Patchset_tools(ctx context.Context, field graphql.CollectedField, obj *model.Patchset) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Patchset", - 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.Patchset().Tools(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.PatchsetTool) - fc.Result = res - return ec.marshalNPatchsetTool2ᚕᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐPatchsetToolᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) _Patchset_mbox(ctx context.Context, field graphql.CollectedField, obj *model.Patchset) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Patchset", - 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.Patchset().Mbox(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.URL) - fc.Result = res - return ec.marshalNURL2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐURL(ctx, field.Selections, res) -} - -func (ec *executionContext) _PatchsetCursor_results(ctx context.Context, field graphql.CollectedField, obj *model.PatchsetCursor) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "PatchsetCursor", - 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.Patchset) - fc.Result = res - return ec.marshalNPatchset2ᚕᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐPatchsetᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) _PatchsetCursor_cursor(ctx context.Context, field graphql.CollectedField, obj *model.PatchsetCursor) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "PatchsetCursor", - 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) _PatchsetTool_id(ctx context.Context, field graphql.CollectedField, obj *model.PatchsetTool) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "PatchsetTool", - 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) _PatchsetTool_created(ctx context.Context, field graphql.CollectedField, obj *model.PatchsetTool) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "PatchsetTool", - 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) _PatchsetTool_updated(ctx context.Context, field graphql.CollectedField, obj *model.PatchsetTool) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "PatchsetTool", - 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) _PatchsetTool_icon(ctx context.Context, field graphql.CollectedField, obj *model.PatchsetTool) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "PatchsetTool", - 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.Icon(), 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.ToolIcon) - fc.Result = res - return ec.marshalNToolIcon2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐToolIcon(ctx, field.Selections, res) -} - -func (ec *executionContext) _PatchsetTool_details(ctx context.Context, field graphql.CollectedField, obj *model.PatchsetTool) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "PatchsetTool", - 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.Details, 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) _PatchsetTool_patchset(ctx context.Context, field graphql.CollectedField, obj *model.PatchsetTool) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "PatchsetTool", - 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.PatchsetTool().Patchset(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.Patchset) - fc.Result = res - return ec.marshalNPatchset2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐPatchset(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ᚋlistsᚗ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ᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "PROFILE") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗ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/lists.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ᚋlistsᚗ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["id"].(int)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "PROFILE") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗ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/lists.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ᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐUser(ctx, field.Selections, res) -} - -func (ec *executionContext) _Query_userByName(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: true, - } - - ctx = graphql.WithFieldContext(ctx, fc) - rawArgs := field.ArgumentMap(ec.Variables) - args, err := ec.field_Query_userByName_args(ctx, rawArgs) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - fc.Args = args - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - directive0 := func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().UserByName(rctx, args["username"].(string)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "PROFILE") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗ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/lists.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ᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐUser(ctx, field.Selections, res) -} - -func (ec *executionContext) _Query_mailingList(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_mailingList_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().MailingList(rctx, args["id"].(int)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "LISTS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗ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.MailingList); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/lists.sr.ht/api/graph/model.MailingList`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.MailingList) - fc.Result = res - return ec.marshalOMailingList2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐMailingList(ctx, field.Selections, res) -} - -func (ec *executionContext) _Query_mailingListByName(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_mailingListByName_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().MailingListByName(rctx, args["name"].(string)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "LISTS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗ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.MailingList); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/lists.sr.ht/api/graph/model.MailingList`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.MailingList) - fc.Result = res - return ec.marshalOMailingList2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐMailingList(ctx, field.Selections, res) -} - -func (ec *executionContext) _Query_mailingListByOwner(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_mailingListByOwner_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().MailingListByOwner(rctx, args["ownerName"].(string), args["listName"].(string)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "LISTS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗ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.MailingList); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/lists.sr.ht/api/graph/model.MailingList`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.MailingList) - fc.Result = res - return ec.marshalOMailingList2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐMailingList(ctx, field.Selections, res) -} - -func (ec *executionContext) _Query_email(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_email_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().Email(rctx, args["id"].(int)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "EMAILS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗ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.Email); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/lists.sr.ht/api/graph/model.Email`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.Email) - fc.Result = res - return ec.marshalOEmail2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEmail(ctx, field.Selections, res) -} - -func (ec *executionContext) _Query_message(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_message_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().Message(rctx, args["messageID"].(string)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "EMAILS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗ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.Email); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/lists.sr.ht/api/graph/model.Email`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.Email) - fc.Result = res - return ec.marshalOEmail2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEmail(ctx, field.Selections, res) -} - -func (ec *executionContext) _Query_patchset(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_patchset_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().Patchset(rctx, args["id"].(int)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "EMAILS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗ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.Patchset); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/lists.sr.ht/api/graph/model.Patchset`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.Patchset) - fc.Result = res - return ec.marshalOPatchset2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐPatchset(ctx, field.Selections, res) -} - -func (ec *executionContext) _Query_mailingLists(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_mailingLists_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().MailingLists(rctx, args["cursor"].(*model1.Cursor)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "LISTS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗ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.MailingListCursor); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/lists.sr.ht/api/graph/model.MailingListCursor`, 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.MailingListCursor) - fc.Result = res - return ec.marshalNMailingListCursor2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐMailingListCursor(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ᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "SUBSCRIPTIONS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗ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/lists.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ᚋlistsᚗ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) _Thread_created(ctx context.Context, field graphql.CollectedField, obj *model.Thread) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Thread", - 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) _Thread_updated(ctx context.Context, field graphql.CollectedField, obj *model.Thread) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Thread", - 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) _Thread_subject(ctx context.Context, field graphql.CollectedField, obj *model.Thread) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Thread", - 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) _Thread_replies(ctx context.Context, field graphql.CollectedField, obj *model.Thread) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Thread", - 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.Replies, 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) _Thread_participants(ctx context.Context, field graphql.CollectedField, obj *model.Thread) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Thread", - 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.Participants, 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) _Thread_sender(ctx context.Context, field graphql.CollectedField, obj *model.Thread) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Thread", - 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.Thread().Sender(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.Entity) - fc.Result = res - return ec.marshalNEntity2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEntity(ctx, field.Selections, res) -} - -func (ec *executionContext) _Thread_root(ctx context.Context, field graphql.CollectedField, obj *model.Thread) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Thread", - 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.Thread().Root(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.Email) - fc.Result = res - return ec.marshalNEmail2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEmail(ctx, field.Selections, res) -} - -func (ec *executionContext) _Thread_list(ctx context.Context, field graphql.CollectedField, obj *model.Thread) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Thread", - 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.Thread().List(rctx, obj) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "LISTS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗ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.MailingList); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/lists.sr.ht/api/graph/model.MailingList`, 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.MailingList) - fc.Result = res - return ec.marshalNMailingList2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐMailingList(ctx, field.Selections, res) -} - -func (ec *executionContext) _Thread_descendants(ctx context.Context, field graphql.CollectedField, obj *model.Thread) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Thread", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: true, - } - - ctx = graphql.WithFieldContext(ctx, fc) - rawArgs := field.ArgumentMap(ec.Variables) - args, err := ec.field_Thread_descendants_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.Thread().Descendants(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.EmailCursor) - fc.Result = res - return ec.marshalNEmailCursor2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEmailCursor(ctx, field.Selections, res) -} - -func (ec *executionContext) _Thread_mailto(ctx context.Context, field graphql.CollectedField, obj *model.Thread) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Thread", - 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.Thread().Mailto(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) _Thread_mbox(ctx context.Context, field graphql.CollectedField, obj *model.Thread) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Thread", - 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.Thread().Mbox(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.URL) - fc.Result = res - return ec.marshalNURL2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐURL(ctx, field.Selections, res) -} - -func (ec *executionContext) _ThreadCursor_results(ctx context.Context, field graphql.CollectedField, obj *model.ThreadCursor) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "ThreadCursor", - 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.Thread) - fc.Result = res - return ec.marshalNThread2ᚕᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐThreadᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) _ThreadCursor_cursor(ctx context.Context, field graphql.CollectedField, obj *model.ThreadCursor) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "ThreadCursor", - 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) _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_lists(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_lists_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().Lists(rctx, obj, args["cursor"].(*model1.Cursor)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "LISTS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗ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.MailingListCursor); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/lists.sr.ht/api/graph/model.MailingListCursor`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.MailingListCursor) - fc.Result = res - return ec.marshalOMailingListCursor2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐMailingListCursor(ctx, field.Selections, res) -} - -func (ec *executionContext) _User_emails(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_emails_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().Emails(rctx, obj, args["cursor"].(*model1.Cursor)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "EMAILS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗ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.EmailCursor); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/lists.sr.ht/api/graph/model.EmailCursor`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.EmailCursor) - fc.Result = res - return ec.marshalOEmailCursor2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEmailCursor(ctx, field.Selections, res) -} - -func (ec *executionContext) _User_threads(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_threads_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().Threads(rctx, obj, args["cursor"].(*model1.Cursor)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "EMAILS") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗ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.ThreadCursor); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/lists.sr.ht/api/graph/model.ThreadCursor`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.ThreadCursor) - fc.Result = res - return ec.marshalOThreadCursor2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐThreadCursor(ctx, field.Selections, res) -} - -func (ec *executionContext) _User_patches(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_patches_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().Patches(rctx, obj, args["cursor"].(*model1.Cursor)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - scope, err := ec.unmarshalNAccessScope2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐAccessScope(ctx, "PATCHES") - if err != nil { - return nil, err - } - kind, err := ec.unmarshalNAccessKind2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗ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.PatchsetCursor); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *git.sr.ht/~sircmpwn/lists.sr.ht/api/graph/model.PatchsetCursor`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.PatchsetCursor) - fc.Result = res - return ec.marshalOPatchsetCursor2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐPatchsetCursor(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 "reply": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("reply")) - it.Reply, err = ec.unmarshalNBoolean2bool(ctx, v) - if err != nil { - return it, err - } - case "post": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("post")) - it.Post, err = ec.unmarshalNBoolean2bool(ctx, v) - if err != nil { - return it, err - } - case "moderate": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("moderate")) - it.Moderate, err = ec.unmarshalNBoolean2bool(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.MailingListACL: - return ec._MailingListACL(ctx, sel, &obj) - case *model.MailingListACL: - if obj == nil { - return graphql.Null - } - return ec._MailingListACL(ctx, sel, obj) - case model.GeneralACL: - return ec._GeneralACL(ctx, sel, &obj) - case *model.GeneralACL: - if obj == nil { - return graphql.Null - } - return ec._GeneralACL(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.MailingListSubscription: - return ec._MailingListSubscription(ctx, sel, &obj) - case *model.MailingListSubscription: - if obj == nil { - return graphql.Null - } - return ec._MailingListSubscription(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.Mailbox: - return ec._Mailbox(ctx, sel, &obj) - case *model.Mailbox: - if obj == nil { - return graphql.Null - } - return ec._Mailbox(ctx, sel, obj) - default: - panic(fmt.Errorf("unexpected type %T", obj)) - } -} - -// endregion ************************** interface.gotpl *************************** - -// region **************************** object.gotpl **************************** - -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 emailImplementors = []string{"Email"} - -func (ec *executionContext) _Email(ctx context.Context, sel ast.SelectionSet, obj *model.Email) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, emailImplementors) - - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("Email") - case "id": - out.Values[i] = ec._Email_id(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "sender": - 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._Email_sender(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - case "received": - out.Values[i] = ec._Email_received(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "date": - field := field - out.Concurrently(i, func() (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Email_date(ctx, field, obj) - return res - }) - case "subject": - out.Values[i] = ec._Email_subject(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "messageID": - out.Values[i] = ec._Email_messageID(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "inReplyTo": - out.Values[i] = ec._Email_inReplyTo(ctx, field, obj) - case "header": - 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._Email_header(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - case "addressList": - 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._Email_addressList(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - case "body": - out.Values[i] = ec._Email_body(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "envelope": - 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._Email_envelope(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - case "thread": - 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._Email_thread(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - case "parent": - 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._Email_parent(ctx, field, obj) - return res - }) - case "patch": - out.Values[i] = ec._Email_patch(ctx, field, obj) - case "patchset": - 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._Email_patchset(ctx, field, obj) - return res - }) - case "list": - 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._Email_list(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 emailCursorImplementors = []string{"EmailCursor"} - -func (ec *executionContext) _EmailCursor(ctx context.Context, sel ast.SelectionSet, obj *model.EmailCursor) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, emailCursorImplementors) - - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("EmailCursor") - case "results": - out.Values[i] = ec._EmailCursor_results(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalids++ - } - case "cursor": - out.Values[i] = ec._EmailCursor_cursor(ctx, field, obj) - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch() - if invalids > 0 { - return graphql.Null - } - return out -} - -var generalACLImplementors = []string{"GeneralACL", "ACL"} - -func (ec *executionContext) _GeneralACL(ctx context.Context, sel ast.SelectionSet, obj *model.GeneralACL) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, generalACLImplementors) - - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("GeneralACL") - case "browse": - out.Values[i] = ec._GeneralACL_browse(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalids++ - } - case "reply": - out.Values[i] = ec._GeneralACL_reply(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalids++ - } - case "post": - out.Values[i] = ec._GeneralACL_post(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalids++ - } - case "moderate": - out.Values[i] = ec._GeneralACL_moderate(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 mailboxImplementors = []string{"Mailbox", "Entity"} - -func (ec *executionContext) _Mailbox(ctx context.Context, sel ast.SelectionSet, obj *model.Mailbox) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, mailboxImplementors) - - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("Mailbox") - case "canonicalName": - out.Values[i] = ec._Mailbox_canonicalName(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalids++ - } - case "name": - out.Values[i] = ec._Mailbox_name(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalids++ - } - case "address": - out.Values[i] = ec._Mailbox_address(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 mailingListImplementors = []string{"MailingList"} - -func (ec *executionContext) _MailingList(ctx context.Context, sel ast.SelectionSet, obj *model.MailingList) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, mailingListImplementors) - - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("MailingList") - case "id": - out.Values[i] = ec._MailingList_id(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "created": - out.Values[i] = ec._MailingList_created(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "updated": - out.Values[i] = ec._MailingList_updated(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "name": - out.Values[i] = ec._MailingList_name(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._MailingList_owner(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - case "description": - out.Values[i] = ec._MailingList_description(ctx, field, obj) - case "permitMime": - out.Values[i] = ec._MailingList_permitMime(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "rejectMime": - out.Values[i] = ec._MailingList_rejectMime(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "threads": - 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._MailingList_threads(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - case "emails": - 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._MailingList_emails(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - case "patches": - 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._MailingList_patches(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - case "importing": - out.Values[i] = ec._MailingList_importing(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "access": - 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._MailingList_access(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._MailingList_subscription(ctx, field, obj) - return res - }) - case "archive": - 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._MailingList_archive(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - case "last30days": - 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._MailingList_last30days(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - 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._MailingList_acl(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - case "nonsubscriber": - out.Values[i] = ec._MailingList_nonsubscriber(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "subscriber": - out.Values[i] = ec._MailingList_subscriber(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "identified": - out.Values[i] = ec._MailingList_identified(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 mailingListACLImplementors = []string{"MailingListACL", "ACL"} - -func (ec *executionContext) _MailingListACL(ctx context.Context, sel ast.SelectionSet, obj *model.MailingListACL) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, mailingListACLImplementors) - - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("MailingListACL") - case "id": - out.Values[i] = ec._MailingListACL_id(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "created": - out.Values[i] = ec._MailingListACL_created(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "list": - 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._MailingListACL_list(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._MailingListACL_entity(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - case "browse": - out.Values[i] = ec._MailingListACL_browse(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "reply": - out.Values[i] = ec._MailingListACL_reply(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "post": - out.Values[i] = ec._MailingListACL_post(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "moderate": - out.Values[i] = ec._MailingListACL_moderate(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 mailingListACLCursorImplementors = []string{"MailingListACLCursor"} - -func (ec *executionContext) _MailingListACLCursor(ctx context.Context, sel ast.SelectionSet, obj *model.MailingListACLCursor) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, mailingListACLCursorImplementors) - - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("MailingListACLCursor") - case "results": - out.Values[i] = ec._MailingListACLCursor_results(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalids++ - } - case "cursor": - out.Values[i] = ec._MailingListACLCursor_cursor(ctx, field, obj) - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch() - if invalids > 0 { - return graphql.Null - } - return out -} - -var mailingListCursorImplementors = []string{"MailingListCursor"} - -func (ec *executionContext) _MailingListCursor(ctx context.Context, sel ast.SelectionSet, obj *model.MailingListCursor) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, mailingListCursorImplementors) - - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("MailingListCursor") - case "results": - out.Values[i] = ec._MailingListCursor_results(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalids++ - } - case "cursor": - out.Values[i] = ec._MailingListCursor_cursor(ctx, field, obj) - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch() - if invalids > 0 { - return graphql.Null - } - return out -} - -var mailingListSubscriptionImplementors = []string{"MailingListSubscription", "ActivitySubscription"} - -func (ec *executionContext) _MailingListSubscription(ctx context.Context, sel ast.SelectionSet, obj *model.MailingListSubscription) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, mailingListSubscriptionImplementors) - - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("MailingListSubscription") - case "id": - out.Values[i] = ec._MailingListSubscription_id(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "created": - out.Values[i] = ec._MailingListSubscription_created(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "list": - 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._MailingListSubscription_list(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 "createMailingList": - out.Values[i] = ec._Mutation_createMailingList(ctx, field) - if out.Values[i] == graphql.Null { - invalids++ - } - case "updateMailingList": - out.Values[i] = ec._Mutation_updateMailingList(ctx, field) - case "deleteMailingList": - out.Values[i] = ec._Mutation_deleteMailingList(ctx, field) - case "updateUserACL": - out.Values[i] = ec._Mutation_updateUserACL(ctx, field) - case "updateSenderACL": - out.Values[i] = ec._Mutation_updateSenderACL(ctx, field) - case "updateMailingListACL": - out.Values[i] = ec._Mutation_updateMailingListACL(ctx, field) - case "deleteACL": - out.Values[i] = ec._Mutation_deleteACL(ctx, field) - case "updatePatchset": - out.Values[i] = ec._Mutation_updatePatchset(ctx, field) - case "createTool": - out.Values[i] = ec._Mutation_createTool(ctx, field) - case "updateTool": - out.Values[i] = ec._Mutation_updateTool(ctx, field) - case "mailingListSubscribe": - out.Values[i] = ec._Mutation_mailingListSubscribe(ctx, field) - case "mailingListUnsubscribe": - out.Values[i] = ec._Mutation_mailingListUnsubscribe(ctx, field) - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch() - if invalids > 0 { - return graphql.Null - } - return out -} - -var patchImplementors = []string{"Patch"} - -func (ec *executionContext) _Patch(ctx context.Context, sel ast.SelectionSet, obj *model.Patch) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, patchImplementors) - - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("Patch") - case "index": - out.Values[i] = ec._Patch_index(ctx, field, obj) - case "count": - out.Values[i] = ec._Patch_count(ctx, field, obj) - case "version": - out.Values[i] = ec._Patch_version(ctx, field, obj) - case "prefix": - out.Values[i] = ec._Patch_prefix(ctx, field, obj) - case "subject": - out.Values[i] = ec._Patch_subject(ctx, field, obj) - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch() - if invalids > 0 { - return graphql.Null - } - return out -} - -var patchsetImplementors = []string{"Patchset"} - -func (ec *executionContext) _Patchset(ctx context.Context, sel ast.SelectionSet, obj *model.Patchset) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, patchsetImplementors) - - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("Patchset") - case "id": - out.Values[i] = ec._Patchset_id(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "created": - out.Values[i] = ec._Patchset_created(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "updated": - out.Values[i] = ec._Patchset_updated(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "subject": - out.Values[i] = ec._Patchset_subject(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "version": - out.Values[i] = ec._Patchset_version(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "prefix": - out.Values[i] = ec._Patchset_prefix(ctx, field, obj) - case "status": - out.Values[i] = ec._Patchset_status(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._Patchset_submitter(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - case "coverLetter": - 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._Patchset_coverLetter(ctx, field, obj) - return res - }) - case "thread": - 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._Patchset_thread(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._Patchset_supersededBy(ctx, field, obj) - return res - }) - case "list": - 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._Patchset_list(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - case "patches": - 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._Patchset_patches(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - case "tools": - 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._Patchset_tools(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - case "mbox": - 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._Patchset_mbox(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 patchsetCursorImplementors = []string{"PatchsetCursor"} - -func (ec *executionContext) _PatchsetCursor(ctx context.Context, sel ast.SelectionSet, obj *model.PatchsetCursor) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, patchsetCursorImplementors) - - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("PatchsetCursor") - case "results": - out.Values[i] = ec._PatchsetCursor_results(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalids++ - } - case "cursor": - out.Values[i] = ec._PatchsetCursor_cursor(ctx, field, obj) - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch() - if invalids > 0 { - return graphql.Null - } - return out -} - -var patchsetToolImplementors = []string{"PatchsetTool"} - -func (ec *executionContext) _PatchsetTool(ctx context.Context, sel ast.SelectionSet, obj *model.PatchsetTool) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, patchsetToolImplementors) - - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("PatchsetTool") - case "id": - out.Values[i] = ec._PatchsetTool_id(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "created": - out.Values[i] = ec._PatchsetTool_created(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "updated": - out.Values[i] = ec._PatchsetTool_updated(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "icon": - out.Values[i] = ec._PatchsetTool_icon(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "details": - out.Values[i] = ec._PatchsetTool_details(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "patchset": - 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._PatchsetTool_patchset(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 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 "userByName": - 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_userByName(ctx, field) - return res - }) - case "mailingList": - 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_mailingList(ctx, field) - return res - }) - case "mailingListByName": - 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_mailingListByName(ctx, field) - return res - }) - case "mailingListByOwner": - 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_mailingListByOwner(ctx, field) - return res - }) - case "email": - field := field - out.Concurrently(i, func() (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Query_email(ctx, field) - return res - }) - case "message": - 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_message(ctx, field) - return res - }) - case "patchset": - 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_patchset(ctx, field) - return res - }) - case "mailingLists": - 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_mailingLists(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - 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 threadImplementors = []string{"Thread"} - -func (ec *executionContext) _Thread(ctx context.Context, sel ast.SelectionSet, obj *model.Thread) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, threadImplementors) - - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("Thread") - case "created": - out.Values[i] = ec._Thread_created(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "updated": - out.Values[i] = ec._Thread_updated(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "subject": - out.Values[i] = ec._Thread_subject(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "replies": - out.Values[i] = ec._Thread_replies(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "participants": - out.Values[i] = ec._Thread_participants(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - case "sender": - 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._Thread_sender(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - case "root": - 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._Thread_root(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - case "list": - 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._Thread_list(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - case "descendants": - 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._Thread_descendants(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - case "mailto": - 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._Thread_mailto(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) - case "mbox": - 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._Thread_mbox(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 threadCursorImplementors = []string{"ThreadCursor"} - -func (ec *executionContext) _ThreadCursor(ctx context.Context, sel ast.SelectionSet, obj *model.ThreadCursor) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, threadCursorImplementors) - - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("ThreadCursor") - case "results": - out.Values[i] = ec._ThreadCursor_results(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalids++ - } - case "cursor": - out.Values[i] = ec._ThreadCursor_cursor(ctx, field, obj) - 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 "lists": - 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_lists(ctx, field, obj) - return res - }) - case "emails": - 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_emails(ctx, field, obj) - return res - }) - case "threads": - 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_threads(ctx, field, obj) - return res - }) - case "patches": - 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_patches(ctx, field, obj) - 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) marshalNACL2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐACL(ctx context.Context, sel ast.SelectionSet, v model.ACL) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - return ec._ACL(ctx, sel, v) -} - -func (ec *executionContext) unmarshalNACLInput2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗ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ᚋlistsᚗ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ᚋlistsᚗ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ᚋlistsᚗ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ᚋlistsᚗ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ᚋlistsᚗ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ᚋlistsᚗ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ᚋlistsᚗ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) 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) marshalNEmail2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEmail(ctx context.Context, sel ast.SelectionSet, v model.Email) graphql.Marshaler { - return ec._Email(ctx, sel, &v) -} - -func (ec *executionContext) marshalNEmail2ᚕᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEmailᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.Email) 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.marshalNEmail2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEmail(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) marshalNEmail2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEmail(ctx context.Context, sel ast.SelectionSet, v *model.Email) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - return ec._Email(ctx, sel, v) -} - -func (ec *executionContext) marshalNEmailCursor2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEmailCursor(ctx context.Context, sel ast.SelectionSet, v model.EmailCursor) graphql.Marshaler { - return ec._EmailCursor(ctx, sel, &v) -} - -func (ec *executionContext) marshalNEmailCursor2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEmailCursor(ctx context.Context, sel ast.SelectionSet, v *model.EmailCursor) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - return ec._EmailCursor(ctx, sel, v) -} - -func (ec *executionContext) marshalNEntity2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗ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) marshalNGeneralACL2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐGeneralACL(ctx context.Context, sel ast.SelectionSet, v *model.GeneralACL) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - return ec._GeneralACL(ctx, sel, 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) marshalNMailbox2ᚕᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐMailboxᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.Mailbox) 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.marshalNMailbox2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐMailbox(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) marshalNMailbox2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐMailbox(ctx context.Context, sel ast.SelectionSet, v *model.Mailbox) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - return ec._Mailbox(ctx, sel, v) -} - -func (ec *executionContext) marshalNMailingList2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐMailingList(ctx context.Context, sel ast.SelectionSet, v model.MailingList) graphql.Marshaler { - return ec._MailingList(ctx, sel, &v) -} - -func (ec *executionContext) marshalNMailingList2ᚕᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐMailingListᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.MailingList) 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.marshalNMailingList2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐMailingList(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) marshalNMailingList2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐMailingList(ctx context.Context, sel ast.SelectionSet, v *model.MailingList) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - return ec._MailingList(ctx, sel, v) -} - -func (ec *executionContext) marshalNMailingListACL2ᚕᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐMailingListACLᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.MailingListACL) 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.marshalNMailingListACL2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐMailingListACL(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) marshalNMailingListACL2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐMailingListACL(ctx context.Context, sel ast.SelectionSet, v *model.MailingListACL) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - return ec._MailingListACL(ctx, sel, v) -} - -func (ec *executionContext) marshalNMailingListACLCursor2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐMailingListACLCursor(ctx context.Context, sel ast.SelectionSet, v model.MailingListACLCursor) graphql.Marshaler { - return ec._MailingListACLCursor(ctx, sel, &v) -} - -func (ec *executionContext) marshalNMailingListACLCursor2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐMailingListACLCursor(ctx context.Context, sel ast.SelectionSet, v *model.MailingListACLCursor) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - return ec._MailingListACLCursor(ctx, sel, v) -} - -func (ec *executionContext) marshalNMailingListCursor2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐMailingListCursor(ctx context.Context, sel ast.SelectionSet, v model.MailingListCursor) graphql.Marshaler { - return ec._MailingListCursor(ctx, sel, &v) -} - -func (ec *executionContext) marshalNMailingListCursor2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐMailingListCursor(ctx context.Context, sel ast.SelectionSet, v *model.MailingListCursor) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - return ec._MailingListCursor(ctx, sel, v) -} - -func (ec *executionContext) unmarshalNMailingListInput2map(ctx context.Context, v interface{}) (map[string]interface{}, error) { - return v.(map[string]interface{}), nil -} - -func (ec *executionContext) marshalNPatchset2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐPatchset(ctx context.Context, sel ast.SelectionSet, v model.Patchset) graphql.Marshaler { - return ec._Patchset(ctx, sel, &v) -} - -func (ec *executionContext) marshalNPatchset2ᚕᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐPatchsetᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.Patchset) 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.marshalNPatchset2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐPatchset(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) marshalNPatchset2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐPatchset(ctx context.Context, sel ast.SelectionSet, v *model.Patchset) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - return ec._Patchset(ctx, sel, v) -} - -func (ec *executionContext) marshalNPatchsetCursor2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐPatchsetCursor(ctx context.Context, sel ast.SelectionSet, v model.PatchsetCursor) graphql.Marshaler { - return ec._PatchsetCursor(ctx, sel, &v) -} - -func (ec *executionContext) marshalNPatchsetCursor2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐPatchsetCursor(ctx context.Context, sel ast.SelectionSet, v *model.PatchsetCursor) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - return ec._PatchsetCursor(ctx, sel, v) -} - -func (ec *executionContext) unmarshalNPatchsetStatus2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐPatchsetStatus(ctx context.Context, v interface{}) (model.PatchsetStatus, error) { - var res model.PatchsetStatus - err := res.UnmarshalGQL(v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalNPatchsetStatus2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐPatchsetStatus(ctx context.Context, sel ast.SelectionSet, v model.PatchsetStatus) graphql.Marshaler { - return v -} - -func (ec *executionContext) marshalNPatchsetTool2ᚕᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐPatchsetToolᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.PatchsetTool) 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.marshalNPatchsetTool2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐPatchsetTool(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) marshalNPatchsetTool2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐPatchsetTool(ctx context.Context, sel ast.SelectionSet, v *model.PatchsetTool) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - return ec._PatchsetTool(ctx, sel, v) -} - -func (ec *executionContext) unmarshalNString2string(ctx context.Context, v interface{}) (string, error) { - res, err := graphql.UnmarshalString(v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { - res := graphql.MarshalString(v) - if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - } - return res -} - -func (ec *executionContext) unmarshalNString2ᚕstringᚄ(ctx context.Context, v interface{}) ([]string, error) { - var vSlice []interface{} - if v != nil { - 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.unmarshalNString2string(ctx, vSlice[i]) - if err != nil { - return nil, err - } - } - return res, nil -} - -func (ec *executionContext) marshalNString2ᚕstringᚄ(ctx context.Context, sel ast.SelectionSet, v []string) graphql.Marshaler { - ret := make(graphql.Array, len(v)) - for i := range v { - ret[i] = ec.marshalNString2string(ctx, sel, v[i]) - } - - for _, e := range ret { - if e == graphql.Null { - return graphql.Null - } - } - - return ret -} - -func (ec *executionContext) marshalNThread2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐThread(ctx context.Context, sel ast.SelectionSet, v model.Thread) graphql.Marshaler { - return ec._Thread(ctx, sel, &v) -} - -func (ec *executionContext) marshalNThread2ᚕᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐThreadᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.Thread) 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.marshalNThread2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐThread(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) marshalNThread2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐThread(ctx context.Context, sel ast.SelectionSet, v *model.Thread) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - return ec._Thread(ctx, sel, v) -} - -func (ec *executionContext) marshalNThreadCursor2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐThreadCursor(ctx context.Context, sel ast.SelectionSet, v model.ThreadCursor) graphql.Marshaler { - return ec._ThreadCursor(ctx, sel, &v) -} - -func (ec *executionContext) marshalNThreadCursor2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐThreadCursor(ctx context.Context, sel ast.SelectionSet, v *model.ThreadCursor) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - return ec._ThreadCursor(ctx, sel, 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) unmarshalNToolIcon2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐToolIcon(ctx context.Context, v interface{}) (model.ToolIcon, error) { - var res model.ToolIcon - err := res.UnmarshalGQL(v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalNToolIcon2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐToolIcon(ctx context.Context, sel ast.SelectionSet, v model.ToolIcon) graphql.Marshaler { - return v -} - -func (ec *executionContext) unmarshalNURL2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐURL(ctx context.Context, v interface{}) (model.URL, error) { - var res model.URL - err := res.UnmarshalGQL(v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalNURL2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐURL(ctx context.Context, sel ast.SelectionSet, v model.URL) graphql.Marshaler { - return v -} - -func (ec *executionContext) unmarshalNURL2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐURL(ctx context.Context, v interface{}) (*model.URL, error) { - var res = new(model.URL) - err := res.UnmarshalGQL(v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalNURL2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐURL(ctx context.Context, sel ast.SelectionSet, v *model.URL) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - return v -} - -func (ec *executionContext) marshalNUser2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗ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ᚋlistsᚗ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ᚋlistsᚗ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ᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐVersion(ctx context.Context, sel ast.SelectionSet, v *model.Version) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - return ec._Version(ctx, sel, v) -} - -func (ec *executionContext) marshalN__Directive2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx context.Context, sel ast.SelectionSet, v introspection.Directive) graphql.Marshaler { - return ec.___Directive(ctx, sel, &v) -} - -func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirectiveᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.Directive) graphql.Marshaler { - ret := make(graphql.Array, len(v)) - var wg sync.WaitGroup - isLen1 := len(v) == 1 - if !isLen1 { - wg.Add(len(v)) - } - for i := range v { - i := i - fc := &graphql.FieldContext{ - Index: &i, - Result: &v[i], - } - ctx := graphql.WithFieldContext(ctx, fc) - f := func(i int) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() - if !isLen1 { - defer wg.Done() - } - ret[i] = ec.marshalN__Directive2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx, sel, v[i]) - } - if isLen1 { - f(i) - } else { - go f(i) - } - - } - wg.Wait() - - for _, e := range ret { - if e == graphql.Null { - return graphql.Null - } - } - - return ret -} - -func (ec *executionContext) unmarshalN__DirectiveLocation2string(ctx context.Context, v interface{}) (string, error) { - res, err := graphql.UnmarshalString(v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalN__DirectiveLocation2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { - res := graphql.MarshalString(v) - if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - } - return res -} - -func (ec *executionContext) unmarshalN__DirectiveLocation2ᚕstringᚄ(ctx context.Context, v interface{}) ([]string, error) { - var vSlice []interface{} - if v != nil { - 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) marshalOActivitySubscriptionCursor2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗ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) 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) marshalOEmail2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEmail(ctx context.Context, sel ast.SelectionSet, v *model.Email) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return ec._Email(ctx, sel, v) -} - -func (ec *executionContext) marshalOEmailCursor2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐEmailCursor(ctx context.Context, sel ast.SelectionSet, v *model.EmailCursor) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return ec._EmailCursor(ctx, sel, v) -} - -func (ec *executionContext) unmarshalOInt2ᚖint(ctx context.Context, v interface{}) (*int, error) { - if v == nil { - return nil, nil - } - res, err := graphql.UnmarshalInt(v) - return &res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalOInt2ᚖint(ctx context.Context, sel ast.SelectionSet, v *int) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return graphql.MarshalInt(*v) -} - -func (ec *executionContext) marshalOMailingList2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐMailingList(ctx context.Context, sel ast.SelectionSet, v *model.MailingList) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return ec._MailingList(ctx, sel, v) -} - -func (ec *executionContext) marshalOMailingListACL2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐMailingListACL(ctx context.Context, sel ast.SelectionSet, v *model.MailingListACL) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return ec._MailingListACL(ctx, sel, v) -} - -func (ec *executionContext) marshalOMailingListCursor2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐMailingListCursor(ctx context.Context, sel ast.SelectionSet, v *model.MailingListCursor) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return ec._MailingListCursor(ctx, sel, v) -} - -func (ec *executionContext) marshalOMailingListSubscription2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐMailingListSubscription(ctx context.Context, sel ast.SelectionSet, v *model.MailingListSubscription) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return ec._MailingListSubscription(ctx, sel, v) -} - -func (ec *executionContext) marshalOPatch2gitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐPatch(ctx context.Context, sel ast.SelectionSet, v model.Patch) graphql.Marshaler { - return ec._Patch(ctx, sel, &v) -} - -func (ec *executionContext) marshalOPatchset2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐPatchset(ctx context.Context, sel ast.SelectionSet, v *model.Patchset) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return ec._Patchset(ctx, sel, v) -} - -func (ec *executionContext) marshalOPatchsetCursor2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐPatchsetCursor(ctx context.Context, sel ast.SelectionSet, v *model.PatchsetCursor) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return ec._PatchsetCursor(ctx, sel, v) -} - -func (ec *executionContext) marshalOPatchsetTool2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐPatchsetTool(ctx context.Context, sel ast.SelectionSet, v *model.PatchsetTool) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return ec._PatchsetTool(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 - } - 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.unmarshalNString2string(ctx, vSlice[i]) - if err != nil { - return nil, err - } - } - return res, nil -} - -func (ec *executionContext) marshalOString2ᚕstringᚄ(ctx context.Context, sel ast.SelectionSet, v []string) graphql.Marshaler { - if v == nil { - return graphql.Null - } - ret := make(graphql.Array, len(v)) - for i := range v { - ret[i] = ec.marshalNString2string(ctx, sel, v[i]) - } - - for _, e := range ret { - if e == graphql.Null { - return graphql.Null - } - } - - return ret -} - -func (ec *executionContext) unmarshalOString2ᚖstring(ctx context.Context, v interface{}) (*string, error) { - if v == nil { - return nil, nil - } - res, err := graphql.UnmarshalString(v) - return &res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalOString2ᚖstring(ctx context.Context, sel ast.SelectionSet, v *string) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return graphql.MarshalString(*v) -} - -func (ec *executionContext) marshalOThreadCursor2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐThreadCursor(ctx context.Context, sel ast.SelectionSet, v *model.ThreadCursor) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return ec._ThreadCursor(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) unmarshalOToolIcon2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐToolIcon(ctx context.Context, v interface{}) (*model.ToolIcon, error) { - if v == nil { - return nil, nil - } - var res = new(model.ToolIcon) - err := res.UnmarshalGQL(v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalOToolIcon2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗsrᚗhtᚋapiᚋgraphᚋmodelᚐToolIcon(ctx context.Context, sel ast.SelectionSet, v *model.ToolIcon) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return v -} - -func (ec *executionContext) marshalOUser2ᚖgitᚗsrᚗhtᚋאsircmpwnᚋlistsᚗ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) 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/aclsbyidloader_gen.go b/api/loaders/aclsbyidloader_gen.go deleted file mode 100644 index 3c78d86..0000000 --- a/api/loaders/aclsbyidloader_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/lists.sr.ht/api/graph/model" -) - -// ACLsByIDLoaderConfig captures the config to create a new ACLsByIDLoader -type ACLsByIDLoaderConfig struct { - // Fetch is a method that provides the data for the loader - Fetch func(keys []int) ([]*model.MailingListACL, []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 -} - -// NewACLsByIDLoader creates a new ACLsByIDLoader given a fetch, wait, and maxBatch -func NewACLsByIDLoader(config ACLsByIDLoaderConfig) *ACLsByIDLoader { - return &ACLsByIDLoader{ - fetch: config.Fetch, - wait: config.Wait, - maxBatch: config.MaxBatch, - } -} - -// ACLsByIDLoader batches and caches requests -type ACLsByIDLoader struct { - // this method provides the data for the loader - fetch func(keys []int) ([]*model.MailingListACL, []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.MailingListACL - - // 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 *aCLsByIDLoaderBatch - - // mutex to prevent races - mu sync.Mutex -} - -type aCLsByIDLoaderBatch struct { - keys []int - data []*model.MailingListACL - error []error - closing bool - done chan struct{} -} - -// Load a MailingListACL by key, batching and caching will be applied automatically -func (l *ACLsByIDLoader) Load(key int) (*model.MailingListACL, error) { - return l.LoadThunk(key)() -} - -// LoadThunk returns a function that when called will block waiting for a MailingListACL. -// 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 *ACLsByIDLoader) LoadThunk(key int) func() (*model.MailingListACL, error) { - l.mu.Lock() - if it, ok := l.cache[key]; ok { - l.mu.Unlock() - return func() (*model.MailingListACL, error) { - return it, nil - } - } - if l.batch == nil { - l.batch = &aCLsByIDLoaderBatch{done: make(chan struct{})} - } - batch := l.batch - pos := batch.keyIndex(l, key) - l.mu.Unlock() - - return func() (*model.MailingListACL, error) { - <-batch.done - - var data *model.MailingListACL - 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 *ACLsByIDLoader) LoadAll(keys []int) ([]*model.MailingListACL, []error) { - results := make([]func() (*model.MailingListACL, error), len(keys)) - - for i, key := range keys { - results[i] = l.LoadThunk(key) - } - - mailingListACLs := make([]*model.MailingListACL, len(keys)) - errors := make([]error, len(keys)) - for i, thunk := range results { - mailingListACLs[i], errors[i] = thunk() - } - return mailingListACLs, errors -} - -// LoadAllThunk returns a function that when called will block waiting for a MailingListACLs. -// 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 *ACLsByIDLoader) LoadAllThunk(keys []int) func() ([]*model.MailingListACL, []error) { - results := make([]func() (*model.MailingListACL, error), len(keys)) - for i, key := range keys { - results[i] = l.LoadThunk(key) - } - return func() ([]*model.MailingListACL, []error) { - mailingListACLs := make([]*model.MailingListACL, len(keys)) - errors := make([]error, len(keys)) - for i, thunk := range results { - mailingListACLs[i], errors[i] = thunk() - } - return mailingListACLs, 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 *ACLsByIDLoader) Prime(key int, value *model.MailingListACL) 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 *ACLsByIDLoader) Clear(key int) { - l.mu.Lock() - delete(l.cache, key) - l.mu.Unlock() -} - -func (l *ACLsByIDLoader) unsafeSet(key int, value *model.MailingListACL) { - if l.cache == nil { - l.cache = map[int]*model.MailingListACL{} - } - 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 *aCLsByIDLoaderBatch) keyIndex(l *ACLsByIDLoader, 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 *aCLsByIDLoaderBatch) startTimer(l *ACLsByIDLoader) { - 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 *aCLsByIDLoaderBatch) end(l *ACLsByIDLoader) { - b.data, b.error = l.fetch(b.keys) - close(b.done) -} diff --git a/api/loaders/emailsbyidloader_gen.go b/api/loaders/emailsbyidloader_gen.go deleted file mode 100644 index 5facb69..0000000 --- a/api/loaders/emailsbyidloader_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/lists.sr.ht/api/graph/model" -) - -// EmailsByIDLoaderConfig captures the config to create a new EmailsByIDLoader -type EmailsByIDLoaderConfig struct { - // Fetch is a method that provides the data for the loader - Fetch func(keys []int) ([]*model.Email, []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 -} - -// NewEmailsByIDLoader creates a new EmailsByIDLoader given a fetch, wait, and maxBatch -func NewEmailsByIDLoader(config EmailsByIDLoaderConfig) *EmailsByIDLoader { - return &EmailsByIDLoader{ - fetch: config.Fetch, - wait: config.Wait, - maxBatch: config.MaxBatch, - } -} - -// EmailsByIDLoader batches and caches requests -type EmailsByIDLoader struct { - // this method provides the data for the loader - fetch func(keys []int) ([]*model.Email, []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.Email - - // 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 *emailsByIDLoaderBatch - - // mutex to prevent races - mu sync.Mutex -} - -type emailsByIDLoaderBatch struct { - keys []int - data []*model.Email - error []error - closing bool - done chan struct{} -} - -// Load a Email by key, batching and caching will be applied automatically -func (l *EmailsByIDLoader) Load(key int) (*model.Email, error) { - return l.LoadThunk(key)() -} - -// LoadThunk returns a function that when called will block waiting for a Email. -// 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 *EmailsByIDLoader) LoadThunk(key int) func() (*model.Email, error) { - l.mu.Lock() - if it, ok := l.cache[key]; ok { - l.mu.Unlock() - return func() (*model.Email, error) { - return it, nil - } - } - if l.batch == nil { - l.batch = &emailsByIDLoaderBatch{done: make(chan struct{})} - } - batch := l.batch - pos := batch.keyIndex(l, key) - l.mu.Unlock() - - return func() (*model.Email, error) { - <-batch.done - - var data *model.Email - 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 *EmailsByIDLoader) LoadAll(keys []int) ([]*model.Email, []error) { - results := make([]func() (*model.Email, error), len(keys)) - - for i, key := range keys { - results[i] = l.LoadThunk(key) - } - - emails := make([]*model.Email, len(keys)) - errors := make([]error, len(keys)) - for i, thunk := range results { - emails[i], errors[i] = thunk() - } - return emails, errors -} - -// LoadAllThunk returns a function that when called will block waiting for a Emails. -// 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 *EmailsByIDLoader) LoadAllThunk(keys []int) func() ([]*model.Email, []error) { - results := make([]func() (*model.Email, error), len(keys)) - for i, key := range keys { - results[i] = l.LoadThunk(key) - } - return func() ([]*model.Email, []error) { - emails := make([]*model.Email, len(keys)) - errors := make([]error, len(keys)) - for i, thunk := range results { - emails[i], errors[i] = thunk() - } - return emails, 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 *EmailsByIDLoader) Prime(key int, value *model.Email) 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 *EmailsByIDLoader) Clear(key int) { - l.mu.Lock() - delete(l.cache, key) - l.mu.Unlock() -} - -func (l *EmailsByIDLoader) unsafeSet(key int, value *model.Email) { - if l.cache == nil { - l.cache = map[int]*model.Email{} - } - 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 *emailsByIDLoaderBatch) keyIndex(l *EmailsByIDLoader, 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 *emailsByIDLoaderBatch) startTimer(l *EmailsByIDLoader) { - 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 *emailsByIDLoaderBatch) end(l *EmailsByIDLoader) { - b.data, b.error = l.fetch(b.keys) - close(b.done) -} diff --git a/api/loaders/emailsbymessageidloader_gen.go b/api/loaders/emailsbymessageidloader_gen.go deleted file mode 100644 index 8a3c3cb..0000000 --- a/api/loaders/emailsbymessageidloader_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/lists.sr.ht/api/graph/model" -) - -// EmailsByMessageIDLoaderConfig captures the config to create a new EmailsByMessageIDLoader -type EmailsByMessageIDLoaderConfig struct { - // Fetch is a method that provides the data for the loader - Fetch func(keys []string) ([]*model.Email, []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 -} - -// NewEmailsByMessageIDLoader creates a new EmailsByMessageIDLoader given a fetch, wait, and maxBatch -func NewEmailsByMessageIDLoader(config EmailsByMessageIDLoaderConfig) *EmailsByMessageIDLoader { - return &EmailsByMessageIDLoader{ - fetch: config.Fetch, - wait: config.Wait, - maxBatch: config.MaxBatch, - } -} - -// EmailsByMessageIDLoader batches and caches requests -type EmailsByMessageIDLoader struct { - // this method provides the data for the loader - fetch func(keys []string) ([]*model.Email, []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.Email - - // 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 *emailsByMessageIDLoaderBatch - - // mutex to prevent races - mu sync.Mutex -} - -type emailsByMessageIDLoaderBatch struct { - keys []string - data []*model.Email - error []error - closing bool - done chan struct{} -} - -// Load a Email by key, batching and caching will be applied automatically -func (l *EmailsByMessageIDLoader) Load(key string) (*model.Email, error) { - return l.LoadThunk(key)() -} - -// LoadThunk returns a function that when called will block waiting for a Email. -// 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 *EmailsByMessageIDLoader) LoadThunk(key string) func() (*model.Email, error) { - l.mu.Lock() - if it, ok := l.cache[key]; ok { - l.mu.Unlock() - return func() (*model.Email, error) { - return it, nil - } - } - if l.batch == nil { - l.batch = &emailsByMessageIDLoaderBatch{done: make(chan struct{})} - } - batch := l.batch - pos := batch.keyIndex(l, key) - l.mu.Unlock() - - return func() (*model.Email, error) { - <-batch.done - - var data *model.Email - 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 *EmailsByMessageIDLoader) LoadAll(keys []string) ([]*model.Email, []error) { - results := make([]func() (*model.Email, error), len(keys)) - - for i, key := range keys { - results[i] = l.LoadThunk(key) - } - - emails := make([]*model.Email, len(keys)) - errors := make([]error, len(keys)) - for i, thunk := range results { - emails[i], errors[i] = thunk() - } - return emails, errors -} - -// LoadAllThunk returns a function that when called will block waiting for a Emails. -// 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 *EmailsByMessageIDLoader) LoadAllThunk(keys []string) func() ([]*model.Email, []error) { - results := make([]func() (*model.Email, error), len(keys)) - for i, key := range keys { - results[i] = l.LoadThunk(key) - } - return func() ([]*model.Email, []error) { - emails := make([]*model.Email, len(keys)) - errors := make([]error, len(keys)) - for i, thunk := range results { - emails[i], errors[i] = thunk() - } - return emails, 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 *EmailsByMessageIDLoader) Prime(key string, value *model.Email) 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 *EmailsByMessageIDLoader) Clear(key string) { - l.mu.Lock() - delete(l.cache, key) - l.mu.Unlock() -} - -func (l *EmailsByMessageIDLoader) unsafeSet(key string, value *model.Email) { - if l.cache == nil { - l.cache = map[string]*model.Email{} - } - 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 *emailsByMessageIDLoaderBatch) keyIndex(l *EmailsByMessageIDLoader, 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 *emailsByMessageIDLoaderBatch) startTimer(l *EmailsByMessageIDLoader) { - 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 *emailsByMessageIDLoaderBatch) end(l *EmailsByMessageIDLoader) { - 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..8fb31af --- /dev/null +++ b/api/loaders/generate.go @@ -0,0 +1,20 @@ +//go:build generate +// +build generate + +package loaders + +import ( + _ "github.com/vektah/dataloaden" +) + +//go:generate ./gen ACLsByIDLoader int api/graph/model.MailingListACL +//go:generate ./gen EmailsByIDLoader int api/graph/model.Email +//go:generate ./gen EmailsByMessageIDLoader string api/graph/model.Email +//go:generate ./gen MailingListsByIDLoader int api/graph/model.MailingList +//go:generate ./gen MailingListsByNameLoader string api/graph/model.MailingList +//go:generate ./gen MailingListsByOwnerNameLoader [2]string api/graph/model.MailingList +//go:generate ./gen PatchsetsByIDLoader int api/graph/model.Patchset +//go:generate go run github.com/vektah/dataloaden SubscriptionsByIDLoader int git.sr.ht/~sircmpwn/lists.sr.ht/api/graph/model.ActivitySubscription +//go:generate ./gen ThreadsByIDLoader int api/graph/model.Thread +//go:generate ./gen UsersByIDLoader int api/graph/model.User +//go:generate ./gen UsersByNameLoader string api/graph/model.User diff --git a/api/loaders/mailinglistsbyidloader_gen.go b/api/loaders/mailinglistsbyidloader_gen.go deleted file mode 100644 index ace110f..0000000 --- a/api/loaders/mailinglistsbyidloader_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/lists.sr.ht/api/graph/model" -) - -// MailingListsByIDLoaderConfig captures the config to create a new MailingListsByIDLoader -type MailingListsByIDLoaderConfig struct { - // Fetch is a method that provides the data for the loader - Fetch func(keys []int) ([]*model.MailingList, []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 -} - -// NewMailingListsByIDLoader creates a new MailingListsByIDLoader given a fetch, wait, and maxBatch -func NewMailingListsByIDLoader(config MailingListsByIDLoaderConfig) *MailingListsByIDLoader { - return &MailingListsByIDLoader{ - fetch: config.Fetch, - wait: config.Wait, - maxBatch: config.MaxBatch, - } -} - -// MailingListsByIDLoader batches and caches requests -type MailingListsByIDLoader struct { - // this method provides the data for the loader - fetch func(keys []int) ([]*model.MailingList, []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.MailingList - - // 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 *mailingListsByIDLoaderBatch - - // mutex to prevent races - mu sync.Mutex -} - -type mailingListsByIDLoaderBatch struct { - keys []int - data []*model.MailingList - error []error - closing bool - done chan struct{} -} - -// Load a MailingList by key, batching and caching will be applied automatically -func (l *MailingListsByIDLoader) Load(key int) (*model.MailingList, error) { - return l.LoadThunk(key)() -} - -// LoadThunk returns a function that when called will block waiting for a MailingList. -// 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 *MailingListsByIDLoader) LoadThunk(key int) func() (*model.MailingList, error) { - l.mu.Lock() - if it, ok := l.cache[key]; ok { - l.mu.Unlock() - return func() (*model.MailingList, error) { - return it, nil - } - } - if l.batch == nil { - l.batch = &mailingListsByIDLoaderBatch{done: make(chan struct{})} - } - batch := l.batch - pos := batch.keyIndex(l, key) - l.mu.Unlock() - - return func() (*model.MailingList, error) { - <-batch.done - - var data *model.MailingList - 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 *MailingListsByIDLoader) LoadAll(keys []int) ([]*model.MailingList, []error) { - results := make([]func() (*model.MailingList, error), len(keys)) - - for i, key := range keys { - results[i] = l.LoadThunk(key) - } - - mailingLists := make([]*model.MailingList, len(keys)) - errors := make([]error, len(keys)) - for i, thunk := range results { - mailingLists[i], errors[i] = thunk() - } - return mailingLists, errors -} - -// LoadAllThunk returns a function that when called will block waiting for a MailingLists. -// 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 *MailingListsByIDLoader) LoadAllThunk(keys []int) func() ([]*model.MailingList, []error) { - results := make([]func() (*model.MailingList, error), len(keys)) - for i, key := range keys { - results[i] = l.LoadThunk(key) - } - return func() ([]*model.MailingList, []error) { - mailingLists := make([]*model.MailingList, len(keys)) - errors := make([]error, len(keys)) - for i, thunk := range results { - mailingLists[i], errors[i] = thunk() - } - return mailingLists, 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 *MailingListsByIDLoader) Prime(key int, value *model.MailingList) 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 *MailingListsByIDLoader) Clear(key int) { - l.mu.Lock() - delete(l.cache, key) - l.mu.Unlock() -} - -func (l *MailingListsByIDLoader) unsafeSet(key int, value *model.MailingList) { - if l.cache == nil { - l.cache = map[int]*model.MailingList{} - } - 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 *mailingListsByIDLoaderBatch) keyIndex(l *MailingListsByIDLoader, 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 *mailingListsByIDLoaderBatch) startTimer(l *MailingListsByIDLoader) { - 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 *mailingListsByIDLoaderBatch) end(l *MailingListsByIDLoader) { - b.data, b.error = l.fetch(b.keys) - close(b.done) -} diff --git a/api/loaders/mailinglistsbynameloader_gen.go b/api/loaders/mailinglistsbynameloader_gen.go deleted file mode 100644 index 8ffad4d..0000000 --- a/api/loaders/mailinglistsbynameloader_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/lists.sr.ht/api/graph/model" -) - -// MailingListsByNameLoaderConfig captures the config to create a new MailingListsByNameLoader -type MailingListsByNameLoaderConfig struct { - // Fetch is a method that provides the data for the loader - Fetch func(keys []string) ([]*model.MailingList, []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 -} - -// NewMailingListsByNameLoader creates a new MailingListsByNameLoader given a fetch, wait, and maxBatch -func NewMailingListsByNameLoader(config MailingListsByNameLoaderConfig) *MailingListsByNameLoader { - return &MailingListsByNameLoader{ - fetch: config.Fetch, - wait: config.Wait, - maxBatch: config.MaxBatch, - } -} - -// MailingListsByNameLoader batches and caches requests -type MailingListsByNameLoader struct { - // this method provides the data for the loader - fetch func(keys []string) ([]*model.MailingList, []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.MailingList - - // 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 *mailingListsByNameLoaderBatch - - // mutex to prevent races - mu sync.Mutex -} - -type mailingListsByNameLoaderBatch struct { - keys []string - data []*model.MailingList - error []error - closing bool - done chan struct{} -} - -// Load a MailingList by key, batching and caching will be applied automatically -func (l *MailingListsByNameLoader) Load(key string) (*model.MailingList, error) { - return l.LoadThunk(key)() -} - -// LoadThunk returns a function that when called will block waiting for a MailingList. -// 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 *MailingListsByNameLoader) LoadThunk(key string) func() (*model.MailingList, error) { - l.mu.Lock() - if it, ok := l.cache[key]; ok { - l.mu.Unlock() - return func() (*model.MailingList, error) { - return it, nil - } - } - if l.batch == nil { - l.batch = &mailingListsByNameLoaderBatch{done: make(chan struct{})} - } - batch := l.batch - pos := batch.keyIndex(l, key) - l.mu.Unlock() - - return func() (*model.MailingList, error) { - <-batch.done - - var data *model.MailingList - 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 *MailingListsByNameLoader) LoadAll(keys []string) ([]*model.MailingList, []error) { - results := make([]func() (*model.MailingList, error), len(keys)) - - for i, key := range keys { - results[i] = l.LoadThunk(key) - } - - mailingLists := make([]*model.MailingList, len(keys)) - errors := make([]error, len(keys)) - for i, thunk := range results { - mailingLists[i], errors[i] = thunk() - } - return mailingLists, errors -} - -// LoadAllThunk returns a function that when called will block waiting for a MailingLists. -// 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 *MailingListsByNameLoader) LoadAllThunk(keys []string) func() ([]*model.MailingList, []error) { - results := make([]func() (*model.MailingList, error), len(keys)) - for i, key := range keys { - results[i] = l.LoadThunk(key) - } - return func() ([]*model.MailingList, []error) { - mailingLists := make([]*model.MailingList, len(keys)) - errors := make([]error, len(keys)) - for i, thunk := range results { - mailingLists[i], errors[i] = thunk() - } - return mailingLists, 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 *MailingListsByNameLoader) Prime(key string, value *model.MailingList) 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 *MailingListsByNameLoader) Clear(key string) { - l.mu.Lock() - delete(l.cache, key) - l.mu.Unlock() -} - -func (l *MailingListsByNameLoader) unsafeSet(key string, value *model.MailingList) { - if l.cache == nil { - l.cache = map[string]*model.MailingList{} - } - 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 *mailingListsByNameLoaderBatch) keyIndex(l *MailingListsByNameLoader, 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 *mailingListsByNameLoaderBatch) startTimer(l *MailingListsByNameLoader) { - 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 *mailingListsByNameLoaderBatch) end(l *MailingListsByNameLoader) { - b.data, b.error = l.fetch(b.keys) - close(b.done) -} diff --git a/api/loaders/mailinglistsbyownernameloader_gen.go b/api/loaders/mailinglistsbyownernameloader_gen.go deleted file mode 100644 index c1769ea..0000000 --- a/api/loaders/mailinglistsbyownernameloader_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/lists.sr.ht/api/graph/model" -) - -// MailingListsByOwnerNameLoaderConfig captures the config to create a new MailingListsByOwnerNameLoader -type MailingListsByOwnerNameLoaderConfig struct { - // Fetch is a method that provides the data for the loader - Fetch func(keys [][2]string) ([]*model.MailingList, []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 -} - -// NewMailingListsByOwnerNameLoader creates a new MailingListsByOwnerNameLoader given a fetch, wait, and maxBatch -func NewMailingListsByOwnerNameLoader(config MailingListsByOwnerNameLoaderConfig) *MailingListsByOwnerNameLoader { - return &MailingListsByOwnerNameLoader{ - fetch: config.Fetch, - wait: config.Wait, - maxBatch: config.MaxBatch, - } -} - -// MailingListsByOwnerNameLoader batches and caches requests -type MailingListsByOwnerNameLoader struct { - // this method provides the data for the loader - fetch func(keys [][2]string) ([]*model.MailingList, []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.MailingList - - // 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 *mailingListsByOwnerNameLoaderBatch - - // mutex to prevent races - mu sync.Mutex -} - -type mailingListsByOwnerNameLoaderBatch struct { - keys [][2]string - data []*model.MailingList - error []error - closing bool - done chan struct{} -} - -// Load a MailingList by key, batching and caching will be applied automatically -func (l *MailingListsByOwnerNameLoader) Load(key [2]string) (*model.MailingList, error) { - return l.LoadThunk(key)() -} - -// LoadThunk returns a function that when called will block waiting for a MailingList. -// 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 *MailingListsByOwnerNameLoader) LoadThunk(key [2]string) func() (*model.MailingList, error) { - l.mu.Lock() - if it, ok := l.cache[key]; ok { - l.mu.Unlock() - return func() (*model.MailingList, error) { - return it, nil - } - } - if l.batch == nil { - l.batch = &mailingListsByOwnerNameLoaderBatch{done: make(chan struct{})} - } - batch := l.batch - pos := batch.keyIndex(l, key) - l.mu.Unlock() - - return func() (*model.MailingList, error) { - <-batch.done - - var data *model.MailingList - 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 *MailingListsByOwnerNameLoader) LoadAll(keys [][2]string) ([]*model.MailingList, []error) { - results := make([]func() (*model.MailingList, error), len(keys)) - - for i, key := range keys { - results[i] = l.LoadThunk(key) - } - - mailingLists := make([]*model.MailingList, len(keys)) - errors := make([]error, len(keys)) - for i, thunk := range results { - mailingLists[i], errors[i] = thunk() - } - return mailingLists, errors -} - -// LoadAllThunk returns a function that when called will block waiting for a MailingLists. -// 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 *MailingListsByOwnerNameLoader) LoadAllThunk(keys [][2]string) func() ([]*model.MailingList, []error) { - results := make([]func() (*model.MailingList, error), len(keys)) - for i, key := range keys { - results[i] = l.LoadThunk(key) - } - return func() ([]*model.MailingList, []error) { - mailingLists := make([]*model.MailingList, len(keys)) - errors := make([]error, len(keys)) - for i, thunk := range results { - mailingLists[i], errors[i] = thunk() - } - return mailingLists, 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 *MailingListsByOwnerNameLoader) Prime(key [2]string, value *model.MailingList) 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 *MailingListsByOwnerNameLoader) Clear(key [2]string) { - l.mu.Lock() - delete(l.cache, key) - l.mu.Unlock() -} - -func (l *MailingListsByOwnerNameLoader) unsafeSet(key [2]string, value *model.MailingList) { - if l.cache == nil { - l.cache = map[[2]string]*model.MailingList{} - } - 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 *mailingListsByOwnerNameLoaderBatch) keyIndex(l *MailingListsByOwnerNameLoader, 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 *mailingListsByOwnerNameLoaderBatch) startTimer(l *MailingListsByOwnerNameLoader) { - 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 *mailingListsByOwnerNameLoaderBatch) end(l *MailingListsByOwnerNameLoader) { - b.data, b.error = l.fetch(b.keys) - close(b.done) -} diff --git a/api/loaders/middleware.go b/api/loaders/middleware.go index be9728c..3b32c4a 100644 --- a/api/loaders/middleware.go +++ b/api/loaders/middleware.go @@ -1,17 +1,5 @@ package loaders -//go:generate ./gen ACLsByIDLoader int api/graph/model.MailingListACL -//go:generate ./gen EmailsByIDLoader int api/graph/model.Email -//go:generate ./gen EmailsByMessageIDLoader string api/graph/model.Email -//go:generate ./gen MailingListsByIDLoader int api/graph/model.MailingList -//go:generate ./gen MailingListsByNameLoader string api/graph/model.MailingList -//go:generate ./gen MailingListsByOwnerNameLoader [2]string api/graph/model.MailingList -//go:generate ./gen PatchsetsByIDLoader int api/graph/model.Patchset -//go:generate go run github.com/vektah/dataloaden SubscriptionsByIDLoader int git.sr.ht/~sircmpwn/lists.sr.ht/api/graph/model.ActivitySubscription -//go:generate ./gen ThreadsByIDLoader int api/graph/model.Thread -//go:generate ./gen UsersByIDLoader int api/graph/model.User -//go:generate ./gen UsersByNameLoader string api/graph/model.User - import ( "context" "database/sql" diff --git a/api/loaders/patchsetsbyidloader_gen.go b/api/loaders/patchsetsbyidloader_gen.go deleted file mode 100644 index d3c724b..0000000 --- a/api/loaders/patchsetsbyidloader_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/lists.sr.ht/api/graph/model" -) - -// PatchsetsByIDLoaderConfig captures the config to create a new PatchsetsByIDLoader -type PatchsetsByIDLoaderConfig struct { - // Fetch is a method that provides the data for the loader - Fetch func(keys []int) ([]*model.Patchset, []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 -} - -// NewPatchsetsByIDLoader creates a new PatchsetsByIDLoader given a fetch, wait, and maxBatch -func NewPatchsetsByIDLoader(config PatchsetsByIDLoaderConfig) *PatchsetsByIDLoader { - return &PatchsetsByIDLoader{ - fetch: config.Fetch, - wait: config.Wait, - maxBatch: config.MaxBatch, - } -} - -// PatchsetsByIDLoader batches and caches requests -type PatchsetsByIDLoader struct { - // this method provides the data for the loader - fetch func(keys []int) ([]*model.Patchset, []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.Patchset - - // 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 *patchsetsByIDLoaderBatch - - // mutex to prevent races - mu sync.Mutex -} - -type patchsetsByIDLoaderBatch struct { - keys []int - data []*model.Patchset - error []error - closing bool - done chan struct{} -} - -// Load a Patchset by key, batching and caching will be applied automatically -func (l *PatchsetsByIDLoader) Load(key int) (*model.Patchset, error) { - return l.LoadThunk(key)() -} - -// LoadThunk returns a function that when called will block waiting for a Patchset. -// 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 *PatchsetsByIDLoader) LoadThunk(key int) func() (*model.Patchset, error) { - l.mu.Lock() - if it, ok := l.cache[key]; ok { - l.mu.Unlock() - return func() (*model.Patchset, error) { - return it, nil - } - } - if l.batch == nil { - l.batch = &patchsetsByIDLoaderBatch{done: make(chan struct{})} - } - batch := l.batch - pos := batch.keyIndex(l, key) - l.mu.Unlock() - - return func() (*model.Patchset, error) { - <-batch.done - - var data *model.Patchset - 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 *PatchsetsByIDLoader) LoadAll(keys []int) ([]*model.Patchset, []error) { - results := make([]func() (*model.Patchset, error), len(keys)) - - for i, key := range keys { - results[i] = l.LoadThunk(key) - } - - patchsets := make([]*model.Patchset, len(keys)) - errors := make([]error, len(keys)) - for i, thunk := range results { - patchsets[i], errors[i] = thunk() - } - return patchsets, errors -} - -// LoadAllThunk returns a function that when called will block waiting for a Patchsets. -// 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 *PatchsetsByIDLoader) LoadAllThunk(keys []int) func() ([]*model.Patchset, []error) { - results := make([]func() (*model.Patchset, error), len(keys)) - for i, key := range keys { - results[i] = l.LoadThunk(key) - } - return func() ([]*model.Patchset, []error) { - patchsets := make([]*model.Patchset, len(keys)) - errors := make([]error, len(keys)) - for i, thunk := range results { - patchsets[i], errors[i] = thunk() - } - return patchsets, 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 *PatchsetsByIDLoader) Prime(key int, value *model.Patchset) 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 *PatchsetsByIDLoader) Clear(key int) { - l.mu.Lock() - delete(l.cache, key) - l.mu.Unlock() -} - -func (l *PatchsetsByIDLoader) unsafeSet(key int, value *model.Patchset) { - if l.cache == nil { - l.cache = map[int]*model.Patchset{} - } - 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 *patchsetsByIDLoaderBatch) keyIndex(l *PatchsetsByIDLoader, 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 *patchsetsByIDLoaderBatch) startTimer(l *PatchsetsByIDLoader) { - 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 *patchsetsByIDLoaderBatch) end(l *PatchsetsByIDLoader) { - b.data, b.error = l.fetch(b.keys) - close(b.done) -} diff --git a/api/loaders/subscriptionsbyidloader_gen.go b/api/loaders/subscriptionsbyidloader_gen.go deleted file mode 100644 index 63ebd07..0000000 --- a/api/loaders/subscriptionsbyidloader_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/lists.sr.ht/api/graph/model" -) - -// SubscriptionsByIDLoaderConfig captures the config to create a new SubscriptionsByIDLoader -type SubscriptionsByIDLoaderConfig struct { - // Fetch is a method that provides the data for the loader - Fetch func(keys []int) ([]model.ActivitySubscription, []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 -} - -// NewSubscriptionsByIDLoader creates a new SubscriptionsByIDLoader given a fetch, wait, and maxBatch -func NewSubscriptionsByIDLoader(config SubscriptionsByIDLoaderConfig) *SubscriptionsByIDLoader { - return &SubscriptionsByIDLoader{ - fetch: config.Fetch, - wait: config.Wait, - maxBatch: config.MaxBatch, - } -} - -// SubscriptionsByIDLoader batches and caches requests -type SubscriptionsByIDLoader struct { - // this method provides the data for the loader - fetch func(keys []int) ([]model.ActivitySubscription, []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.ActivitySubscription - - // 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 *subscriptionsByIDLoaderBatch - - // mutex to prevent races - mu sync.Mutex -} - -type subscriptionsByIDLoaderBatch struct { - keys []int - data []model.ActivitySubscription - error []error - closing bool - done chan struct{} -} - -// Load a ActivitySubscription by key, batching and caching will be applied automatically -func (l *SubscriptionsByIDLoader) Load(key int) (model.ActivitySubscription, error) { - return l.LoadThunk(key)() -} - -// LoadThunk returns a function that when called will block waiting for a ActivitySubscription. -// 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 *SubscriptionsByIDLoader) LoadThunk(key int) func() (model.ActivitySubscription, error) { - l.mu.Lock() - if it, ok := l.cache[key]; ok { - l.mu.Unlock() - return func() (model.ActivitySubscription, error) { - return it, nil - } - } - if l.batch == nil { - l.batch = &subscriptionsByIDLoaderBatch{done: make(chan struct{})} - } - batch := l.batch - pos := batch.keyIndex(l, key) - l.mu.Unlock() - - return func() (model.ActivitySubscription, error) { - <-batch.done - - var data model.ActivitySubscription - 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 *SubscriptionsByIDLoader) LoadAll(keys []int) ([]model.ActivitySubscription, []error) { - results := make([]func() (model.ActivitySubscription, error), len(keys)) - - for i, key := range keys { - results[i] = l.LoadThunk(key) - } - - activitySubscriptions := make([]model.ActivitySubscription, len(keys)) - errors := make([]error, len(keys)) - for i, thunk := range results { - activitySubscriptions[i], errors[i] = thunk() - } - return activitySubscriptions, errors -} - -// LoadAllThunk returns a function that when called will block waiting for a ActivitySubscriptions. -// 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 *SubscriptionsByIDLoader) LoadAllThunk(keys []int) func() ([]model.ActivitySubscription, []error) { - results := make([]func() (model.ActivitySubscription, error), len(keys)) - for i, key := range keys { - results[i] = l.LoadThunk(key) - } - return func() ([]model.ActivitySubscription, []error) { - activitySubscriptions := make([]model.ActivitySubscription, len(keys)) - errors := make([]error, len(keys)) - for i, thunk := range results { - activitySubscriptions[i], errors[i] = thunk() - } - return activitySubscriptions, 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 *SubscriptionsByIDLoader) Prime(key int, value model.ActivitySubscription) 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 *SubscriptionsByIDLoader) Clear(key int) { - l.mu.Lock() - delete(l.cache, key) - l.mu.Unlock() -} - -func (l *SubscriptionsByIDLoader) unsafeSet(key int, value model.ActivitySubscription) { - if l.cache == nil { - l.cache = map[int]model.ActivitySubscription{} - } - 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 *subscriptionsByIDLoaderBatch) keyIndex(l *SubscriptionsByIDLoader, 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 *subscriptionsByIDLoaderBatch) startTimer(l *SubscriptionsByIDLoader) { - 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 *subscriptionsByIDLoaderBatch) end(l *SubscriptionsByIDLoader) { - b.data, b.error = l.fetch(b.keys) - close(b.done) -} diff --git a/api/loaders/threadsbyidloader_gen.go b/api/loaders/threadsbyidloader_gen.go deleted file mode 100644 index d82a6aa..0000000 --- a/api/loaders/threadsbyidloader_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/lists.sr.ht/api/graph/model" -) - -// ThreadsByIDLoaderConfig captures the config to create a new ThreadsByIDLoader -type ThreadsByIDLoaderConfig struct { - // Fetch is a method that provides the data for the loader - Fetch func(keys []int) ([]*model.Thread, []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 -} - -// NewThreadsByIDLoader creates a new ThreadsByIDLoader given a fetch, wait, and maxBatch -func NewThreadsByIDLoader(config ThreadsByIDLoaderConfig) *ThreadsByIDLoader { - return &ThreadsByIDLoader{ - fetch: config.Fetch, - wait: config.Wait, - maxBatch: config.MaxBatch, - } -} - -// ThreadsByIDLoader batches and caches requests -type ThreadsByIDLoader struct { - // this method provides the data for the loader - fetch func(keys []int) ([]*model.Thread, []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.Thread - - // 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 *threadsByIDLoaderBatch - - // mutex to prevent races - mu sync.Mutex -} - -type threadsByIDLoaderBatch struct { - keys []int - data []*model.Thread - error []error - closing bool - done chan struct{} -} - -// Load a Thread by key, batching and caching will be applied automatically -func (l *ThreadsByIDLoader) Load(key int) (*model.Thread, error) { - return l.LoadThunk(key)() -} - -// LoadThunk returns a function that when called will block waiting for a Thread. -// 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 *ThreadsByIDLoader) LoadThunk(key int) func() (*model.Thread, error) { - l.mu.Lock() - if it, ok := l.cache[key]; ok { - l.mu.Unlock() - return func() (*model.Thread, error) { - return it, nil - } - } - if l.batch == nil { - l.batch = &threadsByIDLoaderBatch{done: make(chan struct{})} - } - batch := l.batch - pos := batch.keyIndex(l, key) - l.mu.Unlock() - - return func() (*model.Thread, error) { - <-batch.done - - var data *model.Thread - 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 *ThreadsByIDLoader) LoadAll(keys []int) ([]*model.Thread, []error) { - results := make([]func() (*model.Thread, error), len(keys)) - - for i, key := range keys { - results[i] = l.LoadThunk(key) - } - - threads := make([]*model.Thread, len(keys)) - errors := make([]error, len(keys)) - for i, thunk := range results { - threads[i], errors[i] = thunk() - } - return threads, errors -} - -// LoadAllThunk returns a function that when called will block waiting for a Threads. -// 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 *ThreadsByIDLoader) LoadAllThunk(keys []int) func() ([]*model.Thread, []error) { - results := make([]func() (*model.Thread, error), len(keys)) - for i, key := range keys { - results[i] = l.LoadThunk(key) - } - return func() ([]*model.Thread, []error) { - threads := make([]*model.Thread, len(keys)) - errors := make([]error, len(keys)) - for i, thunk := range results { - threads[i], errors[i] = thunk() - } - return threads, 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 *ThreadsByIDLoader) Prime(key int, value *model.Thread) 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 *ThreadsByIDLoader) Clear(key int) { - l.mu.Lock() - delete(l.cache, key) - l.mu.Unlock() -} - -func (l *ThreadsByIDLoader) unsafeSet(key int, value *model.Thread) { - if l.cache == nil { - l.cache = map[int]*model.Thread{} - } - 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 *threadsByIDLoaderBatch) keyIndex(l *ThreadsByIDLoader, 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 *threadsByIDLoaderBatch) startTimer(l *ThreadsByIDLoader) { - 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 *threadsByIDLoaderBatch) end(l *ThreadsByIDLoader) { - 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 910308c..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/lists.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 2dcfcf2..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/lists.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) -}