From 4543f10c31b71bba97a95adc4a257530ef2f9d9a Mon Sep 17 00:00:00 2001 From: Saad Ur Rahman Date: Mon, 26 May 2025 18:54:38 -0400 Subject: [PATCH] [Chore] General Updates May 2025. * GQLGen * Gin * Req * PGX * Go-Redis --- docs/docs.go | 2 +- docs/swagger.json | 2 +- docs/swagger.yaml | 2 +- go.mod | 59 +- go.sum | 279 ++------ pkg/auth/auth.go | 120 ++-- pkg/auth/errors.go | 10 +- pkg/graphql/generated/auth.generated.go | 6 +- pkg/graphql/generated/common.generated.go | 22 +- pkg/graphql/generated/crypto.generated.go | 54 +- pkg/graphql/generated/fiat.generated.go | 74 +-- .../generated/healthcheck.generated.go | 363 +++++++---- pkg/graphql/generated/prelude.generated.go | 604 +++++++++++++----- pkg/graphql/generated/root_.generated.go | 48 +- pkg/graphql/generated/scalars.generated.go | 21 +- pkg/graphql/generated/user.generated.go | 356 +++++++---- pkg/graphql/graphql.go | 24 +- pkg/graphql/resolvers/authorization_test.go | 20 +- pkg/graphql/resolvers/common.resolvers.go | 2 +- .../resolvers/common.resolvers_test.go | 7 +- pkg/graphql/resolvers/crypto.resolvers.go | 2 +- .../resolvers/crypto.resolvers_test.go | 37 +- pkg/graphql/resolvers/fiat.resolvers.go | 2 +- pkg/graphql/resolvers/fiat.resolvers_test.go | 59 +- pkg/graphql/resolvers/handlers_test.go | 3 +- .../resolvers/healthcheck.resolvers.go | 2 +- .../resolvers/healthcheck.resolvers_test.go | 3 +- pkg/graphql/resolvers/user.resolvers.go | 2 +- pkg/graphql/resolvers/user.resolvers_test.go | 9 +- pkg/logger/logger.go | 38 +- pkg/postgres/crypto_test.go | 10 +- pkg/postgres/errors.go | 10 +- pkg/postgres/fiat_test.go | 16 +- pkg/postgres/main_test.go | 12 +- pkg/postgres/postgres.go | 56 +- pkg/postgres/queries_crypto_test.go | 6 +- pkg/postgres/queries_fiat_test.go | 2 +- pkg/postgres/queries_users_test.go | 5 +- pkg/postgres/transactions_test.go | 12 +- pkg/postgres/udf_sqlc_test.go | 2 +- pkg/postgres/users_test.go | 14 +- pkg/quotes/errors.go | 10 +- pkg/quotes/quotes.go | 116 ++-- pkg/quotes/quotes_test.go | 1 - pkg/redis/errors.go | 10 +- pkg/redis/redis.go | 68 +- pkg/rest/handlers/authorization_test.go | 3 +- pkg/rest/handlers/crypto_test.go | 15 +- pkg/rest/handlers/fiat_test.go | 17 +- pkg/rest/handlers/healthcheck_test.go | 3 +- pkg/rest/handlers/users_test.go | 9 +- pkg/rest/rest.go | 110 ++-- 52 files changed, 1578 insertions(+), 1161 deletions(-) diff --git a/docs/docs.go b/docs/docs.go index fea6364e..8b4c0a8a 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -1462,7 +1462,7 @@ const docTemplate = `{ // SwaggerInfo holds exported Swagger Info so clients can modify it var SwaggerInfo = &swag.Spec{ - Version: "1.2.7", + Version: "1.2.8", Host: "localhost:33723", BasePath: "/api/rest/v1", Schemes: []string{"http"}, diff --git a/docs/swagger.json b/docs/swagger.json index 8589f8ca..63c0cce6 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -21,7 +21,7 @@ "name": "GPL-3.0", "url": "https://opensource.org/licenses/GPL-3.0" }, - "version": "1.2.7" + "version": "1.2.8" }, "host": "localhost:33723", "basePath": "/api/rest/v1", diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 8f82345b..a9f1b0a0 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -149,7 +149,7 @@ info: name: GPL-3.0 url: https://opensource.org/licenses/GPL-3.0 title: FTeX, Inc. (Formerly Crypto-Bro's Bank, Inc.) - version: 1.2.7 + version: 1.2.8 paths: /crypto/exchange/: post: diff --git a/go.mod b/go.mod index 90d50b1c..07bfeec0 100644 --- a/go.mod +++ b/go.mod @@ -1,19 +1,19 @@ module github.com/surahman/FTeX -go 1.23.0 +go 1.24 -toolchain go1.24.1 +toolchain go1.24.2 require ( - github.com/99designs/gqlgen v0.17.70 - github.com/gin-gonic/gin v1.10.0 + github.com/99designs/gqlgen v0.17.73 + github.com/gin-gonic/gin v1.10.1 github.com/go-playground/validator/v10 v10.26.0 github.com/gofrs/uuid v4.4.0+incompatible github.com/golang-jwt/jwt/v5 v5.2.2 github.com/golang/mock v1.6.0 - github.com/imroc/req/v3 v3.50.0 - github.com/jackc/pgx/v5 v5.7.4 - github.com/redis/go-redis/v9 v9.7.3 + github.com/imroc/req/v3 v3.52.2 + github.com/jackc/pgx/v5 v5.7.5 + github.com/redis/go-redis/v9 v9.8.0 github.com/rs/xid v1.6.0 github.com/shopspring/decimal v1.4.0 github.com/spf13/afero v1.14.0 @@ -22,10 +22,10 @@ require ( github.com/swaggo/files v1.0.1 github.com/swaggo/gin-swagger v1.6.0 github.com/swaggo/swag v1.16.4 - github.com/vektah/gqlparser/v2 v2.5.23 + github.com/vektah/gqlparser/v2 v2.5.27 go.uber.org/automaxprocs v1.6.0 go.uber.org/zap v1.27.0 - golang.org/x/crypto v0.36.0 + golang.org/x/crypto v0.38.0 gopkg.in/yaml.v3 v3.0.1 ) @@ -36,14 +36,14 @@ require ( github.com/bytedance/sonic v1.13.2 // indirect github.com/bytedance/sonic/loader v0.2.4 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/cloudflare/circl v1.6.0 // indirect + github.com/cloudflare/circl v1.6.1 // indirect github.com/cloudwego/base64x v0.1.5 // indirect - github.com/cpuguy83/go-md2man/v2 v2.0.6 // indirect + github.com/cpuguy83/go-md2man/v2 v2.0.7 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect - github.com/gabriel-vasile/mimetype v1.4.8 // indirect - github.com/gin-contrib/sse v1.0.0 // indirect + github.com/gabriel-vasile/mimetype v1.4.9 // indirect + github.com/gin-contrib/sse v1.1.0 // indirect github.com/go-openapi/jsonpointer v0.21.1 // indirect github.com/go-openapi/jsonreference v0.21.0 // indirect github.com/go-openapi/spec v0.21.0 // indirect @@ -53,13 +53,13 @@ require ( github.com/go-task/slim-sprig/v3 v3.0.0 // indirect github.com/go-viper/mapstructure/v2 v2.2.1 // indirect github.com/goccy/go-json v0.10.5 // indirect - github.com/google/pprof v0.0.0-20250403155104-27863c87afa6 // indirect + github.com/google/pprof v0.0.0-20250501235452-c0086092b71a // indirect github.com/google/uuid v1.6.0 // indirect github.com/gorilla/websocket v1.5.0 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect - github.com/hashicorp/hcl v1.0.0 // indirect + github.com/icholy/digest v1.1.0 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect github.com/jackc/puddle/v2 v2.2.2 // indirect @@ -68,40 +68,35 @@ require ( github.com/klauspost/compress v1.18.0 // indirect github.com/klauspost/cpuid/v2 v2.2.10 // indirect github.com/leodido/go-urn v1.4.0 // indirect - github.com/magiconair/properties v1.8.7 // indirect github.com/mailru/easyjson v0.9.0 // indirect github.com/mattn/go-isatty v0.0.20 // indirect - github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect - github.com/onsi/ginkgo/v2 v2.23.3 // indirect - github.com/pelletier/go-toml/v2 v2.2.3 // indirect + github.com/onsi/ginkgo/v2 v2.23.4 // indirect + github.com/pelletier/go-toml/v2 v2.2.4 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/quic-go/qpack v0.5.1 // indirect - github.com/quic-go/quic-go v0.50.1 // indirect - github.com/refraction-networking/utls v1.6.7 // indirect + github.com/quic-go/quic-go v0.52.0 // indirect + github.com/refraction-networking/utls v1.7.3 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/sagikazarmark/locafero v0.9.0 // indirect - github.com/sagikazarmark/slog-shim v0.1.0 // indirect github.com/sosodev/duration v1.3.1 // indirect github.com/sourcegraph/conc v0.3.0 // indirect - github.com/spf13/cast v1.7.1 // indirect + github.com/spf13/cast v1.8.0 // indirect github.com/spf13/pflag v1.0.6 // indirect github.com/subosito/gotenv v1.6.0 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect github.com/ugorji/go/codec v1.2.12 // indirect github.com/urfave/cli/v2 v2.27.6 // indirect github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect - go.uber.org/mock v0.5.0 // indirect + go.uber.org/mock v0.5.2 // indirect go.uber.org/multierr v1.11.0 // indirect - golang.org/x/arch v0.16.0 // indirect - golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 // indirect + golang.org/x/arch v0.17.0 // indirect golang.org/x/mod v0.24.0 // indirect - golang.org/x/net v0.38.0 // indirect - golang.org/x/sync v0.13.0 // indirect - golang.org/x/sys v0.32.0 // indirect - golang.org/x/text v0.23.0 // indirect - golang.org/x/tools v0.31.0 // indirect + golang.org/x/net v0.40.0 // indirect + golang.org/x/sync v0.14.0 // indirect + golang.org/x/sys v0.33.0 // indirect + golang.org/x/text v0.25.0 // indirect + golang.org/x/tools v0.33.0 // indirect google.golang.org/protobuf v1.36.6 // indirect - gopkg.in/ini.v1 v1.67.0 // indirect ) diff --git a/go.sum b/go.sum index ed5a44fa..1d73b821 100644 --- a/go.sum +++ b/go.sum @@ -1,54 +1,37 @@ -github.com/99designs/gqlgen v0.17.63 h1:HCdaYDPd9HqUXRchEvmE3EFzELRwLlaJ8DBuyC8Cqto= -github.com/99designs/gqlgen v0.17.63/go.mod h1:sVCM2iwIZisJjTI/DEC3fpH+HFgxY1496ZJ+jbT9IjA= -github.com/99designs/gqlgen v0.17.70 h1:xgLIgQuG+Q2L/AE9cW595CT7xCWCe/bpPIFGSfsGSGs= -github.com/99designs/gqlgen v0.17.70/go.mod h1:fvCiqQAu2VLhKXez2xFvLmE47QgAPf/KTPN5XQ4rsHQ= +github.com/99designs/gqlgen v0.17.73 h1:A3Ki+rHWqKbAOlg5fxiZBnz6OjW3nwupDHEG15gEsrg= +github.com/99designs/gqlgen v0.17.73/go.mod h1:2RyGWjy2k7W9jxrs8MOQthXGkD3L3oGr0jXW3Pu8lGg= github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc= github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE= -github.com/PuerkitoBio/goquery v1.9.3 h1:mpJr/ikUA9/GNJB/DBZcGeFDXUtosHRyRrwh7KGdTG0= -github.com/PuerkitoBio/goquery v1.9.3/go.mod h1:1ndLHPdTz+DyQPICCWYlYQMPl0oXZj0G6D4LCYA6u4U= -github.com/agnivade/levenshtein v1.2.0 h1:U9L4IOT0Y3i0TIlUIDJ7rVUziKi/zPbrJGaFrtYH3SY= -github.com/agnivade/levenshtein v1.2.0/go.mod h1:QVVI16kDrtSuwcpd0p1+xMC6Z/VfhtCyDIjcwga4/DU= +github.com/PuerkitoBio/goquery v1.10.3 h1:pFYcNSqHxBD06Fpj/KsbStFRsgRATgnf3LeXiUkhzPo= +github.com/PuerkitoBio/goquery v1.10.3/go.mod h1:tMUX0zDMHXYlAQk6p35XxQMqMweEKB7iK7iLNd4RH4Y= github.com/agnivade/levenshtein v1.2.1 h1:EHBY3UOn1gwdy/VbFwgo4cxecRznFk7fKWN1KOX7eoM= github.com/agnivade/levenshtein v1.2.1/go.mod h1:QVVI16kDrtSuwcpd0p1+xMC6Z/VfhtCyDIjcwga4/DU= github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883 h1:bvNMNQO63//z+xNgfBlViaCIJKLlCJ6/fmUseuG0wVQ= github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= -github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M= -github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY= github.com/andybalholm/brotli v1.1.1 h1:PR2pgnyFznKEugtsUo0xLdDop5SKXd5Qf5ysW+7XdTA= github.com/andybalholm/brotli v1.1.1/go.mod h1:05ib4cKhjx3OQYUY22hTVd34Bc8upXjOLL2rKwwZBoA= -github.com/andybalholm/cascadia v1.3.2 h1:3Xi6Dw5lHF15JtdcmAHD3i1+T8plmv7BQ/nsViSLyss= -github.com/andybalholm/cascadia v1.3.2/go.mod h1:7gtRlve5FxPPgIgX36uWBX58OdBsSS6lUvCFb+h7KvU= +github.com/andybalholm/cascadia v1.3.3 h1:AG2YHrzJIm4BZ19iwJ/DAua6Btl3IwJX+VI4kktS1LM= +github.com/andybalholm/cascadia v1.3.3/go.mod h1:xNd9bqTn98Ln4DwST8/nG+H0yuB8Hmgu1YHNnWw0GeA= github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0 h1:jfIu9sQUG6Ig+0+Ap1h4unLjW6YQJpKZVmUzxsD4E/Q= github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0/go.mod h1:t2tdKJDJF9BV14lnkjHmOQgcvEKgtqs5a1N3LNdJhGE= github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs= github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c= github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA= github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0= -github.com/bytedance/sonic v1.12.7 h1:CQU8pxOy9HToxhndH0Kx/S1qU/CuS9GnKYrGioDcU1Q= -github.com/bytedance/sonic v1.12.7/go.mod h1:tnbal4mxOMju17EGfknm2XyYcpyCnIROYOEYuemj13I= github.com/bytedance/sonic v1.13.2 h1:8/H1FempDZqC4VqjptGo14QQlJx8VdZJegxs6wwfqpQ= github.com/bytedance/sonic v1.13.2/go.mod h1:o68xyaF9u2gvVBuGHPlUVCy+ZfmNNO5ETf1+KgkJhz4= github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= -github.com/bytedance/sonic/loader v0.2.3 h1:yctD0Q3v2NOGfSWPLPvG2ggA2kV6TS6s4wioyEqssH0= -github.com/bytedance/sonic/loader v0.2.3/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI= github.com/bytedance/sonic/loader v0.2.4 h1:ZWCw4stuXUsn1/+zQDqeE7JKP+QO47tz7QCNan80NzY= github.com/bytedance/sonic/loader v0.2.4/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI= -github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= -github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cloudflare/circl v1.3.7 h1:qlCDlTPz2n9fu58M0Nh1J/JzcFpfgkFHHX3O35r5vcU= -github.com/cloudflare/circl v1.3.7/go.mod h1:sRTcRWXGLrKw6yIGJ+l7amYJFfAXbZG0kBSc8r4zxgA= -github.com/cloudflare/circl v1.5.0 h1:hxIWksrX6XN5a1L2TI/h53AGPhNHoUBo+TD1ms9+pys= -github.com/cloudflare/circl v1.5.0/go.mod h1:uddAzsPgqdMAYatqJ0lsjX1oECcQLIlRpzZh3pJrofs= -github.com/cloudflare/circl v1.6.0 h1:cr5JKic4HI+LkINy2lg3W2jF8sHCVTBncJr5gIIq7qk= -github.com/cloudflare/circl v1.6.0/go.mod h1:uddAzsPgqdMAYatqJ0lsjX1oECcQLIlRpzZh3pJrofs= +github.com/cloudflare/circl v1.6.1 h1:zqIqSPIndyBh1bjLVVDHMPpVKqp8Su/V+6MeDzzQBQ0= +github.com/cloudflare/circl v1.6.1/go.mod h1:uddAzsPgqdMAYatqJ0lsjX1oECcQLIlRpzZh3pJrofs= github.com/cloudwego/base64x v0.1.5 h1:XPciSp1xaq2VCSt6lF0phncD4koWyULpl5bUxbfCyP4= github.com/cloudwego/base64x v0.1.5/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w= github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY= -github.com/cpuguy83/go-md2man/v2 v2.0.6 h1:XJtiaUW6dEEqVuZiMTn1ldk455QWwEIsMIJlo5vtkx0= -github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/cpuguy83/go-md2man/v2 v2.0.7 h1:zbFlGlXEAKlwXpmvle3d8Oe3YnkKIK4xSRTd3sHPnBo= +github.com/cpuguy83/go-md2man/v2 v2.0.7/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= @@ -59,39 +42,24 @@ github.com/dgryski/trifles v0.0.0-20230903005119-f50d829f2e54 h1:SG7nF6SRlWhcT7c github.com/dgryski/trifles v0.0.0-20230903005119-f50d829f2e54/go.mod h1:if7Fbed8SFyPtHLHbg49SI7NAdJiC5WIA09pe59rfAA= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= -github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= -github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k= github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= -github.com/gabriel-vasile/mimetype v1.4.8 h1:FfZ3gj38NjllZIeJAmMhr+qKL8Wu+nOoI3GqacKw1NM= -github.com/gabriel-vasile/mimetype v1.4.8/go.mod h1:ByKUIKGjh1ODkGM1asKUbQZOLGrPjydw3hYPU2YU9t8= +github.com/gabriel-vasile/mimetype v1.4.9 h1:5k+WDwEsD9eTLL8Tz3L0VnmVh9QxGjRmjBvAG7U/oYY= +github.com/gabriel-vasile/mimetype v1.4.9/go.mod h1:WnSQhFKJuBlRyLiKohA/2DtIlPFAbguNaG7QCHcyGok= github.com/gin-contrib/gzip v0.0.6 h1:NjcunTcGAj5CO1gn4N8jHOSIeRFHIbn51z6K+xaN4d4= github.com/gin-contrib/gzip v0.0.6/go.mod h1:QOJlmV2xmayAjkNS2Y8NQsMneuRShOU/kjovCXNuzzk= -github.com/gin-contrib/sse v1.0.0 h1:y3bT1mUWUxDpW4JLQg/HnTqV4rozuW4tC9eFKTxYI9E= -github.com/gin-contrib/sse v1.0.0/go.mod h1:zNuFdwarAygJBht0NTKiSi3jRf6RbqeILZ9Sp6Slhe0= -github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU= -github.com/gin-gonic/gin v1.10.0/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y= +github.com/gin-contrib/sse v1.1.0 h1:n0w2GMuUpWDVp7qSpvze6fAu9iRxJY4Hmj6AmBOU05w= +github.com/gin-contrib/sse v1.1.0/go.mod h1:hxRZ5gVpWMT7Z0B0gSNYqqsSCNIJMjzvm6fqCz9vjwM= +github.com/gin-gonic/gin v1.10.1 h1:T0ujvqyCSqRopADpgPgiTT63DUQVSfojyME59Ei63pQ= +github.com/gin-gonic/gin v1.10.1/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y= github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= -github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= -github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= -github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE= -github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs= github.com/go-openapi/jsonpointer v0.21.1 h1:whnzv/pNXtK2FbX/W9yJfRmE2gsmkfahjMKB0fZvcic= github.com/go-openapi/jsonpointer v0.21.1/go.mod h1:50I1STOfbY1ycR8jGz8DaMeLCdXiI6aDteEdRNNzpdk= -github.com/go-openapi/jsonreference v0.20.0/go.mod h1:Ag74Ico3lPc+zR+qjn4XBUmXymS4zJbYVCZmcgkasdo= -github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE= -github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k= github.com/go-openapi/jsonreference v0.21.0 h1:Rs+Y7hSXT83Jacb7kFyjn4ijOuVGSvOdF2+tg1TRrwQ= github.com/go-openapi/jsonreference v0.21.0/go.mod h1:LmZmgsrTkVg9LG4EaHeY8cBDslNPMo06cago5JNLkm4= -github.com/go-openapi/spec v0.20.8 h1:ubHmXNY3FCIOinT8RNrrPfGc9t7I1qhPtdOGoG2AxRU= -github.com/go-openapi/spec v0.20.8/go.mod h1:2OpW+JddWPrpXSCIX8eOx7lZ5iyuWj3RYR6VaaBKcWA= github.com/go-openapi/spec v0.21.0 h1:LTVzPc3p/RzRnkQqLRndbAzjY0d0BCL72A6j3CdL9ZY= github.com/go-openapi/spec v0.21.0/go.mod h1:78u6VdPw81XU44qEWGhtr982gJ5BWg2c0I5XwVMotYk= -github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= -github.com/go-openapi/swag v0.19.15/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= -github.com/go-openapi/swag v0.22.3 h1:yMBqmnQ0gyZvEb/+KzuWZOXgllrXT4SADYbvDaXHv/g= -github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= github.com/go-openapi/swag v0.23.1 h1:lpsStH0n2ittzTnbaSloVZLuB5+fvSY/+hnagBjSNZU= github.com/go-openapi/swag v0.23.1/go.mod h1:STZs8TbRvEQQKUA+JZNAm3EWlgaOBGpyFDqQnDHMef0= github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= @@ -100,36 +68,25 @@ github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/o github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= -github.com/go-playground/validator/v10 v10.24.0 h1:KHQckvo8G6hlWnrPX4NJJ+aBfWNAE/HH+qdL2cBpCmg= -github.com/go-playground/validator/v10 v10.24.0/go.mod h1:GGzBIJMuE98Ic/kJsBXbz1x/7cByt++cQ+YOuDM5wus= github.com/go-playground/validator/v10 v10.26.0 h1:SP05Nqhjcvz81uJaRfEV0YBSSSGMc/iMaVtFbr3Sw2k= github.com/go-playground/validator/v10 v10.26.0/go.mod h1:I5QpIEbmr8On7W0TktmJAumgzX4CA1XNl4ZmDuVHKKo= -github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8= github.com/go-viper/mapstructure/v2 v2.2.1 h1:ZAaOCxANMuZx5RCeg0mBdEZk7DZasvvZIxtHqx8aGss= github.com/go-viper/mapstructure/v2 v2.2.1/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= -github.com/goccy/go-json v0.10.4 h1:JSwxQzIqKfmFX1swYPpUThQZp/Ka4wzJdK0LWVytLPM= -github.com/goccy/go-json v0.10.4/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4= github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= github.com/gofrs/uuid v4.4.0+incompatible h1:3qXRTX8/NbyulANqlc0lchS1gqAVxRgsuW1YrTJupqA= github.com/gofrs/uuid v4.4.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= -github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= -github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= github.com/golang-jwt/jwt/v5 v5.2.2 h1:Rl4B7itRWVtYIHFrSNd7vhTiz9UpLdi6gZhZ3wEeDy8= github.com/golang-jwt/jwt/v5 v5.2.2/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= -github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= -github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8 h1:FKHo8hFI3A+7w0aUQuYXQ+6EN5stWmeY/AZqtM8xk9k= -github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8/go.mod h1:K1liHPHnj73Fdn/EKuT8nrFqBihUSKXoLYU0BuatOYo= -github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad h1:a6HEuzUHeKH6hwfN/ZoQgRgVIWFJljSWa/zetS2WTvg= -github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= -github.com/google/pprof v0.0.0-20250403155104-27863c87afa6 h1:BHT72Gu3keYf3ZEu2J0b1vyeLSOYI8bm5wbJM/8yDe8= -github.com/google/pprof v0.0.0-20250403155104-27863c87afa6/go.mod h1:boTsfXsheKC2y+lKOCMpSfarhxDeIzfZG1jqGcPl3cA= +github.com/google/pprof v0.0.0-20250501235452-c0086092b71a h1:rDA3FfmxwXR+BVKKdz55WwMJ1pD2hJQNW31d+l3mPk4= +github.com/google/pprof v0.0.0-20250501235452-c0086092b71a/go.mod h1:5hDyRhoBCxViHszMt12TnOpEI4VVi+U8Gm9iphldiMA= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= @@ -141,123 +98,70 @@ github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+l github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= -github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= -github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/imroc/req/v3 v3.43.7 h1:dOcNb9n0X83N5/5/AOkiU+cLhzx8QFXjv5MhikazzQA= -github.com/imroc/req/v3 v3.43.7/go.mod h1:SQIz5iYop16MJxbo8ib+4LnostGCok8NQf8ToyQc2xA= -github.com/imroc/req/v3 v3.49.1 h1:Nvwo02riiPEzh74ozFHeEJrtjakFxnoWNR3YZYuQm9U= -github.com/imroc/req/v3 v3.49.1/go.mod h1:tsOk8K7zI6cU4xu/VWCZVtq9Djw9IWm4MslKzme5woU= -github.com/imroc/req/v3 v3.50.0 h1:n3BVnZiTRpvkN5T1IB79LC/THhFU9iXksNRMH4ZNVaY= -github.com/imroc/req/v3 v3.50.0/go.mod h1:tsOk8K7zI6cU4xu/VWCZVtq9Djw9IWm4MslKzme5woU= +github.com/icholy/digest v1.1.0 h1:HfGg9Irj7i+IX1o1QAmPfIBNu/Q5A5Tu3n/MED9k9H4= +github.com/icholy/digest v1.1.0/go.mod h1:QNrsSGQ5v7v9cReDI0+eyjsXGUoRSUZQHeQ5C4XLa0Y= +github.com/imroc/req/v3 v3.52.2 h1:xJocr1aIv0a2K9knfBQ4JnZHk+kWTITdjf0mgDg229I= +github.com/imroc/req/v3 v3.52.2/go.mod h1:dBGsDloOSZJcFs6PnTjZXYBJK70OXbZpizHBLNqcH2k= github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo= github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= -github.com/jackc/pgx/v5 v5.6.0 h1:SWJzexBzPL5jb0GEsrPMLIsi/3jOo7RHlzTjcAeDrPY= -github.com/jackc/pgx/v5 v5.6.0/go.mod h1:DNZ/vlrUnhWCoFGxHAG8U2ljioxukquj7utPDgtQdTw= -github.com/jackc/pgx/v5 v5.7.2 h1:mLoDLV6sonKlvjIEsV56SkWNCnuNv531l94GaIzO+XI= -github.com/jackc/pgx/v5 v5.7.2/go.mod h1:ncY89UGWxg82EykZUwSpUKEfccBGGYq1xjrOpsbsfGQ= -github.com/jackc/pgx/v5 v5.7.4 h1:9wKznZrhWa2QiHL+NjTSPP6yjl3451BX3imWDnokYlg= -github.com/jackc/pgx/v5 v5.7.4/go.mod h1:ncY89UGWxg82EykZUwSpUKEfccBGGYq1xjrOpsbsfGQ= -github.com/jackc/puddle/v2 v2.2.1 h1:RhxXJtFG022u4ibrCSMSiu5aOq1i77R3OHKNJj77OAk= -github.com/jackc/puddle/v2 v2.2.1/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= +github.com/jackc/pgx/v5 v5.7.5 h1:JHGfMnQY+IEtGM63d+NGMjoRpysB2JBwDr5fsngwmJs= +github.com/jackc/pgx/v5 v5.7.5/go.mod h1:aruU7o91Tc2q2cFp5h4uP3f6ztExVpyVv88Xl/8Vl8M= github.com/jackc/puddle/v2 v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo= github.com/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= -github.com/klauspost/compress v1.17.7 h1:ehO88t2UGzQK66LMdE8tibEd1ErmzZjNEqWkjLAKQQg= -github.com/klauspost/compress v1.17.7/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= -github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IXrJmUc= -github.com/klauspost/compress v1.17.11/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0= github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo= github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= -github.com/klauspost/cpuid/v2 v2.2.9 h1:66ze0taIn2H33fBvCkXuv9BmCwDfafmiIVpKV9kKGuY= -github.com/klauspost/cpuid/v2 v2.2.9/go.mod h1:rqkxqrZ1EhYM9G+hXH7YdowN5R5RGN6NK4QwQ3WMXF8= github.com/klauspost/cpuid/v2 v2.2.10 h1:tBs3QSyvjDyFTq3uoc/9xFpCuOsJQFNPiAhYdw2skhE= github.com/klauspost/cpuid/v2 v2.2.10/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0= github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= -github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= -github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= -github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= -github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= -github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mailru/easyjson v0.9.0 h1:PrnmzHw7262yW8sTBwxi1PdJA3Iw/EKBa8psRf7d9a4= github.com/mailru/easyjson v0.9.0/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= -github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/onsi/ginkgo/v2 v2.20.0 h1:PE84V2mHqoT1sglvHc8ZdQtPcwmvvt29WLEEO3xmdZw= -github.com/onsi/ginkgo/v2 v2.20.0/go.mod h1:lG9ey2Z29hR41WMVthyJBGUBcBhGOtoPF2VFMvBXFCI= -github.com/onsi/ginkgo/v2 v2.22.0 h1:Yed107/8DjTr0lKCNt7Dn8yQ6ybuDRQoMGrNFKzMfHg= -github.com/onsi/ginkgo/v2 v2.22.0/go.mod h1:7Du3c42kxCUegi0IImZ1wUQzMBVecgIHjR1C+NkhLQo= -github.com/onsi/ginkgo/v2 v2.23.3 h1:edHxnszytJ4lD9D5Jjc4tiDkPBZ3siDeJJkUZJJVkp0= -github.com/onsi/ginkgo/v2 v2.23.3/go.mod h1:zXTP6xIp3U8aVuXN8ENK9IXRaTjFnpVB9mGmaSRvxnM= -github.com/onsi/gomega v1.34.1 h1:EUMJIKUjM8sKjYbtxQI9A4z2o+rruxnzNvpknOXie6k= -github.com/onsi/gomega v1.34.1/go.mod h1:kU1QgUvBDLXBJq618Xvm2LUX6rSAfRaFRTcdOeDLwwY= -github.com/onsi/gomega v1.34.2 h1:pNCwDkzrsv7MS9kpaQvVb1aVLahQXyJ/Tv5oAZMI3i8= -github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= -github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc= +github.com/onsi/ginkgo/v2 v2.23.4 h1:ktYTpKJAVZnDT4VjxSbiBenUjmlL/5QkBEocaWXiQus= +github.com/onsi/ginkgo/v2 v2.23.4/go.mod h1:Bt66ApGPBFzHyR+JO10Zbt0Gsp4uWxu5mIOTusL46e8= +github.com/onsi/gomega v1.36.3 h1:hID7cr8t3Wp26+cYnfcjR6HpJ00fdogN6dqZ1t6IylU= +github.com/onsi/gomega v1.36.3/go.mod h1:8D9+Txp43QWKhM24yyOBEdpkzN8FvJyAwecBgsU4KU0= +github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4= +github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g= github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P1IAHhP5U= -github.com/quic-go/qpack v0.4.0 h1:Cr9BXA1sQS2SmDUWjSofMPNKmvF6IiIfDRmgU0w1ZCo= -github.com/quic-go/qpack v0.4.0/go.mod h1:UZVnYIfi5GRk+zI9UMaCPsmZ2xKJP7XBUvVyT1Knj9A= github.com/quic-go/qpack v0.5.1 h1:giqksBPnT/HDtZ6VhtFKgoLOWmlyo9Ei6u9PqzIMbhI= github.com/quic-go/qpack v0.5.1/go.mod h1:+PC4XFrEskIVkcLzpEkbLqq1uCoxPhQuvK5rH1ZgaEg= -github.com/quic-go/quic-go v0.46.0 h1:uuwLClEEyk1DNvchH8uCByQVjo3yKL9opKulExNDs7Y= -github.com/quic-go/quic-go v0.46.0/go.mod h1:1dLehS7TIR64+vxGR70GDcatWTOtMX2PUtnKsjbTurI= -github.com/quic-go/quic-go v0.48.2 h1:wsKXZPeGWpMpCGSWqOcqpW2wZYic/8T3aqiOID0/KWE= -github.com/quic-go/quic-go v0.48.2/go.mod h1:yBgs3rWBOADpga7F+jJsb6Ybg1LSYiQvwWlLX+/6HMs= -github.com/quic-go/quic-go v0.50.1 h1:unsgjFIUqW8a2oopkY7YNONpV1gYND6Nt9hnt1PN94Q= -github.com/quic-go/quic-go v0.50.1/go.mod h1:Vim6OmUvlYdwBhXP9ZVrtGmCMWa3wEqhq3NgYrI8b4E= -github.com/redis/go-redis/v9 v9.6.1 h1:HHDteefn6ZkTtY5fGUE8tj8uy85AHk6zP7CpzIAM0y4= -github.com/redis/go-redis/v9 v9.6.1/go.mod h1:0C0c6ycQsdpVNQpxb1njEQIqkx5UcsM8FJCQLgE9+RA= -github.com/redis/go-redis/v9 v9.7.0 h1:HhLSs+B6O021gwzl+locl0zEDnyNkxMtf/Z3NNBMa9E= -github.com/redis/go-redis/v9 v9.7.0/go.mod h1:f6zhXITC7JUJIlPEiBOTXxJgPLdZcA93GewI7inzyWw= -github.com/redis/go-redis/v9 v9.7.3 h1:YpPyAayJV+XErNsatSElgRZZVCwXX9QzkKYNvO7x0wM= -github.com/redis/go-redis/v9 v9.7.3/go.mod h1:bGUrSggJ9X9GUmZpZNEOQKaANxSGgOEBRltRTZHSvrA= -github.com/refraction-networking/utls v1.6.3 h1:MFOfRN35sSx6K5AZNIoESsBuBxS2LCgRilRIdHb6fDc= -github.com/refraction-networking/utls v1.6.3/go.mod h1:yil9+7qSl+gBwJqztoQseO6Pr3h62pQoY1lXiNR/FPs= -github.com/refraction-networking/utls v1.6.7 h1:zVJ7sP1dJx/WtVuITug3qYUq034cDq9B2MR1K67ULZM= -github.com/refraction-networking/utls v1.6.7/go.mod h1:BC3O4vQzye5hqpmDTWUqi4P5DDhzJfkV1tdqtawQIH0= -github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rs/xid v1.5.0 h1:mKX4bl4iPYJtEIxp6CYiUuLQ/8DYMoz0PUdtGgMFRVc= -github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= +github.com/quic-go/quic-go v0.52.0 h1:/SlHrCRElyaU6MaEPKqKr9z83sBg2v4FLLvWM+Z47pA= +github.com/quic-go/quic-go v0.52.0/go.mod h1:MFlGGpcpJqRAfmYi6NC2cptDPSxRWTOGNuP4wqrWmzQ= +github.com/redis/go-redis/v9 v9.8.0 h1:q3nRvjrlge/6UD7eTu/DSg2uYiU2mCL0G/uzBWqhicI= +github.com/redis/go-redis/v9 v9.8.0/go.mod h1:huWgSWd8mW6+m0VPhJjSSQ+d6Nh1VICQ6Q5lHuCH/Iw= +github.com/refraction-networking/utls v1.7.3 h1:L0WRhHY7Oq1T0zkdzVZMR6zWZv+sXbHB9zcuvsAEqCo= +github.com/refraction-networking/utls v1.7.3/go.mod h1:TUhh27RHMGtQvjQq+RyO11P6ZNQNBb3N0v7wsEjKAIQ= +github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= +github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= github.com/rs/xid v1.6.0 h1:fV591PaemRlL6JfRxGDEPl69wICngIQ3shQtzfy2gxU= github.com/rs/xid v1.6.0/go.mod h1:7XoLgs4eV+QndskICGsho+ADou8ySMSjJKDIan90Nz0= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= -github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= github.com/sagikazarmark/locafero v0.9.0 h1:GbgQGNtTrEmddYDSAH9QLRyfAHY12md+8YFTqyMTC9k= github.com/sagikazarmark/locafero v0.9.0/go.mod h1:UBUyz37V+EdMS3hDF3QWIiVr/2dPrx49OMO0Bn0hJqk= -github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= -github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8= github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I= github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k= @@ -266,35 +170,22 @@ github.com/sosodev/duration v1.3.1 h1:qtHBDMQ6lvMQsL15g4aopM4HEfOaYuhWBw3NPTtlqq github.com/sosodev/duration v1.3.1/go.mod h1:RQIBBX0+fMLc/D9+Jb/fwvVmo0eZvDDEERAikUR6SDg= github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= -github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= -github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= -github.com/spf13/afero v1.12.0 h1:UcOPyRBYczmFn6yvphxkn9ZEOY65cpwGKb5mL36mrqs= -github.com/spf13/afero v1.12.0/go.mod h1:ZTlWwG4/ahT8W7T0WQ5uYmjI9duaLQGy3Q2OAl4sk/4= github.com/spf13/afero v1.14.0 h1:9tH6MapGnn/j0eb0yIXiLjERO8RB6xIVZRDCX7PtqWA= github.com/spf13/afero v1.14.0/go.mod h1:acJQ8t0ohCGuMN3O+Pv0V0hgMxNYDlvdk+VTfyZmbYo= -github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= -github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= -github.com/spf13/cast v1.7.1 h1:cuNEagBQEHWN1FnbGEjCXL2szYEXqfJPbP2HNUaca9Y= -github.com/spf13/cast v1.7.1/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= -github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= -github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/cast v1.8.0 h1:gEN9K4b8Xws4EX0+a0reLmhq8moKn7ntRlQYgjPeCDk= +github.com/spf13/cast v1.8.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o= github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI= -github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg= github.com/spf13/viper v1.20.1 h1:ZMi+z/lvLyPSCoNtFCpqjy0S4kPbirhpTMwl8BkW9X4= github.com/spf13/viper v1.20.1/go.mod h1:P9Mdzt1zoHIG8m2eZQinpiBjo6kCmZSKBClNNqjJvu4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= @@ -303,64 +194,41 @@ github.com/swaggo/files v1.0.1 h1:J1bVJ4XHZNq0I46UU90611i9/YzdrF7x92oX1ig5IdE= github.com/swaggo/files v1.0.1/go.mod h1:0qXmMNH6sXNf+73t65aKeB+ApmgxdnkQzVTAj2uaMUg= github.com/swaggo/gin-swagger v1.6.0 h1:y8sxvQ3E20/RCyrXeFfg60r6H0Z+SwpTjMYsMm+zy8M= github.com/swaggo/gin-swagger v1.6.0/go.mod h1:BG00cCEy294xtVpyIAHG6+e2Qzj/xKlRdOqDkvq0uzo= -github.com/swaggo/swag v1.16.3 h1:PnCYjPCah8FK4I26l2F/KQ4yz3sILcVUN3cTlBFA9Pg= -github.com/swaggo/swag v1.16.3/go.mod h1:DImHIuOFXKpMFAQjcC7FG4m3Dg4+QuUgUzJmKjI/gRk= github.com/swaggo/swag v1.16.4 h1:clWJtd9LStiG3VeijiCfOVODP6VpHtKdQy9ELFG3s1A= github.com/swaggo/swag v1.16.4/go.mod h1:VBsHJRsDvfYvqoiMKnsdwhNV9LEMHgEDZcyVYX0sxPg= github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE= github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= -github.com/urfave/cli/v2 v2.27.5 h1:WoHEJLdsXr6dDWoJgMq/CboDmyY/8HMMH1fTECbih+w= -github.com/urfave/cli/v2 v2.27.5/go.mod h1:3Sevf16NykTbInEnD0yKkjDAeZDS0A6bzhBH5hrMvTQ= github.com/urfave/cli/v2 v2.27.6 h1:VdRdS98FNhKZ8/Az8B7MTyGQmpIr36O1EHybx/LaZ4g= github.com/urfave/cli/v2 v2.27.6/go.mod h1:3Sevf16NykTbInEnD0yKkjDAeZDS0A6bzhBH5hrMvTQ= -github.com/vektah/gqlparser/v2 v2.5.21 h1:Zw1rG2dr1pRR4wqwbVq4d6+xk2f4ut/yo+hwr4QjE08= -github.com/vektah/gqlparser/v2 v2.5.21/go.mod h1:xMl+ta8a5M1Yo1A1Iwt/k7gSpscwSnHZdw7tfhEGfTM= -github.com/vektah/gqlparser/v2 v2.5.23 h1:PurJ9wpgEVB7tty1seRUwkIDa/QH5RzkzraiKIjKLfA= -github.com/vektah/gqlparser/v2 v2.5.23/go.mod h1:D1/VCZtV3LPnQrcPBeR/q5jkSQIPti0uYCP/RI0gIeo= +github.com/vektah/gqlparser/v2 v2.5.27 h1:RHPD3JOplpk5mP5JGX8RKZkt2/Vwj/PZv0HxTdwFp0s= +github.com/vektah/gqlparser/v2 v2.5.27/go.mod h1:D1/VCZtV3LPnQrcPBeR/q5jkSQIPti0uYCP/RI0gIeo= github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 h1:gEOO8jv9F4OT7lGCjxCBTO/36wtF6j2nSip77qHd4x4= github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1/go.mod h1:Ohn+xnUBiLI6FVj/9LpzZWtj1/D6lUovWYBkxHVV3aM= +github.com/xyproto/randomstring v1.0.5 h1:YtlWPoRdgMu3NZtP45drfy1GKoojuR7hmRcnhZqKjWU= github.com/xyproto/randomstring v1.0.5/go.mod h1:rgmS5DeNXLivK7YprL0pY+lTuhNQW3iGxZ18UQApw/E= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -go.uber.org/automaxprocs v1.5.3 h1:kWazyxZUrS3Gs4qUpbwo5kEIMGe/DAvi5Z4tl2NW4j8= -go.uber.org/automaxprocs v1.5.3/go.mod h1:eRbA25aqJrxAbsLO0xy5jVwPt7FQnRgjW+efnwa1WM0= go.uber.org/automaxprocs v1.6.0 h1:O3y2/QNTOdbF+e/dpXNNW7Rx2hZ4sTIPyybbxyNqTUs= go.uber.org/automaxprocs v1.6.0/go.mod h1:ifeIMSnPZuznNm6jmdzmU3/bfk01Fe2fotchwEFJ8r8= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= -go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= -go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= -go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU= -go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM= -go.uber.org/multierr v1.10.0 h1:S0h4aNzvfcFsC3dRF1jLoaov7oRaKqRGC/pUEJ2yvPQ= -go.uber.org/multierr v1.10.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= +go.uber.org/mock v0.5.2 h1:LbtPTcP8A5k9WPXj54PPPbjcI4Y6lhyOZXn+VS7wNko= +go.uber.org/mock v0.5.2/go.mod h1:wLlUxC2vVTPTaE3UD51E0BGOAElKrILxhVSDYQLld5o= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= -golang.org/x/arch v0.13.0 h1:KCkqVVV1kGg0X87TFysjCJ8MxtZEIU4Ja/yXGeoECdA= -golang.org/x/arch v0.13.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys= -golang.org/x/arch v0.16.0 h1:foMtLTdyOmIniqWCHjY6+JxuC54XP1fDwx4N0ASyW+U= -golang.org/x/arch v0.16.0/go.mod h1:JmwW7aLIoRUKgaTzhkiEFxvcEiQGyOg9BMonBJUS7EE= +golang.org/x/arch v0.17.0 h1:4O3dfLzd+lQewptAHqjewQZQDyEdejz3VwgeYwkZneU= +golang.org/x/arch v0.17.0/go.mod h1:bdwinDaKcfZUGpH09BB7ZmOfhalA8lQdzl62l8gGWsk= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc= -golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc= -golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34= -golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc= -golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa h1:ELnwvuAXPNtPk1TJRuGkI9fDTwym6AYBu0qzT8AcHdI= -golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ= -golang.org/x/exp v0.0.0-20241215155358-4a5509556b9e h1:4qufH0hlUYs6AO6XmZC3GqfDPGSXHVXUFR6OND+iJX4= -golang.org/x/exp v0.0.0-20241215155358-4a5509556b9e/go.mod h1:qj5a5QZpwLU2NLQudwIN5koi3beDhSAlJwa67PuM98c= -golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 h1:nDVHiLt8aIbd/VzvPWN6kSOPE7+F/fNFDSXLVYkE/Iw= -golang.org/x/exp v0.0.0-20250305212735-054e65f0b394/go.mod h1:sIifuuw/Yco/y6yb6+bDNfyeQ/MdPUy/hKEMYQV17cM= +golang.org/x/crypto v0.38.0 h1:jt+WWG8IZlBnVbomuhg2Mdq0+BBQaHbtqHEFEigjUV8= +golang.org/x/crypto v0.38.0/go.mod h1:MvrbAqul58NNYPKnOra203SB9vpuZW0e+RRZV+Ggqjw= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4= -golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/mod v0.24.0 h1:ZfthKaKaT4NrhGVZHO1/WDTwGES4De8KtWO0SIbNJMU= golang.org/x/mod v0.24.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= @@ -369,17 +237,13 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0= -golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k= -golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8= -golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= +golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY= +golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= -golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sync v0.13.0 h1:AauUjRAJ9OSnvULf/ARrrVywoJDy0YS2AwQ98I37610= -golang.org/x/sync v0.13.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= +golang.org/x/sync v0.14.0 h1:woo0S4Yywslg6hp4eUFjTVOyKt0RookbpAHG4c1HmhQ= +golang.org/x/sync v0.14.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -390,10 +254,8 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= -golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.32.0 h1:s77OFDvIQeibCmezSnk/q6iAfkdiQaJi4VzroCFrN20= -golang.org/x/sys v0.32.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw= +golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= @@ -401,40 +263,25 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= -golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= -golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= -golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= -golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= -golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= -golang.org/x/time v0.8.0 h1:9i3RxcPv3PZnitoVGMPDKZSq1xW1gK1Xy3ArNOGZfEg= +golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4= +golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.29.0 h1:Xx0h3TtM9rzQpQuR4dKLrdglAmCEN5Oi+P74JdhdzXE= -golang.org/x/tools v0.29.0/go.mod h1:KMQVMRsVxU6nHCFXrBPhDB8XncLNLM0lIy/F14RP588= -golang.org/x/tools v0.31.0 h1:0EedkvKDbh+qistFTd0Bcwe/YLh4vHwWEkiI0toFIBU= -golang.org/x/tools v0.31.0/go.mod h1:naFTU+Cev749tSJRXJlna0T3WxKvb1kWEx15xA4SdmQ= +golang.org/x/tools v0.33.0 h1:4qz2S3zmRxbGIhDIAgjxvFutSvH5EfnsYrRBj0UI0bc= +golang.org/x/tools v0.33.0/go.mod h1:CIJMaWEY88juyUfo7UbgPqbC8rU2OqfAV1h2Qp0oMYI= 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-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/protobuf v1.36.3 h1:82DV7MYdb8anAVi3qge1wSnMDrnKK7ebr+I0hHRN1BU= -google.golang.org/protobuf v1.36.3/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY= google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= -gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/yaml.v2 v2.2.2/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= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU= +gotest.tools/v3 v3.5.1/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50= diff --git a/pkg/auth/auth.go b/pkg/auth/auth.go index 4b236bad..f7ff2907 100644 --- a/pkg/auth/auth.go +++ b/pkg/auth/auth.go @@ -208,66 +208,6 @@ func (a *authImpl) RefreshThreshold() int64 { return a.conf.JWTConfig.RefreshThreshold } -// encryptAES256 employs Authenticated Encryption with Associated Data using Galois/Counter mode and returns the cipher -// as a Base64 encoded string to be used in URIs. -func (a *authImpl) encryptAES256(data []byte) (cipherStr string, cipherBytes []byte, err error) { - var ( - cipherBlock cipher.Block - gcm cipher.AEAD - ) - - if cipherBlock, err = aes.NewCipher(a.cryptoSecret); err != nil { - return - } - - if gcm, err = cipher.NewGCM(cipherBlock); err != nil { - return - } - - nonce := make([]byte, gcm.NonceSize()) - if _, err = io.ReadFull(rand.Reader, nonce); err != nil { - return - } - - // Encrypt to a cipher text. - cipherBytes = gcm.Seal(nonce, nonce, data, nil) - - // Convert to Base64 URL encoded string for use in URLs. - cipherStr = base64.URLEncoding.EncodeToString(cipherBytes) - - return -} - -// decryptAES256 employs Authenticated Encryption with Associated Data using Galois/Counter mode and returns the -// decrypted plaintext bytes. -func (a *authImpl) decryptAES256(data []byte) (cipherBytes []byte, err error) { - var ( - cipherBlock cipher.Block - gcm cipher.AEAD - nonceSize int - ) - - if cipherBlock, err = aes.NewCipher(a.cryptoSecret); err != nil { - return - } - - if gcm, err = cipher.NewGCM(cipherBlock); err != nil { - return - } - - if nonceSize = gcm.NonceSize(); nonceSize < 0 { - return nil, errors.New("bad nonce size") - } - - // Extract the nonce and cipher blocks from the data. - nonce, cipherText := data[:nonceSize], data[nonceSize:] - - // Decrypt cipher text. - cipherBytes, err = gcm.Open(nil, nonce, cipherText, nil) - - return -} - // EncryptToString will generate an encrypted base64 encoded character from the plaintext. func (a *authImpl) EncryptToString(plaintext []byte) (ciphertext string, err error) { ciphertext, _, err = a.encryptAES256(plaintext) @@ -332,3 +272,63 @@ func (a *authImpl) TokenInfoFromGinCtx(ctx *gin.Context) (uuid.UUID, int64, erro return clientID, expiresAt, nil } + +// encryptAES256 employs Authenticated Encryption with Associated Data using Galois/Counter mode and returns the cipher +// as a Base64 encoded string to be used in URIs. +func (a *authImpl) encryptAES256(data []byte) (cipherStr string, cipherBytes []byte, err error) { + var ( + cipherBlock cipher.Block + gcm cipher.AEAD + ) + + if cipherBlock, err = aes.NewCipher(a.cryptoSecret); err != nil { + return + } + + if gcm, err = cipher.NewGCM(cipherBlock); err != nil { + return + } + + nonce := make([]byte, gcm.NonceSize()) + if _, err = io.ReadFull(rand.Reader, nonce); err != nil { + return + } + + // Encrypt to a cipher text. + cipherBytes = gcm.Seal(nonce, nonce, data, nil) + + // Convert to Base64 URL encoded string for use in URLs. + cipherStr = base64.URLEncoding.EncodeToString(cipherBytes) + + return +} + +// decryptAES256 employs Authenticated Encryption with Associated Data using Galois/Counter mode and returns the +// decrypted plaintext bytes. +func (a *authImpl) decryptAES256(data []byte) (cipherBytes []byte, err error) { + var ( + cipherBlock cipher.Block + gcm cipher.AEAD + nonceSize int + ) + + if cipherBlock, err = aes.NewCipher(a.cryptoSecret); err != nil { + return + } + + if gcm, err = cipher.NewGCM(cipherBlock); err != nil { + return + } + + if nonceSize = gcm.NonceSize(); nonceSize < 0 { + return nil, errors.New("bad nonce size") + } + + // Extract the nonce and cipher blocks from the data. + nonce, cipherText := data[:nonceSize], data[nonceSize:] + + // Decrypt cipher text. + cipherBytes, err = gcm.Open(nil, nonce, cipherText, nil) + + return +} diff --git a/pkg/auth/errors.go b/pkg/auth/errors.go index 7abc271a..2eb85705 100644 --- a/pkg/auth/errors.go +++ b/pkg/auth/errors.go @@ -13,6 +13,11 @@ type Error struct { // Check to ensure the error interface is implemented. var _ error = &Error{} +// NewError is a base error message with no special code. +func NewError(message string) *Error { + return &Error{Message: message, Code: 0} +} + // Error get human readable error message. func (e *Error) Error() string { return e.Message @@ -28,11 +33,6 @@ func (e *Error) Is(err error) bool { return e.Code == target.Code } -// NewError is a base error message with no special code. -func NewError(message string) *Error { - return &Error{Message: message, Code: 0} -} - // SetStatus configures the error status/code. func (e *Error) SetStatus(status int) *Error { e.Code = status diff --git a/pkg/graphql/generated/auth.generated.go b/pkg/graphql/generated/auth.generated.go index 7eb3e4c6..5882dd8e 100644 --- a/pkg/graphql/generated/auth.generated.go +++ b/pkg/graphql/generated/auth.generated.go @@ -39,7 +39,7 @@ func (ec *executionContext) _JWTAuthResponse_token(ctx context.Context, field gr ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Token, nil }) @@ -83,7 +83,7 @@ func (ec *executionContext) _JWTAuthResponse_expires(ctx context.Context, field ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Expires, nil }) @@ -127,7 +127,7 @@ func (ec *executionContext) _JWTAuthResponse_threshold(ctx context.Context, fiel ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Threshold, nil }) diff --git a/pkg/graphql/generated/common.generated.go b/pkg/graphql/generated/common.generated.go index 41403b2e..81e84dd5 100644 --- a/pkg/graphql/generated/common.generated.go +++ b/pkg/graphql/generated/common.generated.go @@ -50,7 +50,7 @@ func (ec *executionContext) _Links_nextPage(ctx context.Context, field graphql.C ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.NextPage, nil }) @@ -91,7 +91,7 @@ func (ec *executionContext) _Links_pageCursor(ctx context.Context, field graphql ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.PageCursor, nil }) @@ -132,7 +132,7 @@ func (ec *executionContext) _OfferResponse_priceQuote(ctx context.Context, field ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.PriceQuote, nil }) @@ -188,7 +188,7 @@ func (ec *executionContext) _OfferResponse_debitAmount(ctx context.Context, fiel ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.OfferResponse().DebitAmount(rctx, obj) }) @@ -232,7 +232,7 @@ func (ec *executionContext) _OfferResponse_offerID(ctx context.Context, field gr ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.OfferID, nil }) @@ -276,7 +276,7 @@ func (ec *executionContext) _OfferResponse_expires(ctx context.Context, field gr ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Expires, nil }) @@ -320,7 +320,7 @@ func (ec *executionContext) _PriceQuote_clientID(ctx context.Context, field grap ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.PriceQuote().ClientID(rctx, obj) }) @@ -364,7 +364,7 @@ func (ec *executionContext) _PriceQuote_sourceAcc(ctx context.Context, field gra ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.SourceAcc, nil }) @@ -408,7 +408,7 @@ func (ec *executionContext) _PriceQuote_destinationAcc(ctx context.Context, fiel ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.DestinationAcc, nil }) @@ -452,7 +452,7 @@ func (ec *executionContext) _PriceQuote_rate(ctx context.Context, field graphql. ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.PriceQuote().Rate(rctx, obj) }) @@ -496,7 +496,7 @@ func (ec *executionContext) _PriceQuote_amount(ctx context.Context, field graphq ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.PriceQuote().Amount(rctx, obj) }) diff --git a/pkg/graphql/generated/crypto.generated.go b/pkg/graphql/generated/crypto.generated.go index b83ce6ca..7f36e9e8 100644 --- a/pkg/graphql/generated/crypto.generated.go +++ b/pkg/graphql/generated/crypto.generated.go @@ -63,7 +63,7 @@ func (ec *executionContext) _CryptoAccount_ticker(ctx context.Context, field gra ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Ticker, nil }) @@ -107,7 +107,7 @@ func (ec *executionContext) _CryptoAccount_balance(ctx context.Context, field gr ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.CryptoAccount().Balance(rctx, obj) }) @@ -151,7 +151,7 @@ func (ec *executionContext) _CryptoAccount_lastTx(ctx context.Context, field gra ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.CryptoAccount().LastTx(rctx, obj) }) @@ -195,7 +195,7 @@ func (ec *executionContext) _CryptoAccount_lastTxTs(ctx context.Context, field g ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.CryptoAccount().LastTxTs(rctx, obj) }) @@ -239,7 +239,7 @@ func (ec *executionContext) _CryptoAccount_createdAt(ctx context.Context, field ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.CryptoAccount().CreatedAt(rctx, obj) }) @@ -283,7 +283,7 @@ func (ec *executionContext) _CryptoAccount_clientID(ctx context.Context, field g ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.CryptoAccount().ClientID(rctx, obj) }) @@ -327,7 +327,7 @@ func (ec *executionContext) _CryptoBalancesPaginated_accountBalances(ctx context ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.AccountBalances, nil }) @@ -385,7 +385,7 @@ func (ec *executionContext) _CryptoBalancesPaginated_links(ctx context.Context, ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Links, nil }) @@ -435,7 +435,7 @@ func (ec *executionContext) _CryptoJournal_ticker(ctx context.Context, field gra ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Ticker, nil }) @@ -479,7 +479,7 @@ func (ec *executionContext) _CryptoJournal_amount(ctx context.Context, field gra ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.CryptoJournal().Amount(rctx, obj) }) @@ -523,7 +523,7 @@ func (ec *executionContext) _CryptoJournal_transactedAt(ctx context.Context, fie ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.CryptoJournal().TransactedAt(rctx, obj) }) @@ -567,7 +567,7 @@ func (ec *executionContext) _CryptoJournal_clientID(ctx context.Context, field g ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.CryptoJournal().ClientID(rctx, obj) }) @@ -611,7 +611,7 @@ func (ec *executionContext) _CryptoJournal_txID(ctx context.Context, field graph ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.CryptoJournal().TxID(rctx, obj) }) @@ -655,7 +655,7 @@ func (ec *executionContext) _CryptoOpenAccountResponse_clientID(ctx context.Cont ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.ClientID, nil }) @@ -699,7 +699,7 @@ func (ec *executionContext) _CryptoOpenAccountResponse_ticker(ctx context.Contex ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Ticker, nil }) @@ -743,7 +743,7 @@ func (ec *executionContext) _CryptoTransactionsPaginated_transactions(ctx contex ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.CryptoTransactionsPaginated().Transactions(rctx, obj) }) @@ -799,7 +799,7 @@ func (ec *executionContext) _CryptoTransactionsPaginated_links(ctx context.Conte ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Links, nil }) @@ -849,7 +849,7 @@ func (ec *executionContext) _CryptoTransferResponse_fiatTxReceipt(ctx context.Co ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.FiatTxReceipt, nil }) @@ -902,7 +902,7 @@ func (ec *executionContext) _CryptoTransferResponse_cryptoTxReceipt(ctx context. ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.CryptoTxReceipt, nil }) @@ -947,10 +947,10 @@ func (ec *executionContext) fieldContext_CryptoTransferResponse_cryptoTxReceipt( // region **************************** input.gotpl ***************************** -func (ec *executionContext) unmarshalInputCryptoOfferRequest(ctx context.Context, obj interface{}) (models.HTTPCryptoOfferRequest, error) { +func (ec *executionContext) unmarshalInputCryptoOfferRequest(ctx context.Context, obj any) (models.HTTPCryptoOfferRequest, error) { var it models.HTTPCryptoOfferRequest - asMap := map[string]interface{}{} - for k, v := range obj.(map[string]interface{}) { + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { asMap[k] = v } @@ -997,10 +997,10 @@ func (ec *executionContext) unmarshalInputCryptoOfferRequest(ctx context.Context return it, nil } -func (ec *executionContext) unmarshalInputCryptoPaginatedTxDetailsRequest(ctx context.Context, obj interface{}) (models.CryptoPaginatedTxDetailsRequest, error) { +func (ec *executionContext) unmarshalInputCryptoPaginatedTxDetailsRequest(ctx context.Context, obj any) (models.CryptoPaginatedTxDetailsRequest, error) { var it models.CryptoPaginatedTxDetailsRequest - asMap := map[string]interface{}{} - for k, v := range obj.(map[string]interface{}) { + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { asMap[k] = v } @@ -1794,7 +1794,7 @@ func (ec *executionContext) marshalNCryptoJournal2ᚕgithubᚗcomᚋsurahmanᚋF return ret } -func (ec *executionContext) unmarshalNCryptoOfferRequest2githubᚗcomᚋsurahmanᚋFTeXᚋpkgᚋmodelsᚐHTTPCryptoOfferRequest(ctx context.Context, v interface{}) (models.HTTPCryptoOfferRequest, error) { +func (ec *executionContext) unmarshalNCryptoOfferRequest2githubᚗcomᚋsurahmanᚋFTeXᚋpkgᚋmodelsᚐHTTPCryptoOfferRequest(ctx context.Context, v any) (models.HTTPCryptoOfferRequest, error) { res, err := ec.unmarshalInputCryptoOfferRequest(ctx, v) return res, graphql.ErrorOnPath(ctx, err) } @@ -1813,7 +1813,7 @@ func (ec *executionContext) marshalNCryptoOpenAccountResponse2ᚖgithubᚗcomᚋ return ec._CryptoOpenAccountResponse(ctx, sel, v) } -func (ec *executionContext) unmarshalNCryptoPaginatedTxDetailsRequest2githubᚗcomᚋsurahmanᚋFTeXᚋpkgᚋmodelsᚐCryptoPaginatedTxDetailsRequest(ctx context.Context, v interface{}) (models.CryptoPaginatedTxDetailsRequest, error) { +func (ec *executionContext) unmarshalNCryptoPaginatedTxDetailsRequest2githubᚗcomᚋsurahmanᚋFTeXᚋpkgᚋmodelsᚐCryptoPaginatedTxDetailsRequest(ctx context.Context, v any) (models.CryptoPaginatedTxDetailsRequest, error) { res, err := ec.unmarshalInputCryptoPaginatedTxDetailsRequest(ctx, v) return res, graphql.ErrorOnPath(ctx, err) } diff --git a/pkg/graphql/generated/fiat.generated.go b/pkg/graphql/generated/fiat.generated.go index 6341184c..7a9ba721 100644 --- a/pkg/graphql/generated/fiat.generated.go +++ b/pkg/graphql/generated/fiat.generated.go @@ -80,7 +80,7 @@ func (ec *executionContext) _FiatAccount_currency(ctx context.Context, field gra ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.FiatAccount().Currency(rctx, obj) }) @@ -124,7 +124,7 @@ func (ec *executionContext) _FiatAccount_balance(ctx context.Context, field grap ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.FiatAccount().Balance(rctx, obj) }) @@ -168,7 +168,7 @@ func (ec *executionContext) _FiatAccount_lastTx(ctx context.Context, field graph ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.FiatAccount().LastTx(rctx, obj) }) @@ -212,7 +212,7 @@ func (ec *executionContext) _FiatAccount_lastTxTs(ctx context.Context, field gra ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.FiatAccount().LastTxTs(rctx, obj) }) @@ -256,7 +256,7 @@ func (ec *executionContext) _FiatAccount_createdAt(ctx context.Context, field gr ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.FiatAccount().CreatedAt(rctx, obj) }) @@ -300,7 +300,7 @@ func (ec *executionContext) _FiatAccount_clientID(ctx context.Context, field gra ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.FiatAccount().ClientID(rctx, obj) }) @@ -344,7 +344,7 @@ func (ec *executionContext) _FiatBalancesPaginated_accountBalances(ctx context.C ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.AccountBalances, nil }) @@ -402,7 +402,7 @@ func (ec *executionContext) _FiatBalancesPaginated_links(ctx context.Context, fi ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Links, nil }) @@ -452,7 +452,7 @@ func (ec *executionContext) _FiatDepositResponse_txId(ctx context.Context, field ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.FiatDepositResponse().TxID(rctx, obj) }) @@ -496,7 +496,7 @@ func (ec *executionContext) _FiatDepositResponse_clientId(ctx context.Context, f ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.FiatDepositResponse().ClientID(rctx, obj) }) @@ -540,7 +540,7 @@ func (ec *executionContext) _FiatDepositResponse_txTimestamp(ctx context.Context ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.FiatDepositResponse().TxTimestamp(rctx, obj) }) @@ -584,7 +584,7 @@ func (ec *executionContext) _FiatDepositResponse_balance(ctx context.Context, fi ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.FiatDepositResponse().Balance(rctx, obj) }) @@ -628,7 +628,7 @@ func (ec *executionContext) _FiatDepositResponse_lastTx(ctx context.Context, fie ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.FiatDepositResponse().LastTx(rctx, obj) }) @@ -672,7 +672,7 @@ func (ec *executionContext) _FiatDepositResponse_currency(ctx context.Context, f ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.FiatDepositResponse().Currency(rctx, obj) }) @@ -716,7 +716,7 @@ func (ec *executionContext) _FiatExchangeTransferResponse_sourceReceipt(ctx cont ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.FiatExchangeTransferResponse().SourceReceipt(rctx, obj) }) @@ -774,7 +774,7 @@ func (ec *executionContext) _FiatExchangeTransferResponse_destinationReceipt(ctx ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.FiatExchangeTransferResponse().DestinationReceipt(rctx, obj) }) @@ -832,7 +832,7 @@ func (ec *executionContext) _FiatJournal_currency(ctx context.Context, field gra ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.FiatJournal().Currency(rctx, obj) }) @@ -876,7 +876,7 @@ func (ec *executionContext) _FiatJournal_amount(ctx context.Context, field graph ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.FiatJournal().Amount(rctx, obj) }) @@ -920,7 +920,7 @@ func (ec *executionContext) _FiatJournal_transactedAt(ctx context.Context, field ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.FiatJournal().TransactedAt(rctx, obj) }) @@ -964,7 +964,7 @@ func (ec *executionContext) _FiatJournal_clientID(ctx context.Context, field gra ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.FiatJournal().ClientID(rctx, obj) }) @@ -1008,7 +1008,7 @@ func (ec *executionContext) _FiatJournal_txID(ctx context.Context, field graphql ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.FiatJournal().TxID(rctx, obj) }) @@ -1052,7 +1052,7 @@ func (ec *executionContext) _FiatOpenAccountResponse_clientID(ctx context.Contex ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.ClientID, nil }) @@ -1096,7 +1096,7 @@ func (ec *executionContext) _FiatOpenAccountResponse_currency(ctx context.Contex ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Currency, nil }) @@ -1140,7 +1140,7 @@ func (ec *executionContext) _FiatTransactionsPaginated_transactions(ctx context. ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.FiatTransactionsPaginated().Transactions(rctx, obj) }) @@ -1196,7 +1196,7 @@ func (ec *executionContext) _FiatTransactionsPaginated_links(ctx context.Context ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Links, nil }) @@ -1238,10 +1238,10 @@ func (ec *executionContext) fieldContext_FiatTransactionsPaginated_links(_ conte // region **************************** input.gotpl ***************************** -func (ec *executionContext) unmarshalInputFiatDepositRequest(ctx context.Context, obj interface{}) (models.HTTPDepositCurrencyRequest, error) { +func (ec *executionContext) unmarshalInputFiatDepositRequest(ctx context.Context, obj any) (models.HTTPDepositCurrencyRequest, error) { var it models.HTTPDepositCurrencyRequest - asMap := map[string]interface{}{} - for k, v := range obj.(map[string]interface{}) { + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { asMap[k] = v } @@ -1274,10 +1274,10 @@ func (ec *executionContext) unmarshalInputFiatDepositRequest(ctx context.Context return it, nil } -func (ec *executionContext) unmarshalInputFiatExchangeOfferRequest(ctx context.Context, obj interface{}) (models.HTTPExchangeOfferRequest, error) { +func (ec *executionContext) unmarshalInputFiatExchangeOfferRequest(ctx context.Context, obj any) (models.HTTPExchangeOfferRequest, error) { var it models.HTTPExchangeOfferRequest - asMap := map[string]interface{}{} - for k, v := range obj.(map[string]interface{}) { + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { asMap[k] = v } @@ -1317,10 +1317,10 @@ func (ec *executionContext) unmarshalInputFiatExchangeOfferRequest(ctx context.C return it, nil } -func (ec *executionContext) unmarshalInputFiatPaginatedTxDetailsRequest(ctx context.Context, obj interface{}) (models.FiatPaginatedTxDetailsRequest, error) { +func (ec *executionContext) unmarshalInputFiatPaginatedTxDetailsRequest(ctx context.Context, obj any) (models.FiatPaginatedTxDetailsRequest, error) { var it models.FiatPaginatedTxDetailsRequest - asMap := map[string]interface{}{} - for k, v := range obj.(map[string]interface{}) { + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { asMap[k] = v } @@ -2446,7 +2446,7 @@ func (ec *executionContext) marshalNFiatBalancesPaginated2ᚖgithubᚗcomᚋsura return ec._FiatBalancesPaginated(ctx, sel, v) } -func (ec *executionContext) unmarshalNFiatDepositRequest2githubᚗcomᚋsurahmanᚋFTeXᚋpkgᚋmodelsᚐHTTPDepositCurrencyRequest(ctx context.Context, v interface{}) (models.HTTPDepositCurrencyRequest, error) { +func (ec *executionContext) unmarshalNFiatDepositRequest2githubᚗcomᚋsurahmanᚋFTeXᚋpkgᚋmodelsᚐHTTPDepositCurrencyRequest(ctx context.Context, v any) (models.HTTPDepositCurrencyRequest, error) { res, err := ec.unmarshalInputFiatDepositRequest(ctx, v) return res, graphql.ErrorOnPath(ctx, err) } @@ -2465,7 +2465,7 @@ func (ec *executionContext) marshalNFiatDepositResponse2ᚖgithubᚗcomᚋsurahm return ec._FiatDepositResponse(ctx, sel, v) } -func (ec *executionContext) unmarshalNFiatExchangeOfferRequest2githubᚗcomᚋsurahmanᚋFTeXᚋpkgᚋmodelsᚐHTTPExchangeOfferRequest(ctx context.Context, v interface{}) (models.HTTPExchangeOfferRequest, error) { +func (ec *executionContext) unmarshalNFiatExchangeOfferRequest2githubᚗcomᚋsurahmanᚋFTeXᚋpkgᚋmodelsᚐHTTPExchangeOfferRequest(ctx context.Context, v any) (models.HTTPExchangeOfferRequest, error) { res, err := ec.unmarshalInputFiatExchangeOfferRequest(ctx, v) return res, graphql.ErrorOnPath(ctx, err) } @@ -2546,7 +2546,7 @@ func (ec *executionContext) marshalNFiatOpenAccountResponse2ᚖgithubᚗcomᚋsu return ec._FiatOpenAccountResponse(ctx, sel, v) } -func (ec *executionContext) unmarshalNFiatPaginatedTxDetailsRequest2githubᚗcomᚋsurahmanᚋFTeXᚋpkgᚋmodelsᚐFiatPaginatedTxDetailsRequest(ctx context.Context, v interface{}) (models.FiatPaginatedTxDetailsRequest, error) { +func (ec *executionContext) unmarshalNFiatPaginatedTxDetailsRequest2githubᚗcomᚋsurahmanᚋFTeXᚋpkgᚋmodelsᚐFiatPaginatedTxDetailsRequest(ctx context.Context, v any) (models.FiatPaginatedTxDetailsRequest, error) { res, err := ec.unmarshalInputFiatPaginatedTxDetailsRequest(ctx, v) return res, graphql.ErrorOnPath(ctx, err) } diff --git a/pkg/graphql/generated/healthcheck.generated.go b/pkg/graphql/generated/healthcheck.generated.go index c6822225..40cc7a82 100644 --- a/pkg/graphql/generated/healthcheck.generated.go +++ b/pkg/graphql/generated/healthcheck.generated.go @@ -34,158 +34,303 @@ type QueryResolver interface { // region ***************************** args.gotpl ***************************** -func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]any) (map[string]any, 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 := map[string]any{} + arg0, err := ec.field_Query___type_argsName(ctx, rawArgs) + if err != nil { + return nil, err } args["name"] = arg0 return args, nil } +func (ec *executionContext) field_Query___type_argsName( + ctx context.Context, + rawArgs map[string]any, +) (string, error) { + if _, ok := rawArgs["name"]; !ok { + var zeroVal string + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + if tmp, ok := rawArgs["name"]; ok { + return ec.unmarshalNString2string(ctx, tmp) + } + + var zeroVal string + return zeroVal, nil +} -func (ec *executionContext) field_Query_balanceAllCrypto_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_balanceAllCrypto_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error - args := map[string]interface{}{} - var arg0 *string - if tmp, ok := rawArgs["pageCursor"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pageCursor")) - arg0, err = ec.unmarshalOString2ᚖstring(ctx, tmp) - if err != nil { - return nil, err - } + args := map[string]any{} + arg0, err := ec.field_Query_balanceAllCrypto_argsPageCursor(ctx, rawArgs) + if err != nil { + return nil, err } args["pageCursor"] = arg0 - var arg1 *int32 - if tmp, ok := rawArgs["pageSize"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pageSize")) - arg1, err = ec.unmarshalOInt322ᚖint32(ctx, tmp) - if err != nil { - return nil, err - } + arg1, err := ec.field_Query_balanceAllCrypto_argsPageSize(ctx, rawArgs) + if err != nil { + return nil, err } args["pageSize"] = arg1 return args, nil } +func (ec *executionContext) field_Query_balanceAllCrypto_argsPageCursor( + ctx context.Context, + rawArgs map[string]any, +) (*string, error) { + if _, ok := rawArgs["pageCursor"]; !ok { + var zeroVal *string + return zeroVal, nil + } -func (ec *executionContext) field_Query_balanceAllFiat_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { - var err error - args := map[string]interface{}{} - var arg0 *string + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("pageCursor")) if tmp, ok := rawArgs["pageCursor"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pageCursor")) - arg0, err = ec.unmarshalOString2ᚖstring(ctx, tmp) - if err != nil { - return nil, err - } + return ec.unmarshalOString2ᚖstring(ctx, tmp) } - args["pageCursor"] = arg0 - var arg1 *int32 + + var zeroVal *string + return zeroVal, nil +} + +func (ec *executionContext) field_Query_balanceAllCrypto_argsPageSize( + ctx context.Context, + rawArgs map[string]any, +) (*int32, error) { + if _, ok := rawArgs["pageSize"]; !ok { + var zeroVal *int32 + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("pageSize")) if tmp, ok := rawArgs["pageSize"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pageSize")) - arg1, err = ec.unmarshalOInt322ᚖint32(ctx, tmp) - if err != nil { - return nil, err - } + return ec.unmarshalOInt322ᚖint32(ctx, tmp) + } + + var zeroVal *int32 + return zeroVal, nil +} + +func (ec *executionContext) field_Query_balanceAllFiat_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := ec.field_Query_balanceAllFiat_argsPageCursor(ctx, rawArgs) + if err != nil { + return nil, err + } + args["pageCursor"] = arg0 + arg1, err := ec.field_Query_balanceAllFiat_argsPageSize(ctx, rawArgs) + if err != nil { + return nil, err } args["pageSize"] = arg1 return args, nil } +func (ec *executionContext) field_Query_balanceAllFiat_argsPageCursor( + ctx context.Context, + rawArgs map[string]any, +) (*string, error) { + if _, ok := rawArgs["pageCursor"]; !ok { + var zeroVal *string + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("pageCursor")) + if tmp, ok := rawArgs["pageCursor"]; ok { + return ec.unmarshalOString2ᚖstring(ctx, tmp) + } + + var zeroVal *string + return zeroVal, nil +} -func (ec *executionContext) field_Query_balanceCrypto_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_balanceAllFiat_argsPageSize( + ctx context.Context, + rawArgs map[string]any, +) (*int32, error) { + if _, ok := rawArgs["pageSize"]; !ok { + var zeroVal *int32 + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("pageSize")) + if tmp, ok := rawArgs["pageSize"]; ok { + return ec.unmarshalOInt322ᚖint32(ctx, tmp) + } + + var zeroVal *int32 + return zeroVal, nil +} + +func (ec *executionContext) field_Query_balanceCrypto_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error - args := map[string]interface{}{} - var arg0 string - if tmp, ok := rawArgs["ticker"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ticker")) - arg0, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } + args := map[string]any{} + arg0, err := ec.field_Query_balanceCrypto_argsTicker(ctx, rawArgs) + if err != nil { + return nil, err } args["ticker"] = arg0 return args, nil } +func (ec *executionContext) field_Query_balanceCrypto_argsTicker( + ctx context.Context, + rawArgs map[string]any, +) (string, error) { + if _, ok := rawArgs["ticker"]; !ok { + var zeroVal string + return zeroVal, nil + } -func (ec *executionContext) field_Query_balanceFiat_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("ticker")) + if tmp, ok := rawArgs["ticker"]; ok { + return ec.unmarshalNString2string(ctx, tmp) + } + + var zeroVal string + return zeroVal, nil +} + +func (ec *executionContext) field_Query_balanceFiat_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error - args := map[string]interface{}{} - var arg0 string - if tmp, ok := rawArgs["currencyCode"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("currencyCode")) - arg0, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } + args := map[string]any{} + arg0, err := ec.field_Query_balanceFiat_argsCurrencyCode(ctx, rawArgs) + if err != nil { + return nil, err } args["currencyCode"] = arg0 return args, nil } +func (ec *executionContext) field_Query_balanceFiat_argsCurrencyCode( + ctx context.Context, + rawArgs map[string]any, +) (string, error) { + if _, ok := rawArgs["currencyCode"]; !ok { + var zeroVal string + return zeroVal, nil + } -func (ec *executionContext) field_Query_transactionDetailsAllCrypto_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("currencyCode")) + if tmp, ok := rawArgs["currencyCode"]; ok { + return ec.unmarshalNString2string(ctx, tmp) + } + + var zeroVal string + return zeroVal, nil +} + +func (ec *executionContext) field_Query_transactionDetailsAllCrypto_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error - args := map[string]interface{}{} - var arg0 models.CryptoPaginatedTxDetailsRequest - if tmp, ok := rawArgs["input"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) - arg0, err = ec.unmarshalNCryptoPaginatedTxDetailsRequest2githubᚗcomᚋsurahmanᚋFTeXᚋpkgᚋmodelsᚐCryptoPaginatedTxDetailsRequest(ctx, tmp) - if err != nil { - return nil, err - } + args := map[string]any{} + arg0, err := ec.field_Query_transactionDetailsAllCrypto_argsInput(ctx, rawArgs) + if err != nil { + return nil, err } args["input"] = arg0 return args, nil } +func (ec *executionContext) field_Query_transactionDetailsAllCrypto_argsInput( + ctx context.Context, + rawArgs map[string]any, +) (models.CryptoPaginatedTxDetailsRequest, error) { + if _, ok := rawArgs["input"]; !ok { + var zeroVal models.CryptoPaginatedTxDetailsRequest + return zeroVal, nil + } -func (ec *executionContext) field_Query_transactionDetailsAllFiat_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { - var err error - args := map[string]interface{}{} - var arg0 models.FiatPaginatedTxDetailsRequest + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) if tmp, ok := rawArgs["input"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) - arg0, err = ec.unmarshalNFiatPaginatedTxDetailsRequest2githubᚗcomᚋsurahmanᚋFTeXᚋpkgᚋmodelsᚐFiatPaginatedTxDetailsRequest(ctx, tmp) - if err != nil { - return nil, err - } + return ec.unmarshalNCryptoPaginatedTxDetailsRequest2githubᚗcomᚋsurahmanᚋFTeXᚋpkgᚋmodelsᚐCryptoPaginatedTxDetailsRequest(ctx, tmp) + } + + var zeroVal models.CryptoPaginatedTxDetailsRequest + return zeroVal, nil +} + +func (ec *executionContext) field_Query_transactionDetailsAllFiat_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := ec.field_Query_transactionDetailsAllFiat_argsInput(ctx, rawArgs) + if err != nil { + return nil, err } args["input"] = arg0 return args, nil } +func (ec *executionContext) field_Query_transactionDetailsAllFiat_argsInput( + ctx context.Context, + rawArgs map[string]any, +) (models.FiatPaginatedTxDetailsRequest, error) { + if _, ok := rawArgs["input"]; !ok { + var zeroVal models.FiatPaginatedTxDetailsRequest + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) + if tmp, ok := rawArgs["input"]; ok { + return ec.unmarshalNFiatPaginatedTxDetailsRequest2githubᚗcomᚋsurahmanᚋFTeXᚋpkgᚋmodelsᚐFiatPaginatedTxDetailsRequest(ctx, tmp) + } + + var zeroVal models.FiatPaginatedTxDetailsRequest + return zeroVal, nil +} -func (ec *executionContext) field_Query_transactionDetailsCrypto_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_transactionDetailsCrypto_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error - args := map[string]interface{}{} - var arg0 string - if tmp, ok := rawArgs["transactionID"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("transactionID")) - arg0, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } + args := map[string]any{} + arg0, err := ec.field_Query_transactionDetailsCrypto_argsTransactionID(ctx, rawArgs) + if err != nil { + return nil, err } args["transactionID"] = arg0 return args, nil } +func (ec *executionContext) field_Query_transactionDetailsCrypto_argsTransactionID( + ctx context.Context, + rawArgs map[string]any, +) (string, error) { + if _, ok := rawArgs["transactionID"]; !ok { + var zeroVal string + return zeroVal, nil + } -func (ec *executionContext) field_Query_transactionDetailsFiat_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { - var err error - args := map[string]interface{}{} - var arg0 string + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("transactionID")) if tmp, ok := rawArgs["transactionID"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("transactionID")) - arg0, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } + return ec.unmarshalNString2string(ctx, tmp) + } + + var zeroVal string + return zeroVal, nil +} + +func (ec *executionContext) field_Query_transactionDetailsFiat_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := ec.field_Query_transactionDetailsFiat_argsTransactionID(ctx, rawArgs) + if err != nil { + return nil, err } args["transactionID"] = arg0 return args, nil } +func (ec *executionContext) field_Query_transactionDetailsFiat_argsTransactionID( + ctx context.Context, + rawArgs map[string]any, +) (string, error) { + if _, ok := rawArgs["transactionID"]; !ok { + var zeroVal string + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("transactionID")) + if tmp, ok := rawArgs["transactionID"]; ok { + return ec.unmarshalNString2string(ctx, tmp) + } + + var zeroVal string + return zeroVal, nil +} // endregion ***************************** args.gotpl ***************************** @@ -207,7 +352,7 @@ func (ec *executionContext) _Query_healthcheck(ctx context.Context, field graphq ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Healthcheck(rctx) }) @@ -251,7 +396,7 @@ func (ec *executionContext) _Query_balanceCrypto(ctx context.Context, field grap ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().BalanceCrypto(rctx, fc.Args["ticker"].(string)) }) @@ -320,7 +465,7 @@ func (ec *executionContext) _Query_balanceAllCrypto(ctx context.Context, field g ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().BalanceAllCrypto(rctx, fc.Args["pageCursor"].(*string), fc.Args["pageSize"].(*int32)) }) @@ -381,7 +526,7 @@ func (ec *executionContext) _Query_transactionDetailsCrypto(ctx context.Context, ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().TransactionDetailsCrypto(rctx, fc.Args["transactionID"].(string)) }) @@ -436,7 +581,7 @@ func (ec *executionContext) _Query_transactionDetailsAllCrypto(ctx context.Conte ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().TransactionDetailsAllCrypto(rctx, fc.Args["input"].(models.CryptoPaginatedTxDetailsRequest)) }) @@ -497,7 +642,7 @@ func (ec *executionContext) _Query_balanceFiat(ctx context.Context, field graphq ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().BalanceFiat(rctx, fc.Args["currencyCode"].(string)) }) @@ -566,7 +711,7 @@ func (ec *executionContext) _Query_balanceAllFiat(ctx context.Context, field gra ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().BalanceAllFiat(rctx, fc.Args["pageCursor"].(*string), fc.Args["pageSize"].(*int32)) }) @@ -627,7 +772,7 @@ func (ec *executionContext) _Query_transactionDetailsFiat(ctx context.Context, f ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().TransactionDetailsFiat(rctx, fc.Args["transactionID"].(string)) }) @@ -682,7 +827,7 @@ func (ec *executionContext) _Query_transactionDetailsAllFiat(ctx context.Context ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().TransactionDetailsAllFiat(rctx, fc.Args["input"].(models.FiatPaginatedTxDetailsRequest)) }) @@ -743,7 +888,7 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(fc.Args["name"].(string)) }) @@ -773,6 +918,8 @@ func (ec *executionContext) fieldContext_Query___type(ctx context.Context, field return ec.fieldContext___Type_name(ctx, field) case "description": return ec.fieldContext___Type_description(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) case "fields": return ec.fieldContext___Type_fields(ctx, field) case "interfaces": @@ -785,8 +932,8 @@ func (ec *executionContext) fieldContext_Query___type(ctx context.Context, field return ec.fieldContext___Type_inputFields(ctx, field) case "ofType": return ec.fieldContext___Type_ofType(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) + case "isOneOf": + return ec.fieldContext___Type_isOneOf(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) }, @@ -817,7 +964,7 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() }) diff --git a/pkg/graphql/generated/prelude.generated.go b/pkg/graphql/generated/prelude.generated.go index 242b0b45..74c682f4 100644 --- a/pkg/graphql/generated/prelude.generated.go +++ b/pkg/graphql/generated/prelude.generated.go @@ -21,59 +21,168 @@ import ( // region ***************************** args.gotpl ***************************** -func (ec *executionContext) dir_defer_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) dir_defer_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error - args := map[string]interface{}{} - var arg0 *bool - if tmp, ok := rawArgs["if"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("if")) - arg0, err = ec.unmarshalOBoolean2ᚖbool(ctx, tmp) - if err != nil { - return nil, err - } + args := map[string]any{} + arg0, err := ec.dir_defer_argsIf(ctx, rawArgs) + if err != nil { + return nil, err } args["if"] = arg0 - var arg1 *string - if tmp, ok := rawArgs["label"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("label")) - arg1, err = ec.unmarshalOString2ᚖstring(ctx, tmp) - if err != nil { - return nil, err - } + arg1, err := ec.dir_defer_argsLabel(ctx, rawArgs) + if err != nil { + return nil, err } args["label"] = arg1 return args, nil } +func (ec *executionContext) dir_defer_argsIf( + ctx context.Context, + rawArgs map[string]any, +) (*bool, error) { + if _, ok := rawArgs["if"]; !ok { + var zeroVal *bool + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("if")) + if tmp, ok := rawArgs["if"]; ok { + return ec.unmarshalOBoolean2ᚖbool(ctx, tmp) + } + + var zeroVal *bool + return zeroVal, nil +} -func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) dir_defer_argsLabel( + ctx context.Context, + rawArgs map[string]any, +) (*string, error) { + if _, ok := rawArgs["label"]; !ok { + var zeroVal *string + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("label")) + if tmp, ok := rawArgs["label"]; ok { + return ec.unmarshalOString2ᚖstring(ctx, tmp) + } + + var zeroVal *string + return zeroVal, nil +} + +func (ec *executionContext) field___Directive_args_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error - args := map[string]interface{}{} - var arg0 bool + args := map[string]any{} + arg0, err := ec.field___Directive_args_argsIncludeDeprecated(ctx, rawArgs) + if err != nil { + return nil, err + } + args["includeDeprecated"] = arg0 + return args, nil +} +func (ec *executionContext) field___Directive_args_argsIncludeDeprecated( + ctx context.Context, + rawArgs map[string]any, +) (*bool, error) { + if _, ok := rawArgs["includeDeprecated"]; !ok { + var zeroVal *bool + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) 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 - } + return ec.unmarshalOBoolean2ᚖbool(ctx, tmp) + } + + var zeroVal *bool + return zeroVal, nil +} + +func (ec *executionContext) field___Field_args_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := ec.field___Field_args_argsIncludeDeprecated(ctx, rawArgs) + if err != nil { + return nil, err } args["includeDeprecated"] = arg0 return args, nil } +func (ec *executionContext) field___Field_args_argsIncludeDeprecated( + ctx context.Context, + rawArgs map[string]any, +) (*bool, error) { + if _, ok := rawArgs["includeDeprecated"]; !ok { + var zeroVal *bool + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + if tmp, ok := rawArgs["includeDeprecated"]; ok { + return ec.unmarshalOBoolean2ᚖbool(ctx, tmp) + } -func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var zeroVal *bool + return zeroVal, nil +} + +func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error - args := map[string]interface{}{} - var arg0 bool + args := map[string]any{} + arg0, err := ec.field___Type_enumValues_argsIncludeDeprecated(ctx, rawArgs) + if err != nil { + return nil, err + } + args["includeDeprecated"] = arg0 + return args, nil +} +func (ec *executionContext) field___Type_enumValues_argsIncludeDeprecated( + ctx context.Context, + rawArgs map[string]any, +) (bool, error) { + if _, ok := rawArgs["includeDeprecated"]; !ok { + var zeroVal bool + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) 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 - } + return ec.unmarshalOBoolean2bool(ctx, tmp) + } + + var zeroVal bool + return zeroVal, nil +} + +func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := ec.field___Type_fields_argsIncludeDeprecated(ctx, rawArgs) + if err != nil { + return nil, err } args["includeDeprecated"] = arg0 return args, nil } +func (ec *executionContext) field___Type_fields_argsIncludeDeprecated( + ctx context.Context, + rawArgs map[string]any, +) (bool, error) { + if _, ok := rawArgs["includeDeprecated"]; !ok { + var zeroVal bool + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + if tmp, ok := rawArgs["includeDeprecated"]; ok { + return ec.unmarshalOBoolean2bool(ctx, tmp) + } + + var zeroVal bool + return zeroVal, nil +} // endregion ***************************** args.gotpl ***************************** @@ -95,7 +204,7 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) @@ -139,7 +248,7 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil }) @@ -168,8 +277,8 @@ func (ec *executionContext) fieldContext___Directive_description(_ context.Conte return fc, nil } -func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Directive_locations(ctx, field) +func (ec *executionContext) ___Directive_isRepeatable(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Directive_isRepeatable(ctx, field) if err != nil { return graphql.Null } @@ -180,9 +289,9 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.Locations, nil + return obj.IsRepeatable, nil }) if err != nil { ec.Error(ctx, err) @@ -194,26 +303,26 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr } return graphql.Null } - res := resTmp.([]string) + res := resTmp.(bool) fc.Result = res - return ec.marshalN__DirectiveLocation2ᚕstringᚄ(ctx, field.Selections, res) + return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Directive_locations(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Directive_isRepeatable(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Directive", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type __DirectiveLocation does not have child fields") + return nil, errors.New("field of type Boolean does not have child fields") }, } return fc, nil } -func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Directive_args(ctx, field) +func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Directive_locations(ctx, field) if err != nil { return graphql.Null } @@ -224,9 +333,9 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.Args, nil + return obj.Locations, nil }) if err != nil { ec.Error(ctx, err) @@ -238,36 +347,26 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql } return graphql.Null } - res := resTmp.([]introspection.InputValue) + res := resTmp.([]string) fc.Result = res - return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) + return ec.marshalN__DirectiveLocation2ᚕstringᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Directive_args(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Directive_locations(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Directive", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "name": - return ec.fieldContext___InputValue_name(ctx, field) - case "description": - return ec.fieldContext___InputValue_description(ctx, field) - case "type": - return ec.fieldContext___InputValue_type(ctx, field) - case "defaultValue": - return ec.fieldContext___InputValue_defaultValue(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __InputValue", field.Name) + return nil, errors.New("field of type __DirectiveLocation does not have child fields") }, } return fc, nil } -func (ec *executionContext) ___Directive_isRepeatable(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Directive_isRepeatable(ctx, field) +func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Directive_args(ctx, field) if err != nil { return graphql.Null } @@ -278,9 +377,9 @@ func (ec *executionContext) ___Directive_isRepeatable(ctx context.Context, field ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.IsRepeatable, nil + return obj.Args, nil }) if err != nil { ec.Error(ctx, err) @@ -292,21 +391,46 @@ func (ec *executionContext) ___Directive_isRepeatable(ctx context.Context, field } return graphql.Null } - res := resTmp.(bool) + res := resTmp.([]introspection.InputValue) fc.Result = res - return ec.marshalNBoolean2bool(ctx, field.Selections, res) + return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Directive_isRepeatable(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Directive_args(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Directive", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") + switch field.Name { + case "name": + return ec.fieldContext___InputValue_name(ctx, field) + case "description": + return ec.fieldContext___InputValue_description(ctx, field) + case "type": + return ec.fieldContext___InputValue_type(ctx, field) + case "defaultValue": + return ec.fieldContext___InputValue_defaultValue(ctx, field) + case "isDeprecated": + return ec.fieldContext___InputValue_isDeprecated(ctx, field) + case "deprecationReason": + return ec.fieldContext___InputValue_deprecationReason(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __InputValue", field.Name) }, } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field___Directive_args_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } @@ -322,7 +446,7 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) @@ -366,7 +490,7 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil }) @@ -407,7 +531,7 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil }) @@ -451,7 +575,7 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil }) @@ -492,7 +616,7 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) @@ -536,7 +660,7 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil }) @@ -577,7 +701,7 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil }) @@ -596,7 +720,7 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Field_args(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Field_args(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Field", Field: field, @@ -612,10 +736,25 @@ func (ec *executionContext) fieldContext___Field_args(_ context.Context, field g return ec.fieldContext___InputValue_type(ctx, field) case "defaultValue": return ec.fieldContext___InputValue_defaultValue(ctx, field) + case "isDeprecated": + return ec.fieldContext___InputValue_isDeprecated(ctx, field) + case "deprecationReason": + return ec.fieldContext___InputValue_deprecationReason(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type __InputValue", field.Name) }, } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field___Field_args_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } @@ -631,7 +770,7 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil }) @@ -664,6 +803,8 @@ func (ec *executionContext) fieldContext___Field_type(_ context.Context, field g return ec.fieldContext___Type_name(ctx, field) case "description": return ec.fieldContext___Type_description(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) case "fields": return ec.fieldContext___Type_fields(ctx, field) case "interfaces": @@ -676,8 +817,8 @@ func (ec *executionContext) fieldContext___Field_type(_ context.Context, field g return ec.fieldContext___Type_inputFields(ctx, field) case "ofType": return ec.fieldContext___Type_ofType(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) + case "isOneOf": + return ec.fieldContext___Type_isOneOf(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) }, @@ -697,7 +838,7 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil }) @@ -741,7 +882,7 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil }) @@ -782,7 +923,7 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) @@ -826,7 +967,7 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil }) @@ -867,7 +1008,7 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil }) @@ -900,6 +1041,8 @@ func (ec *executionContext) fieldContext___InputValue_type(_ context.Context, fi return ec.fieldContext___Type_name(ctx, field) case "description": return ec.fieldContext___Type_description(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) case "fields": return ec.fieldContext___Type_fields(ctx, field) case "interfaces": @@ -912,8 +1055,8 @@ func (ec *executionContext) fieldContext___InputValue_type(_ context.Context, fi return ec.fieldContext___Type_inputFields(ctx, field) case "ofType": return ec.fieldContext___Type_ofType(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) + case "isOneOf": + return ec.fieldContext___Type_isOneOf(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) }, @@ -933,7 +1076,7 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil }) @@ -962,6 +1105,91 @@ func (ec *executionContext) fieldContext___InputValue_defaultValue(_ context.Con return fc, nil } +func (ec *executionContext) ___InputValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___InputValue_isDeprecated(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, 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) fieldContext___InputValue_isDeprecated(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___InputValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___InputValue_deprecationReason(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, 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) fieldContext___InputValue_deprecationReason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + func (ec *executionContext) ___Schema_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { fc, err := ec.fieldContext___Schema_description(ctx, field) if err != nil { @@ -974,7 +1202,7 @@ func (ec *executionContext) ___Schema_description(ctx context.Context, field gra ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil }) @@ -1015,7 +1243,7 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil }) @@ -1048,6 +1276,8 @@ func (ec *executionContext) fieldContext___Schema_types(_ context.Context, field return ec.fieldContext___Type_name(ctx, field) case "description": return ec.fieldContext___Type_description(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) case "fields": return ec.fieldContext___Type_fields(ctx, field) case "interfaces": @@ -1060,8 +1290,8 @@ func (ec *executionContext) fieldContext___Schema_types(_ context.Context, field return ec.fieldContext___Type_inputFields(ctx, field) case "ofType": return ec.fieldContext___Type_ofType(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) + case "isOneOf": + return ec.fieldContext___Type_isOneOf(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) }, @@ -1081,7 +1311,7 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil }) @@ -1114,6 +1344,8 @@ func (ec *executionContext) fieldContext___Schema_queryType(_ context.Context, f return ec.fieldContext___Type_name(ctx, field) case "description": return ec.fieldContext___Type_description(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) case "fields": return ec.fieldContext___Type_fields(ctx, field) case "interfaces": @@ -1126,8 +1358,8 @@ func (ec *executionContext) fieldContext___Schema_queryType(_ context.Context, f return ec.fieldContext___Type_inputFields(ctx, field) case "ofType": return ec.fieldContext___Type_ofType(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) + case "isOneOf": + return ec.fieldContext___Type_isOneOf(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) }, @@ -1147,7 +1379,7 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil }) @@ -1177,6 +1409,8 @@ func (ec *executionContext) fieldContext___Schema_mutationType(_ context.Context return ec.fieldContext___Type_name(ctx, field) case "description": return ec.fieldContext___Type_description(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) case "fields": return ec.fieldContext___Type_fields(ctx, field) case "interfaces": @@ -1189,8 +1423,8 @@ func (ec *executionContext) fieldContext___Schema_mutationType(_ context.Context return ec.fieldContext___Type_inputFields(ctx, field) case "ofType": return ec.fieldContext___Type_ofType(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) + case "isOneOf": + return ec.fieldContext___Type_isOneOf(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) }, @@ -1210,7 +1444,7 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil }) @@ -1240,6 +1474,8 @@ func (ec *executionContext) fieldContext___Schema_subscriptionType(_ context.Con return ec.fieldContext___Type_name(ctx, field) case "description": return ec.fieldContext___Type_description(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) case "fields": return ec.fieldContext___Type_fields(ctx, field) case "interfaces": @@ -1252,8 +1488,8 @@ func (ec *executionContext) fieldContext___Schema_subscriptionType(_ context.Con return ec.fieldContext___Type_inputFields(ctx, field) case "ofType": return ec.fieldContext___Type_ofType(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) + case "isOneOf": + return ec.fieldContext___Type_isOneOf(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) }, @@ -1273,7 +1509,7 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil }) @@ -1304,12 +1540,12 @@ func (ec *executionContext) fieldContext___Schema_directives(_ context.Context, return ec.fieldContext___Directive_name(ctx, field) case "description": return ec.fieldContext___Directive_description(ctx, field) + case "isRepeatable": + return ec.fieldContext___Directive_isRepeatable(ctx, field) case "locations": return ec.fieldContext___Directive_locations(ctx, field) case "args": return ec.fieldContext___Directive_args(ctx, field) - case "isRepeatable": - return ec.fieldContext___Directive_isRepeatable(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type __Directive", field.Name) }, @@ -1329,7 +1565,7 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil }) @@ -1373,7 +1609,7 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil }) @@ -1414,7 +1650,7 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil }) @@ -1443,6 +1679,47 @@ func (ec *executionContext) fieldContext___Type_description(_ context.Context, f return fc, nil } +func (ec *executionContext) ___Type_specifiedByURL(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_specifiedByURL(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.SpecifiedByURL(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_specifiedByURL(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { fc, err := ec.fieldContext___Type_fields(ctx, field) if err != nil { @@ -1455,7 +1732,7 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(fc.Args["includeDeprecated"].(bool)), nil }) @@ -1521,7 +1798,7 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil }) @@ -1551,6 +1828,8 @@ func (ec *executionContext) fieldContext___Type_interfaces(_ context.Context, fi return ec.fieldContext___Type_name(ctx, field) case "description": return ec.fieldContext___Type_description(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) case "fields": return ec.fieldContext___Type_fields(ctx, field) case "interfaces": @@ -1563,8 +1842,8 @@ func (ec *executionContext) fieldContext___Type_interfaces(_ context.Context, fi return ec.fieldContext___Type_inputFields(ctx, field) case "ofType": return ec.fieldContext___Type_ofType(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) + case "isOneOf": + return ec.fieldContext___Type_isOneOf(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) }, @@ -1584,7 +1863,7 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil }) @@ -1614,6 +1893,8 @@ func (ec *executionContext) fieldContext___Type_possibleTypes(_ context.Context, return ec.fieldContext___Type_name(ctx, field) case "description": return ec.fieldContext___Type_description(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) case "fields": return ec.fieldContext___Type_fields(ctx, field) case "interfaces": @@ -1626,8 +1907,8 @@ func (ec *executionContext) fieldContext___Type_possibleTypes(_ context.Context, return ec.fieldContext___Type_inputFields(ctx, field) case "ofType": return ec.fieldContext___Type_ofType(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) + case "isOneOf": + return ec.fieldContext___Type_isOneOf(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) }, @@ -1647,7 +1928,7 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(fc.Args["includeDeprecated"].(bool)), nil }) @@ -1709,7 +1990,7 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil }) @@ -1741,6 +2022,10 @@ func (ec *executionContext) fieldContext___Type_inputFields(_ context.Context, f return ec.fieldContext___InputValue_type(ctx, field) case "defaultValue": return ec.fieldContext___InputValue_defaultValue(ctx, field) + case "isDeprecated": + return ec.fieldContext___InputValue_isDeprecated(ctx, field) + case "deprecationReason": + return ec.fieldContext___InputValue_deprecationReason(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type __InputValue", field.Name) }, @@ -1760,7 +2045,7 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil }) @@ -1790,6 +2075,8 @@ func (ec *executionContext) fieldContext___Type_ofType(_ context.Context, field return ec.fieldContext___Type_name(ctx, field) case "description": return ec.fieldContext___Type_description(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) case "fields": return ec.fieldContext___Type_fields(ctx, field) case "interfaces": @@ -1802,8 +2089,8 @@ func (ec *executionContext) fieldContext___Type_ofType(_ context.Context, field return ec.fieldContext___Type_inputFields(ctx, field) case "ofType": return ec.fieldContext___Type_ofType(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) + case "isOneOf": + return ec.fieldContext___Type_isOneOf(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) }, @@ -1811,8 +2098,8 @@ func (ec *executionContext) fieldContext___Type_ofType(_ context.Context, field return fc, nil } -func (ec *executionContext) ___Type_specifiedByURL(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Type_specifiedByURL(ctx, field) +func (ec *executionContext) ___Type_isOneOf(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_isOneOf(ctx, field) if err != nil { return graphql.Null } @@ -1823,9 +2110,9 @@ func (ec *executionContext) ___Type_specifiedByURL(ctx context.Context, field gr ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.SpecifiedByURL(), nil + return obj.IsOneOf(), nil }) if err != nil { ec.Error(ctx, err) @@ -1834,19 +2121,19 @@ func (ec *executionContext) ___Type_specifiedByURL(ctx context.Context, field gr if resTmp == nil { return graphql.Null } - res := resTmp.(*string) + res := resTmp.(bool) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalOBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Type_specifiedByURL(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Type_isOneOf(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Type", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + return nil, errors.New("field of type Boolean does not have child fields") }, } return fc, nil @@ -1882,6 +2169,11 @@ func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionS } case "description": out.Values[i] = ec.___Directive_description(ctx, field, obj) + case "isRepeatable": + out.Values[i] = ec.___Directive_isRepeatable(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } case "locations": out.Values[i] = ec.___Directive_locations(ctx, field, obj) if out.Values[i] == graphql.Null { @@ -1892,11 +2184,6 @@ func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionS if out.Values[i] == graphql.Null { out.Invalids++ } - case "isRepeatable": - out.Values[i] = ec.___Directive_isRepeatable(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -2051,6 +2338,13 @@ func (ec *executionContext) ___InputValue(ctx context.Context, sel ast.Selection } case "defaultValue": out.Values[i] = ec.___InputValue_defaultValue(ctx, field, obj) + case "isDeprecated": + out.Values[i] = ec.___InputValue_isDeprecated(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "deprecationReason": + out.Values[i] = ec.___InputValue_deprecationReason(ctx, field, obj) default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -2149,6 +2443,8 @@ func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, o out.Values[i] = ec.___Type_name(ctx, field, obj) case "description": out.Values[i] = ec.___Type_description(ctx, field, obj) + case "specifiedByURL": + out.Values[i] = ec.___Type_specifiedByURL(ctx, field, obj) case "fields": out.Values[i] = ec.___Type_fields(ctx, field, obj) case "interfaces": @@ -2161,8 +2457,8 @@ func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, o out.Values[i] = ec.___Type_inputFields(ctx, field, obj) case "ofType": out.Values[i] = ec.___Type_ofType(ctx, field, obj) - case "specifiedByURL": - out.Values[i] = ec.___Type_specifiedByURL(ctx, field, obj) + case "isOneOf": + out.Values[i] = ec.___Type_isOneOf(ctx, field, obj) default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -2190,12 +2486,13 @@ func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, o // region ***************************** type.gotpl ***************************** -func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interface{}) (bool, error) { +func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v any) (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 { + _ = sel res := graphql.MarshalBoolean(v) if res == graphql.Null { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { @@ -2205,7 +2502,7 @@ func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.Se return res } -func (ec *executionContext) unmarshalNBoolean2ᚖbool(ctx context.Context, v interface{}) (*bool, error) { +func (ec *executionContext) unmarshalNBoolean2ᚖbool(ctx context.Context, v any) (*bool, error) { res, err := graphql.UnmarshalBoolean(v) return &res, graphql.ErrorOnPath(ctx, err) } @@ -2217,6 +2514,7 @@ func (ec *executionContext) marshalNBoolean2ᚖbool(ctx context.Context, sel ast } return graphql.Null } + _ = sel res := graphql.MarshalBoolean(*v) if res == graphql.Null { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { @@ -2226,12 +2524,13 @@ func (ec *executionContext) marshalNBoolean2ᚖbool(ctx context.Context, sel ast return res } -func (ec *executionContext) unmarshalNFloat2float64(ctx context.Context, v interface{}) (float64, error) { +func (ec *executionContext) unmarshalNFloat2float64(ctx context.Context, v any) (float64, error) { res, err := graphql.UnmarshalFloatContext(ctx, v) return res, graphql.ErrorOnPath(ctx, err) } func (ec *executionContext) marshalNFloat2float64(ctx context.Context, sel ast.SelectionSet, v float64) graphql.Marshaler { + _ = sel res := graphql.MarshalFloatContext(v) if res == graphql.Null { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { @@ -2241,12 +2540,13 @@ func (ec *executionContext) marshalNFloat2float64(ctx context.Context, sel ast.S return graphql.WrapContextMarshaler(ctx, res) } -func (ec *executionContext) unmarshalNString2string(ctx context.Context, v interface{}) (string, error) { +func (ec *executionContext) unmarshalNString2string(ctx context.Context, v any) (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 { + _ = sel res := graphql.MarshalString(v) if res == graphql.Null { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { @@ -2304,12 +2604,13 @@ func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgq return ret } -func (ec *executionContext) unmarshalN__DirectiveLocation2string(ctx context.Context, v interface{}) (string, error) { +func (ec *executionContext) unmarshalN__DirectiveLocation2string(ctx context.Context, v any) (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 { + _ = sel res := graphql.MarshalString(v) if res == graphql.Null { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { @@ -2319,11 +2620,9 @@ func (ec *executionContext) marshalN__DirectiveLocation2string(ctx context.Conte return res } -func (ec *executionContext) unmarshalN__DirectiveLocation2ᚕstringᚄ(ctx context.Context, v interface{}) ([]string, error) { - var vSlice []interface{} - if v != nil { - vSlice = graphql.CoerceList(v) - } +func (ec *executionContext) unmarshalN__DirectiveLocation2ᚕstringᚄ(ctx context.Context, v any) ([]string, error) { + var vSlice []any + vSlice = graphql.CoerceList(v) var err error res := make([]string, len(vSlice)) for i := range vSlice { @@ -2494,12 +2793,13 @@ func (ec *executionContext) marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgen return ec.___Type(ctx, sel, v) } -func (ec *executionContext) unmarshalN__TypeKind2string(ctx context.Context, v interface{}) (string, error) { +func (ec *executionContext) unmarshalN__TypeKind2string(ctx context.Context, v any) (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 { + _ = sel res := graphql.MarshalString(v) if res == graphql.Null { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { @@ -2509,17 +2809,19 @@ func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel a return res } -func (ec *executionContext) unmarshalOBoolean2bool(ctx context.Context, v interface{}) (bool, error) { +func (ec *executionContext) unmarshalOBoolean2bool(ctx context.Context, v any) (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 { + _ = sel + _ = ctx res := graphql.MarshalBoolean(v) return res } -func (ec *executionContext) unmarshalOBoolean2ᚖbool(ctx context.Context, v interface{}) (*bool, error) { +func (ec *executionContext) unmarshalOBoolean2ᚖbool(ctx context.Context, v any) (*bool, error) { if v == nil { return nil, nil } @@ -2531,21 +2833,25 @@ func (ec *executionContext) marshalOBoolean2ᚖbool(ctx context.Context, sel ast if v == nil { return graphql.Null } + _ = sel + _ = ctx res := graphql.MarshalBoolean(*v) return res } -func (ec *executionContext) unmarshalOString2string(ctx context.Context, v interface{}) (string, error) { +func (ec *executionContext) unmarshalOString2string(ctx context.Context, v any) (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 { + _ = sel + _ = ctx res := graphql.MarshalString(v) return res } -func (ec *executionContext) unmarshalOString2ᚖstring(ctx context.Context, v interface{}) (*string, error) { +func (ec *executionContext) unmarshalOString2ᚖstring(ctx context.Context, v any) (*string, error) { if v == nil { return nil, nil } @@ -2557,6 +2863,8 @@ func (ec *executionContext) marshalOString2ᚖstring(ctx context.Context, sel as if v == nil { return graphql.Null } + _ = sel + _ = ctx res := graphql.MarshalString(*v) return res } diff --git a/pkg/graphql/generated/root_.generated.go b/pkg/graphql/generated/root_.generated.go index 07eb4ba0..8989bc8e 100644 --- a/pkg/graphql/generated/root_.generated.go +++ b/pkg/graphql/generated/root_.generated.go @@ -205,7 +205,7 @@ func (e *executableSchema) Schema() *ast.Schema { return parsedSchema } -func (e *executableSchema) Complexity(typeName, field string, childComplexity int, rawArgs map[string]interface{}) (int, bool) { +func (e *executableSchema) Complexity(ctx context.Context, typeName, field string, childComplexity int, rawArgs map[string]any) (int, bool) { ec := executionContext{nil, e, 0, 0, nil} _ = ec switch typeName + "." + field { @@ -558,7 +558,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in break } - args, err := ec.field_Mutation_deleteUser_args(context.TODO(), rawArgs) + args, err := ec.field_Mutation_deleteUser_args(ctx, rawArgs) if err != nil { return 0, false } @@ -570,7 +570,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in break } - args, err := ec.field_Mutation_depositFiat_args(context.TODO(), rawArgs) + args, err := ec.field_Mutation_depositFiat_args(ctx, rawArgs) if err != nil { return 0, false } @@ -582,7 +582,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in break } - args, err := ec.field_Mutation_exchangeCrypto_args(context.TODO(), rawArgs) + args, err := ec.field_Mutation_exchangeCrypto_args(ctx, rawArgs) if err != nil { return 0, false } @@ -594,7 +594,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in break } - args, err := ec.field_Mutation_exchangeOfferFiat_args(context.TODO(), rawArgs) + args, err := ec.field_Mutation_exchangeOfferFiat_args(ctx, rawArgs) if err != nil { return 0, false } @@ -606,7 +606,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in break } - args, err := ec.field_Mutation_exchangeTransferFiat_args(context.TODO(), rawArgs) + args, err := ec.field_Mutation_exchangeTransferFiat_args(ctx, rawArgs) if err != nil { return 0, false } @@ -618,7 +618,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in break } - args, err := ec.field_Mutation_loginUser_args(context.TODO(), rawArgs) + args, err := ec.field_Mutation_loginUser_args(ctx, rawArgs) if err != nil { return 0, false } @@ -630,7 +630,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in break } - args, err := ec.field_Mutation_offerCrypto_args(context.TODO(), rawArgs) + args, err := ec.field_Mutation_offerCrypto_args(ctx, rawArgs) if err != nil { return 0, false } @@ -642,7 +642,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in break } - args, err := ec.field_Mutation_openCrypto_args(context.TODO(), rawArgs) + args, err := ec.field_Mutation_openCrypto_args(ctx, rawArgs) if err != nil { return 0, false } @@ -654,7 +654,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in break } - args, err := ec.field_Mutation_openFiat_args(context.TODO(), rawArgs) + args, err := ec.field_Mutation_openFiat_args(ctx, rawArgs) if err != nil { return 0, false } @@ -673,7 +673,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in break } - args, err := ec.field_Mutation_registerUser_args(context.TODO(), rawArgs) + args, err := ec.field_Mutation_registerUser_args(ctx, rawArgs) if err != nil { return 0, false } @@ -748,7 +748,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in break } - args, err := ec.field_Query_balanceAllCrypto_args(context.TODO(), rawArgs) + args, err := ec.field_Query_balanceAllCrypto_args(ctx, rawArgs) if err != nil { return 0, false } @@ -760,7 +760,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in break } - args, err := ec.field_Query_balanceAllFiat_args(context.TODO(), rawArgs) + args, err := ec.field_Query_balanceAllFiat_args(ctx, rawArgs) if err != nil { return 0, false } @@ -772,7 +772,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in break } - args, err := ec.field_Query_balanceCrypto_args(context.TODO(), rawArgs) + args, err := ec.field_Query_balanceCrypto_args(ctx, rawArgs) if err != nil { return 0, false } @@ -784,7 +784,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in break } - args, err := ec.field_Query_balanceFiat_args(context.TODO(), rawArgs) + args, err := ec.field_Query_balanceFiat_args(ctx, rawArgs) if err != nil { return 0, false } @@ -803,7 +803,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in break } - args, err := ec.field_Query_transactionDetailsAllCrypto_args(context.TODO(), rawArgs) + args, err := ec.field_Query_transactionDetailsAllCrypto_args(ctx, rawArgs) if err != nil { return 0, false } @@ -815,7 +815,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in break } - args, err := ec.field_Query_transactionDetailsAllFiat_args(context.TODO(), rawArgs) + args, err := ec.field_Query_transactionDetailsAllFiat_args(ctx, rawArgs) if err != nil { return 0, false } @@ -827,7 +827,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in break } - args, err := ec.field_Query_transactionDetailsCrypto_args(context.TODO(), rawArgs) + args, err := ec.field_Query_transactionDetailsCrypto_args(ctx, rawArgs) if err != nil { return 0, false } @@ -839,7 +839,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in break } - args, err := ec.field_Query_transactionDetailsFiat_args(context.TODO(), rawArgs) + args, err := ec.field_Query_transactionDetailsFiat_args(ctx, rawArgs) if err != nil { return 0, false } @@ -851,8 +851,8 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in } func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { - rc := graphql.GetOperationContext(ctx) - ec := executionContext{rc, e, 0, 0, make(chan graphql.DeferredResult)} + opCtx := graphql.GetOperationContext(ctx) + ec := executionContext{opCtx, e, 0, 0, make(chan graphql.DeferredResult)} inputUnmarshalMap := graphql.BuildUnmarshalerMap( ec.unmarshalInputCryptoOfferRequest, ec.unmarshalInputCryptoPaginatedTxDetailsRequest, @@ -865,7 +865,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { ) first := true - switch rc.Operation.Operation { + switch opCtx.Operation.Operation { case ast.Query: return func(ctx context.Context) *graphql.Response { var response graphql.Response @@ -873,7 +873,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { if first { first = false ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) - data = ec._Query(ctx, rc.Operation.SelectionSet) + data = ec._Query(ctx, opCtx.Operation.SelectionSet) } else { if atomic.LoadInt32(&ec.pendingDeferred) > 0 { result := <-ec.deferredResults @@ -903,7 +903,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { } first = false ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) - data := ec._Mutation(ctx, rc.Operation.SelectionSet) + data := ec._Mutation(ctx, opCtx.Operation.SelectionSet) var buf bytes.Buffer data.MarshalGQL(&buf) diff --git a/pkg/graphql/generated/scalars.generated.go b/pkg/graphql/generated/scalars.generated.go index cf7c02fd..f238eeba 100644 --- a/pkg/graphql/generated/scalars.generated.go +++ b/pkg/graphql/generated/scalars.generated.go @@ -39,7 +39,7 @@ import ( // region ***************************** type.gotpl ***************************** -func (ec *executionContext) unmarshalNAny2interface(ctx context.Context, v interface{}) (any, error) { +func (ec *executionContext) unmarshalNAny2interface(ctx context.Context, v any) (any, error) { res, err := graphql.UnmarshalAny(v) return res, graphql.ErrorOnPath(ctx, err) } @@ -51,6 +51,7 @@ func (ec *executionContext) marshalNAny2interface(ctx context.Context, sel ast.S } return graphql.Null } + _ = sel res := graphql.MarshalAny(v) if res == graphql.Null { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { @@ -60,11 +61,9 @@ func (ec *executionContext) marshalNAny2interface(ctx context.Context, sel ast.S return res } -func (ec *executionContext) unmarshalNAny2ᚕinterfaceᚄ(ctx context.Context, v interface{}) ([]any, error) { - var vSlice []interface{} - if v != nil { - vSlice = graphql.CoerceList(v) - } +func (ec *executionContext) unmarshalNAny2ᚕinterfaceᚄ(ctx context.Context, v any) ([]any, error) { + var vSlice []any + vSlice = graphql.CoerceList(v) var err error res := make([]any, len(vSlice)) for i := range vSlice { @@ -92,12 +91,13 @@ func (ec *executionContext) marshalNAny2ᚕinterfaceᚄ(ctx context.Context, sel return ret } -func (ec *executionContext) unmarshalNInt642int64(ctx context.Context, v interface{}) (int64, error) { +func (ec *executionContext) unmarshalNInt642int64(ctx context.Context, v any) (int64, error) { res, err := graphql.UnmarshalInt64(v) return res, graphql.ErrorOnPath(ctx, err) } func (ec *executionContext) marshalNInt642int64(ctx context.Context, sel ast.SelectionSet, v int64) graphql.Marshaler { + _ = sel res := graphql.MarshalInt64(v) if res == graphql.Null { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { @@ -107,12 +107,13 @@ func (ec *executionContext) marshalNInt642int64(ctx context.Context, sel ast.Sel return res } -func (ec *executionContext) unmarshalNUUID2string(ctx context.Context, v interface{}) (string, error) { +func (ec *executionContext) unmarshalNUUID2string(ctx context.Context, v any) (string, error) { res, err := graphql.UnmarshalString(v) return res, graphql.ErrorOnPath(ctx, err) } func (ec *executionContext) marshalNUUID2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { + _ = sel res := graphql.MarshalString(v) if res == graphql.Null { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { @@ -122,7 +123,7 @@ func (ec *executionContext) marshalNUUID2string(ctx context.Context, sel ast.Sel return res } -func (ec *executionContext) unmarshalOInt322ᚖint32(ctx context.Context, v interface{}) (*int32, error) { +func (ec *executionContext) unmarshalOInt322ᚖint32(ctx context.Context, v any) (*int32, error) { if v == nil { return nil, nil } @@ -134,6 +135,8 @@ func (ec *executionContext) marshalOInt322ᚖint32(ctx context.Context, sel ast. if v == nil { return graphql.Null } + _ = sel + _ = ctx res := graphql.MarshalInt32(*v) return res } diff --git a/pkg/graphql/generated/user.generated.go b/pkg/graphql/generated/user.generated.go index c26d1e70..723c62a0 100644 --- a/pkg/graphql/generated/user.generated.go +++ b/pkg/graphql/generated/user.generated.go @@ -36,155 +36,285 @@ type MutationResolver interface { // region ***************************** args.gotpl ***************************** -func (ec *executionContext) field_Mutation_deleteUser_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Mutation_deleteUser_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error - args := map[string]interface{}{} - var arg0 models1.HTTPDeleteUserRequest - if tmp, ok := rawArgs["input"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) - arg0, err = ec.unmarshalNDeleteUserRequest2githubᚗcomᚋsurahmanᚋFTeXᚋpkgᚋmodelsᚐHTTPDeleteUserRequest(ctx, tmp) - if err != nil { - return nil, err - } + args := map[string]any{} + arg0, err := ec.field_Mutation_deleteUser_argsInput(ctx, rawArgs) + if err != nil { + return nil, err } args["input"] = arg0 return args, nil } +func (ec *executionContext) field_Mutation_deleteUser_argsInput( + ctx context.Context, + rawArgs map[string]any, +) (models1.HTTPDeleteUserRequest, error) { + if _, ok := rawArgs["input"]; !ok { + var zeroVal models1.HTTPDeleteUserRequest + return zeroVal, nil + } -func (ec *executionContext) field_Mutation_depositFiat_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { - var err error - args := map[string]interface{}{} - var arg0 models1.HTTPDepositCurrencyRequest + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) if tmp, ok := rawArgs["input"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) - arg0, err = ec.unmarshalNFiatDepositRequest2githubᚗcomᚋsurahmanᚋFTeXᚋpkgᚋmodelsᚐHTTPDepositCurrencyRequest(ctx, tmp) - if err != nil { - return nil, err - } + return ec.unmarshalNDeleteUserRequest2githubᚗcomᚋsurahmanᚋFTeXᚋpkgᚋmodelsᚐHTTPDeleteUserRequest(ctx, tmp) + } + + var zeroVal models1.HTTPDeleteUserRequest + return zeroVal, nil +} + +func (ec *executionContext) field_Mutation_depositFiat_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := ec.field_Mutation_depositFiat_argsInput(ctx, rawArgs) + if err != nil { + return nil, err } args["input"] = arg0 return args, nil } +func (ec *executionContext) field_Mutation_depositFiat_argsInput( + ctx context.Context, + rawArgs map[string]any, +) (models1.HTTPDepositCurrencyRequest, error) { + if _, ok := rawArgs["input"]; !ok { + var zeroVal models1.HTTPDepositCurrencyRequest + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) + if tmp, ok := rawArgs["input"]; ok { + return ec.unmarshalNFiatDepositRequest2githubᚗcomᚋsurahmanᚋFTeXᚋpkgᚋmodelsᚐHTTPDepositCurrencyRequest(ctx, tmp) + } + + var zeroVal models1.HTTPDepositCurrencyRequest + return zeroVal, nil +} -func (ec *executionContext) field_Mutation_exchangeCrypto_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Mutation_exchangeCrypto_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error - args := map[string]interface{}{} - var arg0 string - if tmp, ok := rawArgs["offerID"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("offerID")) - arg0, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } + args := map[string]any{} + arg0, err := ec.field_Mutation_exchangeCrypto_argsOfferID(ctx, rawArgs) + if err != nil { + return nil, err } args["offerID"] = arg0 return args, nil } +func (ec *executionContext) field_Mutation_exchangeCrypto_argsOfferID( + ctx context.Context, + rawArgs map[string]any, +) (string, error) { + if _, ok := rawArgs["offerID"]; !ok { + var zeroVal string + return zeroVal, nil + } -func (ec *executionContext) field_Mutation_exchangeOfferFiat_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("offerID")) + if tmp, ok := rawArgs["offerID"]; ok { + return ec.unmarshalNString2string(ctx, tmp) + } + + var zeroVal string + return zeroVal, nil +} + +func (ec *executionContext) field_Mutation_exchangeOfferFiat_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error - args := map[string]interface{}{} - var arg0 models1.HTTPExchangeOfferRequest - if tmp, ok := rawArgs["input"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) - arg0, err = ec.unmarshalNFiatExchangeOfferRequest2githubᚗcomᚋsurahmanᚋFTeXᚋpkgᚋmodelsᚐHTTPExchangeOfferRequest(ctx, tmp) - if err != nil { - return nil, err - } + args := map[string]any{} + arg0, err := ec.field_Mutation_exchangeOfferFiat_argsInput(ctx, rawArgs) + if err != nil { + return nil, err } args["input"] = arg0 return args, nil } +func (ec *executionContext) field_Mutation_exchangeOfferFiat_argsInput( + ctx context.Context, + rawArgs map[string]any, +) (models1.HTTPExchangeOfferRequest, error) { + if _, ok := rawArgs["input"]; !ok { + var zeroVal models1.HTTPExchangeOfferRequest + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) + if tmp, ok := rawArgs["input"]; ok { + return ec.unmarshalNFiatExchangeOfferRequest2githubᚗcomᚋsurahmanᚋFTeXᚋpkgᚋmodelsᚐHTTPExchangeOfferRequest(ctx, tmp) + } + + var zeroVal models1.HTTPExchangeOfferRequest + return zeroVal, nil +} -func (ec *executionContext) field_Mutation_exchangeTransferFiat_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Mutation_exchangeTransferFiat_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error - args := map[string]interface{}{} - var arg0 string - if tmp, ok := rawArgs["offerID"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("offerID")) - arg0, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } + args := map[string]any{} + arg0, err := ec.field_Mutation_exchangeTransferFiat_argsOfferID(ctx, rawArgs) + if err != nil { + return nil, err } args["offerID"] = arg0 return args, nil } +func (ec *executionContext) field_Mutation_exchangeTransferFiat_argsOfferID( + ctx context.Context, + rawArgs map[string]any, +) (string, error) { + if _, ok := rawArgs["offerID"]; !ok { + var zeroVal string + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("offerID")) + if tmp, ok := rawArgs["offerID"]; ok { + return ec.unmarshalNString2string(ctx, tmp) + } + + var zeroVal string + return zeroVal, nil +} -func (ec *executionContext) field_Mutation_loginUser_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Mutation_loginUser_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error - args := map[string]interface{}{} - var arg0 models.UserLoginCredentials - if tmp, ok := rawArgs["input"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) - arg0, err = ec.unmarshalNUserLoginCredentials2githubᚗcomᚋsurahmanᚋFTeXᚋpkgᚋmodelsᚋpostgresᚐUserLoginCredentials(ctx, tmp) - if err != nil { - return nil, err - } + args := map[string]any{} + arg0, err := ec.field_Mutation_loginUser_argsInput(ctx, rawArgs) + if err != nil { + return nil, err } args["input"] = arg0 return args, nil } +func (ec *executionContext) field_Mutation_loginUser_argsInput( + ctx context.Context, + rawArgs map[string]any, +) (models.UserLoginCredentials, error) { + if _, ok := rawArgs["input"]; !ok { + var zeroVal models.UserLoginCredentials + return zeroVal, nil + } -func (ec *executionContext) field_Mutation_offerCrypto_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { - var err error - args := map[string]interface{}{} - var arg0 models1.HTTPCryptoOfferRequest + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) if tmp, ok := rawArgs["input"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) - arg0, err = ec.unmarshalNCryptoOfferRequest2githubᚗcomᚋsurahmanᚋFTeXᚋpkgᚋmodelsᚐHTTPCryptoOfferRequest(ctx, tmp) - if err != nil { - return nil, err - } + return ec.unmarshalNUserLoginCredentials2githubᚗcomᚋsurahmanᚋFTeXᚋpkgᚋmodelsᚋpostgresᚐUserLoginCredentials(ctx, tmp) + } + + var zeroVal models.UserLoginCredentials + return zeroVal, nil +} + +func (ec *executionContext) field_Mutation_offerCrypto_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := ec.field_Mutation_offerCrypto_argsInput(ctx, rawArgs) + if err != nil { + return nil, err } args["input"] = arg0 return args, nil } +func (ec *executionContext) field_Mutation_offerCrypto_argsInput( + ctx context.Context, + rawArgs map[string]any, +) (models1.HTTPCryptoOfferRequest, error) { + if _, ok := rawArgs["input"]; !ok { + var zeroVal models1.HTTPCryptoOfferRequest + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) + if tmp, ok := rawArgs["input"]; ok { + return ec.unmarshalNCryptoOfferRequest2githubᚗcomᚋsurahmanᚋFTeXᚋpkgᚋmodelsᚐHTTPCryptoOfferRequest(ctx, tmp) + } + + var zeroVal models1.HTTPCryptoOfferRequest + return zeroVal, nil +} -func (ec *executionContext) field_Mutation_openCrypto_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Mutation_openCrypto_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error - args := map[string]interface{}{} - var arg0 string - if tmp, ok := rawArgs["ticker"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ticker")) - arg0, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } + args := map[string]any{} + arg0, err := ec.field_Mutation_openCrypto_argsTicker(ctx, rawArgs) + if err != nil { + return nil, err } args["ticker"] = arg0 return args, nil } +func (ec *executionContext) field_Mutation_openCrypto_argsTicker( + ctx context.Context, + rawArgs map[string]any, +) (string, error) { + if _, ok := rawArgs["ticker"]; !ok { + var zeroVal string + return zeroVal, nil + } -func (ec *executionContext) field_Mutation_openFiat_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("ticker")) + if tmp, ok := rawArgs["ticker"]; ok { + return ec.unmarshalNString2string(ctx, tmp) + } + + var zeroVal string + return zeroVal, nil +} + +func (ec *executionContext) field_Mutation_openFiat_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error - args := map[string]interface{}{} - var arg0 string - if tmp, ok := rawArgs["currency"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("currency")) - arg0, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } + args := map[string]any{} + arg0, err := ec.field_Mutation_openFiat_argsCurrency(ctx, rawArgs) + if err != nil { + return nil, err } args["currency"] = arg0 return args, nil } +func (ec *executionContext) field_Mutation_openFiat_argsCurrency( + ctx context.Context, + rawArgs map[string]any, +) (string, error) { + if _, ok := rawArgs["currency"]; !ok { + var zeroVal string + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("currency")) + if tmp, ok := rawArgs["currency"]; ok { + return ec.unmarshalNString2string(ctx, tmp) + } + + var zeroVal string + return zeroVal, nil +} -func (ec *executionContext) field_Mutation_registerUser_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Mutation_registerUser_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error - args := map[string]interface{}{} - var arg0 *models.UserAccount - if tmp, ok := rawArgs["input"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) - arg0, err = ec.unmarshalOUserAccount2ᚖgithubᚗcomᚋsurahmanᚋFTeXᚋpkgᚋmodelsᚋpostgresᚐUserAccount(ctx, tmp) - if err != nil { - return nil, err - } + args := map[string]any{} + arg0, err := ec.field_Mutation_registerUser_argsInput(ctx, rawArgs) + if err != nil { + return nil, err } args["input"] = arg0 return args, nil } +func (ec *executionContext) field_Mutation_registerUser_argsInput( + ctx context.Context, + rawArgs map[string]any, +) (*models.UserAccount, error) { + if _, ok := rawArgs["input"]; !ok { + var zeroVal *models.UserAccount + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) + if tmp, ok := rawArgs["input"]; ok { + return ec.unmarshalOUserAccount2ᚖgithubᚗcomᚋsurahmanᚋFTeXᚋpkgᚋmodelsᚋpostgresᚐUserAccount(ctx, tmp) + } + + var zeroVal *models.UserAccount + return zeroVal, nil +} // endregion ***************************** args.gotpl ***************************** @@ -206,7 +336,7 @@ func (ec *executionContext) _Mutation_registerUser(ctx context.Context, field gr ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().RegisterUser(rctx, fc.Args["input"].(*models.UserAccount)) }) @@ -269,7 +399,7 @@ func (ec *executionContext) _Mutation_deleteUser(ctx context.Context, field grap ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().DeleteUser(rctx, fc.Args["input"].(models1.HTTPDeleteUserRequest)) }) @@ -324,7 +454,7 @@ func (ec *executionContext) _Mutation_loginUser(ctx context.Context, field graph ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().LoginUser(rctx, fc.Args["input"].(models.UserLoginCredentials)) }) @@ -387,7 +517,7 @@ func (ec *executionContext) _Mutation_refreshToken(ctx context.Context, field gr ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().RefreshToken(rctx) }) @@ -439,7 +569,7 @@ func (ec *executionContext) _Mutation_openCrypto(ctx context.Context, field grap ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().OpenCrypto(rctx, fc.Args["ticker"].(string)) }) @@ -500,7 +630,7 @@ func (ec *executionContext) _Mutation_offerCrypto(ctx context.Context, field gra ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().OfferCrypto(rctx, fc.Args["input"].(models1.HTTPCryptoOfferRequest)) }) @@ -565,7 +695,7 @@ func (ec *executionContext) _Mutation_exchangeCrypto(ctx context.Context, field ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().ExchangeCrypto(rctx, fc.Args["offerID"].(string)) }) @@ -626,7 +756,7 @@ func (ec *executionContext) _Mutation_openFiat(ctx context.Context, field graphq ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().OpenFiat(rctx, fc.Args["currency"].(string)) }) @@ -687,7 +817,7 @@ func (ec *executionContext) _Mutation_depositFiat(ctx context.Context, field gra ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().DepositFiat(rctx, fc.Args["input"].(models1.HTTPDepositCurrencyRequest)) }) @@ -756,7 +886,7 @@ func (ec *executionContext) _Mutation_exchangeOfferFiat(ctx context.Context, fie ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().ExchangeOfferFiat(rctx, fc.Args["input"].(models1.HTTPExchangeOfferRequest)) }) @@ -821,7 +951,7 @@ func (ec *executionContext) _Mutation_exchangeTransferFiat(ctx context.Context, ret = graphql.Null } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().ExchangeTransferFiat(rctx, fc.Args["offerID"].(string)) }) @@ -874,10 +1004,10 @@ func (ec *executionContext) fieldContext_Mutation_exchangeTransferFiat(ctx conte // region **************************** input.gotpl ***************************** -func (ec *executionContext) unmarshalInputDeleteUserRequest(ctx context.Context, obj interface{}) (models1.HTTPDeleteUserRequest, error) { +func (ec *executionContext) unmarshalInputDeleteUserRequest(ctx context.Context, obj any) (models1.HTTPDeleteUserRequest, error) { var it models1.HTTPDeleteUserRequest - asMap := map[string]interface{}{} - for k, v := range obj.(map[string]interface{}) { + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { asMap[k] = v } @@ -915,10 +1045,10 @@ func (ec *executionContext) unmarshalInputDeleteUserRequest(ctx context.Context, return it, nil } -func (ec *executionContext) unmarshalInputUserAccount(ctx context.Context, obj interface{}) (models.UserAccount, error) { +func (ec *executionContext) unmarshalInputUserAccount(ctx context.Context, obj any) (models.UserAccount, error) { var it models.UserAccount - asMap := map[string]interface{}{} - for k, v := range obj.(map[string]interface{}) { + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { asMap[k] = v } @@ -963,10 +1093,10 @@ func (ec *executionContext) unmarshalInputUserAccount(ctx context.Context, obj i return it, nil } -func (ec *executionContext) unmarshalInputUserLoginCredentials(ctx context.Context, obj interface{}) (models.UserLoginCredentials, error) { +func (ec *executionContext) unmarshalInputUserLoginCredentials(ctx context.Context, obj any) (models.UserLoginCredentials, error) { var it models.UserLoginCredentials - asMap := map[string]interface{}{} - for k, v := range obj.(map[string]interface{}) { + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { asMap[k] = v } @@ -1128,17 +1258,17 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) // region ***************************** type.gotpl ***************************** -func (ec *executionContext) unmarshalNDeleteUserRequest2githubᚗcomᚋsurahmanᚋFTeXᚋpkgᚋmodelsᚐHTTPDeleteUserRequest(ctx context.Context, v interface{}) (models1.HTTPDeleteUserRequest, error) { +func (ec *executionContext) unmarshalNDeleteUserRequest2githubᚗcomᚋsurahmanᚋFTeXᚋpkgᚋmodelsᚐHTTPDeleteUserRequest(ctx context.Context, v any) (models1.HTTPDeleteUserRequest, error) { res, err := ec.unmarshalInputDeleteUserRequest(ctx, v) return res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) unmarshalNUserLoginCredentials2githubᚗcomᚋsurahmanᚋFTeXᚋpkgᚋmodelsᚋpostgresᚐUserLoginCredentials(ctx context.Context, v interface{}) (models.UserLoginCredentials, error) { +func (ec *executionContext) unmarshalNUserLoginCredentials2githubᚗcomᚋsurahmanᚋFTeXᚋpkgᚋmodelsᚋpostgresᚐUserLoginCredentials(ctx context.Context, v any) (models.UserLoginCredentials, error) { res, err := ec.unmarshalInputUserLoginCredentials(ctx, v) return res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) unmarshalOUserAccount2ᚖgithubᚗcomᚋsurahmanᚋFTeXᚋpkgᚋmodelsᚋpostgresᚐUserAccount(ctx context.Context, v interface{}) (*models.UserAccount, error) { +func (ec *executionContext) unmarshalOUserAccount2ᚖgithubᚗcomᚋsurahmanᚋFTeXᚋpkgᚋmodelsᚋpostgresᚐUserAccount(ctx context.Context, v any) (*models.UserAccount, error) { if v == nil { return nil, nil } diff --git a/pkg/graphql/graphql.go b/pkg/graphql/graphql.go index ceac0db1..9d8769b9 100644 --- a/pkg/graphql/graphql.go +++ b/pkg/graphql/graphql.go @@ -56,18 +56,6 @@ func NewServer(fs *afero.Fs, auth auth.Auth, postgres postgres.Postgres, redis r err } -// initialize will configure the HTTP server routes. -func (s *Server) initialize() { - s.router = gin.Default() - - // Endpoint configurations - api := s.router.Group(s.conf.Server.BasePath) - api.Use(graphql.GinContextToContextMiddleware()) - api.POST(s.conf.Server.QueryPath, - graphql.QueryHandler(s.conf.Authorization.HeaderKey, s.auth, s.cache, s.db, s.quotes, s.logger)) - api.GET(s.conf.Server.PlaygroundPath, graphql.PlaygroundHandler(s.conf.Server.BasePath, s.conf.Server.QueryPath)) -} - // Run brings the HTTP GraphQL service up. func (s *Server) Run() { // Indicate to bootstrapping thread to wait for completion. @@ -121,3 +109,15 @@ func (s *Server) Run() { s.logger.Info("GraphQL server exited") } + +// initialize will configure the HTTP server routes. +func (s *Server) initialize() { + s.router = gin.Default() + + // Endpoint configurations + api := s.router.Group(s.conf.Server.BasePath) + api.Use(graphql.GinContextToContextMiddleware()) + api.POST(s.conf.Server.QueryPath, + graphql.QueryHandler(s.conf.Authorization.HeaderKey, s.auth, s.cache, s.db, s.quotes, s.logger)) + api.GET(s.conf.Server.PlaygroundPath, graphql.PlaygroundHandler(s.conf.Server.BasePath, s.conf.Server.QueryPath)) +} diff --git a/pkg/graphql/resolvers/authorization_test.go b/pkg/graphql/resolvers/authorization_test.go index b73f0a47..7517f984 100644 --- a/pkg/graphql/resolvers/authorization_test.go +++ b/pkg/graphql/resolvers/authorization_test.go @@ -26,16 +26,16 @@ func TestGinContextFromContext(t *testing.T) { name: "no context", expectedMsg: "information not found", expectErr: require.Error, - ctx: context.TODO(), + ctx: t.Context(), }, { name: "incorrect context", expectedMsg: "information malformed", expectErr: require.Error, - ctx: context.WithValue(context.TODO(), GinContextKey{}, context.TODO()), + ctx: context.WithValue(t.Context(), GinContextKey{}, t.Context()), }, { name: "success", expectErr: require.NoError, - ctx: context.WithValue(context.TODO(), GinContextKey{}, &gin.Context{}), + ctx: context.WithValue(t.Context(), GinContextKey{}, &gin.Context{}), }, } @@ -79,7 +79,7 @@ func TestAuthorizationCheck(t *testing.T) { name: "no context", expectedMsg: "information not found", expectErr: require.Error, - ctx: context.TODO(), + ctx: t.Context(), authValidateJWTErr: nil, authValidateJWTTimes: 0, isDeletedError: nil, @@ -89,7 +89,7 @@ func TestAuthorizationCheck(t *testing.T) { name: "incorrect context", expectedMsg: "information malformed", expectErr: require.Error, - ctx: context.WithValue(context.TODO(), GinContextKey{}, context.TODO()), + ctx: context.WithValue(t.Context(), GinContextKey{}, t.Context()), authValidateJWTErr: nil, authValidateJWTTimes: 0, isDeletedError: nil, @@ -99,7 +99,7 @@ func TestAuthorizationCheck(t *testing.T) { name: "no token", expectedMsg: "does not contain", expectErr: require.Error, - ctx: context.WithValue(context.TODO(), GinContextKey{}, ginCtxNoAuth), + ctx: context.WithValue(t.Context(), GinContextKey{}, ginCtxNoAuth), authValidateJWTErr: nil, authValidateJWTTimes: 0, isDeletedError: nil, @@ -109,7 +109,7 @@ func TestAuthorizationCheck(t *testing.T) { name: "bad token", expectedMsg: "failed to authenticate token", expectErr: require.Error, - ctx: context.WithValue(context.TODO(), GinContextKey{}, ginCtxAuth), + ctx: context.WithValue(t.Context(), GinContextKey{}, ginCtxAuth), authValidateJWTErr: errors.New("failed to authenticate token"), authValidateJWTTimes: 1, isDeletedError: nil, @@ -118,7 +118,7 @@ func TestAuthorizationCheck(t *testing.T) { }, { name: "db failure", expectErr: require.Error, - ctx: context.WithValue(context.TODO(), GinContextKey{}, ginCtxAuth), + ctx: context.WithValue(t.Context(), GinContextKey{}, ginCtxAuth), authValidateJWTErr: nil, authValidateJWTTimes: 1, isDeletedError: errors.New("db failure"), @@ -127,7 +127,7 @@ func TestAuthorizationCheck(t *testing.T) { }, { name: "deleted user", expectErr: require.Error, - ctx: context.WithValue(context.TODO(), GinContextKey{}, ginCtxAuth), + ctx: context.WithValue(t.Context(), GinContextKey{}, ginCtxAuth), authValidateJWTErr: nil, authValidateJWTTimes: 1, isDeletedError: nil, @@ -136,7 +136,7 @@ func TestAuthorizationCheck(t *testing.T) { }, { name: "success", expectErr: require.NoError, - ctx: context.WithValue(context.TODO(), GinContextKey{}, ginCtxAuth), + ctx: context.WithValue(t.Context(), GinContextKey{}, ginCtxAuth), authValidateJWTErr: nil, authValidateJWTTimes: 1, isDeletedError: nil, diff --git a/pkg/graphql/resolvers/common.resolvers.go b/pkg/graphql/resolvers/common.resolvers.go index 4e10ba3a..978dde39 100644 --- a/pkg/graphql/resolvers/common.resolvers.go +++ b/pkg/graphql/resolvers/common.resolvers.go @@ -2,7 +2,7 @@ package graphql // This file will be automatically regenerated based on the schema, any resolver implementations // will be copied through when generating and any unknown code will be moved to the end. -// Code generated by github.com/99designs/gqlgen version v0.17.49 +// Code generated by github.com/99designs/gqlgen version v0.17.73 import ( "context" diff --git a/pkg/graphql/resolvers/common.resolvers_test.go b/pkg/graphql/resolvers/common.resolvers_test.go index 1b9f6439..386c4c6e 100644 --- a/pkg/graphql/resolvers/common.resolvers_test.go +++ b/pkg/graphql/resolvers/common.resolvers_test.go @@ -1,7 +1,6 @@ package graphql import ( - "context" "testing" "github.com/gofrs/uuid" @@ -32,7 +31,7 @@ func TestResolver_PriceQuoteResolvers(t *testing.T) { t.Run("Client ID", func(t *testing.T) { t.Parallel() - result, err := resolver.ClientID(context.TODO(), priceQuote) + result, err := resolver.ClientID(t.Context(), priceQuote) require.NoError(t, err, "failed to resolve client id.") require.Equal(t, clientID.String(), result, "client id mismatched.") }) @@ -40,7 +39,7 @@ func TestResolver_PriceQuoteResolvers(t *testing.T) { t.Run("Rate", func(t *testing.T) { t.Parallel() - result, err := resolver.Rate(context.TODO(), priceQuote) + result, err := resolver.Rate(t.Context(), priceQuote) require.NoError(t, err, "failed to resolve rate.") require.InDelta(t, rate.InexactFloat64(), result, 0.0001, "rate mismatched.") }) @@ -48,7 +47,7 @@ func TestResolver_PriceQuoteResolvers(t *testing.T) { t.Run("Amount", func(t *testing.T) { t.Parallel() - result, err := resolver.Amount(context.TODO(), priceQuote) + result, err := resolver.Amount(t.Context(), priceQuote) require.NoError(t, err, "failed to resolve amount.") require.InDelta(t, amount.InexactFloat64(), result, 0.0001, "amount mismatched.") }) diff --git a/pkg/graphql/resolvers/crypto.resolvers.go b/pkg/graphql/resolvers/crypto.resolvers.go index da6bd8b1..42d098b9 100644 --- a/pkg/graphql/resolvers/crypto.resolvers.go +++ b/pkg/graphql/resolvers/crypto.resolvers.go @@ -2,7 +2,7 @@ package graphql // This file will be automatically regenerated based on the schema, any resolver implementations // will be copied through when generating and any unknown code will be moved to the end. -// Code generated by github.com/99designs/gqlgen version v0.17.49 +// Code generated by github.com/99designs/gqlgen version v0.17.73 import ( "context" diff --git a/pkg/graphql/resolvers/crypto.resolvers_test.go b/pkg/graphql/resolvers/crypto.resolvers_test.go index b35e3d34..86097fad 100644 --- a/pkg/graphql/resolvers/crypto.resolvers_test.go +++ b/pkg/graphql/resolvers/crypto.resolvers_test.go @@ -2,7 +2,6 @@ package graphql import ( "bytes" - "context" "encoding/json" "errors" "fmt" @@ -124,7 +123,7 @@ func TestCryptoResolver_OpenCrypto(t *testing.T) { router.Use(GinContextToContextMiddleware()) router.POST(test.path, QueryHandler(testAuthHeaderKey, mockAuth, mockRedis, mockPostgres, mockQuotes, zapLogger)) - req, _ := http.NewRequestWithContext(context.TODO(), http.MethodPost, test.path, + req, _ := http.NewRequestWithContext(t.Context(), http.MethodPost, test.path, bytes.NewBufferString(test.query)) req.Header.Set("Content-Type", "application/json") req.Header.Set("Authorization", "some valid auth token goes here") @@ -160,7 +159,7 @@ func TestCryptoResolver_CryptoOfferRequestResolver(t *testing.T) { t.Run("SourceAmount", func(t *testing.T) { t.Parallel() - err := resolver.SourceAmount(context.TODO(), &input, sourceFloat) + err := resolver.SourceAmount(t.Context(), &input, sourceFloat) require.NoError(t, err, "source amount should always return a nil error.") require.Equal(t, sourceAmount, input.SourceAmount, "source amounts mismatched.") }) @@ -426,7 +425,7 @@ func TestCryptoResolver_OfferCrypto(t *testing.T) { //nolint:maintidx router.Use(GinContextToContextMiddleware()) router.POST(test.path, QueryHandler(testAuthHeaderKey, mockAuth, mockRedis, mockPostgres, mockQuotes, zapLogger)) - req, _ := http.NewRequestWithContext(context.TODO(), http.MethodPost, test.path, + req, _ := http.NewRequestWithContext(t.Context(), http.MethodPost, test.path, bytes.NewBufferString(test.query)) req.Header.Set("Content-Type", "application/json") req.Header.Set("Authorization", "some valid auth token goes here") @@ -471,7 +470,7 @@ func TestCryptoResolver_CryptoJournalResolver(t *testing.T) { t.Run("Amount", func(t *testing.T) { t.Parallel() - result, err := resolver.Amount(context.TODO(), obj) + result, err := resolver.Amount(t.Context(), obj) require.NoError(t, err, "failed to resolve amount.") require.InDelta(t, obj.Amount.InexactFloat64(), result, 0.01, "amount mismatched.") }) @@ -479,7 +478,7 @@ func TestCryptoResolver_CryptoJournalResolver(t *testing.T) { t.Run("TransactedAt", func(t *testing.T) { t.Parallel() - result, err := resolver.TransactedAt(context.TODO(), obj) + result, err := resolver.TransactedAt(t.Context(), obj) require.NoError(t, err, "failed to resolve transacted at.") require.Equal(t, obj.TransactedAt.Time.String(), result, "transacted at mismatched.") }) @@ -487,7 +486,7 @@ func TestCryptoResolver_CryptoJournalResolver(t *testing.T) { t.Run("ClientID", func(t *testing.T) { t.Parallel() - result, err := resolver.ClientID(context.TODO(), obj) + result, err := resolver.ClientID(t.Context(), obj) require.NoError(t, err, "failed to resolve client id") require.Equal(t, obj.ClientID.String(), result, "client id mismatched.") }) @@ -495,7 +494,7 @@ func TestCryptoResolver_CryptoJournalResolver(t *testing.T) { t.Run("TxID", func(t *testing.T) { t.Parallel() - result, err := resolver.TxID(context.TODO(), obj) + result, err := resolver.TxID(t.Context(), obj) require.NoError(t, err, "failed to resolve tx id") require.Equal(t, obj.TxID.String(), result, "client tx mismatched.") }) @@ -698,7 +697,7 @@ func TestCryptoResolver_ExchangeCrypto(t *testing.T) { router.Use(GinContextToContextMiddleware()) router.POST(test.path, QueryHandler(testAuthHeaderKey, mockAuth, mockRedis, mockPostgres, mockQuotes, zapLogger)) - req, _ := http.NewRequestWithContext(context.TODO(), http.MethodPost, test.path, + req, _ := http.NewRequestWithContext(t.Context(), http.MethodPost, test.path, bytes.NewBufferString(test.query)) req.Header.Set("Content-Type", "application/json") req.Header.Set("Authorization", "some valid auth token goes here") @@ -749,7 +748,7 @@ func TestCryptoResolver_CryptoAccountResolver(t *testing.T) { t.Run("Balance", func(t *testing.T) { t.Parallel() - result, err := resolver.Balance(context.TODO(), obj) + result, err := resolver.Balance(t.Context(), obj) require.NoError(t, err, "failed to resolve balance.") require.InDelta(t, obj.Balance.InexactFloat64(), result, 0.01, "balance mismatched.") }) @@ -757,7 +756,7 @@ func TestCryptoResolver_CryptoAccountResolver(t *testing.T) { t.Run("LastTx", func(t *testing.T) { t.Parallel() - result, err := resolver.LastTx(context.TODO(), obj) + result, err := resolver.LastTx(t.Context(), obj) require.NoError(t, err, "failed to resolve last tx.") require.InDelta(t, obj.LastTx.InexactFloat64(), result, 0.01, "last tx mismatched.") }) @@ -765,7 +764,7 @@ func TestCryptoResolver_CryptoAccountResolver(t *testing.T) { t.Run("LastTxTs", func(t *testing.T) { t.Parallel() - result, err := resolver.LastTxTs(context.TODO(), obj) + result, err := resolver.LastTxTs(t.Context(), obj) require.NoError(t, err, "failed to resolve LastTxTs.") require.Equal(t, obj.LastTxTs.Time.String(), result, "LastTxTs mismatched.") }) @@ -773,7 +772,7 @@ func TestCryptoResolver_CryptoAccountResolver(t *testing.T) { t.Run("CreatedAt", func(t *testing.T) { t.Parallel() - result, err := resolver.CreatedAt(context.TODO(), obj) + result, err := resolver.CreatedAt(t.Context(), obj) require.NoError(t, err, "failed to resolve CreatedAt.") require.Equal(t, obj.CreatedAt.Time.String(), result, "CreatedAt mismatched.") }) @@ -781,7 +780,7 @@ func TestCryptoResolver_CryptoAccountResolver(t *testing.T) { t.Run("ClientID", func(t *testing.T) { t.Parallel() - result, err := resolver.ClientID(context.TODO(), obj) + result, err := resolver.ClientID(t.Context(), obj) require.NoError(t, err, "failed to resolve client id") require.Equal(t, obj.ClientID.String(), result, "client id mismatched.") }) @@ -899,7 +898,7 @@ func TestCryptoResolver_BalanceCrypto(t *testing.T) { router.Use(GinContextToContextMiddleware()) router.POST(test.path, QueryHandler(testAuthHeaderKey, mockAuth, mockRedis, mockPostgres, mockQuotes, zapLogger)) - req, _ := http.NewRequestWithContext(context.TODO(), http.MethodPost, test.path, + req, _ := http.NewRequestWithContext(t.Context(), http.MethodPost, test.path, bytes.NewBufferString(test.query)) req.Header.Set("Content-Type", "application/json") req.Header.Set("Authorization", "some valid auth token goes here") @@ -1159,7 +1158,7 @@ func TestCryptoResolver_BalanceAllCrypto(t *testing.T) { router.Use(GinContextToContextMiddleware()) router.POST(test.path, QueryHandler(testAuthHeaderKey, mockAuth, mockRedis, mockPostgres, mockQuotes, zapLogger)) - req, _ := http.NewRequestWithContext(context.TODO(), http.MethodPost, test.path, + req, _ := http.NewRequestWithContext(t.Context(), http.MethodPost, test.path, bytes.NewBufferString(test.query)) req.Header.Set("Content-Type", "application/json") req.Header.Set("Authorization", "some valid auth token goes here") @@ -1318,7 +1317,7 @@ func TestCryptoResolver_TransactionDetailsCrypto(t *testing.T) { //nolint:dupl router.Use(GinContextToContextMiddleware()) router.POST(test.path, QueryHandler(testAuthHeaderKey, mockAuth, mockRedis, mockPostgres, mockQuotes, zapLogger)) - req, _ := http.NewRequestWithContext(context.TODO(), http.MethodPost, test.path, + req, _ := http.NewRequestWithContext(t.Context(), http.MethodPost, test.path, bytes.NewBufferString(test.query)) req.Header.Set("Content-Type", "application/json") req.Header.Set("Authorization", "some valid auth token goes here") @@ -1348,7 +1347,7 @@ func TestFiatResolver_CryptoTransactionsPaginatedResolver(t *testing.T) { transactions := &models.HTTPCryptoTransactionsPaginated{} - actual, err := resolver.Transactions(context.TODO(), transactions) + actual, err := resolver.Transactions(t.Context(), transactions) require.NoError(t, err, "error should always be nil.") require.Equal(t, transactions.TransactionDetails, actual, "actual and returned addresses do not match.") } @@ -1570,7 +1569,7 @@ func TestCryptoResolver_TransactionDetailsAllCrypto(t *testing.T) { router.Use(GinContextToContextMiddleware()) router.POST(test.path, QueryHandler(testAuthHeaderKey, mockAuth, mockRedis, mockPostgres, mockQuotes, zapLogger)) - req, _ := http.NewRequestWithContext(context.TODO(), http.MethodPost, test.path, + req, _ := http.NewRequestWithContext(t.Context(), http.MethodPost, test.path, bytes.NewBufferString(test.query)) req.Header.Set("Content-Type", "application/json") req.Header.Set("Authorization", "some valid auth token goes here") diff --git a/pkg/graphql/resolvers/fiat.resolvers.go b/pkg/graphql/resolvers/fiat.resolvers.go index dde00423..1baa9a50 100644 --- a/pkg/graphql/resolvers/fiat.resolvers.go +++ b/pkg/graphql/resolvers/fiat.resolvers.go @@ -2,7 +2,7 @@ package graphql // This file will be automatically regenerated based on the schema, any resolver implementations // will be copied through when generating and any unknown code will be moved to the end. -// Code generated by github.com/99designs/gqlgen version v0.17.49 +// Code generated by github.com/99designs/gqlgen version v0.17.73 import ( "context" diff --git a/pkg/graphql/resolvers/fiat.resolvers_test.go b/pkg/graphql/resolvers/fiat.resolvers_test.go index ebcfd97d..9ad5d6e5 100644 --- a/pkg/graphql/resolvers/fiat.resolvers_test.go +++ b/pkg/graphql/resolvers/fiat.resolvers_test.go @@ -2,7 +2,6 @@ package graphql import ( "bytes" - "context" "encoding/json" "errors" "fmt" @@ -137,7 +136,7 @@ func TestFiatResolver_OpenFiat(t *testing.T) { router.Use(GinContextToContextMiddleware()) router.POST(test.path, QueryHandler(testAuthHeaderKey, mockAuth, mockRedis, mockPostgres, mockQuotes, zapLogger)) - req, _ := http.NewRequestWithContext(context.TODO(), http.MethodPost, test.path, + req, _ := http.NewRequestWithContext(t.Context(), http.MethodPost, test.path, bytes.NewBufferString(test.query)) req.Header.Set("Content-Type", "application/json") req.Header.Set("Authorization", "some valid auth token goes here") @@ -192,7 +191,7 @@ func TestFiatResolver_FiatDepositResponseResolvers(t *testing.T) { t.Run("TxID", func(t *testing.T) { t.Parallel() - result, err := resolver.TxID(context.TODO(), input) + result, err := resolver.TxID(t.Context(), input) require.NoError(t, err, "failed to resolve tx id.") require.Equal(t, txID.String(), result, "tx id mismatched.") }) @@ -200,7 +199,7 @@ func TestFiatResolver_FiatDepositResponseResolvers(t *testing.T) { t.Run("ClientID", func(t *testing.T) { t.Parallel() - result, err := resolver.ClientID(context.TODO(), input) + result, err := resolver.ClientID(t.Context(), input) require.NoError(t, err, "failed to resolve client id.") require.Equal(t, clientID.String(), result, "client id mismatched.") }) @@ -208,7 +207,7 @@ func TestFiatResolver_FiatDepositResponseResolvers(t *testing.T) { t.Run("TxTimestamp", func(t *testing.T) { t.Parallel() - result, err := resolver.TxTimestamp(context.TODO(), input) + result, err := resolver.TxTimestamp(t.Context(), input) require.NoError(t, err, "failed to resolve tx timestamp.") require.Equal(t, txTS.Time.String(), result, "tx timestamp mismatched.") }) @@ -216,7 +215,7 @@ func TestFiatResolver_FiatDepositResponseResolvers(t *testing.T) { t.Run("Balance", func(t *testing.T) { t.Parallel() - result, err := resolver.Balance(context.TODO(), input) + result, err := resolver.Balance(t.Context(), input) require.NoError(t, err, "failed to resolve balance") require.Equal(t, balance.String(), result, "balance mismatched.") }) @@ -224,7 +223,7 @@ func TestFiatResolver_FiatDepositResponseResolvers(t *testing.T) { t.Run("LastTx", func(t *testing.T) { t.Parallel() - result, err := resolver.LastTx(context.TODO(), input) + result, err := resolver.LastTx(t.Context(), input) require.NoError(t, err, "failed to resolve lastTx") require.Equal(t, lastTx.String(), result, "lastTx mismatched.") }) @@ -232,7 +231,7 @@ func TestFiatResolver_FiatDepositResponseResolvers(t *testing.T) { t.Run("Currency", func(t *testing.T) { t.Parallel() - result, err := resolver.Currency(context.TODO(), input) + result, err := resolver.Currency(t.Context(), input) require.NoError(t, err, "failed to resolve currency") require.Equal(t, "USD", result, "currency mismatched.") }) @@ -362,7 +361,7 @@ func TestFiatResolver_DepositFiat(t *testing.T) { router.Use(GinContextToContextMiddleware()) router.POST(test.path, QueryHandler(testAuthHeaderKey, mockAuth, mockRedis, mockPostgres, mockQuotes, zapLogger)) - req, _ := http.NewRequestWithContext(context.TODO(), http.MethodPost, test.path, + req, _ := http.NewRequestWithContext(t.Context(), http.MethodPost, test.path, bytes.NewBufferString(test.query)) req.Header.Set("Content-Type", "application/json") req.Header.Set("Authorization", "some valid auth token goes here") @@ -400,7 +399,7 @@ func TestFiatResolver_FiatExchangeOfferRequestResolver(t *testing.T) { t.Run("SourceAmount", func(t *testing.T) { t.Parallel() - err := resolver.SourceAmount(context.TODO(), exchangeOfferRequest, expected) + err := resolver.SourceAmount(t.Context(), exchangeOfferRequest, expected) require.NoError(t, err, "failed to resolve debit amount") require.InDelta(t, expected, exchangeOfferRequest.SourceAmount.InexactFloat64(), 0.01, "debit amount mismatched.") }) @@ -423,7 +422,7 @@ func TestFiatResolver_OfferResponseResolver(t *testing.T) { t.Run("DebitAmount", func(t *testing.T) { t.Parallel() - result, err := resolver.DebitAmount(context.TODO(), exchangeOfferResponse) + result, err := resolver.DebitAmount(t.Context(), exchangeOfferResponse) require.NoError(t, err, "failed to resolve debit amount") require.InDelta(t, debitAmount.InexactFloat64(), result, 0.01, "debit amount mismatched.") }) @@ -672,7 +671,7 @@ func TestFiatResolver_ExchangeOfferFiat(t *testing.T) { //nolint:maintidx router.Use(GinContextToContextMiddleware()) router.POST(test.path, QueryHandler(testAuthHeaderKey, mockAuth, mockRedis, mockPostgres, mockQuotes, zapLogger)) - req, _ := http.NewRequestWithContext(context.TODO(), http.MethodPost, test.path, + req, _ := http.NewRequestWithContext(t.Context(), http.MethodPost, test.path, bytes.NewBufferString(test.query)) req.Header.Set("Content-Type", "application/json") req.Header.Set("Authorization", "some valid auth token goes here") @@ -719,11 +718,11 @@ func TestFiatResolver_FiatExchangeTransferResponseResolver(t *testing.T) { }, } - source, err := resolver.SourceReceipt(context.TODO(), response) + source, err := resolver.SourceReceipt(t.Context(), response) require.NoError(t, err, "source should always return a nil error.") require.Equal(t, response.SrcTxReceipt, source, "source and returned struct addresses mismatched.") - destination, err := resolver.SourceReceipt(context.TODO(), response) + destination, err := resolver.SourceReceipt(t.Context(), response) require.NoError(t, err, "destinations should always return a nil error.") require.Equal(t, response.DstTxReceipt, destination, "destination and returned struct addresses mismatched.") } @@ -1049,7 +1048,7 @@ func TestFiatResolver_ExchangeTransferFiat(t *testing.T) { //nolint:maintidx router.Use(GinContextToContextMiddleware()) router.POST(test.path, QueryHandler(testAuthHeaderKey, mockAuth, mockRedis, mockPostgres, mockQuotes, zapLogger)) - req, _ := http.NewRequestWithContext(context.TODO(), http.MethodPost, test.path, + req, _ := http.NewRequestWithContext(t.Context(), http.MethodPost, test.path, bytes.NewBufferString(test.query)) req.Header.Set("Content-Type", "application/json") req.Header.Set("Authorization", "some valid auth token goes here") @@ -1103,7 +1102,7 @@ func TestFiatResolver_FiatAccountResolvers(t *testing.T) { t.Run("Currency", func(t *testing.T) { t.Parallel() - result, err := resolver.Currency(context.TODO(), fiatAccount) + result, err := resolver.Currency(t.Context(), fiatAccount) require.NoError(t, err, "failed to resolve currency") require.Equal(t, "USD", result, "currency mismatched.") }) @@ -1111,7 +1110,7 @@ func TestFiatResolver_FiatAccountResolvers(t *testing.T) { t.Run("BalanceAmount", func(t *testing.T) { t.Parallel() - result, err := resolver.Balance(context.TODO(), fiatAccount) + result, err := resolver.Balance(t.Context(), fiatAccount) require.NoError(t, err, "failed to resolve balance amount") require.InDelta(t, balanceAmount.InexactFloat64(), result, 0.01, "balance amount mismatched.") }) @@ -1119,7 +1118,7 @@ func TestFiatResolver_FiatAccountResolvers(t *testing.T) { t.Run("LastTxAmount", func(t *testing.T) { t.Parallel() - result, err := resolver.LastTx(context.TODO(), fiatAccount) + result, err := resolver.LastTx(t.Context(), fiatAccount) require.NoError(t, err, "failed to resolve lastTx amount") require.InDelta(t, lastTxAmount.InexactFloat64(), result, 0.01, "lastTx amount mismatched.") }) @@ -1127,7 +1126,7 @@ func TestFiatResolver_FiatAccountResolvers(t *testing.T) { t.Run("LastTxTS", func(t *testing.T) { t.Parallel() - result, err := resolver.LastTxTs(context.TODO(), fiatAccount) + result, err := resolver.LastTxTs(t.Context(), fiatAccount) require.NoError(t, err, "failed to resolve lastTx timestamp") require.Equal(t, lastTxTS.String(), result, "lastTx timestamp mismatched.") }) @@ -1135,7 +1134,7 @@ func TestFiatResolver_FiatAccountResolvers(t *testing.T) { t.Run("CreatedAtTS", func(t *testing.T) { t.Parallel() - result, err := resolver.CreatedAt(context.TODO(), fiatAccount) + result, err := resolver.CreatedAt(t.Context(), fiatAccount) require.NoError(t, err, "failed to resolve created at timestamp.") require.Equal(t, createdAt.String(), result, "created at timestamp mismatched.") }) @@ -1261,7 +1260,7 @@ func TestFiatResolver_BalanceFiat(t *testing.T) { router.Use(GinContextToContextMiddleware()) router.POST(test.path, QueryHandler(testAuthHeaderKey, mockAuth, mockRedis, mockPostgres, mockQuotes, zapLogger)) - req, _ := http.NewRequestWithContext(context.TODO(), http.MethodPost, test.path, + req, _ := http.NewRequestWithContext(t.Context(), http.MethodPost, test.path, bytes.NewBufferString(test.query)) req.Header.Set("Content-Type", "application/json") req.Header.Set("Authorization", "some valid auth token goes here") @@ -1521,7 +1520,7 @@ func TestFiatResolver_BalanceAllFiat(t *testing.T) { router.Use(GinContextToContextMiddleware()) router.POST(test.path, QueryHandler(testAuthHeaderKey, mockAuth, mockRedis, mockPostgres, mockQuotes, zapLogger)) - req, _ := http.NewRequestWithContext(context.TODO(), http.MethodPost, test.path, + req, _ := http.NewRequestWithContext(t.Context(), http.MethodPost, test.path, bytes.NewBufferString(test.query)) req.Header.Set("Content-Type", "application/json") req.Header.Set("Authorization", "some valid auth token goes here") @@ -1572,7 +1571,7 @@ func TestFiatResolver_FiatJournalResolvers(t *testing.T) { t.Run("Currency", func(t *testing.T) { t.Parallel() - result, err := resolver.Currency(context.TODO(), fiatJournal) + result, err := resolver.Currency(t.Context(), fiatJournal) require.NoError(t, err, "failed to resolve currency") require.Equal(t, string(postgres.CurrencyUSD), result, "currency mismatched.") }) @@ -1580,7 +1579,7 @@ func TestFiatResolver_FiatJournalResolvers(t *testing.T) { t.Run("Amount", func(t *testing.T) { t.Parallel() - result, err := resolver.Amount(context.TODO(), fiatJournal) + result, err := resolver.Amount(t.Context(), fiatJournal) require.NoError(t, err, "failed to resolve amount") require.InDeltaf(t, amount.InexactFloat64(), result, 0.01, "amount mismatched.") }) @@ -1588,7 +1587,7 @@ func TestFiatResolver_FiatJournalResolvers(t *testing.T) { t.Run("TransactedAt", func(t *testing.T) { t.Parallel() - result, err := resolver.TransactedAt(context.TODO(), fiatJournal) + result, err := resolver.TransactedAt(t.Context(), fiatJournal) require.NoError(t, err, "failed to resolve transacted at timestamp.") require.Equal(t, timestamp.String(), result, "transacted at timestamp mismatched.") }) @@ -1596,7 +1595,7 @@ func TestFiatResolver_FiatJournalResolvers(t *testing.T) { t.Run("ClientID", func(t *testing.T) { t.Parallel() - result, err := resolver.ClientID(context.TODO(), fiatJournal) + result, err := resolver.ClientID(t.Context(), fiatJournal) require.NoError(t, err, "failed to resolve client id.") require.Equal(t, clientID.String(), result, "client id mismatched.") }) @@ -1604,7 +1603,7 @@ func TestFiatResolver_FiatJournalResolvers(t *testing.T) { t.Run("TxID", func(t *testing.T) { t.Parallel() - result, err := resolver.TxID(context.TODO(), fiatJournal) + result, err := resolver.TxID(t.Context(), fiatJournal) require.NoError(t, err, "failed to resolve tx id.") require.Equal(t, txID.String(), result, "tx id mismatched.") }) @@ -1746,7 +1745,7 @@ func TestFiatResolver_TransactionDetailsFiat(t *testing.T) { //nolint:dupl router.Use(GinContextToContextMiddleware()) router.POST(test.path, QueryHandler(testAuthHeaderKey, mockAuth, mockRedis, mockPostgres, mockQuotes, zapLogger)) - req, _ := http.NewRequestWithContext(context.TODO(), http.MethodPost, test.path, + req, _ := http.NewRequestWithContext(t.Context(), http.MethodPost, test.path, bytes.NewBufferString(test.query)) req.Header.Set("Content-Type", "application/json") req.Header.Set("Authorization", "some valid auth token goes here") @@ -2004,7 +2003,7 @@ func TestFiatResolver_TransactionDetailsAllFiat(t *testing.T) { router.Use(GinContextToContextMiddleware()) router.POST(test.path, QueryHandler(testAuthHeaderKey, mockAuth, mockRedis, mockPostgres, mockQuotes, zapLogger)) - req, _ := http.NewRequestWithContext(context.TODO(), http.MethodPost, test.path, + req, _ := http.NewRequestWithContext(t.Context(), http.MethodPost, test.path, bytes.NewBufferString(test.query)) req.Header.Set("Content-Type", "application/json") req.Header.Set("Authorization", "some valid auth token goes here") @@ -2034,7 +2033,7 @@ func TestFiatResolver_FiatTransactionsPaginatedResolver(t *testing.T) { transactions := &models.HTTPFiatTransactionsPaginated{} - actual, err := resolver.Transactions(context.TODO(), transactions) + actual, err := resolver.Transactions(t.Context(), transactions) require.NoError(t, err, "error should always be nil.") require.Equal(t, transactions.TransactionDetails, actual, "actual and returned addresses do not match.") } diff --git a/pkg/graphql/resolvers/handlers_test.go b/pkg/graphql/resolvers/handlers_test.go index ec100013..bce370b3 100644 --- a/pkg/graphql/resolvers/handlers_test.go +++ b/pkg/graphql/resolvers/handlers_test.go @@ -1,7 +1,6 @@ package graphql import ( - "context" "net/http" "net/http/httptest" "testing" @@ -36,7 +35,7 @@ func TestGinContextToContextMiddleware(t *testing.T) { router := gin.Default() router.POST("/middleware-test", GinContextToContextMiddleware()) - req, _ := http.NewRequestWithContext(context.TODO(), http.MethodPost, "/middleware-test", nil) + req, _ := http.NewRequestWithContext(t.Context(), http.MethodPost, "/middleware-test", nil) w := httptest.NewRecorder() router.ServeHTTP(w, req) diff --git a/pkg/graphql/resolvers/healthcheck.resolvers.go b/pkg/graphql/resolvers/healthcheck.resolvers.go index 91111fe9..b1432496 100644 --- a/pkg/graphql/resolvers/healthcheck.resolvers.go +++ b/pkg/graphql/resolvers/healthcheck.resolvers.go @@ -2,7 +2,7 @@ package graphql // This file will be automatically regenerated based on the schema, any resolver implementations // will be copied through when generating and any unknown code will be moved to the end. -// Code generated by github.com/99designs/gqlgen version v0.17.49 +// Code generated by github.com/99designs/gqlgen version v0.17.73 import ( "context" diff --git a/pkg/graphql/resolvers/healthcheck.resolvers_test.go b/pkg/graphql/resolvers/healthcheck.resolvers_test.go index 828f1da2..f70f5d11 100644 --- a/pkg/graphql/resolvers/healthcheck.resolvers_test.go +++ b/pkg/graphql/resolvers/healthcheck.resolvers_test.go @@ -2,7 +2,6 @@ package graphql import ( "bytes" - "context" "encoding/json" "net/http" "net/http/httptest" @@ -90,7 +89,7 @@ func TestQueryResolver_Healthcheck(t *testing.T) { router := gin.Default() router.POST(test.path, QueryHandler(testAuthHeaderKey, mockAuth, mockRedis, mockPostgres, mockQuotes, zapLogger)) - req, _ := http.NewRequestWithContext(context.TODO(), http.MethodPost, test.path, bytes.NewBufferString(query)) + req, _ := http.NewRequestWithContext(t.Context(), http.MethodPost, test.path, bytes.NewBufferString(query)) req.Header.Set("Content-Type", "application/json") recorder := httptest.NewRecorder() diff --git a/pkg/graphql/resolvers/user.resolvers.go b/pkg/graphql/resolvers/user.resolvers.go index d09ef9be..0f87febb 100644 --- a/pkg/graphql/resolvers/user.resolvers.go +++ b/pkg/graphql/resolvers/user.resolvers.go @@ -2,7 +2,7 @@ package graphql // This file will be automatically regenerated based on the schema, any resolver implementations // will be copied through when generating and any unknown code will be moved to the end. -// Code generated by github.com/99designs/gqlgen version v0.17.49 +// Code generated by github.com/99designs/gqlgen version v0.17.73 import ( "context" diff --git a/pkg/graphql/resolvers/user.resolvers_test.go b/pkg/graphql/resolvers/user.resolvers_test.go index 721ecd4b..c05203d8 100644 --- a/pkg/graphql/resolvers/user.resolvers_test.go +++ b/pkg/graphql/resolvers/user.resolvers_test.go @@ -2,7 +2,6 @@ package graphql import ( "bytes" - "context" "encoding/json" "errors" "fmt" @@ -131,7 +130,7 @@ func TestUserResolver_RegisterUser(t *testing.T) { router := gin.Default() router.POST(test.path, QueryHandler(testAuthHeaderKey, mockAuth, mockRedis, mockPostgres, mockQuotes, zapLogger)) - req, _ := http.NewRequestWithContext(context.TODO(), http.MethodPost, test.path, bytes.NewBufferString(test.user)) + req, _ := http.NewRequestWithContext(t.Context(), http.MethodPost, test.path, bytes.NewBufferString(test.user)) req.Header.Set("Content-Type", "application/json") recorder := httptest.NewRecorder() @@ -417,7 +416,7 @@ func TestUserResolver_DeleteUser(t *testing.T) { //nolint:maintidx router.Use(GinContextToContextMiddleware()) router.POST(test.path, QueryHandler(testAuthHeaderKey, mockAuth, mockRedis, mockPostgres, mockQuotes, zapLogger)) - req, _ := http.NewRequestWithContext(context.TODO(), http.MethodPost, test.path, bytes.NewBufferString(test.query)) + req, _ := http.NewRequestWithContext(t.Context(), http.MethodPost, test.path, bytes.NewBufferString(test.query)) req.Header.Set("Content-Type", "application/json") req.Header.Set("Authorization", authToken) @@ -553,7 +552,7 @@ func TestUserResolver_LoginUser(t *testing.T) { router := gin.Default() router.POST(test.path, QueryHandler(testAuthHeaderKey, mockAuth, mockRedis, mockPostgres, mockQuotes, zapLogger)) - req, _ := http.NewRequestWithContext(context.TODO(), http.MethodPost, test.path, bytes.NewBufferString(test.user)) + req, _ := http.NewRequestWithContext(t.Context(), http.MethodPost, test.path, bytes.NewBufferString(test.user)) req.Header.Set("Content-Type", "application/json") recorder := httptest.NewRecorder() @@ -807,7 +806,7 @@ func TestUserResolver_RefreshToken(t *testing.T) { router.Use(GinContextToContextMiddleware()) router.POST(test.path, QueryHandler(testAuthHeaderKey, mockAuth, mockRedis, mockPostgres, mockQuotes, zapLogger)) - req, _ := http.NewRequestWithContext(context.TODO(), http.MethodPost, test.path, + req, _ := http.NewRequestWithContext(t.Context(), http.MethodPost, test.path, bytes.NewBufferString(testUserQuery["refresh"])) req.Header.Set("Content-Type", "application/json") req.Header.Set("Authorization", "some valid auth token goes here") diff --git a/pkg/logger/logger.go b/pkg/logger/logger.go index c1cd8c5a..f6d99120 100644 --- a/pkg/logger/logger.go +++ b/pkg/logger/logger.go @@ -22,6 +22,25 @@ func NewLogger() *Logger { return &Logger{} } +// NewTestLogger will create a new development logger to be used in test suites. +func NewTestLogger() (*Logger, error) { + baseConfig := zap.NewDevelopmentConfig() + baseConfig.EncoderConfig = zap.NewDevelopmentEncoderConfig() + + var ( + err error + zapLogger *zap.Logger + ) + + if zapLogger, err = baseConfig.Build(zap.AddCallerSkip(1)); err != nil { + log.Printf("failure configuring logger: %v\n", err) + + return nil, fmt.Errorf("zap logger base config builing failed: %w", err) + } + + return &Logger{zapLogger: zapLogger}, nil +} + // Init will initialize the logger with configurations and start it. func (l *Logger) Init(fs *afero.Fs) error { if l.zapLogger != nil { @@ -138,22 +157,3 @@ func mergeConfig[DST *zap.Config | *zapcore.EncoderConfig, SRC *generalConfig | func (l *Logger) setTestLogger(testLogger *zap.Logger) { l.zapLogger = testLogger } - -// NewTestLogger will create a new development logger to be used in test suites. -func NewTestLogger() (*Logger, error) { - baseConfig := zap.NewDevelopmentConfig() - baseConfig.EncoderConfig = zap.NewDevelopmentEncoderConfig() - - var ( - err error - zapLogger *zap.Logger - ) - - if zapLogger, err = baseConfig.Build(zap.AddCallerSkip(1)); err != nil { - log.Printf("failure configuring logger: %v\n", err) - - return nil, fmt.Errorf("zap logger base config builing failed: %w", err) - } - - return &Logger{zapLogger: zapLogger}, nil -} diff --git a/pkg/postgres/crypto_test.go b/pkg/postgres/crypto_test.go index d0724022..6290a743 100644 --- a/pkg/postgres/crypto_test.go +++ b/pkg/postgres/crypto_test.go @@ -27,7 +27,7 @@ func TestCrypto_CryptoCreateAccount(t *testing.T) { // Insert an initial set of test crypto accounts. resetTestCryptoAccounts(t, clientID1, clientID2) - ctx, cancel := context.WithTimeout(context.TODO(), time.Second) + ctx, cancel := context.WithTimeout(t.Context(), time.Second) defer cancel() @@ -147,7 +147,7 @@ func TestCrypto_CryptoPurchase(t *testing.T) { } // Configure context. - ctx, cancel := context.WithTimeout(context.TODO(), 3*time.Second) + ctx, cancel := context.WithTimeout(t.Context(), 3*time.Second) t.Cleanup(func() { cancel() @@ -383,7 +383,7 @@ func TestCrypto_CryptoSell(t *testing.T) { } // Configure context. - ctx, cancel := context.WithTimeout(context.TODO(), 3*time.Second) + ctx, cancel := context.WithTimeout(t.Context(), 3*time.Second) t.Cleanup(func() { cancel() @@ -589,7 +589,7 @@ func TestCrypto_CryptoGetAllAccounts(t *testing.T) { }, } - ctx, cancel := context.WithTimeout(context.TODO(), time.Second) + ctx, cancel := context.WithTimeout(t.Context(), time.Second) defer cancel() @@ -628,7 +628,7 @@ func TestCrypto_CryptoGetAllJournalTransactionPaginated(t *testing.T) { resetTestCryptoJournal(t) // Context setup for no hold-and-wait. - ctx, cancel := context.WithTimeout(context.TODO(), 2*time.Second) + ctx, cancel := context.WithTimeout(t.Context(), 2*time.Second) defer cancel() diff --git a/pkg/postgres/errors.go b/pkg/postgres/errors.go index 5de0a7c0..136d07f0 100644 --- a/pkg/postgres/errors.go +++ b/pkg/postgres/errors.go @@ -14,6 +14,11 @@ type Error struct { // Check to ensure the error interface is implemented. var _ error = &Error{} +// NewError is a base error message with no special code. +func NewError(message string) *Error { + return &Error{Message: message, Code: 0} +} + // Error get human readable error message. func (e *Error) Error() string { return e.Message @@ -29,11 +34,6 @@ func (e *Error) Is(err error) bool { return e.Code == target.Code } -// NewError is a base error message with no special code. -func NewError(message string) *Error { - return &Error{Message: message, Code: 0} -} - // SetStatus will configure the status code within the error message. func (e *Error) SetStatus(code int) *Error { e.Code = code diff --git a/pkg/postgres/fiat_test.go b/pkg/postgres/fiat_test.go index 2c0ef5b1..358ba0f4 100644 --- a/pkg/postgres/fiat_test.go +++ b/pkg/postgres/fiat_test.go @@ -24,7 +24,7 @@ func TestFiat_FiatCreateAccount(t *testing.T) { // Insert initial set of test fiat accounts. clientID1, clientID2 := resetTestFiatAccounts(t) - ctx, cancel := context.WithTimeout(context.TODO(), time.Second) + ctx, cancel := context.WithTimeout(t.Context(), time.Second) defer cancel() @@ -113,7 +113,7 @@ func TestFiat_FiatRowLockAccount(t *testing.T) { }, } - ctx, cancel := context.WithTimeout(context.TODO(), time.Second) + ctx, cancel := context.WithTimeout(t.Context(), time.Second) defer cancel() @@ -203,7 +203,7 @@ func TestFiat_FiatUpdateAccountBalance(t *testing.T) { }, } - ctx, cancel := context.WithTimeout(context.TODO(), time.Second) + ctx, cancel := context.WithTimeout(t.Context(), time.Second) defer cancel() @@ -291,7 +291,7 @@ func TestFiat_FiatGetJournalTransaction(t *testing.T) { negOne := decimal.NewFromFloat(-1) - ctx, cancel := context.WithTimeout(context.TODO(), time.Second) + ctx, cancel := context.WithTimeout(t.Context(), time.Second) defer cancel() @@ -398,7 +398,7 @@ func TestFiat_FiatGetJournalTransactionForAccount(t *testing.T) { }, } - ctx, cancel := context.WithTimeout(context.TODO(), time.Second) + ctx, cancel := context.WithTimeout(t.Context(), time.Second) defer cancel() @@ -477,7 +477,7 @@ func TestFiat_GetFiatAccount(t *testing.T) { }, } - ctx, cancel := context.WithTimeout(context.TODO(), time.Second) + ctx, cancel := context.WithTimeout(t.Context(), time.Second) defer cancel() @@ -561,7 +561,7 @@ func TestFiat_FiatGetAllAccounts(t *testing.T) { }, } - ctx, cancel := context.WithTimeout(context.TODO(), time.Second) + ctx, cancel := context.WithTimeout(t.Context(), time.Second) defer cancel() @@ -594,7 +594,7 @@ func TestFiat_FiatGetAllJournalTransactionPaginated(t *testing.T) { resetTestFiatJournal(t, clientID1, clientID2) // Context setup for no hold-and-wait. - ctx, cancel := context.WithTimeout(context.TODO(), 2*time.Second) + ctx, cancel := context.WithTimeout(t.Context(), 2*time.Second) defer cancel() diff --git a/pkg/postgres/main_test.go b/pkg/postgres/main_test.go index f3e559f8..8c2c7fe6 100644 --- a/pkg/postgres/main_test.go +++ b/pkg/postgres/main_test.go @@ -115,7 +115,7 @@ func insertTestUsers(t *testing.T) []uuid.UUID { // Reset the user's table. query := "DELETE FROM users WHERE first_name != 'Internal';" - ctx, cancel := context.WithTimeout(context.TODO(), constants.TwoSeconds()) + ctx, cancel := context.WithTimeout(t.Context(), constants.TwoSeconds()) defer cancel() @@ -146,7 +146,7 @@ func resetTestFiatAccounts(t *testing.T) (uuid.UUID, uuid.UUID) { // Reset the fiat accounts table. query := "TRUNCATE TABLE fiat_accounts CASCADE;" - ctx, cancel := context.WithTimeout(context.TODO(), constants.TwoSeconds()) + ctx, cancel := context.WithTimeout(t.Context(), constants.TwoSeconds()) defer cancel() @@ -182,7 +182,7 @@ func resetTestFiatJournal(t *testing.T, clientID1, clientID2 uuid.UUID) { // Reset the fiat journal table. query := "TRUNCATE TABLE fiat_journal CASCADE;" - ctx, cancel := context.WithTimeout(context.TODO(), constants.TwoSeconds()) + ctx, cancel := context.WithTimeout(t.Context(), constants.TwoSeconds()) defer cancel() @@ -210,7 +210,7 @@ func insertTestInternalFiatGeneralLedger(t *testing.T, clientID1, clientID2 uuid map[string]fiatInternalTransferJournalEntryParams, map[string]fiatInternalTransferJournalEntryRow) { t.Helper() - ctx, cancel := context.WithTimeout(context.TODO(), constants.TwoSeconds()) + ctx, cancel := context.WithTimeout(t.Context(), constants.TwoSeconds()) defer cancel() @@ -239,7 +239,7 @@ func resetTestCryptoAccounts(t *testing.T, clientID1, clientID2 uuid.UUID) { // Reset the crypto accounts table. query := "TRUNCATE TABLE crypto_accounts CASCADE;" - ctx, cancel := context.WithTimeout(context.TODO(), constants.TwoSeconds()) + ctx, cancel := context.WithTimeout(t.Context(), constants.TwoSeconds()) defer cancel() @@ -267,7 +267,7 @@ func resetTestCryptoJournal(t *testing.T) { // Reset the fiat accounts table. query := "TRUNCATE TABLE crypto_journal CASCADE;" - ctx, cancel := context.WithTimeout(context.TODO(), constants.TwoSeconds()) + ctx, cancel := context.WithTimeout(t.Context(), constants.TwoSeconds()) defer cancel() diff --git a/pkg/postgres/postgres.go b/pkg/postgres/postgres.go index aef084ba..e54201f1 100644 --- a/pkg/postgres/postgres.go +++ b/pkg/postgres/postgres.go @@ -193,34 +193,6 @@ func (p *postgresImpl) Open() error { return nil } -// verifySession will check to see if a session is established. -func (p *postgresImpl) verifySession() error { - if p.pool == nil || p.pool.Ping(context.Background()) != nil { - return errors.New("no session established") - } - - return nil -} - -// createSessionRetry will attempt to open the connection using binary exponential back-off. -// Stop on the first success or fail after the last one. -func (p *postgresImpl) createSessionRetry() (err error) { - for attempt := 1; attempt <= p.conf.Connection.MaxConnAttempts; attempt++ { - waitTime := time.Duration(math.Pow(2, float64(attempt))) * time.Second - p.logger.Info(fmt.Sprintf("Attempting connection to Postgres database in %s...", waitTime), - zap.String("attempt", strconv.Itoa(attempt))) - time.Sleep(waitTime) - - if err = p.pool.Ping(context.Background()); err == nil { - return nil - } - } - - p.logger.Error("unable to establish connection to Postgres database", zap.Error(err)) - - return -} - // Close will close the database connection pool. func (p *postgresImpl) Close() (err error) { if err = p.verifySession(); err != nil { @@ -248,3 +220,31 @@ func (p *postgresImpl) Healthcheck() error { return nil } + +// verifySession will check to see if a session is established. +func (p *postgresImpl) verifySession() error { + if p.pool == nil || p.pool.Ping(context.Background()) != nil { + return errors.New("no session established") + } + + return nil +} + +// createSessionRetry will attempt to open the connection using binary exponential back-off. +// Stop on the first success or fail after the last one. +func (p *postgresImpl) createSessionRetry() (err error) { + for attempt := 1; attempt <= p.conf.Connection.MaxConnAttempts; attempt++ { + waitTime := time.Duration(math.Pow(2, float64(attempt))) * time.Second + p.logger.Info(fmt.Sprintf("Attempting connection to Postgres database in %s...", waitTime), + zap.String("attempt", strconv.Itoa(attempt))) + time.Sleep(waitTime) + + if err = p.pool.Ping(context.Background()); err == nil { + return nil + } + } + + p.logger.Error("unable to establish connection to Postgres database", zap.Error(err)) + + return +} diff --git a/pkg/postgres/queries_crypto_test.go b/pkg/postgres/queries_crypto_test.go index 13894bff..715ffff6 100644 --- a/pkg/postgres/queries_crypto_test.go +++ b/pkg/postgres/queries_crypto_test.go @@ -150,7 +150,7 @@ func TestQueries_CryptoPurchase(t *testing.T) { } // Configure context. - ctx, cancel := context.WithTimeout(context.TODO(), 3*time.Second) + ctx, cancel := context.WithTimeout(t.Context(), 3*time.Second) t.Cleanup(func() { cancel() @@ -275,7 +275,7 @@ func TestQueries_CryptoSell(t *testing.T) { } // Configure context. - ctx, cancel := context.WithTimeout(context.TODO(), 3*time.Second) + ctx, cancel := context.WithTimeout(t.Context(), 3*time.Second) t.Cleanup(func() { cancel() @@ -435,7 +435,7 @@ func TestCrypto_CryptoTransactionsPaginated(t *testing.T) { resetTestCryptoJournal(t) // Context setup for no hold-and-wait. - ctx, cancel := context.WithTimeout(context.TODO(), 2*time.Second) + ctx, cancel := context.WithTimeout(t.Context(), 2*time.Second) defer cancel() diff --git a/pkg/postgres/queries_fiat_test.go b/pkg/postgres/queries_fiat_test.go index 81eaa2b2..1097e90f 100644 --- a/pkg/postgres/queries_fiat_test.go +++ b/pkg/postgres/queries_fiat_test.go @@ -164,7 +164,7 @@ func TestFiat_FiatTransactionsCurrencyPaginated(t *testing.T) { resetTestFiatJournal(t, clientID1, clientID2) // Context setup for no hold-and-wait. - ctx, cancel := context.WithTimeout(context.TODO(), 2*time.Second) + ctx, cancel := context.WithTimeout(t.Context(), 2*time.Second) defer cancel() diff --git a/pkg/postgres/queries_users_test.go b/pkg/postgres/queries_users_test.go index dfede184..6c5deaea 100644 --- a/pkg/postgres/queries_users_test.go +++ b/pkg/postgres/queries_users_test.go @@ -1,7 +1,6 @@ package postgres import ( - "context" "testing" "github.com/gofrs/uuid" @@ -58,7 +57,7 @@ func TestQueries_UserCredentials(t *testing.T) { require.NotEmpty(t, hashedPass, "retrieved an invalid password.") // Deleted account. - rowsAffected, err := connection.Query.userDelete(context.TODO(), clientID) + rowsAffected, err := connection.Query.userDelete(t.Context(), clientID) require.NoError(t, err, "errored whilst trying to delete user.") require.Equal(t, int64(1), rowsAffected, "no users were deleted.") @@ -87,7 +86,7 @@ func TestQueries_UserGetInfo(t *testing.T) { const uname = "username1" expectedAccount := getTestUsers()[uname] - clientID, err := connection.queries.userGetClientId(context.TODO(), uname) + clientID, err := connection.queries.userGetClientId(t.Context(), uname) require.NoError(t, err, "failed to retrieve client id for username1.") actualAccount, err := connection.UserGetInfo(clientID) require.NoError(t, err, "failed to retrieve account info for username1.") diff --git a/pkg/postgres/transactions_test.go b/pkg/postgres/transactions_test.go index ea92f9b1..bbc9bb19 100644 --- a/pkg/postgres/transactions_test.go +++ b/pkg/postgres/transactions_test.go @@ -198,7 +198,7 @@ func TestTransactions_FiatExternalTransfer(t *testing.T) { wg := sync.WaitGroup{} wg.Add(len(testCases)) - ctx, cancel := context.WithTimeout(context.TODO(), 3*time.Second) + ctx, cancel := context.WithTimeout(t.Context(), 3*time.Second) defer cancel() @@ -347,7 +347,7 @@ func TestTransactions_FiatExternalTransfer_Mock(t *testing.T) { ) // Check for error. - _, err := fiatExternalTransfer(context.TODO(), connection.logger, mockQuerier, &txDetails) + _, err := fiatExternalTransfer(t.Context(), connection.logger, mockQuerier, &txDetails) require.Error(t, err, "failed to get error.") require.Contains(t, err.Error(), test.expectedErrMsg, "error messages mismatched.") }) @@ -384,7 +384,7 @@ func TestTransactions_FiatTransactionRowLockAndBalanceCheck(t *testing.T) { require.NoError(t, txTimestamp.Scan(time.Now().UTC()), "failed to create current timestamp.") // Configure context for test suite. - ctx, cancel := context.WithTimeout(context.TODO(), 3*time.Second) + ctx, cancel := context.WithTimeout(t.Context(), 3*time.Second) t.Cleanup(func() { cancel() @@ -616,7 +616,7 @@ func TestTransactions_FiatTransactionRowLockAndBalanceCheck_mock(t *testing.T) { ) // Check for error. - err := fiatTransactionRowLockAndBalanceCheck(context.TODO(), mockQuerier, test.srcAccount, test.dstAccount) + err := fiatTransactionRowLockAndBalanceCheck(t.Context(), mockQuerier, test.srcAccount, test.dstAccount) require.Error(t, err, "failed to get error.") require.Contains(t, err.Error(), test.expectedErrMsg, "error messages mismatched.") }) @@ -649,7 +649,7 @@ func TestTransactions_FiatInternalTransfer(t *testing.T) { //nolint:maintidx require.NoError(t, txTimestamp.Scan(time.Now().UTC()), "failed to create current timestamp.") // Configure context for test suite. - ctx, cancel := context.WithTimeout(context.TODO(), 3*time.Second) + ctx, cancel := context.WithTimeout(t.Context(), 3*time.Second) defer cancel() @@ -1003,7 +1003,7 @@ func TestTransactions_FiatInternalTransfer_Mock(t *testing.T) { ) // Check for error. - _, _, err := fiatInternalTransfer(context.TODO(), connection.logger, mockQuerier, &txDetails, &txDetails) + _, _, err := fiatInternalTransfer(t.Context(), connection.logger, mockQuerier, &txDetails, &txDetails) require.Error(t, err, "failed to get error.") require.Contains(t, err.Error(), test.expectedErrMsg, "error messages mismatched.") }) diff --git a/pkg/postgres/udf_sqlc_test.go b/pkg/postgres/udf_sqlc_test.go index 0b4b1e76..b719ffe9 100644 --- a/pkg/postgres/udf_sqlc_test.go +++ b/pkg/postgres/udf_sqlc_test.go @@ -102,7 +102,7 @@ func TestUDF_RoundHalfEven(t *testing.T) { }, } - ctx, cancel := context.WithTimeout(context.TODO(), 3*time.Second) + ctx, cancel := context.WithTimeout(t.Context(), 3*time.Second) t.Cleanup(func() { cancel() diff --git a/pkg/postgres/users_test.go b/pkg/postgres/users_test.go index 9327a4cf..4b519075 100644 --- a/pkg/postgres/users_test.go +++ b/pkg/postgres/users_test.go @@ -23,7 +23,7 @@ func TestCreateUser(t *testing.T) { user := testCase t.Run("Test case "+key, func(t *testing.T) { - ctx, cancel := context.WithTimeout(context.TODO(), time.Second) + ctx, cancel := context.WithTimeout(t.Context(), time.Second) defer cancel() @@ -42,7 +42,7 @@ func TestCreateUser(t *testing.T) { Email: "user1@email-address.com", } - ctx, cancel := context.WithTimeout(context.TODO(), time.Second) + ctx, cancel := context.WithTimeout(t.Context(), time.Second) defer cancel() @@ -60,7 +60,7 @@ func TestPostgres_DeleteUser(t *testing.T) { // Insert an initial set of test users. clientIDs := insertTestUsers(t) - ctx, cancel := context.WithTimeout(context.TODO(), time.Second) + ctx, cancel := context.WithTimeout(t.Context(), time.Second) defer cancel() @@ -90,7 +90,7 @@ func TestGetClientIdUser(t *testing.T) { // Insert an initial set of test users. insertTestUsers(t) - ctx, cancel := context.WithTimeout(context.TODO(), time.Second) + ctx, cancel := context.WithTimeout(t.Context(), time.Second) defer cancel() @@ -118,7 +118,7 @@ func TestGetCredentialsUser(t *testing.T) { // Insert an initial set of test users. insertTestUsers(t) - ctx, cancel := context.WithTimeout(context.TODO(), time.Second) + ctx, cancel := context.WithTimeout(t.Context(), time.Second) defer cancel() @@ -148,7 +148,7 @@ func TestGetInfoUser(t *testing.T) { // Insert an initial set of test users. clientIDs := insertTestUsers(t) - ctx, cancel := context.WithTimeout(context.TODO(), time.Second) + ctx, cancel := context.WithTimeout(t.Context(), time.Second) defer cancel() @@ -193,7 +193,7 @@ func TestPostgres_IsDeletedUser(t *testing.T) { // Insert an initial set of test users. clientIDs := insertTestUsers(t) - ctx, cancel := context.WithTimeout(context.TODO(), time.Second) + ctx, cancel := context.WithTimeout(t.Context(), time.Second) defer cancel() diff --git a/pkg/quotes/errors.go b/pkg/quotes/errors.go index 7cf71770..3984cafe 100644 --- a/pkg/quotes/errors.go +++ b/pkg/quotes/errors.go @@ -11,6 +11,11 @@ type Error struct { // Check to ensure the error interface is implemented. var _ error = &Error{} +// NewError is a base error message with no special code. +func NewError(message string) *Error { + return &Error{Message: message, Code: 0} +} + // Error get human readable error message. func (e *Error) Error() string { return e.Message @@ -26,11 +31,6 @@ func (e *Error) Is(err error) bool { return e.Code == target.Code } -// NewError is a base error message with no special code. -func NewError(message string) *Error { - return &Error{Message: message, Code: 0} -} - // SetStatus configures the error status/code. func (e *Error) SetStatus(status int) *Error { e.Code = status diff --git a/pkg/quotes/quotes.go b/pkg/quotes/quotes.go index 63f3eac3..7875440d 100644 --- a/pkg/quotes/quotes.go +++ b/pkg/quotes/quotes.go @@ -110,32 +110,6 @@ func configCryptoClient(conf *config) (*req.Client, error) { nil } -// FiatQuote will access the Fiat currency price quote service and get the latest exchange rate. -func (q *quotesImpl) fiatQuote(source, destination string, sourceAmount decimal.Decimal) (models.FiatQuote, error) { - result := models.FiatQuote{} - - _, err := q.clientFiat.R(). - SetQueryParam("from", source). - SetQueryParam("to", destination). - SetQueryParam("amount", sourceAmount.String()). - SetSuccessResult(&result). - Get(q.conf.FiatCurrency.Endpoint) - - // Failed to query endpoint for price. - if err != nil { - q.logger.Warn("failed to get Fiat currency price quote", zap.Error(err)) - - return result, NewError(constants.RetryMessageString()).SetStatus(http.StatusServiceUnavailable) - } - - // Check for a successful rate retrieval. - if !result.Success { - return result, NewError("invalid Fiat currency code").SetStatus(http.StatusBadRequest) - } - - return result, nil -} - // FiatConversion will convert a source currency, of a given amount, to the destination currency. func (q *quotesImpl) FiatConversion( source, @@ -169,38 +143,6 @@ func (q *quotesImpl) FiatConversion( return rawQuote.Info.Rate, convertedAmount, nil } -// CryptoQuote will access the Fiat currency price quote service and get the latest exchange rate. -func (q *quotesImpl) cryptoQuote(source, destination string) (models.CryptoQuote, error) { - result := models.CryptoQuote{} - - resp, err := q.clientCrypto.R(). - SetPathParam("base_symbol", source). - SetPathParam("quote_symbol", destination). - SetSuccessResult(&result). - Get(q.conf.CryptoCurrency.Endpoint) - - // Failed to query endpoint for price. - if err != nil { - q.logger.Warn("failed to get Fiat currency price quote", zap.Error(err)) - - return result, NewError("crypto price service unreachable").SetStatus(http.StatusInternalServerError) - } - - if !resp.IsSuccessState() { - // Invalid cryptocurrency codes. - if resp.StatusCode == 550 { //nolint:mnd,gomnd - return result, NewError("invalid Crypto currency code").SetStatus(http.StatusBadRequest) - } - - // Log and other API related errors and return an internal server error to user. - q.logger.Error("API error", zap.String("Response", resp.String())) - - return result, NewError(constants.RetryMessageString()).SetStatus(http.StatusInternalServerError) - } - - return result, nil -} - // CryptoConversion will convert Fiat to Crypto and Crypto to Fiat currencies, for a given amount. func (q *quotesImpl) CryptoConversion( sourceCurrency, @@ -239,3 +181,61 @@ func (q *quotesImpl) CryptoConversion( return rawQuote.Rate, convertedAmount, nil } + +// FiatQuote will access the Fiat currency price quote service and get the latest exchange rate. +func (q *quotesImpl) fiatQuote(source, destination string, sourceAmount decimal.Decimal) (models.FiatQuote, error) { + result := models.FiatQuote{} + + _, err := q.clientFiat.R(). + SetQueryParam("from", source). + SetQueryParam("to", destination). + SetQueryParam("amount", sourceAmount.String()). + SetSuccessResult(&result). + Get(q.conf.FiatCurrency.Endpoint) + + // Failed to query endpoint for price. + if err != nil { + q.logger.Warn("failed to get Fiat currency price quote", zap.Error(err)) + + return result, NewError(constants.RetryMessageString()).SetStatus(http.StatusServiceUnavailable) + } + + // Check for a successful rate retrieval. + if !result.Success { + return result, NewError("invalid Fiat currency code").SetStatus(http.StatusBadRequest) + } + + return result, nil +} + +// CryptoQuote will access the Fiat currency price quote service and get the latest exchange rate. +func (q *quotesImpl) cryptoQuote(source, destination string) (models.CryptoQuote, error) { + result := models.CryptoQuote{} + + resp, err := q.clientCrypto.R(). + SetPathParam("base_symbol", source). + SetPathParam("quote_symbol", destination). + SetSuccessResult(&result). + Get(q.conf.CryptoCurrency.Endpoint) + + // Failed to query endpoint for price. + if err != nil { + q.logger.Warn("failed to get Fiat currency price quote", zap.Error(err)) + + return result, NewError("crypto price service unreachable").SetStatus(http.StatusInternalServerError) + } + + if !resp.IsSuccessState() { + // Invalid cryptocurrency codes. + if resp.StatusCode == 550 { //nolint:mnd,gomnd + return result, NewError("invalid Crypto currency code").SetStatus(http.StatusBadRequest) + } + + // Log and other API related errors and return an internal server error to user. + q.logger.Error("API error", zap.String("Response", resp.String())) + + return result, NewError(constants.RetryMessageString()).SetStatus(http.StatusInternalServerError) + } + + return result, nil +} diff --git a/pkg/quotes/quotes_test.go b/pkg/quotes/quotes_test.go index 3d2cd02d..9d8ff223 100644 --- a/pkg/quotes/quotes_test.go +++ b/pkg/quotes/quotes_test.go @@ -115,7 +115,6 @@ func TestQuotesImpl_FiatQuote(t *testing.T) { if err != nil { require.NotEqual(t, 200, result.Error.Code, "received valid response code on error.") require.NotEmpty(t, result.Error.Type, "received no type on error.") - require.NotEmpty(t, result.Error.Info, "received no info on error.") return } diff --git a/pkg/redis/errors.go b/pkg/redis/errors.go index bb1964f1..348ae4b5 100644 --- a/pkg/redis/errors.go +++ b/pkg/redis/errors.go @@ -22,6 +22,11 @@ type Error struct { // Check to ensure the error interface is implemented. var _ error = &Error{} +// NewError is a base error message with no special code. +func NewError(message string) *Error { + return &Error{Message: message, Code: ErrorUnknown} +} + // Error get human readable error message. func (e *Error) Error() string { return e.Message @@ -37,11 +42,6 @@ func (e *Error) Is(err error) bool { return e.Code == target.Code } -// NewError is a base error message with no special code. -func NewError(message string) *Error { - return &Error{Message: message, Code: ErrorUnknown} -} - // errorCacheMiss will specialize the error as a cache miss. func (e *Error) errorCacheMiss() *Error { e.Code = ErrorCacheMiss diff --git a/pkg/redis/redis.go b/pkg/redis/redis.go index f102de94..c166fe99 100644 --- a/pkg/redis/redis.go +++ b/pkg/redis/redis.go @@ -73,40 +73,6 @@ func newRedisImpl(fs *afero.Fs, logger *logger.Logger) (c *redisImpl, err error) return } -// verifySession will check to see if a session is established. -func (r *redisImpl) verifySession() error { - if r.redisDB == nil || r.redisDB.Ping(context.Background()).Err() != nil { - return errors.New("no session established") - } - - return nil -} - -// createSessionRetry will attempt to open the connection using binary exponential back-off and stop on the first -// success or fail after the last one. -func (r *redisImpl) createSessionRetry() error { - var err error - - for attempt := 1; attempt <= r.conf.Connection.MaxConnAttempts; attempt++ { - waitTime := time.Duration(math.Pow(2, float64(attempt))) * time.Second - r.logger.Info(fmt.Sprintf("Attempting connection to Redis server in %s...", waitTime), - zap.String("attempt", strconv.Itoa(attempt))) - - time.Sleep(waitTime) - - // Successfully opened lazy connection with a ping. - if err = r.redisDB.Ping(context.Background()).Err(); err == nil { - return nil - } - } - - // Unable to ping Redis server and establish lazy connection. - msg := "unable to establish connection to Redis server" - r.logger.Error(msg, zap.Error(err)) - - return fmt.Errorf(constants.ErrorFormatMessage(), msg, err) -} - // Open will establish a connection to the Redis cache server. func (r *redisImpl) Open() error { // Stop connection leaks. @@ -234,3 +200,37 @@ func (r *redisImpl) Del(keys ...string) error { return nil } + +// verifySession will check to see if a session is established. +func (r *redisImpl) verifySession() error { + if r.redisDB == nil || r.redisDB.Ping(context.Background()).Err() != nil { + return errors.New("no session established") + } + + return nil +} + +// createSessionRetry will attempt to open the connection using binary exponential back-off and stop on the first +// success or fail after the last one. +func (r *redisImpl) createSessionRetry() error { + var err error + + for attempt := 1; attempt <= r.conf.Connection.MaxConnAttempts; attempt++ { + waitTime := time.Duration(math.Pow(2, float64(attempt))) * time.Second + r.logger.Info(fmt.Sprintf("Attempting connection to Redis server in %s...", waitTime), + zap.String("attempt", strconv.Itoa(attempt))) + + time.Sleep(waitTime) + + // Successfully opened lazy connection with a ping. + if err = r.redisDB.Ping(context.Background()).Err(); err == nil { + return nil + } + } + + // Unable to ping Redis server and establish lazy connection. + msg := "unable to establish connection to Redis server" + r.logger.Error(msg, zap.Error(err)) + + return fmt.Errorf(constants.ErrorFormatMessage(), msg, err) +} diff --git a/pkg/rest/handlers/authorization_test.go b/pkg/rest/handlers/authorization_test.go index c4567332..f9d1e39f 100644 --- a/pkg/rest/handlers/authorization_test.go +++ b/pkg/rest/handlers/authorization_test.go @@ -1,7 +1,6 @@ package rest import ( - "context" "errors" "net/http" "net/http/httptest" @@ -133,7 +132,7 @@ func TestAuthMiddleware_Handler(t *testing.T) { // Endpoint setup for test. router := gin.Default() router.POST(test.path, AuthMiddleware(mockAuth, mockDB, zapLogger, "Authorization")) - req, _ := http.NewRequestWithContext(context.TODO(), http.MethodPost, test.path, nil) + req, _ := http.NewRequestWithContext(t.Context(), http.MethodPost, test.path, nil) req.Header.Set("Authorization", test.token) w := httptest.NewRecorder() diff --git a/pkg/rest/handlers/crypto_test.go b/pkg/rest/handlers/crypto_test.go index 15535666..85181aa0 100644 --- a/pkg/rest/handlers/crypto_test.go +++ b/pkg/rest/handlers/crypto_test.go @@ -2,7 +2,6 @@ package rest import ( "bytes" - "context" "encoding/json" "errors" "fmt" @@ -111,7 +110,7 @@ func TestHandlers_OpenCrypto(t *testing.T) { // Endpoint setup for test. router := gin.Default() router.POST(test.path, OpenCrypto(zapLogger, mockAuth, mockPostgres)) - req, _ := http.NewRequestWithContext(context.TODO(), http.MethodPost, test.path, bytes.NewBuffer(openReqJSON)) + req, _ := http.NewRequestWithContext(t.Context(), http.MethodPost, test.path, bytes.NewBuffer(openReqJSON)) w := httptest.NewRecorder() router.ServeHTTP(w, req) @@ -457,7 +456,7 @@ func TestHandlers_OfferCrypto(t *testing.T) { //nolint:maintidx // Endpoint setup for test. router := gin.Default() router.POST(test.path, OfferCrypto(zapLogger, mockAuth, mockCache, mockQuotes)) - req, _ := http.NewRequestWithContext(context.TODO(), http.MethodPost, test.path, bytes.NewBuffer(offerReqJSON)) + req, _ := http.NewRequestWithContext(t.Context(), http.MethodPost, test.path, bytes.NewBuffer(offerReqJSON)) recorder := httptest.NewRecorder() router.ServeHTTP(recorder, req) @@ -670,7 +669,7 @@ func TestHandlers_ExchangeCrypto(t *testing.T) { // Endpoint setup for test. router := gin.Default() router.POST(test.path, ExchangeCrypto(zapLogger, mockAuth, mockCache, mockDB)) - req, _ := http.NewRequestWithContext(context.TODO(), http.MethodPost, test.path, bytes.NewBuffer(offerReqJSON)) + req, _ := http.NewRequestWithContext(t.Context(), http.MethodPost, test.path, bytes.NewBuffer(offerReqJSON)) recorder := httptest.NewRecorder() router.ServeHTTP(recorder, req) @@ -784,7 +783,7 @@ func TestHandler_BalanceCrypto(t *testing.T) { //nolint:dupl // Endpoint setup for test. router := gin.Default() router.GET(basePath+tickerPathVar, BalanceCrypto(zapLogger, mockAuth, mockDB)) - req, _ := http.NewRequestWithContext(context.TODO(), http.MethodGet, basePath+test.currency, nil) + req, _ := http.NewRequestWithContext(t.Context(), http.MethodGet, basePath+test.currency, nil) recorder := httptest.NewRecorder() router.ServeHTTP(recorder, req) @@ -893,7 +892,7 @@ func TestHandler_TxDetailsCrypto(t *testing.T) { // Endpoint setup for test. router := gin.Default() router.GET(basePath+":transactionID", TxDetailsCrypto(zapLogger, mockAuth, mockDB)) - req, _ := http.NewRequestWithContext(context.TODO(), http.MethodGet, basePath+validTxID.String(), nil) + req, _ := http.NewRequestWithContext(t.Context(), http.MethodGet, basePath+validTxID.String(), nil) recorder := httptest.NewRecorder() router.ServeHTTP(recorder, req) @@ -1105,7 +1104,7 @@ func TestHandler_BalanceCurrencyCryptoPaginated(t *testing.T) { //nolint:dupl // Endpoint setup for test. router := gin.Default() router.GET(basePath+test.path, BalanceCryptoPaginated(zapLogger, mockAuth, mockDB)) - req, _ := http.NewRequestWithContext(context.TODO(), http.MethodGet, basePath+test.path+test.querySegment, nil) + req, _ := http.NewRequestWithContext(t.Context(), http.MethodGet, basePath+test.path+test.querySegment, nil) recorder := httptest.NewRecorder() router.ServeHTTP(recorder, req) @@ -1301,7 +1300,7 @@ func TestHandler_TxDetailsCryptoPaginated(t *testing.T) { // Endpoint setup for test. router := gin.Default() router.GET(basePath+test.path+tickerPathVar, TxDetailsCryptoPaginated(zapLogger, mockAuth, mockDB)) - req, _ := http.NewRequestWithContext(context.TODO(), http.MethodGet, + req, _ := http.NewRequestWithContext(t.Context(), http.MethodGet, basePath+test.path+test.ticker+test.querySegment, nil) recorder := httptest.NewRecorder() router.ServeHTTP(recorder, req) diff --git a/pkg/rest/handlers/fiat_test.go b/pkg/rest/handlers/fiat_test.go index 5150386d..67bbc0eb 100644 --- a/pkg/rest/handlers/fiat_test.go +++ b/pkg/rest/handlers/fiat_test.go @@ -2,7 +2,6 @@ package rest import ( "bytes" - "context" "encoding/json" "errors" "fmt" @@ -121,7 +120,7 @@ func TestHandlers_OpenFiat(t *testing.T) { // Endpoint setup for test. router := gin.Default() router.POST(test.path, OpenFiat(zapLogger, mockAuth, mockPostgres)) - req, _ := http.NewRequestWithContext(context.TODO(), http.MethodPost, test.path, bytes.NewBuffer(openReqJSON)) + req, _ := http.NewRequestWithContext(t.Context(), http.MethodPost, test.path, bytes.NewBuffer(openReqJSON)) w := httptest.NewRecorder() router.ServeHTTP(w, req) @@ -256,7 +255,7 @@ func TestHandlers_DepositFiat(t *testing.T) { // Endpoint setup for test. router := gin.Default() router.POST(test.path, DepositFiat(zapLogger, mockAuth, mockPostgres)) - req, _ := http.NewRequestWithContext(context.TODO(), http.MethodPost, test.path, bytes.NewBuffer(depositReqJSON)) + req, _ := http.NewRequestWithContext(t.Context(), http.MethodPost, test.path, bytes.NewBuffer(depositReqJSON)) recorder := httptest.NewRecorder() router.ServeHTTP(recorder, req) @@ -517,7 +516,7 @@ func TestHandlers_ExchangeOfferFiat(t *testing.T) { //nolint:maintidx // Endpoint setup for test. router := gin.Default() router.POST(test.path, ExchangeOfferFiat(zapLogger, mockAuth, mockCache, mockQuotes)) - req, _ := http.NewRequestWithContext(context.TODO(), http.MethodPost, test.path, bytes.NewBuffer(offerReqJSON)) + req, _ := http.NewRequestWithContext(t.Context(), http.MethodPost, test.path, bytes.NewBuffer(offerReqJSON)) recorder := httptest.NewRecorder() router.ServeHTTP(recorder, req) @@ -878,7 +877,7 @@ func TestHandler_ExchangeTransferFiat(t *testing.T) { //nolint:maintidx // Endpoint setup for test. router := gin.Default() router.POST(test.path, ExchangeTransferFiat(zapLogger, mockAuth, mockCache, mockDB)) - req, _ := http.NewRequestWithContext(context.TODO(), http.MethodPost, test.path, bytes.NewBuffer(xferReqJSON)) + req, _ := http.NewRequestWithContext(t.Context(), http.MethodPost, test.path, bytes.NewBuffer(xferReqJSON)) recorder := httptest.NewRecorder() router.ServeHTTP(recorder, req) @@ -992,7 +991,7 @@ func TestHandler_BalanceFiat(t *testing.T) { //nolint:dupl // Endpoint setup for test. router := gin.Default() router.GET(basePath+tickerPathVar, BalanceFiat(zapLogger, mockAuth, mockDB)) - req, _ := http.NewRequestWithContext(context.TODO(), http.MethodGet, basePath+test.currency, nil) + req, _ := http.NewRequestWithContext(t.Context(), http.MethodGet, basePath+test.currency, nil) recorder := httptest.NewRecorder() router.ServeHTTP(recorder, req) @@ -1145,7 +1144,7 @@ func TestHandler_TxDetailsFiat(t *testing.T) { // Endpoint setup for test. router := gin.Default() router.GET(basePath+":transactionID", TxDetailsFiat(zapLogger, mockAuth, mockDB)) - req, _ := http.NewRequestWithContext(context.TODO(), http.MethodGet, basePath+test.transactionID, nil) + req, _ := http.NewRequestWithContext(t.Context(), http.MethodGet, basePath+test.transactionID, nil) recorder := httptest.NewRecorder() router.ServeHTTP(recorder, req) @@ -1357,7 +1356,7 @@ func TestHandler_BalanceFiatPaginated(t *testing.T) { //nolint:dupl // Endpoint setup for test. router := gin.Default() router.GET(basePath+test.path, BalanceFiatPaginated(zapLogger, mockAuth, mockDB)) - req, _ := http.NewRequestWithContext(context.TODO(), http.MethodGet, basePath+test.path+test.querySegment, nil) + req, _ := http.NewRequestWithContext(t.Context(), http.MethodGet, basePath+test.path+test.querySegment, nil) recorder := httptest.NewRecorder() router.ServeHTTP(recorder, req) @@ -1569,7 +1568,7 @@ func TestHandler_TxDetailsFiatPaginated(t *testing.T) { // Endpoint setup for test. router := gin.Default() router.GET(basePath+test.path+":currencyCode", TxDetailsFiatPaginated(zapLogger, mockAuth, mockDB)) - req, _ := http.NewRequestWithContext(context.TODO(), http.MethodGet, + req, _ := http.NewRequestWithContext(t.Context(), http.MethodGet, basePath+test.path+test.currency+test.querySegment, nil) recorder := httptest.NewRecorder() router.ServeHTTP(recorder, req) diff --git a/pkg/rest/handlers/healthcheck_test.go b/pkg/rest/handlers/healthcheck_test.go index b169b533..4cab332e 100644 --- a/pkg/rest/handlers/healthcheck_test.go +++ b/pkg/rest/handlers/healthcheck_test.go @@ -1,7 +1,6 @@ package rest import ( - "context" "encoding/json" "net/http" "net/http/httptest" @@ -86,7 +85,7 @@ func TestHealthcheck(t *testing.T) { router := gin.Default() router.GET(test.path, Healthcheck(zapLogger, mockPostgres, mockRedis)) - req, _ := http.NewRequestWithContext(context.TODO(), http.MethodGet, test.path, nil) + req, _ := http.NewRequestWithContext(t.Context(), http.MethodGet, test.path, nil) recorder := httptest.NewRecorder() router.ServeHTTP(recorder, req) diff --git a/pkg/rest/handlers/users_test.go b/pkg/rest/handlers/users_test.go index b52d67af..63efe094 100644 --- a/pkg/rest/handlers/users_test.go +++ b/pkg/rest/handlers/users_test.go @@ -2,7 +2,6 @@ package rest import ( "bytes" - "context" "encoding/json" "errors" "fmt" @@ -140,7 +139,7 @@ func TestHandlers_UserRegister(t *testing.T) { // Endpoint setup for test. router := gin.Default() router.POST(test.path, RegisterUser(zapLogger, mockAuth, mockPostgres)) - req, _ := http.NewRequestWithContext(context.TODO(), http.MethodPost, test.path, bytes.NewBuffer(userJSON)) + req, _ := http.NewRequestWithContext(t.Context(), http.MethodPost, test.path, bytes.NewBuffer(userJSON)) w := httptest.NewRecorder() router.ServeHTTP(w, req) @@ -256,7 +255,7 @@ func TestHandlers_UserLogin(t *testing.T) { // Endpoint setup for test. router := gin.Default() router.POST(test.path, LoginUser(zapLogger, mockAuth, mockPostgres)) - req, _ := http.NewRequestWithContext(context.TODO(), http.MethodPost, test.path, bytes.NewBuffer(userJSON)) + req, _ := http.NewRequestWithContext(t.Context(), http.MethodPost, test.path, bytes.NewBuffer(userJSON)) w := httptest.NewRecorder() router.ServeHTTP(w, req) @@ -427,7 +426,7 @@ func TestHandlers_LoginRefresh(t *testing.T) { // Endpoint setup for test. router := gin.Default() router.POST(test.path, LoginRefresh(zapLogger, mockAuth, mockPostgres)) - req, _ := http.NewRequestWithContext(context.TODO(), http.MethodPost, test.path, nil) + req, _ := http.NewRequestWithContext(t.Context(), http.MethodPost, test.path, nil) w := httptest.NewRecorder() router.ServeHTTP(w, req) @@ -687,7 +686,7 @@ func TestHandlers_DeleteUser(t *testing.T) { // Endpoint setup for test. router := gin.Default() router.DELETE(test.path, DeleteUser(zapLogger, mockAuth, mockPostgres)) - req, _ := http.NewRequestWithContext(context.TODO(), http.MethodDelete, test.path, bytes.NewBuffer(requestJSON)) + req, _ := http.NewRequestWithContext(t.Context(), http.MethodDelete, test.path, bytes.NewBuffer(requestJSON)) w := httptest.NewRecorder() router.ServeHTTP(w, req) diff --git a/pkg/rest/rest.go b/pkg/rest/rest.go index ce2d7add..c4431945 100644 --- a/pkg/rest/rest.go +++ b/pkg/rest/rest.go @@ -59,12 +59,66 @@ func NewServer(fs *afero.Fs, auth auth.Auth, postgres postgres.Postgres, redis r err } +// Run brings the HTTP service up. +func (s *Server) Run() { + // Indicate to bootstrapping thread to wait for completion. + defer s.wg.Done() + + // Configure routes. + s.initialize() + + // Create server. + srv := &http.Server{ + ReadTimeout: s.conf.Server.ReadTimeout, + WriteTimeout: s.conf.Server.WriteTimeout, + ReadHeaderTimeout: s.conf.Server.ReadHeaderTimeout, + Addr: fmt.Sprintf(":%d", s.conf.Server.PortNumber), + Handler: s.router, + } + + // Error channel for failed server start. + serverErr := make(chan error, 1) + + // Wait for interrupt signal to gracefully shut down the server. + quit := make(chan os.Signal, 1) + signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM) + + // Start HTTP listener. + go func() { + if err := srv.ListenAndServe(); err != nil && err != http.ErrServerClosed { + serverErr <- err + } + }() + + // Check for server start failure or shutdown signal. + select { + case err := <-serverErr: + s.logger.Error(fmt.Sprintf("REST server failed to listen on port %d", s.conf.Server.PortNumber), zap.Error(err)) + + return + case <-quit: + s.logger.Info("Shutting down REST server...", zap.Duration("waiting", s.conf.Server.ShutdownDelay)) + } + + ctx, cancel := context.WithTimeout(context.Background(), s.conf.Server.ShutdownDelay) + defer cancel() + + if err := srv.Shutdown(ctx); err != nil { + s.logger.Panic("Failed to shutdown REST server", zap.Error(err)) + } + + // 5 second wait to exit. + <-ctx.Done() + + s.logger.Info("REST server exited") +} + // initialize will configure the HTTP server routes. func (s *Server) initialize() { s.router = gin.Default() // @title FTeX, Inc. (Formerly Crypto-Bro's Bank, Inc.) - // @version 1.2.7 + // @version 1.2.8 // @description FTeX Fiat and Cryptocurrency Banking API. // @description Bank, buy, and sell Fiat and Cryptocurrencies. Prices for all currencies are retrieved from real-time quote providers. // @@ -123,57 +177,3 @@ func (s *Server) initialize() { cryptoGroup.GET("/info/balance/", restHandlers.BalanceCryptoPaginated(s.logger, s.auth, s.db)) cryptoGroup.GET("/info/transaction/all/:ticker", restHandlers.TxDetailsCryptoPaginated(s.logger, s.auth, s.db)) } - -// Run brings the HTTP service up. -func (s *Server) Run() { - // Indicate to bootstrapping thread to wait for completion. - defer s.wg.Done() - - // Configure routes. - s.initialize() - - // Create server. - srv := &http.Server{ - ReadTimeout: s.conf.Server.ReadTimeout, - WriteTimeout: s.conf.Server.WriteTimeout, - ReadHeaderTimeout: s.conf.Server.ReadHeaderTimeout, - Addr: fmt.Sprintf(":%d", s.conf.Server.PortNumber), - Handler: s.router, - } - - // Error channel for failed server start. - serverErr := make(chan error, 1) - - // Wait for interrupt signal to gracefully shut down the server. - quit := make(chan os.Signal, 1) - signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM) - - // Start HTTP listener. - go func() { - if err := srv.ListenAndServe(); err != nil && err != http.ErrServerClosed { - serverErr <- err - } - }() - - // Check for server start failure or shutdown signal. - select { - case err := <-serverErr: - s.logger.Error(fmt.Sprintf("REST server failed to listen on port %d", s.conf.Server.PortNumber), zap.Error(err)) - - return - case <-quit: - s.logger.Info("Shutting down REST server...", zap.Duration("waiting", s.conf.Server.ShutdownDelay)) - } - - ctx, cancel := context.WithTimeout(context.Background(), s.conf.Server.ShutdownDelay) - defer cancel() - - if err := srv.Shutdown(ctx); err != nil { - s.logger.Panic("Failed to shutdown REST server", zap.Error(err)) - } - - // 5 second wait to exit. - <-ctx.Done() - - s.logger.Info("REST server exited") -}