diff --git a/go.mod b/go.mod index f1548807..300009c3 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/dexidp/dex go 1.17 require ( - entgo.io/ent v0.9.1 + entgo.io/ent v0.10.1 github.com/AppsFlyer/go-sundheit v0.5.0 github.com/Masterminds/semver v1.5.0 github.com/Masterminds/sprig/v3 v3.2.2 @@ -40,40 +40,49 @@ require ( ) require ( + ariga.io/atlas v0.3.7-0.20220303204946-787354f533c3 // indirect cloud.google.com/go/compute v1.5.0 // indirect - github.com/Azure/go-ntlmssp v0.0.0-20211209120228-48547f28849e // indirect + github.com/Azure/go-ntlmssp v0.0.0-20200615164410-66371956d46c // indirect github.com/Masterminds/goutils v1.1.1 // indirect github.com/Masterminds/semver/v3 v3.1.1 // indirect + github.com/agext/levenshtein v1.2.1 // indirect + github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.1.2 // indirect github.com/coreos/go-semver v0.3.0 // indirect github.com/coreos/go-systemd/v22 v22.3.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-asn1-ber/asn1-ber v1.5.3 // indirect + github.com/go-asn1-ber/asn1-ber v1.5.1 // indirect + github.com/go-openapi/inflect v0.19.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.2 // indirect + github.com/google/go-cmp v0.5.7 // indirect github.com/google/uuid v1.3.0 // indirect github.com/googleapis/gax-go/v2 v2.2.0 // indirect - github.com/huandu/xstrings v1.3.2 // indirect - github.com/imdario/mergo v0.3.12 // indirect + github.com/hashicorp/hcl/v2 v2.10.0 // indirect + github.com/huandu/xstrings v1.3.1 // indirect + github.com/imdario/mergo v0.3.11 // indirect github.com/inconshreveable/mousetrap v1.0.0 // indirect github.com/jonboulle/clockwork v0.2.2 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect - github.com/mitchellh/copystructure v1.2.0 // indirect - github.com/mitchellh/reflectwalk v1.0.2 // indirect + github.com/mitchellh/copystructure v1.0.0 // indirect + github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7 // indirect + github.com/mitchellh/reflectwalk v1.0.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/client_model v0.2.0 // indirect github.com/prometheus/common v0.32.1 // indirect github.com/prometheus/procfs v0.7.3 // indirect - github.com/shopspring/decimal v1.3.1 // indirect - github.com/spf13/cast v1.4.1 // indirect + github.com/shopspring/decimal v1.2.0 // indirect + github.com/spf13/cast v1.3.1 // indirect github.com/spf13/pflag v1.0.5 // indirect + github.com/zclconf/go-cty v1.8.0 // indirect go.etcd.io/etcd/api/v3 v3.5.2 // indirect go.opencensus.io v0.23.0 // indirect - go.uber.org/atomic v1.9.0 // indirect - go.uber.org/multierr v1.7.0 // indirect - go.uber.org/zap v1.21.0 // indirect + go.uber.org/atomic v1.7.0 // indirect + go.uber.org/multierr v1.6.0 // indirect + go.uber.org/zap v1.17.0 // indirect + golang.org/x/mod v0.5.1 // indirect golang.org/x/sys v0.0.0-20220328115105-d36c6a25d886 // indirect golang.org/x/text v0.3.7 // indirect google.golang.org/appengine v1.6.7 // indirect diff --git a/go.sum b/go.sum index 77bc5727..a26576af 100644 --- a/go.sum +++ b/go.sum @@ -1,3 +1,5 @@ +ariga.io/atlas v0.3.7-0.20220303204946-787354f533c3 h1:fjG4oFCQEfGrRi0QoxWcH2OO28CE6VYa6DkIr3yDySU= +ariga.io/atlas v0.3.7-0.20220303204946-787354f533c3/go.mod h1:yWGf4VPiD4SW83+kAqzD624txN9VKoJC+bpVXr2pKJA= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= @@ -26,7 +28,6 @@ cloud.google.com/go v0.93.3/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+Y cloud.google.com/go v0.94.1/go.mod h1:qAlAugsXlC+JWO+Bke5vCtc9ONxjQT3drlTTnAplMW4= cloud.google.com/go v0.97.0/go.mod h1:GF7l59pYBVlXQIBLx3a761cZ41F9bBH3JUlihCt2Udc= cloud.google.com/go v0.99.0/go.mod h1:w0Xx2nLzqWJPuozYQX+hFfCSI8WioryfRDzkoI/Y2ZA= -cloud.google.com/go v0.100.2 h1:t9Iw5QH5v4XtlEQaCtUY7x6sCABps8sW0acw7e2WQ6Y= cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w99A= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= @@ -40,7 +41,6 @@ cloud.google.com/go/compute v1.5.0 h1:b1zWmYuuHz7gO9kDcM/EpHGr06UgsYNRpNJzI2kFiL cloud.google.com/go/compute v1.5.0/go.mod h1:9SMHyhJlzhlkJqrPAc839t2BZFTSk6Jdj6mkzQJeu0M= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= -cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= @@ -51,17 +51,15 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -entgo.io/ent v0.9.1 h1:IG8andyeD79GG24U8Q+1Y45hQXj6gY5evSBcva5gtBk= -entgo.io/ent v0.9.1/go.mod h1:6NUeTfUN5mp5YN+5tgoH1SlakSvYPTBOYotSOvaI4ak= +entgo.io/ent v0.10.1 h1:dM5h4Zk6yHGIgw4dCqVzGw3nWgpGYJiV4/kyHEF6PFo= +entgo.io/ent v0.10.1/go.mod h1:YPgxeLnoQ/YdpVORRtqjBF+wCy9NX9IR7veTv3Bffus= github.com/AppsFlyer/go-sundheit v0.5.0 h1:/VxpyigCfJrq1r97mn9HPiAB2qrhcTFHwNIIDr15CZM= github.com/AppsFlyer/go-sundheit v0.5.0/go.mod h1:2ZM0BnfqT/mljBQO224VbL5XH06TgWuQ6Cn+cTtCpTY= +github.com/Azure/go-ntlmssp v0.0.0-20200615164410-66371956d46c h1:/IBSNwUN8+eKzUzbJPqhK839ygXJ82sde8x3ogr6R28= github.com/Azure/go-ntlmssp v0.0.0-20200615164410-66371956d46c/go.mod h1:chxPXzSsl7ZWRAuOIE23GDNzjWuZquvFlgA8xmpunjU= -github.com/Azure/go-ntlmssp v0.0.0-20211209120228-48547f28849e h1:ZU22z/2YRFLyf/P4ZwUYSdNCWsMEI0VeyrFoI2rAhJQ= -github.com/Azure/go-ntlmssp v0.0.0-20211209120228-48547f28849e/go.mod h1:chxPXzSsl7ZWRAuOIE23GDNzjWuZquvFlgA8xmpunjU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60= -github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI= github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww= @@ -71,27 +69,25 @@ github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0 github.com/Masterminds/sprig/v3 v3.2.2 h1:17jRggJu518dr3QaafizSXOjKYp94wKfABxUmyxvxX8= github.com/Masterminds/sprig/v3 v3.2.2/go.mod h1:UoaO7Yp8KlPnJIYWTFkMaqPUYKTfGFPhxNuwnnxkKlk= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/agext/levenshtein v1.2.1 h1:QmvMAjj2aEICytGiWzmxoE0x2KZvE0fvmqMOfy2tjT8= +github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= -github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= -github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3/go.mod h1:oL81AME2rN47vu18xqj1S1jPIPuN7afo62yKTNn3XMM= +github.com/apparentlymart/go-textseg v1.0.0/go.mod h1:z96Txxhf3xSFMPmb5X/1W05FF/Nj9VFpLOpjS5yuumk= +github.com/apparentlymart/go-textseg/v13 v13.0.0 h1:Y+KvPE1NYz0xl601PVImeQfFyEy6iT90AvPUL1NNfNw= +github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo= github.com/beevik/etree v1.1.0 h1:T0xke/WvNtMoCqgzPhkX2r4rjY3GDZFi+FjpRZY2Jbs= github.com/beevik/etree v1.1.0/go.mod h1:r8Aw8JqVegEf0w2fDnATrX9VpkMcyFeM0FhwO62wh+A= -github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= -github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= @@ -108,25 +104,17 @@ github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= -github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-oidc/v3 v3.1.0 h1:6avEvcdvTa1qYsOZ6I5PRkSYHzpTNWgKYmaJfaYbrRw= github.com/coreos/go-oidc/v3 v3.1.0/go.mod h1:rEJ/idjfUyfkBit1eI1fvyr+64/g9dcKpAm8MJMesvo= github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e h1:Wf6HqHfScWJN9/ZjdUKyjop4mf3Qdd+1TvvltAvM3m8= -github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd/v22 v22.3.2 h1:D9/bQk5vlXQFZ6Kwuu6zaiXJ9oTPe68++AzAJc1DzSI= github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= -github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= @@ -137,19 +125,15 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.m github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/felixge/httpsnoop v1.0.2 h1:+nS9g82KMXccJ/wp0zyRW9ZBHFETmMGtkk+2CTTrW4o= github.com/felixge/httpsnoop v1.0.2/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-asn1-ber/asn1-ber v1.5.1 h1:pDbRAunXzIUXfx4CB2QJFv5IuPiuoW+sWvr/Us009o8= github.com/go-asn1-ber/asn1-ber v1.5.1/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkProFKoKdwZRWMe0= -github.com/go-asn1-ber/asn1-ber v1.5.3 h1:u7utq56RUFiynqUzgVMFDymapcOtQ/MZkh3H4QYkxag= -github.com/go-asn1-ber/asn1-ber v1.5.3/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkProFKoKdwZRWMe0= -github.com/go-bindata/go-bindata v1.0.1-0.20190711162640-ee3c2418e368/go.mod h1:7xCgX1lzlrXPHkfvn3EhumqHkmSlzt8at9q7v0ax19c= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= @@ -161,18 +145,18 @@ github.com/go-ldap/ldap/v3 v3.4.2/go.mod h1:iYS1MdmrmceOJ1QOTnRXrIs7i3kloqtmGQjR github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/go-openapi/inflect v0.19.0 h1:9jCH9scKIbHeV9m12SmPilScz6krDxKRasNNSNPXu/4= github.com/go-openapi/inflect v0.19.0/go.mod h1:lHpZVlpIQqLyKwJ4N+YSc9hchQy/i12fJykb83CRBH4= -github.com/go-sql-driver/mysql v1.5.1-0.20200311113236-681ffa848bae/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE= github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68= +github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -187,6 +171,7 @@ github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8= github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= +github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -252,49 +237,25 @@ github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pf github.com/googleapis/gax-go/v2 v2.1.1/go.mod h1:hddJymUZASv3XPyGkUpKj8pPO47Rmb0eJc8R6ouapiM= github.com/googleapis/gax-go/v2 v2.2.0 h1:s7jOdKSaksJVOxE0Y/S32otcfiP+UQ0cL8/GTKaONwE= github.com/googleapis/gax-go/v2 v2.2.0/go.mod h1:as02EH8zWkzwUoLbBaFeQ+arQaj/OthfcblKl4IGNaM= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/handlers v1.5.1 h1:9lRY6j8DEeeBT10CvO9hGW0gmky0BprnvDI5vfhUHH4= github.com/gorilla/handlers v1.5.1/go.mod h1:t8XrUpc4KVXb7HGyJ4/cEnwQiaxrX/hz1Zv/4g96P1Q= github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= -github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= -github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= -github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= -github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= -github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= -github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= -github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= -github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= -github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= -github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= -github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= -github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= -github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= -github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= +github.com/hashicorp/hcl/v2 v2.10.0 h1:1S1UnuhDGlv3gRFV4+0EdwB+znNP5HmcGbIqwnSCByg= +github.com/hashicorp/hcl/v2 v2.10.0/go.mod h1:FwWsfWEjyV/CMj8s/gqAuiviY72rJ1/oayI9WftqcKg= +github.com/huandu/xstrings v1.3.1 h1:4jgBlKK6tLKFvO8u5pmYjG91cqytmDCDvGh7ECVFfFs= github.com/huandu/xstrings v1.3.1/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= -github.com/huandu/xstrings v1.3.2 h1:L18LIDzqlW6xN2rEkpdV8+oL/IXWJ1APd+vsdYy4Wdw= -github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/imdario/mergo v0.3.11 h1:3tnifQM4i+fbajXKBHXWEH+KvNHqojZ778UH75j3bGA= github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= -github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU= -github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4= -github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/jonboulle/clockwork v0.2.2 h1:UOGuzwb1PwsrDAObMuhUnj0p5ULPj8V/xJ7Kx9qUBdQ= github.com/jonboulle/clockwork v0.2.2/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= @@ -304,11 +265,8 @@ github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/ github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= -github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= @@ -322,38 +280,23 @@ 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/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/lib/pq v1.10.4 h1:SO9z7FRPzA03QhHKJrH5BXA6HU1rS4V2nIVrrNC1iYk= github.com/lib/pq v1.10.4/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mattermost/xml-roundtrip-validator v0.1.0 h1:RXbVD2UAl7A7nOTR4u7E3ILa4IbtvKBHw64LDsmu9hU= github.com/mattermost/xml-roundtrip-validator v0.1.0/go.mod h1:qccnGMcpgwcNaBnxqpJpWWUiPNr5H3O8eDgGV9gT5To= -github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -github.com/mattn/go-sqlite3 v1.14.8/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= github.com/mattn/go-sqlite3 v1.14.11 h1:gt+cp9c0XGqe9S/wAHTL3n/7MqY+siPWgWJgqdsFrzQ= github.com/mattn/go-sqlite3 v1.14.11/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= -github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= +github.com/mitchellh/copystructure v1.0.0 h1:Laisrj+bAB6b/yJwB5Bt3ITZhGJdqmxquMKeZ+mmkFQ= github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= -github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= -github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= -github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= -github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= -github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= -github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7 h1:DpOJ2HYzCv8LZP15IdmG+YdwD2luVPHITV96TkirNBM= +github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= +github.com/mitchellh/reflectwalk v1.0.0 h1:9D+8oIskB4VJBN5SFlmc27fSlIBZaov1Wpk/IfikLNY= github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= -github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= -github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= @@ -363,10 +306,6 @@ github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRW github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/oklog/run v1.1.0 h1:GEenZ1cK0+q0+wsJew9qUg/DyD8k3JzYsZAi5gYi2mA= github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU= -github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= -github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= -github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -374,9 +313,7 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= @@ -387,22 +324,17 @@ github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1: github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= github.com/prometheus/common v0.32.1 h1:hWIdL3N2HoUx3B8j3YN9mWor0qhY/NlEKZEaXxuIRh4= github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0VU= github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= -github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= @@ -410,36 +342,24 @@ github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUA github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= github.com/russellhaering/goxmldsig v1.2.0 h1:Y6GTTc9Un5hCxSzVz4UIWQ/zuVwDvzJk80guqzwx6Vg= github.com/russellhaering/goxmldsig v1.2.0/go.mod h1:gM4MDENBQf7M+V824SGfyIUVFWydB7n0KkEubVJl+Tw= -github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= -github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= +github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ= +github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= +github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ= github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= -github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= -github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= -github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= -github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= -github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cast v1.3.1 h1:nFm6S0SMdyzrzcmThSipiEubIDy8WEXKNZ0UOgiRpng= github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cast v1.4.1 h1:s0hze+J0196ZfEMTs80N7UlFt0BDuQ7Q+JDnHiMWKdA= -github.com/spf13/cast v1.4.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSWzOo= github.com/spf13/cobra v1.4.0 h1:y+wJpx64xcgO1V+RcnwW0LEHxTKRi2ZDPSBjWnrg88Q= github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g= -github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= -github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= 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/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48= @@ -452,15 +372,18 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= -github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= +github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= +github.com/vmihailenco/msgpack/v4 v4.3.12/go.mod h1:gborTTJjAo/GWTqqRjrLCn9pgNN+NXzzngzBKDPIqw4= +github.com/vmihailenco/tagparser v0.1.1/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +github.com/zclconf/go-cty v1.2.0/go.mod h1:hOPWgoHbaTUnI5k4D2ld+GRpFJSCe6bCM7m1q/N4PQ8= +github.com/zclconf/go-cty v1.8.0 h1:s4AvqaeQzJIu3ndv4gVIhplVD0krU+bgrcLSVUnaWuA= +github.com/zclconf/go-cty v1.8.0/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk= +github.com/zclconf/go-cty-debug v0.0.0-20191215020915-b22d67c1ba0b/go.mod h1:ZRKQfBXbGkpdV6QMzT3rU1kSTAnfu1dO8dPKjYprgj8= go.etcd.io/etcd/api/v3 v3.5.2 h1:tXok5yLlKyuQ/SXSjtqHc4uzNaMqZi2XsoSPr/LlJXI= go.etcd.io/etcd/api/v3 v3.5.2/go.mod h1:5GB2vv4A4AOn3yk7MftYGHkUfGtDHnEraIjym4dYz5A= go.etcd.io/etcd/client/pkg/v3 v3.5.2 h1:4hzqQ6hIb3blLyQ8usCU4h3NghkqcsohEQ3o3VetYxE= @@ -476,23 +399,15 @@ go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= -go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= -go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= -go.uber.org/goleak v1.1.11 h1:wy28qYRKZgnJTxGxvye5/wgWr1EKjmUDGYox5mGlRlI= -go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= -go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= -go.uber.org/multierr v1.7.0 h1:zaiO/rmgFjbmCXdSYJWQcdvOCsthmdaHfr3Gm2Kx4Ec= -go.uber.org/multierr v1.7.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak= -go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +go.uber.org/zap v1.17.0 h1:MTjgFu6ZLKvY6Pvaqk97GlxNBuMpV4Hy/3P6tRGlI2U= go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= -go.uber.org/zap v1.21.0 h1:WefMeulhovoZ2sYXz7st6K0sLj7bBhpiFaud4r4zST8= -go.uber.org/zap v1.21.0/go.mod h1:wjWOCqI0f2ZZrJF/UufIOkiC8ii6tm1iqIsLo76RfJw= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -536,12 +451,12 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.5.1 h1:OJxoQ/rynoF0dcCdI7cLPktw/hR2cueqYfjm43oqK38= +golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180811021610-c39426892332/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= @@ -578,7 +493,6 @@ golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLd golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220325170049-de3da57026de h1:pZB1TWnKi+o4bENlbzAgLrEbY4RMYmUIRobMcSmfeYc= @@ -613,17 +527,15 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502175342-a43fa875dd82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -677,7 +589,6 @@ golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220207234003-57398862261d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220328115105-d36c6a25d886 h1:eJv7u3ksNXoLbGSKuv2s/SIO4tJVxc/A+MTpzxDgz/Q= @@ -697,15 +608,12 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= @@ -715,7 +623,6 @@ golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgw golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= @@ -865,7 +772,6 @@ google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ6 google.golang.org/genproto v0.0.0-20211221195035-429b39de9b1c/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20220126215142-9970aeb2e350/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20220207164111-0872dc986b00/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20220207185906-7721543eae58/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20220218161850-94dd64e39d7c/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/genproto v0.0.0-20220304144024-325a89244dc8/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= @@ -924,12 +830,9 @@ gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8 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/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/square/go-jose.v2 v2.5.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= gopkg.in/square/go-jose.v2 v2.6.0 h1:NGk74WTnPKBNUhNzQX7PYcTLUjoq7mzKk2OKbvwk2iI= gopkg.in/square/go-jose.v2 v2.6.0/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= -gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/storage/ent/db/authcode_create.go b/storage/ent/db/authcode_create.go index eaf2f8ac..23b34300 100644 --- a/storage/ent/db/authcode_create.go +++ b/storage/ent/db/authcode_create.go @@ -228,79 +228,79 @@ func (acc *AuthCodeCreate) defaults() { // check runs all checks and user-defined validators on the builder. func (acc *AuthCodeCreate) check() error { if _, ok := acc.mutation.ClientID(); !ok { - return &ValidationError{Name: "client_id", err: errors.New(`db: missing required field "client_id"`)} + return &ValidationError{Name: "client_id", err: errors.New(`db: missing required field "AuthCode.client_id"`)} } if v, ok := acc.mutation.ClientID(); ok { if err := authcode.ClientIDValidator(v); err != nil { - return &ValidationError{Name: "client_id", err: fmt.Errorf(`db: validator failed for field "client_id": %w`, err)} + return &ValidationError{Name: "client_id", err: fmt.Errorf(`db: validator failed for field "AuthCode.client_id": %w`, err)} } } if _, ok := acc.mutation.Nonce(); !ok { - return &ValidationError{Name: "nonce", err: errors.New(`db: missing required field "nonce"`)} + return &ValidationError{Name: "nonce", err: errors.New(`db: missing required field "AuthCode.nonce"`)} } if v, ok := acc.mutation.Nonce(); ok { if err := authcode.NonceValidator(v); err != nil { - return &ValidationError{Name: "nonce", err: fmt.Errorf(`db: validator failed for field "nonce": %w`, err)} + return &ValidationError{Name: "nonce", err: fmt.Errorf(`db: validator failed for field "AuthCode.nonce": %w`, err)} } } if _, ok := acc.mutation.RedirectURI(); !ok { - return &ValidationError{Name: "redirect_uri", err: errors.New(`db: missing required field "redirect_uri"`)} + return &ValidationError{Name: "redirect_uri", err: errors.New(`db: missing required field "AuthCode.redirect_uri"`)} } if v, ok := acc.mutation.RedirectURI(); ok { if err := authcode.RedirectURIValidator(v); err != nil { - return &ValidationError{Name: "redirect_uri", err: fmt.Errorf(`db: validator failed for field "redirect_uri": %w`, err)} + return &ValidationError{Name: "redirect_uri", err: fmt.Errorf(`db: validator failed for field "AuthCode.redirect_uri": %w`, err)} } } if _, ok := acc.mutation.ClaimsUserID(); !ok { - return &ValidationError{Name: "claims_user_id", err: errors.New(`db: missing required field "claims_user_id"`)} + return &ValidationError{Name: "claims_user_id", err: errors.New(`db: missing required field "AuthCode.claims_user_id"`)} } if v, ok := acc.mutation.ClaimsUserID(); ok { if err := authcode.ClaimsUserIDValidator(v); err != nil { - return &ValidationError{Name: "claims_user_id", err: fmt.Errorf(`db: validator failed for field "claims_user_id": %w`, err)} + return &ValidationError{Name: "claims_user_id", err: fmt.Errorf(`db: validator failed for field "AuthCode.claims_user_id": %w`, err)} } } if _, ok := acc.mutation.ClaimsUsername(); !ok { - return &ValidationError{Name: "claims_username", err: errors.New(`db: missing required field "claims_username"`)} + return &ValidationError{Name: "claims_username", err: errors.New(`db: missing required field "AuthCode.claims_username"`)} } if v, ok := acc.mutation.ClaimsUsername(); ok { if err := authcode.ClaimsUsernameValidator(v); err != nil { - return &ValidationError{Name: "claims_username", err: fmt.Errorf(`db: validator failed for field "claims_username": %w`, err)} + return &ValidationError{Name: "claims_username", err: fmt.Errorf(`db: validator failed for field "AuthCode.claims_username": %w`, err)} } } if _, ok := acc.mutation.ClaimsEmail(); !ok { - return &ValidationError{Name: "claims_email", err: errors.New(`db: missing required field "claims_email"`)} + return &ValidationError{Name: "claims_email", err: errors.New(`db: missing required field "AuthCode.claims_email"`)} } if v, ok := acc.mutation.ClaimsEmail(); ok { if err := authcode.ClaimsEmailValidator(v); err != nil { - return &ValidationError{Name: "claims_email", err: fmt.Errorf(`db: validator failed for field "claims_email": %w`, err)} + return &ValidationError{Name: "claims_email", err: fmt.Errorf(`db: validator failed for field "AuthCode.claims_email": %w`, err)} } } if _, ok := acc.mutation.ClaimsEmailVerified(); !ok { - return &ValidationError{Name: "claims_email_verified", err: errors.New(`db: missing required field "claims_email_verified"`)} + return &ValidationError{Name: "claims_email_verified", err: errors.New(`db: missing required field "AuthCode.claims_email_verified"`)} } if _, ok := acc.mutation.ClaimsPreferredUsername(); !ok { - return &ValidationError{Name: "claims_preferred_username", err: errors.New(`db: missing required field "claims_preferred_username"`)} + return &ValidationError{Name: "claims_preferred_username", err: errors.New(`db: missing required field "AuthCode.claims_preferred_username"`)} } if _, ok := acc.mutation.ConnectorID(); !ok { - return &ValidationError{Name: "connector_id", err: errors.New(`db: missing required field "connector_id"`)} + return &ValidationError{Name: "connector_id", err: errors.New(`db: missing required field "AuthCode.connector_id"`)} } if v, ok := acc.mutation.ConnectorID(); ok { if err := authcode.ConnectorIDValidator(v); err != nil { - return &ValidationError{Name: "connector_id", err: fmt.Errorf(`db: validator failed for field "connector_id": %w`, err)} + return &ValidationError{Name: "connector_id", err: fmt.Errorf(`db: validator failed for field "AuthCode.connector_id": %w`, err)} } } if _, ok := acc.mutation.Expiry(); !ok { - return &ValidationError{Name: "expiry", err: errors.New(`db: missing required field "expiry"`)} + return &ValidationError{Name: "expiry", err: errors.New(`db: missing required field "AuthCode.expiry"`)} } if _, ok := acc.mutation.CodeChallenge(); !ok { - return &ValidationError{Name: "code_challenge", err: errors.New(`db: missing required field "code_challenge"`)} + return &ValidationError{Name: "code_challenge", err: errors.New(`db: missing required field "AuthCode.code_challenge"`)} } if _, ok := acc.mutation.CodeChallengeMethod(); !ok { - return &ValidationError{Name: "code_challenge_method", err: errors.New(`db: missing required field "code_challenge_method"`)} + return &ValidationError{Name: "code_challenge_method", err: errors.New(`db: missing required field "AuthCode.code_challenge_method"`)} } if v, ok := acc.mutation.ID(); ok { if err := authcode.IDValidator(v); err != nil { - return &ValidationError{Name: "id", err: fmt.Errorf(`db: validator failed for field "id": %w`, err)} + return &ValidationError{Name: "id", err: fmt.Errorf(`db: validator failed for field "AuthCode.id": %w`, err)} } } return nil @@ -314,6 +314,13 @@ func (acc *AuthCodeCreate) sqlSave(ctx context.Context) (*AuthCode, error) { } return nil, err } + if _spec.ID.Value != nil { + if id, ok := _spec.ID.Value.(string); ok { + _node.ID = id + } else { + return nil, fmt.Errorf("unexpected AuthCode.ID type: %T", _spec.ID.Value) + } + } return _node, nil } diff --git a/storage/ent/db/authcode_query.go b/storage/ent/db/authcode_query.go index 89116dd9..452b9847 100644 --- a/storage/ent/db/authcode_query.go +++ b/storage/ent/db/authcode_query.go @@ -106,7 +106,7 @@ func (acq *AuthCodeQuery) FirstIDX(ctx context.Context) string { } // Only returns a single AuthCode entity found by the query, ensuring it only returns one. -// Returns a *NotSingularError when exactly one AuthCode entity is not found. +// Returns a *NotSingularError when more than one AuthCode entity is found. // Returns a *NotFoundError when no AuthCode entities are found. func (acq *AuthCodeQuery) Only(ctx context.Context) (*AuthCode, error) { nodes, err := acq.Limit(2).All(ctx) @@ -133,7 +133,7 @@ func (acq *AuthCodeQuery) OnlyX(ctx context.Context) *AuthCode { } // OnlyID is like Only, but returns the only AuthCode ID in the query. -// Returns a *NotSingularError when exactly one AuthCode ID is not found. +// Returns a *NotSingularError when more than one AuthCode ID is found. // Returns a *NotFoundError when no entities are found. func (acq *AuthCodeQuery) OnlyID(ctx context.Context) (id string, err error) { var ids []string @@ -242,8 +242,9 @@ func (acq *AuthCodeQuery) Clone() *AuthCodeQuery { order: append([]OrderFunc{}, acq.order...), predicates: append([]predicate.AuthCode{}, acq.predicates...), // clone intermediate query. - sql: acq.sql.Clone(), - path: acq.path, + sql: acq.sql.Clone(), + path: acq.path, + unique: acq.unique, } } @@ -336,6 +337,10 @@ func (acq *AuthCodeQuery) sqlAll(ctx context.Context) ([]*AuthCode, error) { func (acq *AuthCodeQuery) sqlCount(ctx context.Context) (int, error) { _spec := acq.querySpec() + _spec.Node.Columns = acq.fields + if len(acq.fields) > 0 { + _spec.Unique = acq.unique != nil && *acq.unique + } return sqlgraph.CountNodes(ctx, acq.driver, _spec) } @@ -407,6 +412,9 @@ func (acq *AuthCodeQuery) sqlQuery(ctx context.Context) *sql.Selector { selector = acq.sql selector.Select(selector.Columns(columns...)...) } + if acq.unique != nil && *acq.unique { + selector.Distinct() + } for _, p := range acq.predicates { p(selector) } @@ -685,9 +693,7 @@ func (acgb *AuthCodeGroupBy) sqlQuery() *sql.Selector { for _, f := range acgb.fields { columns = append(columns, selector.C(f)) } - for _, c := range aggregation { - columns = append(columns, c) - } + columns = append(columns, aggregation...) selector.Select(columns...) } return selector.GroupBy(selector.Columns(acgb.fields...)...) diff --git a/storage/ent/db/authcode_update.go b/storage/ent/db/authcode_update.go index f86d04c6..ccd0eee8 100644 --- a/storage/ent/db/authcode_update.go +++ b/storage/ent/db/authcode_update.go @@ -4,6 +4,7 @@ package db import ( "context" + "errors" "fmt" "time" @@ -228,37 +229,37 @@ func (acu *AuthCodeUpdate) ExecX(ctx context.Context) { func (acu *AuthCodeUpdate) check() error { if v, ok := acu.mutation.ClientID(); ok { if err := authcode.ClientIDValidator(v); err != nil { - return &ValidationError{Name: "client_id", err: fmt.Errorf("db: validator failed for field \"client_id\": %w", err)} + return &ValidationError{Name: "client_id", err: fmt.Errorf(`db: validator failed for field "AuthCode.client_id": %w`, err)} } } if v, ok := acu.mutation.Nonce(); ok { if err := authcode.NonceValidator(v); err != nil { - return &ValidationError{Name: "nonce", err: fmt.Errorf("db: validator failed for field \"nonce\": %w", err)} + return &ValidationError{Name: "nonce", err: fmt.Errorf(`db: validator failed for field "AuthCode.nonce": %w`, err)} } } if v, ok := acu.mutation.RedirectURI(); ok { if err := authcode.RedirectURIValidator(v); err != nil { - return &ValidationError{Name: "redirect_uri", err: fmt.Errorf("db: validator failed for field \"redirect_uri\": %w", err)} + return &ValidationError{Name: "redirect_uri", err: fmt.Errorf(`db: validator failed for field "AuthCode.redirect_uri": %w`, err)} } } if v, ok := acu.mutation.ClaimsUserID(); ok { if err := authcode.ClaimsUserIDValidator(v); err != nil { - return &ValidationError{Name: "claims_user_id", err: fmt.Errorf("db: validator failed for field \"claims_user_id\": %w", err)} + return &ValidationError{Name: "claims_user_id", err: fmt.Errorf(`db: validator failed for field "AuthCode.claims_user_id": %w`, err)} } } if v, ok := acu.mutation.ClaimsUsername(); ok { if err := authcode.ClaimsUsernameValidator(v); err != nil { - return &ValidationError{Name: "claims_username", err: fmt.Errorf("db: validator failed for field \"claims_username\": %w", err)} + return &ValidationError{Name: "claims_username", err: fmt.Errorf(`db: validator failed for field "AuthCode.claims_username": %w`, err)} } } if v, ok := acu.mutation.ClaimsEmail(); ok { if err := authcode.ClaimsEmailValidator(v); err != nil { - return &ValidationError{Name: "claims_email", err: fmt.Errorf("db: validator failed for field \"claims_email\": %w", err)} + return &ValidationError{Name: "claims_email", err: fmt.Errorf(`db: validator failed for field "AuthCode.claims_email": %w`, err)} } } if v, ok := acu.mutation.ConnectorID(); ok { if err := authcode.ConnectorIDValidator(v); err != nil { - return &ValidationError{Name: "connector_id", err: fmt.Errorf("db: validator failed for field \"connector_id\": %w", err)} + return &ValidationError{Name: "connector_id", err: fmt.Errorf(`db: validator failed for field "AuthCode.connector_id": %w`, err)} } } return nil @@ -632,37 +633,37 @@ func (acuo *AuthCodeUpdateOne) ExecX(ctx context.Context) { func (acuo *AuthCodeUpdateOne) check() error { if v, ok := acuo.mutation.ClientID(); ok { if err := authcode.ClientIDValidator(v); err != nil { - return &ValidationError{Name: "client_id", err: fmt.Errorf("db: validator failed for field \"client_id\": %w", err)} + return &ValidationError{Name: "client_id", err: fmt.Errorf(`db: validator failed for field "AuthCode.client_id": %w`, err)} } } if v, ok := acuo.mutation.Nonce(); ok { if err := authcode.NonceValidator(v); err != nil { - return &ValidationError{Name: "nonce", err: fmt.Errorf("db: validator failed for field \"nonce\": %w", err)} + return &ValidationError{Name: "nonce", err: fmt.Errorf(`db: validator failed for field "AuthCode.nonce": %w`, err)} } } if v, ok := acuo.mutation.RedirectURI(); ok { if err := authcode.RedirectURIValidator(v); err != nil { - return &ValidationError{Name: "redirect_uri", err: fmt.Errorf("db: validator failed for field \"redirect_uri\": %w", err)} + return &ValidationError{Name: "redirect_uri", err: fmt.Errorf(`db: validator failed for field "AuthCode.redirect_uri": %w`, err)} } } if v, ok := acuo.mutation.ClaimsUserID(); ok { if err := authcode.ClaimsUserIDValidator(v); err != nil { - return &ValidationError{Name: "claims_user_id", err: fmt.Errorf("db: validator failed for field \"claims_user_id\": %w", err)} + return &ValidationError{Name: "claims_user_id", err: fmt.Errorf(`db: validator failed for field "AuthCode.claims_user_id": %w`, err)} } } if v, ok := acuo.mutation.ClaimsUsername(); ok { if err := authcode.ClaimsUsernameValidator(v); err != nil { - return &ValidationError{Name: "claims_username", err: fmt.Errorf("db: validator failed for field \"claims_username\": %w", err)} + return &ValidationError{Name: "claims_username", err: fmt.Errorf(`db: validator failed for field "AuthCode.claims_username": %w`, err)} } } if v, ok := acuo.mutation.ClaimsEmail(); ok { if err := authcode.ClaimsEmailValidator(v); err != nil { - return &ValidationError{Name: "claims_email", err: fmt.Errorf("db: validator failed for field \"claims_email\": %w", err)} + return &ValidationError{Name: "claims_email", err: fmt.Errorf(`db: validator failed for field "AuthCode.claims_email": %w`, err)} } } if v, ok := acuo.mutation.ConnectorID(); ok { if err := authcode.ConnectorIDValidator(v); err != nil { - return &ValidationError{Name: "connector_id", err: fmt.Errorf("db: validator failed for field \"connector_id\": %w", err)} + return &ValidationError{Name: "connector_id", err: fmt.Errorf(`db: validator failed for field "AuthCode.connector_id": %w`, err)} } } return nil @@ -681,7 +682,7 @@ func (acuo *AuthCodeUpdateOne) sqlSave(ctx context.Context) (_node *AuthCode, er } id, ok := acuo.mutation.ID() if !ok { - return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing AuthCode.ID for update")} + return nil, &ValidationError{Name: "id", err: errors.New(`db: missing "AuthCode.id" for update`)} } _spec.Node.ID.Value = id if fields := acuo.fields; len(fields) > 0 { diff --git a/storage/ent/db/authrequest_create.go b/storage/ent/db/authrequest_create.go index 3e96b284..f324c159 100644 --- a/storage/ent/db/authrequest_create.go +++ b/storage/ent/db/authrequest_create.go @@ -252,53 +252,53 @@ func (arc *AuthRequestCreate) defaults() { // check runs all checks and user-defined validators on the builder. func (arc *AuthRequestCreate) check() error { if _, ok := arc.mutation.ClientID(); !ok { - return &ValidationError{Name: "client_id", err: errors.New(`db: missing required field "client_id"`)} + return &ValidationError{Name: "client_id", err: errors.New(`db: missing required field "AuthRequest.client_id"`)} } if _, ok := arc.mutation.RedirectURI(); !ok { - return &ValidationError{Name: "redirect_uri", err: errors.New(`db: missing required field "redirect_uri"`)} + return &ValidationError{Name: "redirect_uri", err: errors.New(`db: missing required field "AuthRequest.redirect_uri"`)} } if _, ok := arc.mutation.Nonce(); !ok { - return &ValidationError{Name: "nonce", err: errors.New(`db: missing required field "nonce"`)} + return &ValidationError{Name: "nonce", err: errors.New(`db: missing required field "AuthRequest.nonce"`)} } if _, ok := arc.mutation.State(); !ok { - return &ValidationError{Name: "state", err: errors.New(`db: missing required field "state"`)} + return &ValidationError{Name: "state", err: errors.New(`db: missing required field "AuthRequest.state"`)} } if _, ok := arc.mutation.ForceApprovalPrompt(); !ok { - return &ValidationError{Name: "force_approval_prompt", err: errors.New(`db: missing required field "force_approval_prompt"`)} + return &ValidationError{Name: "force_approval_prompt", err: errors.New(`db: missing required field "AuthRequest.force_approval_prompt"`)} } if _, ok := arc.mutation.LoggedIn(); !ok { - return &ValidationError{Name: "logged_in", err: errors.New(`db: missing required field "logged_in"`)} + return &ValidationError{Name: "logged_in", err: errors.New(`db: missing required field "AuthRequest.logged_in"`)} } if _, ok := arc.mutation.ClaimsUserID(); !ok { - return &ValidationError{Name: "claims_user_id", err: errors.New(`db: missing required field "claims_user_id"`)} + return &ValidationError{Name: "claims_user_id", err: errors.New(`db: missing required field "AuthRequest.claims_user_id"`)} } if _, ok := arc.mutation.ClaimsUsername(); !ok { - return &ValidationError{Name: "claims_username", err: errors.New(`db: missing required field "claims_username"`)} + return &ValidationError{Name: "claims_username", err: errors.New(`db: missing required field "AuthRequest.claims_username"`)} } if _, ok := arc.mutation.ClaimsEmail(); !ok { - return &ValidationError{Name: "claims_email", err: errors.New(`db: missing required field "claims_email"`)} + return &ValidationError{Name: "claims_email", err: errors.New(`db: missing required field "AuthRequest.claims_email"`)} } if _, ok := arc.mutation.ClaimsEmailVerified(); !ok { - return &ValidationError{Name: "claims_email_verified", err: errors.New(`db: missing required field "claims_email_verified"`)} + return &ValidationError{Name: "claims_email_verified", err: errors.New(`db: missing required field "AuthRequest.claims_email_verified"`)} } if _, ok := arc.mutation.ClaimsPreferredUsername(); !ok { - return &ValidationError{Name: "claims_preferred_username", err: errors.New(`db: missing required field "claims_preferred_username"`)} + return &ValidationError{Name: "claims_preferred_username", err: errors.New(`db: missing required field "AuthRequest.claims_preferred_username"`)} } if _, ok := arc.mutation.ConnectorID(); !ok { - return &ValidationError{Name: "connector_id", err: errors.New(`db: missing required field "connector_id"`)} + return &ValidationError{Name: "connector_id", err: errors.New(`db: missing required field "AuthRequest.connector_id"`)} } if _, ok := arc.mutation.Expiry(); !ok { - return &ValidationError{Name: "expiry", err: errors.New(`db: missing required field "expiry"`)} + return &ValidationError{Name: "expiry", err: errors.New(`db: missing required field "AuthRequest.expiry"`)} } if _, ok := arc.mutation.CodeChallenge(); !ok { - return &ValidationError{Name: "code_challenge", err: errors.New(`db: missing required field "code_challenge"`)} + return &ValidationError{Name: "code_challenge", err: errors.New(`db: missing required field "AuthRequest.code_challenge"`)} } if _, ok := arc.mutation.CodeChallengeMethod(); !ok { - return &ValidationError{Name: "code_challenge_method", err: errors.New(`db: missing required field "code_challenge_method"`)} + return &ValidationError{Name: "code_challenge_method", err: errors.New(`db: missing required field "AuthRequest.code_challenge_method"`)} } if v, ok := arc.mutation.ID(); ok { if err := authrequest.IDValidator(v); err != nil { - return &ValidationError{Name: "id", err: fmt.Errorf(`db: validator failed for field "id": %w`, err)} + return &ValidationError{Name: "id", err: fmt.Errorf(`db: validator failed for field "AuthRequest.id": %w`, err)} } } return nil @@ -312,6 +312,13 @@ func (arc *AuthRequestCreate) sqlSave(ctx context.Context) (*AuthRequest, error) } return nil, err } + if _spec.ID.Value != nil { + if id, ok := _spec.ID.Value.(string); ok { + _node.ID = id + } else { + return nil, fmt.Errorf("unexpected AuthRequest.ID type: %T", _spec.ID.Value) + } + } return _node, nil } diff --git a/storage/ent/db/authrequest_query.go b/storage/ent/db/authrequest_query.go index e71f8546..236b684b 100644 --- a/storage/ent/db/authrequest_query.go +++ b/storage/ent/db/authrequest_query.go @@ -106,7 +106,7 @@ func (arq *AuthRequestQuery) FirstIDX(ctx context.Context) string { } // Only returns a single AuthRequest entity found by the query, ensuring it only returns one. -// Returns a *NotSingularError when exactly one AuthRequest entity is not found. +// Returns a *NotSingularError when more than one AuthRequest entity is found. // Returns a *NotFoundError when no AuthRequest entities are found. func (arq *AuthRequestQuery) Only(ctx context.Context) (*AuthRequest, error) { nodes, err := arq.Limit(2).All(ctx) @@ -133,7 +133,7 @@ func (arq *AuthRequestQuery) OnlyX(ctx context.Context) *AuthRequest { } // OnlyID is like Only, but returns the only AuthRequest ID in the query. -// Returns a *NotSingularError when exactly one AuthRequest ID is not found. +// Returns a *NotSingularError when more than one AuthRequest ID is found. // Returns a *NotFoundError when no entities are found. func (arq *AuthRequestQuery) OnlyID(ctx context.Context) (id string, err error) { var ids []string @@ -242,8 +242,9 @@ func (arq *AuthRequestQuery) Clone() *AuthRequestQuery { order: append([]OrderFunc{}, arq.order...), predicates: append([]predicate.AuthRequest{}, arq.predicates...), // clone intermediate query. - sql: arq.sql.Clone(), - path: arq.path, + sql: arq.sql.Clone(), + path: arq.path, + unique: arq.unique, } } @@ -336,6 +337,10 @@ func (arq *AuthRequestQuery) sqlAll(ctx context.Context) ([]*AuthRequest, error) func (arq *AuthRequestQuery) sqlCount(ctx context.Context) (int, error) { _spec := arq.querySpec() + _spec.Node.Columns = arq.fields + if len(arq.fields) > 0 { + _spec.Unique = arq.unique != nil && *arq.unique + } return sqlgraph.CountNodes(ctx, arq.driver, _spec) } @@ -407,6 +412,9 @@ func (arq *AuthRequestQuery) sqlQuery(ctx context.Context) *sql.Selector { selector = arq.sql selector.Select(selector.Columns(columns...)...) } + if arq.unique != nil && *arq.unique { + selector.Distinct() + } for _, p := range arq.predicates { p(selector) } @@ -685,9 +693,7 @@ func (argb *AuthRequestGroupBy) sqlQuery() *sql.Selector { for _, f := range argb.fields { columns = append(columns, selector.C(f)) } - for _, c := range aggregation { - columns = append(columns, c) - } + columns = append(columns, aggregation...) selector.Select(columns...) } return selector.GroupBy(selector.Columns(argb.fields...)...) diff --git a/storage/ent/db/authrequest_update.go b/storage/ent/db/authrequest_update.go index 2306d2e6..bc476c08 100644 --- a/storage/ent/db/authrequest_update.go +++ b/storage/ent/db/authrequest_update.go @@ -4,6 +4,7 @@ package db import ( "context" + "errors" "fmt" "time" @@ -683,7 +684,7 @@ func (aruo *AuthRequestUpdateOne) sqlSave(ctx context.Context) (_node *AuthReque } id, ok := aruo.mutation.ID() if !ok { - return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing AuthRequest.ID for update")} + return nil, &ValidationError{Name: "id", err: errors.New(`db: missing "AuthRequest.id" for update`)} } _spec.Node.ID.Value = id if fields := aruo.fields; len(fields) > 0 { diff --git a/storage/ent/db/client.go b/storage/ent/db/client.go index a27286a0..7a8e7ede 100644 --- a/storage/ent/db/client.go +++ b/storage/ent/db/client.go @@ -132,6 +132,7 @@ func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) cfg := c.config cfg.driver = &txDriver{tx: tx, drv: c.driver} return &Tx{ + ctx: ctx, config: cfg, AuthCode: NewAuthCodeClient(cfg), AuthRequest: NewAuthRequestClient(cfg), diff --git a/storage/ent/db/connector_create.go b/storage/ent/db/connector_create.go index 387231b9..b3836019 100644 --- a/storage/ent/db/connector_create.go +++ b/storage/ent/db/connector_create.go @@ -120,30 +120,30 @@ func (cc *ConnectorCreate) ExecX(ctx context.Context) { // check runs all checks and user-defined validators on the builder. func (cc *ConnectorCreate) check() error { if _, ok := cc.mutation.GetType(); !ok { - return &ValidationError{Name: "type", err: errors.New(`db: missing required field "type"`)} + return &ValidationError{Name: "type", err: errors.New(`db: missing required field "Connector.type"`)} } if v, ok := cc.mutation.GetType(); ok { if err := connector.TypeValidator(v); err != nil { - return &ValidationError{Name: "type", err: fmt.Errorf(`db: validator failed for field "type": %w`, err)} + return &ValidationError{Name: "type", err: fmt.Errorf(`db: validator failed for field "Connector.type": %w`, err)} } } if _, ok := cc.mutation.Name(); !ok { - return &ValidationError{Name: "name", err: errors.New(`db: missing required field "name"`)} + return &ValidationError{Name: "name", err: errors.New(`db: missing required field "Connector.name"`)} } if v, ok := cc.mutation.Name(); ok { if err := connector.NameValidator(v); err != nil { - return &ValidationError{Name: "name", err: fmt.Errorf(`db: validator failed for field "name": %w`, err)} + return &ValidationError{Name: "name", err: fmt.Errorf(`db: validator failed for field "Connector.name": %w`, err)} } } if _, ok := cc.mutation.ResourceVersion(); !ok { - return &ValidationError{Name: "resource_version", err: errors.New(`db: missing required field "resource_version"`)} + return &ValidationError{Name: "resource_version", err: errors.New(`db: missing required field "Connector.resource_version"`)} } if _, ok := cc.mutation.Config(); !ok { - return &ValidationError{Name: "config", err: errors.New(`db: missing required field "config"`)} + return &ValidationError{Name: "config", err: errors.New(`db: missing required field "Connector.config"`)} } if v, ok := cc.mutation.ID(); ok { if err := connector.IDValidator(v); err != nil { - return &ValidationError{Name: "id", err: fmt.Errorf(`db: validator failed for field "id": %w`, err)} + return &ValidationError{Name: "id", err: fmt.Errorf(`db: validator failed for field "Connector.id": %w`, err)} } } return nil @@ -157,6 +157,13 @@ func (cc *ConnectorCreate) sqlSave(ctx context.Context) (*Connector, error) { } return nil, err } + if _spec.ID.Value != nil { + if id, ok := _spec.ID.Value.(string); ok { + _node.ID = id + } else { + return nil, fmt.Errorf("unexpected Connector.ID type: %T", _spec.ID.Value) + } + } return _node, nil } diff --git a/storage/ent/db/connector_query.go b/storage/ent/db/connector_query.go index 9bcf368a..f79b4047 100644 --- a/storage/ent/db/connector_query.go +++ b/storage/ent/db/connector_query.go @@ -106,7 +106,7 @@ func (cq *ConnectorQuery) FirstIDX(ctx context.Context) string { } // Only returns a single Connector entity found by the query, ensuring it only returns one. -// Returns a *NotSingularError when exactly one Connector entity is not found. +// Returns a *NotSingularError when more than one Connector entity is found. // Returns a *NotFoundError when no Connector entities are found. func (cq *ConnectorQuery) Only(ctx context.Context) (*Connector, error) { nodes, err := cq.Limit(2).All(ctx) @@ -133,7 +133,7 @@ func (cq *ConnectorQuery) OnlyX(ctx context.Context) *Connector { } // OnlyID is like Only, but returns the only Connector ID in the query. -// Returns a *NotSingularError when exactly one Connector ID is not found. +// Returns a *NotSingularError when more than one Connector ID is found. // Returns a *NotFoundError when no entities are found. func (cq *ConnectorQuery) OnlyID(ctx context.Context) (id string, err error) { var ids []string @@ -242,8 +242,9 @@ func (cq *ConnectorQuery) Clone() *ConnectorQuery { order: append([]OrderFunc{}, cq.order...), predicates: append([]predicate.Connector{}, cq.predicates...), // clone intermediate query. - sql: cq.sql.Clone(), - path: cq.path, + sql: cq.sql.Clone(), + path: cq.path, + unique: cq.unique, } } @@ -336,6 +337,10 @@ func (cq *ConnectorQuery) sqlAll(ctx context.Context) ([]*Connector, error) { func (cq *ConnectorQuery) sqlCount(ctx context.Context) (int, error) { _spec := cq.querySpec() + _spec.Node.Columns = cq.fields + if len(cq.fields) > 0 { + _spec.Unique = cq.unique != nil && *cq.unique + } return sqlgraph.CountNodes(ctx, cq.driver, _spec) } @@ -407,6 +412,9 @@ func (cq *ConnectorQuery) sqlQuery(ctx context.Context) *sql.Selector { selector = cq.sql selector.Select(selector.Columns(columns...)...) } + if cq.unique != nil && *cq.unique { + selector.Distinct() + } for _, p := range cq.predicates { p(selector) } @@ -685,9 +693,7 @@ func (cgb *ConnectorGroupBy) sqlQuery() *sql.Selector { for _, f := range cgb.fields { columns = append(columns, selector.C(f)) } - for _, c := range aggregation { - columns = append(columns, c) - } + columns = append(columns, aggregation...) selector.Select(columns...) } return selector.GroupBy(selector.Columns(cgb.fields...)...) diff --git a/storage/ent/db/connector_update.go b/storage/ent/db/connector_update.go index 1bc9ffb5..b11c1aa5 100644 --- a/storage/ent/db/connector_update.go +++ b/storage/ent/db/connector_update.go @@ -4,6 +4,7 @@ package db import ( "context" + "errors" "fmt" "entgo.io/ent/dialect/sql" @@ -119,12 +120,12 @@ func (cu *ConnectorUpdate) ExecX(ctx context.Context) { func (cu *ConnectorUpdate) check() error { if v, ok := cu.mutation.GetType(); ok { if err := connector.TypeValidator(v); err != nil { - return &ValidationError{Name: "type", err: fmt.Errorf("db: validator failed for field \"type\": %w", err)} + return &ValidationError{Name: "type", err: fmt.Errorf(`db: validator failed for field "Connector.type": %w`, err)} } } if v, ok := cu.mutation.Name(); ok { if err := connector.NameValidator(v); err != nil { - return &ValidationError{Name: "name", err: fmt.Errorf("db: validator failed for field \"name\": %w", err)} + return &ValidationError{Name: "name", err: fmt.Errorf(`db: validator failed for field "Connector.name": %w`, err)} } } return nil @@ -295,12 +296,12 @@ func (cuo *ConnectorUpdateOne) ExecX(ctx context.Context) { func (cuo *ConnectorUpdateOne) check() error { if v, ok := cuo.mutation.GetType(); ok { if err := connector.TypeValidator(v); err != nil { - return &ValidationError{Name: "type", err: fmt.Errorf("db: validator failed for field \"type\": %w", err)} + return &ValidationError{Name: "type", err: fmt.Errorf(`db: validator failed for field "Connector.type": %w`, err)} } } if v, ok := cuo.mutation.Name(); ok { if err := connector.NameValidator(v); err != nil { - return &ValidationError{Name: "name", err: fmt.Errorf("db: validator failed for field \"name\": %w", err)} + return &ValidationError{Name: "name", err: fmt.Errorf(`db: validator failed for field "Connector.name": %w`, err)} } } return nil @@ -319,7 +320,7 @@ func (cuo *ConnectorUpdateOne) sqlSave(ctx context.Context) (_node *Connector, e } id, ok := cuo.mutation.ID() if !ok { - return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing Connector.ID for update")} + return nil, &ValidationError{Name: "id", err: errors.New(`db: missing "Connector.id" for update`)} } _spec.Node.ID.Value = id if fields := cuo.fields; len(fields) > 0 { diff --git a/storage/ent/db/devicerequest_create.go b/storage/ent/db/devicerequest_create.go index 102d028e..7600b47b 100644 --- a/storage/ent/db/devicerequest_create.go +++ b/storage/ent/db/devicerequest_create.go @@ -127,39 +127,39 @@ func (drc *DeviceRequestCreate) ExecX(ctx context.Context) { // check runs all checks and user-defined validators on the builder. func (drc *DeviceRequestCreate) check() error { if _, ok := drc.mutation.UserCode(); !ok { - return &ValidationError{Name: "user_code", err: errors.New(`db: missing required field "user_code"`)} + return &ValidationError{Name: "user_code", err: errors.New(`db: missing required field "DeviceRequest.user_code"`)} } if v, ok := drc.mutation.UserCode(); ok { if err := devicerequest.UserCodeValidator(v); err != nil { - return &ValidationError{Name: "user_code", err: fmt.Errorf(`db: validator failed for field "user_code": %w`, err)} + return &ValidationError{Name: "user_code", err: fmt.Errorf(`db: validator failed for field "DeviceRequest.user_code": %w`, err)} } } if _, ok := drc.mutation.DeviceCode(); !ok { - return &ValidationError{Name: "device_code", err: errors.New(`db: missing required field "device_code"`)} + return &ValidationError{Name: "device_code", err: errors.New(`db: missing required field "DeviceRequest.device_code"`)} } if v, ok := drc.mutation.DeviceCode(); ok { if err := devicerequest.DeviceCodeValidator(v); err != nil { - return &ValidationError{Name: "device_code", err: fmt.Errorf(`db: validator failed for field "device_code": %w`, err)} + return &ValidationError{Name: "device_code", err: fmt.Errorf(`db: validator failed for field "DeviceRequest.device_code": %w`, err)} } } if _, ok := drc.mutation.ClientID(); !ok { - return &ValidationError{Name: "client_id", err: errors.New(`db: missing required field "client_id"`)} + return &ValidationError{Name: "client_id", err: errors.New(`db: missing required field "DeviceRequest.client_id"`)} } if v, ok := drc.mutation.ClientID(); ok { if err := devicerequest.ClientIDValidator(v); err != nil { - return &ValidationError{Name: "client_id", err: fmt.Errorf(`db: validator failed for field "client_id": %w`, err)} + return &ValidationError{Name: "client_id", err: fmt.Errorf(`db: validator failed for field "DeviceRequest.client_id": %w`, err)} } } if _, ok := drc.mutation.ClientSecret(); !ok { - return &ValidationError{Name: "client_secret", err: errors.New(`db: missing required field "client_secret"`)} + return &ValidationError{Name: "client_secret", err: errors.New(`db: missing required field "DeviceRequest.client_secret"`)} } if v, ok := drc.mutation.ClientSecret(); ok { if err := devicerequest.ClientSecretValidator(v); err != nil { - return &ValidationError{Name: "client_secret", err: fmt.Errorf(`db: validator failed for field "client_secret": %w`, err)} + return &ValidationError{Name: "client_secret", err: fmt.Errorf(`db: validator failed for field "DeviceRequest.client_secret": %w`, err)} } } if _, ok := drc.mutation.Expiry(); !ok { - return &ValidationError{Name: "expiry", err: errors.New(`db: missing required field "expiry"`)} + return &ValidationError{Name: "expiry", err: errors.New(`db: missing required field "DeviceRequest.expiry"`)} } return nil } diff --git a/storage/ent/db/devicerequest_query.go b/storage/ent/db/devicerequest_query.go index 350b7ae6..f6839821 100644 --- a/storage/ent/db/devicerequest_query.go +++ b/storage/ent/db/devicerequest_query.go @@ -106,7 +106,7 @@ func (drq *DeviceRequestQuery) FirstIDX(ctx context.Context) int { } // Only returns a single DeviceRequest entity found by the query, ensuring it only returns one. -// Returns a *NotSingularError when exactly one DeviceRequest entity is not found. +// Returns a *NotSingularError when more than one DeviceRequest entity is found. // Returns a *NotFoundError when no DeviceRequest entities are found. func (drq *DeviceRequestQuery) Only(ctx context.Context) (*DeviceRequest, error) { nodes, err := drq.Limit(2).All(ctx) @@ -133,7 +133,7 @@ func (drq *DeviceRequestQuery) OnlyX(ctx context.Context) *DeviceRequest { } // OnlyID is like Only, but returns the only DeviceRequest ID in the query. -// Returns a *NotSingularError when exactly one DeviceRequest ID is not found. +// Returns a *NotSingularError when more than one DeviceRequest ID is found. // Returns a *NotFoundError when no entities are found. func (drq *DeviceRequestQuery) OnlyID(ctx context.Context) (id int, err error) { var ids []int @@ -242,8 +242,9 @@ func (drq *DeviceRequestQuery) Clone() *DeviceRequestQuery { order: append([]OrderFunc{}, drq.order...), predicates: append([]predicate.DeviceRequest{}, drq.predicates...), // clone intermediate query. - sql: drq.sql.Clone(), - path: drq.path, + sql: drq.sql.Clone(), + path: drq.path, + unique: drq.unique, } } @@ -336,6 +337,10 @@ func (drq *DeviceRequestQuery) sqlAll(ctx context.Context) ([]*DeviceRequest, er func (drq *DeviceRequestQuery) sqlCount(ctx context.Context) (int, error) { _spec := drq.querySpec() + _spec.Node.Columns = drq.fields + if len(drq.fields) > 0 { + _spec.Unique = drq.unique != nil && *drq.unique + } return sqlgraph.CountNodes(ctx, drq.driver, _spec) } @@ -407,6 +412,9 @@ func (drq *DeviceRequestQuery) sqlQuery(ctx context.Context) *sql.Selector { selector = drq.sql selector.Select(selector.Columns(columns...)...) } + if drq.unique != nil && *drq.unique { + selector.Distinct() + } for _, p := range drq.predicates { p(selector) } @@ -685,9 +693,7 @@ func (drgb *DeviceRequestGroupBy) sqlQuery() *sql.Selector { for _, f := range drgb.fields { columns = append(columns, selector.C(f)) } - for _, c := range aggregation { - columns = append(columns, c) - } + columns = append(columns, aggregation...) selector.Select(columns...) } return selector.GroupBy(selector.Columns(drgb.fields...)...) diff --git a/storage/ent/db/devicerequest_update.go b/storage/ent/db/devicerequest_update.go index 21c2f300..e47e565a 100644 --- a/storage/ent/db/devicerequest_update.go +++ b/storage/ent/db/devicerequest_update.go @@ -4,6 +4,7 @@ package db import ( "context" + "errors" "fmt" "time" @@ -138,22 +139,22 @@ func (dru *DeviceRequestUpdate) ExecX(ctx context.Context) { func (dru *DeviceRequestUpdate) check() error { if v, ok := dru.mutation.UserCode(); ok { if err := devicerequest.UserCodeValidator(v); err != nil { - return &ValidationError{Name: "user_code", err: fmt.Errorf("db: validator failed for field \"user_code\": %w", err)} + return &ValidationError{Name: "user_code", err: fmt.Errorf(`db: validator failed for field "DeviceRequest.user_code": %w`, err)} } } if v, ok := dru.mutation.DeviceCode(); ok { if err := devicerequest.DeviceCodeValidator(v); err != nil { - return &ValidationError{Name: "device_code", err: fmt.Errorf("db: validator failed for field \"device_code\": %w", err)} + return &ValidationError{Name: "device_code", err: fmt.Errorf(`db: validator failed for field "DeviceRequest.device_code": %w`, err)} } } if v, ok := dru.mutation.ClientID(); ok { if err := devicerequest.ClientIDValidator(v); err != nil { - return &ValidationError{Name: "client_id", err: fmt.Errorf("db: validator failed for field \"client_id\": %w", err)} + return &ValidationError{Name: "client_id", err: fmt.Errorf(`db: validator failed for field "DeviceRequest.client_id": %w`, err)} } } if v, ok := dru.mutation.ClientSecret(); ok { if err := devicerequest.ClientSecretValidator(v); err != nil { - return &ValidationError{Name: "client_secret", err: fmt.Errorf("db: validator failed for field \"client_secret\": %w", err)} + return &ValidationError{Name: "client_secret", err: fmt.Errorf(`db: validator failed for field "DeviceRequest.client_secret": %w`, err)} } } return nil @@ -362,22 +363,22 @@ func (druo *DeviceRequestUpdateOne) ExecX(ctx context.Context) { func (druo *DeviceRequestUpdateOne) check() error { if v, ok := druo.mutation.UserCode(); ok { if err := devicerequest.UserCodeValidator(v); err != nil { - return &ValidationError{Name: "user_code", err: fmt.Errorf("db: validator failed for field \"user_code\": %w", err)} + return &ValidationError{Name: "user_code", err: fmt.Errorf(`db: validator failed for field "DeviceRequest.user_code": %w`, err)} } } if v, ok := druo.mutation.DeviceCode(); ok { if err := devicerequest.DeviceCodeValidator(v); err != nil { - return &ValidationError{Name: "device_code", err: fmt.Errorf("db: validator failed for field \"device_code\": %w", err)} + return &ValidationError{Name: "device_code", err: fmt.Errorf(`db: validator failed for field "DeviceRequest.device_code": %w`, err)} } } if v, ok := druo.mutation.ClientID(); ok { if err := devicerequest.ClientIDValidator(v); err != nil { - return &ValidationError{Name: "client_id", err: fmt.Errorf("db: validator failed for field \"client_id\": %w", err)} + return &ValidationError{Name: "client_id", err: fmt.Errorf(`db: validator failed for field "DeviceRequest.client_id": %w`, err)} } } if v, ok := druo.mutation.ClientSecret(); ok { if err := devicerequest.ClientSecretValidator(v); err != nil { - return &ValidationError{Name: "client_secret", err: fmt.Errorf("db: validator failed for field \"client_secret\": %w", err)} + return &ValidationError{Name: "client_secret", err: fmt.Errorf(`db: validator failed for field "DeviceRequest.client_secret": %w`, err)} } } return nil @@ -396,7 +397,7 @@ func (druo *DeviceRequestUpdateOne) sqlSave(ctx context.Context) (_node *DeviceR } id, ok := druo.mutation.ID() if !ok { - return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing DeviceRequest.ID for update")} + return nil, &ValidationError{Name: "id", err: errors.New(`db: missing "DeviceRequest.id" for update`)} } _spec.Node.ID.Value = id if fields := druo.fields; len(fields) > 0 { diff --git a/storage/ent/db/devicetoken_create.go b/storage/ent/db/devicetoken_create.go index db73ad4d..42c86755 100644 --- a/storage/ent/db/devicetoken_create.go +++ b/storage/ent/db/devicetoken_create.go @@ -127,29 +127,29 @@ func (dtc *DeviceTokenCreate) ExecX(ctx context.Context) { // check runs all checks and user-defined validators on the builder. func (dtc *DeviceTokenCreate) check() error { if _, ok := dtc.mutation.DeviceCode(); !ok { - return &ValidationError{Name: "device_code", err: errors.New(`db: missing required field "device_code"`)} + return &ValidationError{Name: "device_code", err: errors.New(`db: missing required field "DeviceToken.device_code"`)} } if v, ok := dtc.mutation.DeviceCode(); ok { if err := devicetoken.DeviceCodeValidator(v); err != nil { - return &ValidationError{Name: "device_code", err: fmt.Errorf(`db: validator failed for field "device_code": %w`, err)} + return &ValidationError{Name: "device_code", err: fmt.Errorf(`db: validator failed for field "DeviceToken.device_code": %w`, err)} } } if _, ok := dtc.mutation.Status(); !ok { - return &ValidationError{Name: "status", err: errors.New(`db: missing required field "status"`)} + return &ValidationError{Name: "status", err: errors.New(`db: missing required field "DeviceToken.status"`)} } if v, ok := dtc.mutation.Status(); ok { if err := devicetoken.StatusValidator(v); err != nil { - return &ValidationError{Name: "status", err: fmt.Errorf(`db: validator failed for field "status": %w`, err)} + return &ValidationError{Name: "status", err: fmt.Errorf(`db: validator failed for field "DeviceToken.status": %w`, err)} } } if _, ok := dtc.mutation.Expiry(); !ok { - return &ValidationError{Name: "expiry", err: errors.New(`db: missing required field "expiry"`)} + return &ValidationError{Name: "expiry", err: errors.New(`db: missing required field "DeviceToken.expiry"`)} } if _, ok := dtc.mutation.LastRequest(); !ok { - return &ValidationError{Name: "last_request", err: errors.New(`db: missing required field "last_request"`)} + return &ValidationError{Name: "last_request", err: errors.New(`db: missing required field "DeviceToken.last_request"`)} } if _, ok := dtc.mutation.PollInterval(); !ok { - return &ValidationError{Name: "poll_interval", err: errors.New(`db: missing required field "poll_interval"`)} + return &ValidationError{Name: "poll_interval", err: errors.New(`db: missing required field "DeviceToken.poll_interval"`)} } return nil } diff --git a/storage/ent/db/devicetoken_query.go b/storage/ent/db/devicetoken_query.go index 2fb2712f..07697c49 100644 --- a/storage/ent/db/devicetoken_query.go +++ b/storage/ent/db/devicetoken_query.go @@ -106,7 +106,7 @@ func (dtq *DeviceTokenQuery) FirstIDX(ctx context.Context) int { } // Only returns a single DeviceToken entity found by the query, ensuring it only returns one. -// Returns a *NotSingularError when exactly one DeviceToken entity is not found. +// Returns a *NotSingularError when more than one DeviceToken entity is found. // Returns a *NotFoundError when no DeviceToken entities are found. func (dtq *DeviceTokenQuery) Only(ctx context.Context) (*DeviceToken, error) { nodes, err := dtq.Limit(2).All(ctx) @@ -133,7 +133,7 @@ func (dtq *DeviceTokenQuery) OnlyX(ctx context.Context) *DeviceToken { } // OnlyID is like Only, but returns the only DeviceToken ID in the query. -// Returns a *NotSingularError when exactly one DeviceToken ID is not found. +// Returns a *NotSingularError when more than one DeviceToken ID is found. // Returns a *NotFoundError when no entities are found. func (dtq *DeviceTokenQuery) OnlyID(ctx context.Context) (id int, err error) { var ids []int @@ -242,8 +242,9 @@ func (dtq *DeviceTokenQuery) Clone() *DeviceTokenQuery { order: append([]OrderFunc{}, dtq.order...), predicates: append([]predicate.DeviceToken{}, dtq.predicates...), // clone intermediate query. - sql: dtq.sql.Clone(), - path: dtq.path, + sql: dtq.sql.Clone(), + path: dtq.path, + unique: dtq.unique, } } @@ -336,6 +337,10 @@ func (dtq *DeviceTokenQuery) sqlAll(ctx context.Context) ([]*DeviceToken, error) func (dtq *DeviceTokenQuery) sqlCount(ctx context.Context) (int, error) { _spec := dtq.querySpec() + _spec.Node.Columns = dtq.fields + if len(dtq.fields) > 0 { + _spec.Unique = dtq.unique != nil && *dtq.unique + } return sqlgraph.CountNodes(ctx, dtq.driver, _spec) } @@ -407,6 +412,9 @@ func (dtq *DeviceTokenQuery) sqlQuery(ctx context.Context) *sql.Selector { selector = dtq.sql selector.Select(selector.Columns(columns...)...) } + if dtq.unique != nil && *dtq.unique { + selector.Distinct() + } for _, p := range dtq.predicates { p(selector) } @@ -685,9 +693,7 @@ func (dtgb *DeviceTokenGroupBy) sqlQuery() *sql.Selector { for _, f := range dtgb.fields { columns = append(columns, selector.C(f)) } - for _, c := range aggregation { - columns = append(columns, c) - } + columns = append(columns, aggregation...) selector.Select(columns...) } return selector.GroupBy(selector.Columns(dtgb.fields...)...) diff --git a/storage/ent/db/devicetoken_update.go b/storage/ent/db/devicetoken_update.go index a61a8b0b..bf9d2993 100644 --- a/storage/ent/db/devicetoken_update.go +++ b/storage/ent/db/devicetoken_update.go @@ -4,6 +4,7 @@ package db import ( "context" + "errors" "fmt" "time" @@ -145,12 +146,12 @@ func (dtu *DeviceTokenUpdate) ExecX(ctx context.Context) { func (dtu *DeviceTokenUpdate) check() error { if v, ok := dtu.mutation.DeviceCode(); ok { if err := devicetoken.DeviceCodeValidator(v); err != nil { - return &ValidationError{Name: "device_code", err: fmt.Errorf("db: validator failed for field \"device_code\": %w", err)} + return &ValidationError{Name: "device_code", err: fmt.Errorf(`db: validator failed for field "DeviceToken.device_code": %w`, err)} } } if v, ok := dtu.mutation.Status(); ok { if err := devicetoken.StatusValidator(v); err != nil { - return &ValidationError{Name: "status", err: fmt.Errorf("db: validator failed for field \"status\": %w", err)} + return &ValidationError{Name: "status", err: fmt.Errorf(`db: validator failed for field "DeviceToken.status": %w`, err)} } } return nil @@ -373,12 +374,12 @@ func (dtuo *DeviceTokenUpdateOne) ExecX(ctx context.Context) { func (dtuo *DeviceTokenUpdateOne) check() error { if v, ok := dtuo.mutation.DeviceCode(); ok { if err := devicetoken.DeviceCodeValidator(v); err != nil { - return &ValidationError{Name: "device_code", err: fmt.Errorf("db: validator failed for field \"device_code\": %w", err)} + return &ValidationError{Name: "device_code", err: fmt.Errorf(`db: validator failed for field "DeviceToken.device_code": %w`, err)} } } if v, ok := dtuo.mutation.Status(); ok { if err := devicetoken.StatusValidator(v); err != nil { - return &ValidationError{Name: "status", err: fmt.Errorf("db: validator failed for field \"status\": %w", err)} + return &ValidationError{Name: "status", err: fmt.Errorf(`db: validator failed for field "DeviceToken.status": %w`, err)} } } return nil @@ -397,7 +398,7 @@ func (dtuo *DeviceTokenUpdateOne) sqlSave(ctx context.Context) (_node *DeviceTok } id, ok := dtuo.mutation.ID() if !ok { - return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing DeviceToken.ID for update")} + return nil, &ValidationError{Name: "id", err: errors.New(`db: missing "DeviceToken.id" for update`)} } _spec.Node.ID.Value = id if fields := dtuo.fields; len(fields) > 0 { diff --git a/storage/ent/db/ent.go b/storage/ent/db/ent.go index 42d7ad52..15a183a2 100644 --- a/storage/ent/db/ent.go +++ b/storage/ent/db/ent.go @@ -159,7 +159,7 @@ func Sum(field string) AggregateFunc { } } -// ValidationError returns when validating a field fails. +// ValidationError returns when validating a field or edge fails. type ValidationError struct { Name string // Field or edge name. err error diff --git a/storage/ent/db/keys_create.go b/storage/ent/db/keys_create.go index 18e58f8b..2b37b581 100644 --- a/storage/ent/db/keys_create.go +++ b/storage/ent/db/keys_create.go @@ -123,20 +123,20 @@ func (kc *KeysCreate) ExecX(ctx context.Context) { // check runs all checks and user-defined validators on the builder. func (kc *KeysCreate) check() error { if _, ok := kc.mutation.VerificationKeys(); !ok { - return &ValidationError{Name: "verification_keys", err: errors.New(`db: missing required field "verification_keys"`)} + return &ValidationError{Name: "verification_keys", err: errors.New(`db: missing required field "Keys.verification_keys"`)} } if _, ok := kc.mutation.SigningKey(); !ok { - return &ValidationError{Name: "signing_key", err: errors.New(`db: missing required field "signing_key"`)} + return &ValidationError{Name: "signing_key", err: errors.New(`db: missing required field "Keys.signing_key"`)} } if _, ok := kc.mutation.SigningKeyPub(); !ok { - return &ValidationError{Name: "signing_key_pub", err: errors.New(`db: missing required field "signing_key_pub"`)} + return &ValidationError{Name: "signing_key_pub", err: errors.New(`db: missing required field "Keys.signing_key_pub"`)} } if _, ok := kc.mutation.NextRotation(); !ok { - return &ValidationError{Name: "next_rotation", err: errors.New(`db: missing required field "next_rotation"`)} + return &ValidationError{Name: "next_rotation", err: errors.New(`db: missing required field "Keys.next_rotation"`)} } if v, ok := kc.mutation.ID(); ok { if err := keys.IDValidator(v); err != nil { - return &ValidationError{Name: "id", err: fmt.Errorf(`db: validator failed for field "id": %w`, err)} + return &ValidationError{Name: "id", err: fmt.Errorf(`db: validator failed for field "Keys.id": %w`, err)} } } return nil @@ -150,6 +150,13 @@ func (kc *KeysCreate) sqlSave(ctx context.Context) (*Keys, error) { } return nil, err } + if _spec.ID.Value != nil { + if id, ok := _spec.ID.Value.(string); ok { + _node.ID = id + } else { + return nil, fmt.Errorf("unexpected Keys.ID type: %T", _spec.ID.Value) + } + } return _node, nil } diff --git a/storage/ent/db/keys_query.go b/storage/ent/db/keys_query.go index ee102e27..c2dfc173 100644 --- a/storage/ent/db/keys_query.go +++ b/storage/ent/db/keys_query.go @@ -106,7 +106,7 @@ func (kq *KeysQuery) FirstIDX(ctx context.Context) string { } // Only returns a single Keys entity found by the query, ensuring it only returns one. -// Returns a *NotSingularError when exactly one Keys entity is not found. +// Returns a *NotSingularError when more than one Keys entity is found. // Returns a *NotFoundError when no Keys entities are found. func (kq *KeysQuery) Only(ctx context.Context) (*Keys, error) { nodes, err := kq.Limit(2).All(ctx) @@ -133,7 +133,7 @@ func (kq *KeysQuery) OnlyX(ctx context.Context) *Keys { } // OnlyID is like Only, but returns the only Keys ID in the query. -// Returns a *NotSingularError when exactly one Keys ID is not found. +// Returns a *NotSingularError when more than one Keys ID is found. // Returns a *NotFoundError when no entities are found. func (kq *KeysQuery) OnlyID(ctx context.Context) (id string, err error) { var ids []string @@ -242,8 +242,9 @@ func (kq *KeysQuery) Clone() *KeysQuery { order: append([]OrderFunc{}, kq.order...), predicates: append([]predicate.Keys{}, kq.predicates...), // clone intermediate query. - sql: kq.sql.Clone(), - path: kq.path, + sql: kq.sql.Clone(), + path: kq.path, + unique: kq.unique, } } @@ -336,6 +337,10 @@ func (kq *KeysQuery) sqlAll(ctx context.Context) ([]*Keys, error) { func (kq *KeysQuery) sqlCount(ctx context.Context) (int, error) { _spec := kq.querySpec() + _spec.Node.Columns = kq.fields + if len(kq.fields) > 0 { + _spec.Unique = kq.unique != nil && *kq.unique + } return sqlgraph.CountNodes(ctx, kq.driver, _spec) } @@ -407,6 +412,9 @@ func (kq *KeysQuery) sqlQuery(ctx context.Context) *sql.Selector { selector = kq.sql selector.Select(selector.Columns(columns...)...) } + if kq.unique != nil && *kq.unique { + selector.Distinct() + } for _, p := range kq.predicates { p(selector) } @@ -685,9 +693,7 @@ func (kgb *KeysGroupBy) sqlQuery() *sql.Selector { for _, f := range kgb.fields { columns = append(columns, selector.C(f)) } - for _, c := range aggregation { - columns = append(columns, c) - } + columns = append(columns, aggregation...) selector.Select(columns...) } return selector.GroupBy(selector.Columns(kgb.fields...)...) diff --git a/storage/ent/db/keys_update.go b/storage/ent/db/keys_update.go index 0e40565f..e5b5529a 100644 --- a/storage/ent/db/keys_update.go +++ b/storage/ent/db/keys_update.go @@ -4,6 +4,7 @@ package db import ( "context" + "errors" "fmt" "time" @@ -280,7 +281,7 @@ func (kuo *KeysUpdateOne) sqlSave(ctx context.Context) (_node *Keys, err error) } id, ok := kuo.mutation.ID() if !ok { - return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing Keys.ID for update")} + return nil, &ValidationError{Name: "id", err: errors.New(`db: missing "Keys.id" for update`)} } _spec.Node.ID.Value = id if fields := kuo.fields; len(fields) > 0 { diff --git a/storage/ent/db/migrate/migrate.go b/storage/ent/db/migrate/migrate.go index e4a9a221..9bdaf523 100644 --- a/storage/ent/db/migrate/migrate.go +++ b/storage/ent/db/migrate/migrate.go @@ -37,8 +37,7 @@ var ( // Schema is the API for creating, migrating and dropping a schema. type Schema struct { - drv dialect.Driver - universalID bool + drv dialect.Driver } // NewSchema creates a new schema client. diff --git a/storage/ent/db/mutation.go b/storage/ent/db/mutation.go index d6d1dbab..d7d4e423 100644 --- a/storage/ent/db/mutation.go +++ b/storage/ent/db/mutation.go @@ -4,6 +4,7 @@ package db import ( "context" + "errors" "fmt" "sync" "time" @@ -103,7 +104,7 @@ func withAuthCodeID(id string) authcodeOption { m.oldValue = func(ctx context.Context) (*AuthCode, error) { once.Do(func() { if m.done { - err = fmt.Errorf("querying old values post mutation is not allowed") + err = errors.New("querying old values post mutation is not allowed") } else { value, err = m.Client().AuthCode.Get(ctx, id) } @@ -136,7 +137,7 @@ func (m AuthCodeMutation) Client() *Client { // it returns an error otherwise. func (m AuthCodeMutation) Tx() (*Tx, error) { if _, ok := m.driver.(*txDriver); !ok { - return nil, fmt.Errorf("db: mutation is not running in a transaction") + return nil, errors.New("db: mutation is not running in a transaction") } tx := &Tx{config: m.config} tx.init() @@ -158,6 +159,25 @@ func (m *AuthCodeMutation) ID() (id string, exists bool) { return *m.id, true } +// IDs queries the database and returns the entity ids that match the mutation's predicate. +// That means, if the mutation is applied within a transaction with an isolation level such +// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated +// or updated by the mutation. +func (m *AuthCodeMutation) IDs(ctx context.Context) ([]string, error) { + switch { + case m.op.Is(OpUpdateOne | OpDeleteOne): + id, exists := m.ID() + if exists { + return []string{id}, nil + } + fallthrough + case m.op.Is(OpUpdate | OpDelete): + return m.Client().AuthCode.Query().Where(m.predicates...).IDs(ctx) + default: + return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op) + } +} + // SetClientID sets the "client_id" field. func (m *AuthCodeMutation) SetClientID(s string) { m.client_id = &s @@ -177,10 +197,10 @@ func (m *AuthCodeMutation) ClientID() (r string, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *AuthCodeMutation) OldClientID(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldClientID is only allowed on UpdateOne operations") + return v, errors.New("OldClientID is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldClientID requires an ID field in the mutation") + return v, errors.New("OldClientID requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -213,10 +233,10 @@ func (m *AuthCodeMutation) Scopes() (r []string, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *AuthCodeMutation) OldScopes(ctx context.Context) (v []string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldScopes is only allowed on UpdateOne operations") + return v, errors.New("OldScopes is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldScopes requires an ID field in the mutation") + return v, errors.New("OldScopes requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -262,10 +282,10 @@ func (m *AuthCodeMutation) Nonce() (r string, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *AuthCodeMutation) OldNonce(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldNonce is only allowed on UpdateOne operations") + return v, errors.New("OldNonce is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldNonce requires an ID field in the mutation") + return v, errors.New("OldNonce requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -298,10 +318,10 @@ func (m *AuthCodeMutation) RedirectURI() (r string, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *AuthCodeMutation) OldRedirectURI(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldRedirectURI is only allowed on UpdateOne operations") + return v, errors.New("OldRedirectURI is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldRedirectURI requires an ID field in the mutation") + return v, errors.New("OldRedirectURI requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -334,10 +354,10 @@ func (m *AuthCodeMutation) ClaimsUserID() (r string, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *AuthCodeMutation) OldClaimsUserID(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldClaimsUserID is only allowed on UpdateOne operations") + return v, errors.New("OldClaimsUserID is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldClaimsUserID requires an ID field in the mutation") + return v, errors.New("OldClaimsUserID requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -370,10 +390,10 @@ func (m *AuthCodeMutation) ClaimsUsername() (r string, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *AuthCodeMutation) OldClaimsUsername(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldClaimsUsername is only allowed on UpdateOne operations") + return v, errors.New("OldClaimsUsername is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldClaimsUsername requires an ID field in the mutation") + return v, errors.New("OldClaimsUsername requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -406,10 +426,10 @@ func (m *AuthCodeMutation) ClaimsEmail() (r string, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *AuthCodeMutation) OldClaimsEmail(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldClaimsEmail is only allowed on UpdateOne operations") + return v, errors.New("OldClaimsEmail is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldClaimsEmail requires an ID field in the mutation") + return v, errors.New("OldClaimsEmail requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -442,10 +462,10 @@ func (m *AuthCodeMutation) ClaimsEmailVerified() (r bool, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *AuthCodeMutation) OldClaimsEmailVerified(ctx context.Context) (v bool, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldClaimsEmailVerified is only allowed on UpdateOne operations") + return v, errors.New("OldClaimsEmailVerified is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldClaimsEmailVerified requires an ID field in the mutation") + return v, errors.New("OldClaimsEmailVerified requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -478,10 +498,10 @@ func (m *AuthCodeMutation) ClaimsGroups() (r []string, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *AuthCodeMutation) OldClaimsGroups(ctx context.Context) (v []string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldClaimsGroups is only allowed on UpdateOne operations") + return v, errors.New("OldClaimsGroups is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldClaimsGroups requires an ID field in the mutation") + return v, errors.New("OldClaimsGroups requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -527,10 +547,10 @@ func (m *AuthCodeMutation) ClaimsPreferredUsername() (r string, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *AuthCodeMutation) OldClaimsPreferredUsername(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldClaimsPreferredUsername is only allowed on UpdateOne operations") + return v, errors.New("OldClaimsPreferredUsername is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldClaimsPreferredUsername requires an ID field in the mutation") + return v, errors.New("OldClaimsPreferredUsername requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -563,10 +583,10 @@ func (m *AuthCodeMutation) ConnectorID() (r string, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *AuthCodeMutation) OldConnectorID(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldConnectorID is only allowed on UpdateOne operations") + return v, errors.New("OldConnectorID is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldConnectorID requires an ID field in the mutation") + return v, errors.New("OldConnectorID requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -599,10 +619,10 @@ func (m *AuthCodeMutation) ConnectorData() (r []byte, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *AuthCodeMutation) OldConnectorData(ctx context.Context) (v *[]byte, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldConnectorData is only allowed on UpdateOne operations") + return v, errors.New("OldConnectorData is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldConnectorData requires an ID field in the mutation") + return v, errors.New("OldConnectorData requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -648,10 +668,10 @@ func (m *AuthCodeMutation) Expiry() (r time.Time, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *AuthCodeMutation) OldExpiry(ctx context.Context) (v time.Time, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldExpiry is only allowed on UpdateOne operations") + return v, errors.New("OldExpiry is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldExpiry requires an ID field in the mutation") + return v, errors.New("OldExpiry requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -684,10 +704,10 @@ func (m *AuthCodeMutation) CodeChallenge() (r string, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *AuthCodeMutation) OldCodeChallenge(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldCodeChallenge is only allowed on UpdateOne operations") + return v, errors.New("OldCodeChallenge is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldCodeChallenge requires an ID field in the mutation") + return v, errors.New("OldCodeChallenge requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -720,10 +740,10 @@ func (m *AuthCodeMutation) CodeChallengeMethod() (r string, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *AuthCodeMutation) OldCodeChallengeMethod(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldCodeChallengeMethod is only allowed on UpdateOne operations") + return v, errors.New("OldCodeChallengeMethod is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldCodeChallengeMethod requires an ID field in the mutation") + return v, errors.New("OldCodeChallengeMethod requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -1221,7 +1241,7 @@ func withAuthRequestID(id string) authrequestOption { m.oldValue = func(ctx context.Context) (*AuthRequest, error) { once.Do(func() { if m.done { - err = fmt.Errorf("querying old values post mutation is not allowed") + err = errors.New("querying old values post mutation is not allowed") } else { value, err = m.Client().AuthRequest.Get(ctx, id) } @@ -1254,7 +1274,7 @@ func (m AuthRequestMutation) Client() *Client { // it returns an error otherwise. func (m AuthRequestMutation) Tx() (*Tx, error) { if _, ok := m.driver.(*txDriver); !ok { - return nil, fmt.Errorf("db: mutation is not running in a transaction") + return nil, errors.New("db: mutation is not running in a transaction") } tx := &Tx{config: m.config} tx.init() @@ -1276,6 +1296,25 @@ func (m *AuthRequestMutation) ID() (id string, exists bool) { return *m.id, true } +// IDs queries the database and returns the entity ids that match the mutation's predicate. +// That means, if the mutation is applied within a transaction with an isolation level such +// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated +// or updated by the mutation. +func (m *AuthRequestMutation) IDs(ctx context.Context) ([]string, error) { + switch { + case m.op.Is(OpUpdateOne | OpDeleteOne): + id, exists := m.ID() + if exists { + return []string{id}, nil + } + fallthrough + case m.op.Is(OpUpdate | OpDelete): + return m.Client().AuthRequest.Query().Where(m.predicates...).IDs(ctx) + default: + return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op) + } +} + // SetClientID sets the "client_id" field. func (m *AuthRequestMutation) SetClientID(s string) { m.client_id = &s @@ -1295,10 +1334,10 @@ func (m *AuthRequestMutation) ClientID() (r string, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *AuthRequestMutation) OldClientID(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldClientID is only allowed on UpdateOne operations") + return v, errors.New("OldClientID is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldClientID requires an ID field in the mutation") + return v, errors.New("OldClientID requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -1331,10 +1370,10 @@ func (m *AuthRequestMutation) Scopes() (r []string, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *AuthRequestMutation) OldScopes(ctx context.Context) (v []string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldScopes is only allowed on UpdateOne operations") + return v, errors.New("OldScopes is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldScopes requires an ID field in the mutation") + return v, errors.New("OldScopes requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -1380,10 +1419,10 @@ func (m *AuthRequestMutation) ResponseTypes() (r []string, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *AuthRequestMutation) OldResponseTypes(ctx context.Context) (v []string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldResponseTypes is only allowed on UpdateOne operations") + return v, errors.New("OldResponseTypes is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldResponseTypes requires an ID field in the mutation") + return v, errors.New("OldResponseTypes requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -1429,10 +1468,10 @@ func (m *AuthRequestMutation) RedirectURI() (r string, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *AuthRequestMutation) OldRedirectURI(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldRedirectURI is only allowed on UpdateOne operations") + return v, errors.New("OldRedirectURI is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldRedirectURI requires an ID field in the mutation") + return v, errors.New("OldRedirectURI requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -1465,10 +1504,10 @@ func (m *AuthRequestMutation) Nonce() (r string, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *AuthRequestMutation) OldNonce(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldNonce is only allowed on UpdateOne operations") + return v, errors.New("OldNonce is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldNonce requires an ID field in the mutation") + return v, errors.New("OldNonce requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -1501,10 +1540,10 @@ func (m *AuthRequestMutation) State() (r string, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *AuthRequestMutation) OldState(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldState is only allowed on UpdateOne operations") + return v, errors.New("OldState is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldState requires an ID field in the mutation") + return v, errors.New("OldState requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -1537,10 +1576,10 @@ func (m *AuthRequestMutation) ForceApprovalPrompt() (r bool, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *AuthRequestMutation) OldForceApprovalPrompt(ctx context.Context) (v bool, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldForceApprovalPrompt is only allowed on UpdateOne operations") + return v, errors.New("OldForceApprovalPrompt is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldForceApprovalPrompt requires an ID field in the mutation") + return v, errors.New("OldForceApprovalPrompt requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -1573,10 +1612,10 @@ func (m *AuthRequestMutation) LoggedIn() (r bool, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *AuthRequestMutation) OldLoggedIn(ctx context.Context) (v bool, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldLoggedIn is only allowed on UpdateOne operations") + return v, errors.New("OldLoggedIn is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldLoggedIn requires an ID field in the mutation") + return v, errors.New("OldLoggedIn requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -1609,10 +1648,10 @@ func (m *AuthRequestMutation) ClaimsUserID() (r string, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *AuthRequestMutation) OldClaimsUserID(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldClaimsUserID is only allowed on UpdateOne operations") + return v, errors.New("OldClaimsUserID is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldClaimsUserID requires an ID field in the mutation") + return v, errors.New("OldClaimsUserID requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -1645,10 +1684,10 @@ func (m *AuthRequestMutation) ClaimsUsername() (r string, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *AuthRequestMutation) OldClaimsUsername(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldClaimsUsername is only allowed on UpdateOne operations") + return v, errors.New("OldClaimsUsername is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldClaimsUsername requires an ID field in the mutation") + return v, errors.New("OldClaimsUsername requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -1681,10 +1720,10 @@ func (m *AuthRequestMutation) ClaimsEmail() (r string, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *AuthRequestMutation) OldClaimsEmail(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldClaimsEmail is only allowed on UpdateOne operations") + return v, errors.New("OldClaimsEmail is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldClaimsEmail requires an ID field in the mutation") + return v, errors.New("OldClaimsEmail requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -1717,10 +1756,10 @@ func (m *AuthRequestMutation) ClaimsEmailVerified() (r bool, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *AuthRequestMutation) OldClaimsEmailVerified(ctx context.Context) (v bool, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldClaimsEmailVerified is only allowed on UpdateOne operations") + return v, errors.New("OldClaimsEmailVerified is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldClaimsEmailVerified requires an ID field in the mutation") + return v, errors.New("OldClaimsEmailVerified requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -1753,10 +1792,10 @@ func (m *AuthRequestMutation) ClaimsGroups() (r []string, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *AuthRequestMutation) OldClaimsGroups(ctx context.Context) (v []string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldClaimsGroups is only allowed on UpdateOne operations") + return v, errors.New("OldClaimsGroups is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldClaimsGroups requires an ID field in the mutation") + return v, errors.New("OldClaimsGroups requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -1802,10 +1841,10 @@ func (m *AuthRequestMutation) ClaimsPreferredUsername() (r string, exists bool) // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *AuthRequestMutation) OldClaimsPreferredUsername(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldClaimsPreferredUsername is only allowed on UpdateOne operations") + return v, errors.New("OldClaimsPreferredUsername is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldClaimsPreferredUsername requires an ID field in the mutation") + return v, errors.New("OldClaimsPreferredUsername requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -1838,10 +1877,10 @@ func (m *AuthRequestMutation) ConnectorID() (r string, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *AuthRequestMutation) OldConnectorID(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldConnectorID is only allowed on UpdateOne operations") + return v, errors.New("OldConnectorID is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldConnectorID requires an ID field in the mutation") + return v, errors.New("OldConnectorID requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -1874,10 +1913,10 @@ func (m *AuthRequestMutation) ConnectorData() (r []byte, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *AuthRequestMutation) OldConnectorData(ctx context.Context) (v *[]byte, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldConnectorData is only allowed on UpdateOne operations") + return v, errors.New("OldConnectorData is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldConnectorData requires an ID field in the mutation") + return v, errors.New("OldConnectorData requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -1923,10 +1962,10 @@ func (m *AuthRequestMutation) Expiry() (r time.Time, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *AuthRequestMutation) OldExpiry(ctx context.Context) (v time.Time, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldExpiry is only allowed on UpdateOne operations") + return v, errors.New("OldExpiry is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldExpiry requires an ID field in the mutation") + return v, errors.New("OldExpiry requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -1959,10 +1998,10 @@ func (m *AuthRequestMutation) CodeChallenge() (r string, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *AuthRequestMutation) OldCodeChallenge(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldCodeChallenge is only allowed on UpdateOne operations") + return v, errors.New("OldCodeChallenge is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldCodeChallenge requires an ID field in the mutation") + return v, errors.New("OldCodeChallenge requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -1995,10 +2034,10 @@ func (m *AuthRequestMutation) CodeChallengeMethod() (r string, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *AuthRequestMutation) OldCodeChallengeMethod(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldCodeChallengeMethod is only allowed on UpdateOne operations") + return v, errors.New("OldCodeChallengeMethod is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldCodeChallengeMethod requires an ID field in the mutation") + return v, errors.New("OldCodeChallengeMethod requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -2555,7 +2594,7 @@ func withConnectorID(id string) connectorOption { m.oldValue = func(ctx context.Context) (*Connector, error) { once.Do(func() { if m.done { - err = fmt.Errorf("querying old values post mutation is not allowed") + err = errors.New("querying old values post mutation is not allowed") } else { value, err = m.Client().Connector.Get(ctx, id) } @@ -2588,7 +2627,7 @@ func (m ConnectorMutation) Client() *Client { // it returns an error otherwise. func (m ConnectorMutation) Tx() (*Tx, error) { if _, ok := m.driver.(*txDriver); !ok { - return nil, fmt.Errorf("db: mutation is not running in a transaction") + return nil, errors.New("db: mutation is not running in a transaction") } tx := &Tx{config: m.config} tx.init() @@ -2610,6 +2649,25 @@ func (m *ConnectorMutation) ID() (id string, exists bool) { return *m.id, true } +// IDs queries the database and returns the entity ids that match the mutation's predicate. +// That means, if the mutation is applied within a transaction with an isolation level such +// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated +// or updated by the mutation. +func (m *ConnectorMutation) IDs(ctx context.Context) ([]string, error) { + switch { + case m.op.Is(OpUpdateOne | OpDeleteOne): + id, exists := m.ID() + if exists { + return []string{id}, nil + } + fallthrough + case m.op.Is(OpUpdate | OpDelete): + return m.Client().Connector.Query().Where(m.predicates...).IDs(ctx) + default: + return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op) + } +} + // SetType sets the "type" field. func (m *ConnectorMutation) SetType(s string) { m._type = &s @@ -2629,10 +2687,10 @@ func (m *ConnectorMutation) GetType() (r string, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *ConnectorMutation) OldType(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldType is only allowed on UpdateOne operations") + return v, errors.New("OldType is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldType requires an ID field in the mutation") + return v, errors.New("OldType requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -2665,10 +2723,10 @@ func (m *ConnectorMutation) Name() (r string, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *ConnectorMutation) OldName(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldName is only allowed on UpdateOne operations") + return v, errors.New("OldName is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldName requires an ID field in the mutation") + return v, errors.New("OldName requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -2701,10 +2759,10 @@ func (m *ConnectorMutation) ResourceVersion() (r string, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *ConnectorMutation) OldResourceVersion(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldResourceVersion is only allowed on UpdateOne operations") + return v, errors.New("OldResourceVersion is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldResourceVersion requires an ID field in the mutation") + return v, errors.New("OldResourceVersion requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -2737,10 +2795,10 @@ func (m *ConnectorMutation) Config() (r []byte, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *ConnectorMutation) OldConfig(ctx context.Context) (v []byte, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldConfig is only allowed on UpdateOne operations") + return v, errors.New("OldConfig is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldConfig requires an ID field in the mutation") + return v, errors.New("OldConfig requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -3017,7 +3075,7 @@ func withDeviceRequestID(id int) devicerequestOption { m.oldValue = func(ctx context.Context) (*DeviceRequest, error) { once.Do(func() { if m.done { - err = fmt.Errorf("querying old values post mutation is not allowed") + err = errors.New("querying old values post mutation is not allowed") } else { value, err = m.Client().DeviceRequest.Get(ctx, id) } @@ -3050,7 +3108,7 @@ func (m DeviceRequestMutation) Client() *Client { // it returns an error otherwise. func (m DeviceRequestMutation) Tx() (*Tx, error) { if _, ok := m.driver.(*txDriver); !ok { - return nil, fmt.Errorf("db: mutation is not running in a transaction") + return nil, errors.New("db: mutation is not running in a transaction") } tx := &Tx{config: m.config} tx.init() @@ -3066,6 +3124,25 @@ func (m *DeviceRequestMutation) ID() (id int, exists bool) { return *m.id, true } +// IDs queries the database and returns the entity ids that match the mutation's predicate. +// That means, if the mutation is applied within a transaction with an isolation level such +// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated +// or updated by the mutation. +func (m *DeviceRequestMutation) IDs(ctx context.Context) ([]int, error) { + switch { + case m.op.Is(OpUpdateOne | OpDeleteOne): + id, exists := m.ID() + if exists { + return []int{id}, nil + } + fallthrough + case m.op.Is(OpUpdate | OpDelete): + return m.Client().DeviceRequest.Query().Where(m.predicates...).IDs(ctx) + default: + return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op) + } +} + // SetUserCode sets the "user_code" field. func (m *DeviceRequestMutation) SetUserCode(s string) { m.user_code = &s @@ -3085,10 +3162,10 @@ func (m *DeviceRequestMutation) UserCode() (r string, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *DeviceRequestMutation) OldUserCode(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldUserCode is only allowed on UpdateOne operations") + return v, errors.New("OldUserCode is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldUserCode requires an ID field in the mutation") + return v, errors.New("OldUserCode requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -3121,10 +3198,10 @@ func (m *DeviceRequestMutation) DeviceCode() (r string, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *DeviceRequestMutation) OldDeviceCode(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldDeviceCode is only allowed on UpdateOne operations") + return v, errors.New("OldDeviceCode is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldDeviceCode requires an ID field in the mutation") + return v, errors.New("OldDeviceCode requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -3157,10 +3234,10 @@ func (m *DeviceRequestMutation) ClientID() (r string, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *DeviceRequestMutation) OldClientID(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldClientID is only allowed on UpdateOne operations") + return v, errors.New("OldClientID is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldClientID requires an ID field in the mutation") + return v, errors.New("OldClientID requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -3193,10 +3270,10 @@ func (m *DeviceRequestMutation) ClientSecret() (r string, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *DeviceRequestMutation) OldClientSecret(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldClientSecret is only allowed on UpdateOne operations") + return v, errors.New("OldClientSecret is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldClientSecret requires an ID field in the mutation") + return v, errors.New("OldClientSecret requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -3229,10 +3306,10 @@ func (m *DeviceRequestMutation) Scopes() (r []string, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *DeviceRequestMutation) OldScopes(ctx context.Context) (v []string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldScopes is only allowed on UpdateOne operations") + return v, errors.New("OldScopes is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldScopes requires an ID field in the mutation") + return v, errors.New("OldScopes requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -3278,10 +3355,10 @@ func (m *DeviceRequestMutation) Expiry() (r time.Time, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *DeviceRequestMutation) OldExpiry(ctx context.Context) (v time.Time, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldExpiry is only allowed on UpdateOne operations") + return v, errors.New("OldExpiry is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldExpiry requires an ID field in the mutation") + return v, errors.New("OldExpiry requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -3602,7 +3679,7 @@ func withDeviceTokenID(id int) devicetokenOption { m.oldValue = func(ctx context.Context) (*DeviceToken, error) { once.Do(func() { if m.done { - err = fmt.Errorf("querying old values post mutation is not allowed") + err = errors.New("querying old values post mutation is not allowed") } else { value, err = m.Client().DeviceToken.Get(ctx, id) } @@ -3635,7 +3712,7 @@ func (m DeviceTokenMutation) Client() *Client { // it returns an error otherwise. func (m DeviceTokenMutation) Tx() (*Tx, error) { if _, ok := m.driver.(*txDriver); !ok { - return nil, fmt.Errorf("db: mutation is not running in a transaction") + return nil, errors.New("db: mutation is not running in a transaction") } tx := &Tx{config: m.config} tx.init() @@ -3651,6 +3728,25 @@ func (m *DeviceTokenMutation) ID() (id int, exists bool) { return *m.id, true } +// IDs queries the database and returns the entity ids that match the mutation's predicate. +// That means, if the mutation is applied within a transaction with an isolation level such +// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated +// or updated by the mutation. +func (m *DeviceTokenMutation) IDs(ctx context.Context) ([]int, error) { + switch { + case m.op.Is(OpUpdateOne | OpDeleteOne): + id, exists := m.ID() + if exists { + return []int{id}, nil + } + fallthrough + case m.op.Is(OpUpdate | OpDelete): + return m.Client().DeviceToken.Query().Where(m.predicates...).IDs(ctx) + default: + return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op) + } +} + // SetDeviceCode sets the "device_code" field. func (m *DeviceTokenMutation) SetDeviceCode(s string) { m.device_code = &s @@ -3670,10 +3766,10 @@ func (m *DeviceTokenMutation) DeviceCode() (r string, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *DeviceTokenMutation) OldDeviceCode(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldDeviceCode is only allowed on UpdateOne operations") + return v, errors.New("OldDeviceCode is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldDeviceCode requires an ID field in the mutation") + return v, errors.New("OldDeviceCode requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -3706,10 +3802,10 @@ func (m *DeviceTokenMutation) Status() (r string, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *DeviceTokenMutation) OldStatus(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldStatus is only allowed on UpdateOne operations") + return v, errors.New("OldStatus is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldStatus requires an ID field in the mutation") + return v, errors.New("OldStatus requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -3742,10 +3838,10 @@ func (m *DeviceTokenMutation) Token() (r []byte, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *DeviceTokenMutation) OldToken(ctx context.Context) (v *[]byte, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldToken is only allowed on UpdateOne operations") + return v, errors.New("OldToken is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldToken requires an ID field in the mutation") + return v, errors.New("OldToken requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -3791,10 +3887,10 @@ func (m *DeviceTokenMutation) Expiry() (r time.Time, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *DeviceTokenMutation) OldExpiry(ctx context.Context) (v time.Time, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldExpiry is only allowed on UpdateOne operations") + return v, errors.New("OldExpiry is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldExpiry requires an ID field in the mutation") + return v, errors.New("OldExpiry requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -3827,10 +3923,10 @@ func (m *DeviceTokenMutation) LastRequest() (r time.Time, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *DeviceTokenMutation) OldLastRequest(ctx context.Context) (v time.Time, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldLastRequest is only allowed on UpdateOne operations") + return v, errors.New("OldLastRequest is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldLastRequest requires an ID field in the mutation") + return v, errors.New("OldLastRequest requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -3864,10 +3960,10 @@ func (m *DeviceTokenMutation) PollInterval() (r int, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *DeviceTokenMutation) OldPollInterval(ctx context.Context) (v int, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldPollInterval is only allowed on UpdateOne operations") + return v, errors.New("OldPollInterval is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldPollInterval requires an ID field in the mutation") + return v, errors.New("OldPollInterval requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -4219,7 +4315,7 @@ func withKeysID(id string) keysOption { m.oldValue = func(ctx context.Context) (*Keys, error) { once.Do(func() { if m.done { - err = fmt.Errorf("querying old values post mutation is not allowed") + err = errors.New("querying old values post mutation is not allowed") } else { value, err = m.Client().Keys.Get(ctx, id) } @@ -4252,7 +4348,7 @@ func (m KeysMutation) Client() *Client { // it returns an error otherwise. func (m KeysMutation) Tx() (*Tx, error) { if _, ok := m.driver.(*txDriver); !ok { - return nil, fmt.Errorf("db: mutation is not running in a transaction") + return nil, errors.New("db: mutation is not running in a transaction") } tx := &Tx{config: m.config} tx.init() @@ -4274,6 +4370,25 @@ func (m *KeysMutation) ID() (id string, exists bool) { return *m.id, true } +// IDs queries the database and returns the entity ids that match the mutation's predicate. +// That means, if the mutation is applied within a transaction with an isolation level such +// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated +// or updated by the mutation. +func (m *KeysMutation) IDs(ctx context.Context) ([]string, error) { + switch { + case m.op.Is(OpUpdateOne | OpDeleteOne): + id, exists := m.ID() + if exists { + return []string{id}, nil + } + fallthrough + case m.op.Is(OpUpdate | OpDelete): + return m.Client().Keys.Query().Where(m.predicates...).IDs(ctx) + default: + return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op) + } +} + // SetVerificationKeys sets the "verification_keys" field. func (m *KeysMutation) SetVerificationKeys(sk []storage.VerificationKey) { m.verification_keys = &sk @@ -4293,10 +4408,10 @@ func (m *KeysMutation) VerificationKeys() (r []storage.VerificationKey, exists b // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *KeysMutation) OldVerificationKeys(ctx context.Context) (v []storage.VerificationKey, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldVerificationKeys is only allowed on UpdateOne operations") + return v, errors.New("OldVerificationKeys is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldVerificationKeys requires an ID field in the mutation") + return v, errors.New("OldVerificationKeys requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -4329,10 +4444,10 @@ func (m *KeysMutation) SigningKey() (r jose.JSONWebKey, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *KeysMutation) OldSigningKey(ctx context.Context) (v jose.JSONWebKey, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldSigningKey is only allowed on UpdateOne operations") + return v, errors.New("OldSigningKey is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldSigningKey requires an ID field in the mutation") + return v, errors.New("OldSigningKey requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -4365,10 +4480,10 @@ func (m *KeysMutation) SigningKeyPub() (r jose.JSONWebKey, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *KeysMutation) OldSigningKeyPub(ctx context.Context) (v jose.JSONWebKey, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldSigningKeyPub is only allowed on UpdateOne operations") + return v, errors.New("OldSigningKeyPub is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldSigningKeyPub requires an ID field in the mutation") + return v, errors.New("OldSigningKeyPub requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -4401,10 +4516,10 @@ func (m *KeysMutation) NextRotation() (r time.Time, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *KeysMutation) OldNextRotation(ctx context.Context) (v time.Time, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldNextRotation is only allowed on UpdateOne operations") + return v, errors.New("OldNextRotation is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldNextRotation requires an ID field in the mutation") + return v, errors.New("OldNextRotation requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -4681,7 +4796,7 @@ func withOAuth2ClientID(id string) oauth2clientOption { m.oldValue = func(ctx context.Context) (*OAuth2Client, error) { once.Do(func() { if m.done { - err = fmt.Errorf("querying old values post mutation is not allowed") + err = errors.New("querying old values post mutation is not allowed") } else { value, err = m.Client().OAuth2Client.Get(ctx, id) } @@ -4714,7 +4829,7 @@ func (m OAuth2ClientMutation) Client() *Client { // it returns an error otherwise. func (m OAuth2ClientMutation) Tx() (*Tx, error) { if _, ok := m.driver.(*txDriver); !ok { - return nil, fmt.Errorf("db: mutation is not running in a transaction") + return nil, errors.New("db: mutation is not running in a transaction") } tx := &Tx{config: m.config} tx.init() @@ -4736,6 +4851,25 @@ func (m *OAuth2ClientMutation) ID() (id string, exists bool) { return *m.id, true } +// IDs queries the database and returns the entity ids that match the mutation's predicate. +// That means, if the mutation is applied within a transaction with an isolation level such +// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated +// or updated by the mutation. +func (m *OAuth2ClientMutation) IDs(ctx context.Context) ([]string, error) { + switch { + case m.op.Is(OpUpdateOne | OpDeleteOne): + id, exists := m.ID() + if exists { + return []string{id}, nil + } + fallthrough + case m.op.Is(OpUpdate | OpDelete): + return m.Client().OAuth2Client.Query().Where(m.predicates...).IDs(ctx) + default: + return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op) + } +} + // SetSecret sets the "secret" field. func (m *OAuth2ClientMutation) SetSecret(s string) { m.secret = &s @@ -4755,10 +4889,10 @@ func (m *OAuth2ClientMutation) Secret() (r string, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *OAuth2ClientMutation) OldSecret(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldSecret is only allowed on UpdateOne operations") + return v, errors.New("OldSecret is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldSecret requires an ID field in the mutation") + return v, errors.New("OldSecret requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -4791,10 +4925,10 @@ func (m *OAuth2ClientMutation) RedirectUris() (r []string, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *OAuth2ClientMutation) OldRedirectUris(ctx context.Context) (v []string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldRedirectUris is only allowed on UpdateOne operations") + return v, errors.New("OldRedirectUris is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldRedirectUris requires an ID field in the mutation") + return v, errors.New("OldRedirectUris requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -4840,10 +4974,10 @@ func (m *OAuth2ClientMutation) TrustedPeers() (r []string, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *OAuth2ClientMutation) OldTrustedPeers(ctx context.Context) (v []string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldTrustedPeers is only allowed on UpdateOne operations") + return v, errors.New("OldTrustedPeers is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldTrustedPeers requires an ID field in the mutation") + return v, errors.New("OldTrustedPeers requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -4889,10 +5023,10 @@ func (m *OAuth2ClientMutation) Public() (r bool, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *OAuth2ClientMutation) OldPublic(ctx context.Context) (v bool, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldPublic is only allowed on UpdateOne operations") + return v, errors.New("OldPublic is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldPublic requires an ID field in the mutation") + return v, errors.New("OldPublic requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -4925,10 +5059,10 @@ func (m *OAuth2ClientMutation) Name() (r string, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *OAuth2ClientMutation) OldName(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldName is only allowed on UpdateOne operations") + return v, errors.New("OldName is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldName requires an ID field in the mutation") + return v, errors.New("OldName requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -4961,10 +5095,10 @@ func (m *OAuth2ClientMutation) LogoURL() (r string, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *OAuth2ClientMutation) OldLogoURL(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldLogoURL is only allowed on UpdateOne operations") + return v, errors.New("OldLogoURL is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldLogoURL requires an ID field in the mutation") + return v, errors.New("OldLogoURL requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -5288,7 +5422,7 @@ func withOfflineSessionID(id string) offlinesessionOption { m.oldValue = func(ctx context.Context) (*OfflineSession, error) { once.Do(func() { if m.done { - err = fmt.Errorf("querying old values post mutation is not allowed") + err = errors.New("querying old values post mutation is not allowed") } else { value, err = m.Client().OfflineSession.Get(ctx, id) } @@ -5321,7 +5455,7 @@ func (m OfflineSessionMutation) Client() *Client { // it returns an error otherwise. func (m OfflineSessionMutation) Tx() (*Tx, error) { if _, ok := m.driver.(*txDriver); !ok { - return nil, fmt.Errorf("db: mutation is not running in a transaction") + return nil, errors.New("db: mutation is not running in a transaction") } tx := &Tx{config: m.config} tx.init() @@ -5343,6 +5477,25 @@ func (m *OfflineSessionMutation) ID() (id string, exists bool) { return *m.id, true } +// IDs queries the database and returns the entity ids that match the mutation's predicate. +// That means, if the mutation is applied within a transaction with an isolation level such +// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated +// or updated by the mutation. +func (m *OfflineSessionMutation) IDs(ctx context.Context) ([]string, error) { + switch { + case m.op.Is(OpUpdateOne | OpDeleteOne): + id, exists := m.ID() + if exists { + return []string{id}, nil + } + fallthrough + case m.op.Is(OpUpdate | OpDelete): + return m.Client().OfflineSession.Query().Where(m.predicates...).IDs(ctx) + default: + return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op) + } +} + // SetUserID sets the "user_id" field. func (m *OfflineSessionMutation) SetUserID(s string) { m.user_id = &s @@ -5362,10 +5515,10 @@ func (m *OfflineSessionMutation) UserID() (r string, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *OfflineSessionMutation) OldUserID(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldUserID is only allowed on UpdateOne operations") + return v, errors.New("OldUserID is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldUserID requires an ID field in the mutation") + return v, errors.New("OldUserID requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -5398,10 +5551,10 @@ func (m *OfflineSessionMutation) ConnID() (r string, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *OfflineSessionMutation) OldConnID(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldConnID is only allowed on UpdateOne operations") + return v, errors.New("OldConnID is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldConnID requires an ID field in the mutation") + return v, errors.New("OldConnID requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -5434,10 +5587,10 @@ func (m *OfflineSessionMutation) Refresh() (r []byte, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *OfflineSessionMutation) OldRefresh(ctx context.Context) (v []byte, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldRefresh is only allowed on UpdateOne operations") + return v, errors.New("OldRefresh is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldRefresh requires an ID field in the mutation") + return v, errors.New("OldRefresh requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -5470,10 +5623,10 @@ func (m *OfflineSessionMutation) ConnectorData() (r []byte, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *OfflineSessionMutation) OldConnectorData(ctx context.Context) (v *[]byte, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldConnectorData is only allowed on UpdateOne operations") + return v, errors.New("OldConnectorData is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldConnectorData requires an ID field in the mutation") + return v, errors.New("OldConnectorData requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -5770,7 +5923,7 @@ func withPasswordID(id int) passwordOption { m.oldValue = func(ctx context.Context) (*Password, error) { once.Do(func() { if m.done { - err = fmt.Errorf("querying old values post mutation is not allowed") + err = errors.New("querying old values post mutation is not allowed") } else { value, err = m.Client().Password.Get(ctx, id) } @@ -5803,7 +5956,7 @@ func (m PasswordMutation) Client() *Client { // it returns an error otherwise. func (m PasswordMutation) Tx() (*Tx, error) { if _, ok := m.driver.(*txDriver); !ok { - return nil, fmt.Errorf("db: mutation is not running in a transaction") + return nil, errors.New("db: mutation is not running in a transaction") } tx := &Tx{config: m.config} tx.init() @@ -5819,6 +5972,25 @@ func (m *PasswordMutation) ID() (id int, exists bool) { return *m.id, true } +// IDs queries the database and returns the entity ids that match the mutation's predicate. +// That means, if the mutation is applied within a transaction with an isolation level such +// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated +// or updated by the mutation. +func (m *PasswordMutation) IDs(ctx context.Context) ([]int, error) { + switch { + case m.op.Is(OpUpdateOne | OpDeleteOne): + id, exists := m.ID() + if exists { + return []int{id}, nil + } + fallthrough + case m.op.Is(OpUpdate | OpDelete): + return m.Client().Password.Query().Where(m.predicates...).IDs(ctx) + default: + return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op) + } +} + // SetEmail sets the "email" field. func (m *PasswordMutation) SetEmail(s string) { m.email = &s @@ -5838,10 +6010,10 @@ func (m *PasswordMutation) Email() (r string, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *PasswordMutation) OldEmail(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldEmail is only allowed on UpdateOne operations") + return v, errors.New("OldEmail is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldEmail requires an ID field in the mutation") + return v, errors.New("OldEmail requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -5874,10 +6046,10 @@ func (m *PasswordMutation) Hash() (r []byte, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *PasswordMutation) OldHash(ctx context.Context) (v []byte, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldHash is only allowed on UpdateOne operations") + return v, errors.New("OldHash is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldHash requires an ID field in the mutation") + return v, errors.New("OldHash requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -5910,10 +6082,10 @@ func (m *PasswordMutation) Username() (r string, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *PasswordMutation) OldUsername(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldUsername is only allowed on UpdateOne operations") + return v, errors.New("OldUsername is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldUsername requires an ID field in the mutation") + return v, errors.New("OldUsername requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -5946,10 +6118,10 @@ func (m *PasswordMutation) UserID() (r string, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *PasswordMutation) OldUserID(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldUserID is only allowed on UpdateOne operations") + return v, errors.New("OldUserID is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldUserID requires an ID field in the mutation") + return v, errors.New("OldUserID requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -6235,7 +6407,7 @@ func withRefreshTokenID(id string) refreshtokenOption { m.oldValue = func(ctx context.Context) (*RefreshToken, error) { once.Do(func() { if m.done { - err = fmt.Errorf("querying old values post mutation is not allowed") + err = errors.New("querying old values post mutation is not allowed") } else { value, err = m.Client().RefreshToken.Get(ctx, id) } @@ -6268,7 +6440,7 @@ func (m RefreshTokenMutation) Client() *Client { // it returns an error otherwise. func (m RefreshTokenMutation) Tx() (*Tx, error) { if _, ok := m.driver.(*txDriver); !ok { - return nil, fmt.Errorf("db: mutation is not running in a transaction") + return nil, errors.New("db: mutation is not running in a transaction") } tx := &Tx{config: m.config} tx.init() @@ -6290,6 +6462,25 @@ func (m *RefreshTokenMutation) ID() (id string, exists bool) { return *m.id, true } +// IDs queries the database and returns the entity ids that match the mutation's predicate. +// That means, if the mutation is applied within a transaction with an isolation level such +// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated +// or updated by the mutation. +func (m *RefreshTokenMutation) IDs(ctx context.Context) ([]string, error) { + switch { + case m.op.Is(OpUpdateOne | OpDeleteOne): + id, exists := m.ID() + if exists { + return []string{id}, nil + } + fallthrough + case m.op.Is(OpUpdate | OpDelete): + return m.Client().RefreshToken.Query().Where(m.predicates...).IDs(ctx) + default: + return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op) + } +} + // SetClientID sets the "client_id" field. func (m *RefreshTokenMutation) SetClientID(s string) { m.client_id = &s @@ -6309,10 +6500,10 @@ func (m *RefreshTokenMutation) ClientID() (r string, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *RefreshTokenMutation) OldClientID(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldClientID is only allowed on UpdateOne operations") + return v, errors.New("OldClientID is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldClientID requires an ID field in the mutation") + return v, errors.New("OldClientID requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -6345,10 +6536,10 @@ func (m *RefreshTokenMutation) Scopes() (r []string, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *RefreshTokenMutation) OldScopes(ctx context.Context) (v []string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldScopes is only allowed on UpdateOne operations") + return v, errors.New("OldScopes is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldScopes requires an ID field in the mutation") + return v, errors.New("OldScopes requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -6394,10 +6585,10 @@ func (m *RefreshTokenMutation) Nonce() (r string, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *RefreshTokenMutation) OldNonce(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldNonce is only allowed on UpdateOne operations") + return v, errors.New("OldNonce is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldNonce requires an ID field in the mutation") + return v, errors.New("OldNonce requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -6430,10 +6621,10 @@ func (m *RefreshTokenMutation) ClaimsUserID() (r string, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *RefreshTokenMutation) OldClaimsUserID(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldClaimsUserID is only allowed on UpdateOne operations") + return v, errors.New("OldClaimsUserID is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldClaimsUserID requires an ID field in the mutation") + return v, errors.New("OldClaimsUserID requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -6466,10 +6657,10 @@ func (m *RefreshTokenMutation) ClaimsUsername() (r string, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *RefreshTokenMutation) OldClaimsUsername(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldClaimsUsername is only allowed on UpdateOne operations") + return v, errors.New("OldClaimsUsername is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldClaimsUsername requires an ID field in the mutation") + return v, errors.New("OldClaimsUsername requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -6502,10 +6693,10 @@ func (m *RefreshTokenMutation) ClaimsEmail() (r string, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *RefreshTokenMutation) OldClaimsEmail(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldClaimsEmail is only allowed on UpdateOne operations") + return v, errors.New("OldClaimsEmail is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldClaimsEmail requires an ID field in the mutation") + return v, errors.New("OldClaimsEmail requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -6538,10 +6729,10 @@ func (m *RefreshTokenMutation) ClaimsEmailVerified() (r bool, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *RefreshTokenMutation) OldClaimsEmailVerified(ctx context.Context) (v bool, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldClaimsEmailVerified is only allowed on UpdateOne operations") + return v, errors.New("OldClaimsEmailVerified is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldClaimsEmailVerified requires an ID field in the mutation") + return v, errors.New("OldClaimsEmailVerified requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -6574,10 +6765,10 @@ func (m *RefreshTokenMutation) ClaimsGroups() (r []string, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *RefreshTokenMutation) OldClaimsGroups(ctx context.Context) (v []string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldClaimsGroups is only allowed on UpdateOne operations") + return v, errors.New("OldClaimsGroups is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldClaimsGroups requires an ID field in the mutation") + return v, errors.New("OldClaimsGroups requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -6623,10 +6814,10 @@ func (m *RefreshTokenMutation) ClaimsPreferredUsername() (r string, exists bool) // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *RefreshTokenMutation) OldClaimsPreferredUsername(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldClaimsPreferredUsername is only allowed on UpdateOne operations") + return v, errors.New("OldClaimsPreferredUsername is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldClaimsPreferredUsername requires an ID field in the mutation") + return v, errors.New("OldClaimsPreferredUsername requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -6659,10 +6850,10 @@ func (m *RefreshTokenMutation) ConnectorID() (r string, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *RefreshTokenMutation) OldConnectorID(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldConnectorID is only allowed on UpdateOne operations") + return v, errors.New("OldConnectorID is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldConnectorID requires an ID field in the mutation") + return v, errors.New("OldConnectorID requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -6695,10 +6886,10 @@ func (m *RefreshTokenMutation) ConnectorData() (r []byte, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *RefreshTokenMutation) OldConnectorData(ctx context.Context) (v *[]byte, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldConnectorData is only allowed on UpdateOne operations") + return v, errors.New("OldConnectorData is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldConnectorData requires an ID field in the mutation") + return v, errors.New("OldConnectorData requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -6744,10 +6935,10 @@ func (m *RefreshTokenMutation) Token() (r string, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *RefreshTokenMutation) OldToken(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldToken is only allowed on UpdateOne operations") + return v, errors.New("OldToken is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldToken requires an ID field in the mutation") + return v, errors.New("OldToken requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -6780,10 +6971,10 @@ func (m *RefreshTokenMutation) ObsoleteToken() (r string, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *RefreshTokenMutation) OldObsoleteToken(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldObsoleteToken is only allowed on UpdateOne operations") + return v, errors.New("OldObsoleteToken is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldObsoleteToken requires an ID field in the mutation") + return v, errors.New("OldObsoleteToken requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -6816,10 +7007,10 @@ func (m *RefreshTokenMutation) CreatedAt() (r time.Time, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *RefreshTokenMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldCreatedAt is only allowed on UpdateOne operations") + return v, errors.New("OldCreatedAt is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldCreatedAt requires an ID field in the mutation") + return v, errors.New("OldCreatedAt requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -6852,10 +7043,10 @@ func (m *RefreshTokenMutation) LastUsed() (r time.Time, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *RefreshTokenMutation) OldLastUsed(ctx context.Context) (v time.Time, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldLastUsed is only allowed on UpdateOne operations") + return v, errors.New("OldLastUsed is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldLastUsed requires an ID field in the mutation") + return v, errors.New("OldLastUsed requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { diff --git a/storage/ent/db/oauth2client_create.go b/storage/ent/db/oauth2client_create.go index b141352b..4c64b11b 100644 --- a/storage/ent/db/oauth2client_create.go +++ b/storage/ent/db/oauth2client_create.go @@ -132,35 +132,35 @@ func (oc *OAuth2ClientCreate) ExecX(ctx context.Context) { // check runs all checks and user-defined validators on the builder. func (oc *OAuth2ClientCreate) check() error { if _, ok := oc.mutation.Secret(); !ok { - return &ValidationError{Name: "secret", err: errors.New(`db: missing required field "secret"`)} + return &ValidationError{Name: "secret", err: errors.New(`db: missing required field "OAuth2Client.secret"`)} } if v, ok := oc.mutation.Secret(); ok { if err := oauth2client.SecretValidator(v); err != nil { - return &ValidationError{Name: "secret", err: fmt.Errorf(`db: validator failed for field "secret": %w`, err)} + return &ValidationError{Name: "secret", err: fmt.Errorf(`db: validator failed for field "OAuth2Client.secret": %w`, err)} } } if _, ok := oc.mutation.Public(); !ok { - return &ValidationError{Name: "public", err: errors.New(`db: missing required field "public"`)} + return &ValidationError{Name: "public", err: errors.New(`db: missing required field "OAuth2Client.public"`)} } if _, ok := oc.mutation.Name(); !ok { - return &ValidationError{Name: "name", err: errors.New(`db: missing required field "name"`)} + return &ValidationError{Name: "name", err: errors.New(`db: missing required field "OAuth2Client.name"`)} } if v, ok := oc.mutation.Name(); ok { if err := oauth2client.NameValidator(v); err != nil { - return &ValidationError{Name: "name", err: fmt.Errorf(`db: validator failed for field "name": %w`, err)} + return &ValidationError{Name: "name", err: fmt.Errorf(`db: validator failed for field "OAuth2Client.name": %w`, err)} } } if _, ok := oc.mutation.LogoURL(); !ok { - return &ValidationError{Name: "logo_url", err: errors.New(`db: missing required field "logo_url"`)} + return &ValidationError{Name: "logo_url", err: errors.New(`db: missing required field "OAuth2Client.logo_url"`)} } if v, ok := oc.mutation.LogoURL(); ok { if err := oauth2client.LogoURLValidator(v); err != nil { - return &ValidationError{Name: "logo_url", err: fmt.Errorf(`db: validator failed for field "logo_url": %w`, err)} + return &ValidationError{Name: "logo_url", err: fmt.Errorf(`db: validator failed for field "OAuth2Client.logo_url": %w`, err)} } } if v, ok := oc.mutation.ID(); ok { if err := oauth2client.IDValidator(v); err != nil { - return &ValidationError{Name: "id", err: fmt.Errorf(`db: validator failed for field "id": %w`, err)} + return &ValidationError{Name: "id", err: fmt.Errorf(`db: validator failed for field "OAuth2Client.id": %w`, err)} } } return nil @@ -174,6 +174,13 @@ func (oc *OAuth2ClientCreate) sqlSave(ctx context.Context) (*OAuth2Client, error } return nil, err } + if _spec.ID.Value != nil { + if id, ok := _spec.ID.Value.(string); ok { + _node.ID = id + } else { + return nil, fmt.Errorf("unexpected OAuth2Client.ID type: %T", _spec.ID.Value) + } + } return _node, nil } diff --git a/storage/ent/db/oauth2client_query.go b/storage/ent/db/oauth2client_query.go index d2363288..d66607ab 100644 --- a/storage/ent/db/oauth2client_query.go +++ b/storage/ent/db/oauth2client_query.go @@ -106,7 +106,7 @@ func (oq *OAuth2ClientQuery) FirstIDX(ctx context.Context) string { } // Only returns a single OAuth2Client entity found by the query, ensuring it only returns one. -// Returns a *NotSingularError when exactly one OAuth2Client entity is not found. +// Returns a *NotSingularError when more than one OAuth2Client entity is found. // Returns a *NotFoundError when no OAuth2Client entities are found. func (oq *OAuth2ClientQuery) Only(ctx context.Context) (*OAuth2Client, error) { nodes, err := oq.Limit(2).All(ctx) @@ -133,7 +133,7 @@ func (oq *OAuth2ClientQuery) OnlyX(ctx context.Context) *OAuth2Client { } // OnlyID is like Only, but returns the only OAuth2Client ID in the query. -// Returns a *NotSingularError when exactly one OAuth2Client ID is not found. +// Returns a *NotSingularError when more than one OAuth2Client ID is found. // Returns a *NotFoundError when no entities are found. func (oq *OAuth2ClientQuery) OnlyID(ctx context.Context) (id string, err error) { var ids []string @@ -242,8 +242,9 @@ func (oq *OAuth2ClientQuery) Clone() *OAuth2ClientQuery { order: append([]OrderFunc{}, oq.order...), predicates: append([]predicate.OAuth2Client{}, oq.predicates...), // clone intermediate query. - sql: oq.sql.Clone(), - path: oq.path, + sql: oq.sql.Clone(), + path: oq.path, + unique: oq.unique, } } @@ -336,6 +337,10 @@ func (oq *OAuth2ClientQuery) sqlAll(ctx context.Context) ([]*OAuth2Client, error func (oq *OAuth2ClientQuery) sqlCount(ctx context.Context) (int, error) { _spec := oq.querySpec() + _spec.Node.Columns = oq.fields + if len(oq.fields) > 0 { + _spec.Unique = oq.unique != nil && *oq.unique + } return sqlgraph.CountNodes(ctx, oq.driver, _spec) } @@ -407,6 +412,9 @@ func (oq *OAuth2ClientQuery) sqlQuery(ctx context.Context) *sql.Selector { selector = oq.sql selector.Select(selector.Columns(columns...)...) } + if oq.unique != nil && *oq.unique { + selector.Distinct() + } for _, p := range oq.predicates { p(selector) } @@ -685,9 +693,7 @@ func (ogb *OAuth2ClientGroupBy) sqlQuery() *sql.Selector { for _, f := range ogb.fields { columns = append(columns, selector.C(f)) } - for _, c := range aggregation { - columns = append(columns, c) - } + columns = append(columns, aggregation...) selector.Select(columns...) } return selector.GroupBy(selector.Columns(ogb.fields...)...) diff --git a/storage/ent/db/oauth2client_update.go b/storage/ent/db/oauth2client_update.go index 29b7f090..b86c5491 100644 --- a/storage/ent/db/oauth2client_update.go +++ b/storage/ent/db/oauth2client_update.go @@ -4,6 +4,7 @@ package db import ( "context" + "errors" "fmt" "entgo.io/ent/dialect/sql" @@ -143,17 +144,17 @@ func (ou *OAuth2ClientUpdate) ExecX(ctx context.Context) { func (ou *OAuth2ClientUpdate) check() error { if v, ok := ou.mutation.Secret(); ok { if err := oauth2client.SecretValidator(v); err != nil { - return &ValidationError{Name: "secret", err: fmt.Errorf("db: validator failed for field \"secret\": %w", err)} + return &ValidationError{Name: "secret", err: fmt.Errorf(`db: validator failed for field "OAuth2Client.secret": %w`, err)} } } if v, ok := ou.mutation.Name(); ok { if err := oauth2client.NameValidator(v); err != nil { - return &ValidationError{Name: "name", err: fmt.Errorf("db: validator failed for field \"name\": %w", err)} + return &ValidationError{Name: "name", err: fmt.Errorf(`db: validator failed for field "OAuth2Client.name": %w`, err)} } } if v, ok := ou.mutation.LogoURL(); ok { if err := oauth2client.LogoURLValidator(v); err != nil { - return &ValidationError{Name: "logo_url", err: fmt.Errorf("db: validator failed for field \"logo_url\": %w", err)} + return &ValidationError{Name: "logo_url", err: fmt.Errorf(`db: validator failed for field "OAuth2Client.logo_url": %w`, err)} } } return nil @@ -374,17 +375,17 @@ func (ouo *OAuth2ClientUpdateOne) ExecX(ctx context.Context) { func (ouo *OAuth2ClientUpdateOne) check() error { if v, ok := ouo.mutation.Secret(); ok { if err := oauth2client.SecretValidator(v); err != nil { - return &ValidationError{Name: "secret", err: fmt.Errorf("db: validator failed for field \"secret\": %w", err)} + return &ValidationError{Name: "secret", err: fmt.Errorf(`db: validator failed for field "OAuth2Client.secret": %w`, err)} } } if v, ok := ouo.mutation.Name(); ok { if err := oauth2client.NameValidator(v); err != nil { - return &ValidationError{Name: "name", err: fmt.Errorf("db: validator failed for field \"name\": %w", err)} + return &ValidationError{Name: "name", err: fmt.Errorf(`db: validator failed for field "OAuth2Client.name": %w`, err)} } } if v, ok := ouo.mutation.LogoURL(); ok { if err := oauth2client.LogoURLValidator(v); err != nil { - return &ValidationError{Name: "logo_url", err: fmt.Errorf("db: validator failed for field \"logo_url\": %w", err)} + return &ValidationError{Name: "logo_url", err: fmt.Errorf(`db: validator failed for field "OAuth2Client.logo_url": %w`, err)} } } return nil @@ -403,7 +404,7 @@ func (ouo *OAuth2ClientUpdateOne) sqlSave(ctx context.Context) (_node *OAuth2Cli } id, ok := ouo.mutation.ID() if !ok { - return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing OAuth2Client.ID for update")} + return nil, &ValidationError{Name: "id", err: errors.New(`db: missing "OAuth2Client.id" for update`)} } _spec.Node.ID.Value = id if fields := ouo.fields; len(fields) > 0 { diff --git a/storage/ent/db/offlinesession_create.go b/storage/ent/db/offlinesession_create.go index add3912a..74bb3213 100644 --- a/storage/ent/db/offlinesession_create.go +++ b/storage/ent/db/offlinesession_create.go @@ -120,27 +120,27 @@ func (osc *OfflineSessionCreate) ExecX(ctx context.Context) { // check runs all checks and user-defined validators on the builder. func (osc *OfflineSessionCreate) check() error { if _, ok := osc.mutation.UserID(); !ok { - return &ValidationError{Name: "user_id", err: errors.New(`db: missing required field "user_id"`)} + return &ValidationError{Name: "user_id", err: errors.New(`db: missing required field "OfflineSession.user_id"`)} } if v, ok := osc.mutation.UserID(); ok { if err := offlinesession.UserIDValidator(v); err != nil { - return &ValidationError{Name: "user_id", err: fmt.Errorf(`db: validator failed for field "user_id": %w`, err)} + return &ValidationError{Name: "user_id", err: fmt.Errorf(`db: validator failed for field "OfflineSession.user_id": %w`, err)} } } if _, ok := osc.mutation.ConnID(); !ok { - return &ValidationError{Name: "conn_id", err: errors.New(`db: missing required field "conn_id"`)} + return &ValidationError{Name: "conn_id", err: errors.New(`db: missing required field "OfflineSession.conn_id"`)} } if v, ok := osc.mutation.ConnID(); ok { if err := offlinesession.ConnIDValidator(v); err != nil { - return &ValidationError{Name: "conn_id", err: fmt.Errorf(`db: validator failed for field "conn_id": %w`, err)} + return &ValidationError{Name: "conn_id", err: fmt.Errorf(`db: validator failed for field "OfflineSession.conn_id": %w`, err)} } } if _, ok := osc.mutation.Refresh(); !ok { - return &ValidationError{Name: "refresh", err: errors.New(`db: missing required field "refresh"`)} + return &ValidationError{Name: "refresh", err: errors.New(`db: missing required field "OfflineSession.refresh"`)} } if v, ok := osc.mutation.ID(); ok { if err := offlinesession.IDValidator(v); err != nil { - return &ValidationError{Name: "id", err: fmt.Errorf(`db: validator failed for field "id": %w`, err)} + return &ValidationError{Name: "id", err: fmt.Errorf(`db: validator failed for field "OfflineSession.id": %w`, err)} } } return nil @@ -154,6 +154,13 @@ func (osc *OfflineSessionCreate) sqlSave(ctx context.Context) (*OfflineSession, } return nil, err } + if _spec.ID.Value != nil { + if id, ok := _spec.ID.Value.(string); ok { + _node.ID = id + } else { + return nil, fmt.Errorf("unexpected OfflineSession.ID type: %T", _spec.ID.Value) + } + } return _node, nil } diff --git a/storage/ent/db/offlinesession_query.go b/storage/ent/db/offlinesession_query.go index 4306deaa..f40e2255 100644 --- a/storage/ent/db/offlinesession_query.go +++ b/storage/ent/db/offlinesession_query.go @@ -106,7 +106,7 @@ func (osq *OfflineSessionQuery) FirstIDX(ctx context.Context) string { } // Only returns a single OfflineSession entity found by the query, ensuring it only returns one. -// Returns a *NotSingularError when exactly one OfflineSession entity is not found. +// Returns a *NotSingularError when more than one OfflineSession entity is found. // Returns a *NotFoundError when no OfflineSession entities are found. func (osq *OfflineSessionQuery) Only(ctx context.Context) (*OfflineSession, error) { nodes, err := osq.Limit(2).All(ctx) @@ -133,7 +133,7 @@ func (osq *OfflineSessionQuery) OnlyX(ctx context.Context) *OfflineSession { } // OnlyID is like Only, but returns the only OfflineSession ID in the query. -// Returns a *NotSingularError when exactly one OfflineSession ID is not found. +// Returns a *NotSingularError when more than one OfflineSession ID is found. // Returns a *NotFoundError when no entities are found. func (osq *OfflineSessionQuery) OnlyID(ctx context.Context) (id string, err error) { var ids []string @@ -242,8 +242,9 @@ func (osq *OfflineSessionQuery) Clone() *OfflineSessionQuery { order: append([]OrderFunc{}, osq.order...), predicates: append([]predicate.OfflineSession{}, osq.predicates...), // clone intermediate query. - sql: osq.sql.Clone(), - path: osq.path, + sql: osq.sql.Clone(), + path: osq.path, + unique: osq.unique, } } @@ -336,6 +337,10 @@ func (osq *OfflineSessionQuery) sqlAll(ctx context.Context) ([]*OfflineSession, func (osq *OfflineSessionQuery) sqlCount(ctx context.Context) (int, error) { _spec := osq.querySpec() + _spec.Node.Columns = osq.fields + if len(osq.fields) > 0 { + _spec.Unique = osq.unique != nil && *osq.unique + } return sqlgraph.CountNodes(ctx, osq.driver, _spec) } @@ -407,6 +412,9 @@ func (osq *OfflineSessionQuery) sqlQuery(ctx context.Context) *sql.Selector { selector = osq.sql selector.Select(selector.Columns(columns...)...) } + if osq.unique != nil && *osq.unique { + selector.Distinct() + } for _, p := range osq.predicates { p(selector) } @@ -685,9 +693,7 @@ func (osgb *OfflineSessionGroupBy) sqlQuery() *sql.Selector { for _, f := range osgb.fields { columns = append(columns, selector.C(f)) } - for _, c := range aggregation { - columns = append(columns, c) - } + columns = append(columns, aggregation...) selector.Select(columns...) } return selector.GroupBy(selector.Columns(osgb.fields...)...) diff --git a/storage/ent/db/offlinesession_update.go b/storage/ent/db/offlinesession_update.go index 20c9faf3..e19f5a05 100644 --- a/storage/ent/db/offlinesession_update.go +++ b/storage/ent/db/offlinesession_update.go @@ -4,6 +4,7 @@ package db import ( "context" + "errors" "fmt" "entgo.io/ent/dialect/sql" @@ -125,12 +126,12 @@ func (osu *OfflineSessionUpdate) ExecX(ctx context.Context) { func (osu *OfflineSessionUpdate) check() error { if v, ok := osu.mutation.UserID(); ok { if err := offlinesession.UserIDValidator(v); err != nil { - return &ValidationError{Name: "user_id", err: fmt.Errorf("db: validator failed for field \"user_id\": %w", err)} + return &ValidationError{Name: "user_id", err: fmt.Errorf(`db: validator failed for field "OfflineSession.user_id": %w`, err)} } } if v, ok := osu.mutation.ConnID(); ok { if err := offlinesession.ConnIDValidator(v); err != nil { - return &ValidationError{Name: "conn_id", err: fmt.Errorf("db: validator failed for field \"conn_id\": %w", err)} + return &ValidationError{Name: "conn_id", err: fmt.Errorf(`db: validator failed for field "OfflineSession.conn_id": %w`, err)} } } return nil @@ -313,12 +314,12 @@ func (osuo *OfflineSessionUpdateOne) ExecX(ctx context.Context) { func (osuo *OfflineSessionUpdateOne) check() error { if v, ok := osuo.mutation.UserID(); ok { if err := offlinesession.UserIDValidator(v); err != nil { - return &ValidationError{Name: "user_id", err: fmt.Errorf("db: validator failed for field \"user_id\": %w", err)} + return &ValidationError{Name: "user_id", err: fmt.Errorf(`db: validator failed for field "OfflineSession.user_id": %w`, err)} } } if v, ok := osuo.mutation.ConnID(); ok { if err := offlinesession.ConnIDValidator(v); err != nil { - return &ValidationError{Name: "conn_id", err: fmt.Errorf("db: validator failed for field \"conn_id\": %w", err)} + return &ValidationError{Name: "conn_id", err: fmt.Errorf(`db: validator failed for field "OfflineSession.conn_id": %w`, err)} } } return nil @@ -337,7 +338,7 @@ func (osuo *OfflineSessionUpdateOne) sqlSave(ctx context.Context) (_node *Offlin } id, ok := osuo.mutation.ID() if !ok { - return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing OfflineSession.ID for update")} + return nil, &ValidationError{Name: "id", err: errors.New(`db: missing "OfflineSession.id" for update`)} } _spec.Node.ID.Value = id if fields := osuo.fields; len(fields) > 0 { diff --git a/storage/ent/db/password_create.go b/storage/ent/db/password_create.go index af902ea3..fa356dca 100644 --- a/storage/ent/db/password_create.go +++ b/storage/ent/db/password_create.go @@ -114,30 +114,30 @@ func (pc *PasswordCreate) ExecX(ctx context.Context) { // check runs all checks and user-defined validators on the builder. func (pc *PasswordCreate) check() error { if _, ok := pc.mutation.Email(); !ok { - return &ValidationError{Name: "email", err: errors.New(`db: missing required field "email"`)} + return &ValidationError{Name: "email", err: errors.New(`db: missing required field "Password.email"`)} } if v, ok := pc.mutation.Email(); ok { if err := password.EmailValidator(v); err != nil { - return &ValidationError{Name: "email", err: fmt.Errorf(`db: validator failed for field "email": %w`, err)} + return &ValidationError{Name: "email", err: fmt.Errorf(`db: validator failed for field "Password.email": %w`, err)} } } if _, ok := pc.mutation.Hash(); !ok { - return &ValidationError{Name: "hash", err: errors.New(`db: missing required field "hash"`)} + return &ValidationError{Name: "hash", err: errors.New(`db: missing required field "Password.hash"`)} } if _, ok := pc.mutation.Username(); !ok { - return &ValidationError{Name: "username", err: errors.New(`db: missing required field "username"`)} + return &ValidationError{Name: "username", err: errors.New(`db: missing required field "Password.username"`)} } if v, ok := pc.mutation.Username(); ok { if err := password.UsernameValidator(v); err != nil { - return &ValidationError{Name: "username", err: fmt.Errorf(`db: validator failed for field "username": %w`, err)} + return &ValidationError{Name: "username", err: fmt.Errorf(`db: validator failed for field "Password.username": %w`, err)} } } if _, ok := pc.mutation.UserID(); !ok { - return &ValidationError{Name: "user_id", err: errors.New(`db: missing required field "user_id"`)} + return &ValidationError{Name: "user_id", err: errors.New(`db: missing required field "Password.user_id"`)} } if v, ok := pc.mutation.UserID(); ok { if err := password.UserIDValidator(v); err != nil { - return &ValidationError{Name: "user_id", err: fmt.Errorf(`db: validator failed for field "user_id": %w`, err)} + return &ValidationError{Name: "user_id", err: fmt.Errorf(`db: validator failed for field "Password.user_id": %w`, err)} } } return nil diff --git a/storage/ent/db/password_query.go b/storage/ent/db/password_query.go index 50e493fd..99b1af76 100644 --- a/storage/ent/db/password_query.go +++ b/storage/ent/db/password_query.go @@ -106,7 +106,7 @@ func (pq *PasswordQuery) FirstIDX(ctx context.Context) int { } // Only returns a single Password entity found by the query, ensuring it only returns one. -// Returns a *NotSingularError when exactly one Password entity is not found. +// Returns a *NotSingularError when more than one Password entity is found. // Returns a *NotFoundError when no Password entities are found. func (pq *PasswordQuery) Only(ctx context.Context) (*Password, error) { nodes, err := pq.Limit(2).All(ctx) @@ -133,7 +133,7 @@ func (pq *PasswordQuery) OnlyX(ctx context.Context) *Password { } // OnlyID is like Only, but returns the only Password ID in the query. -// Returns a *NotSingularError when exactly one Password ID is not found. +// Returns a *NotSingularError when more than one Password ID is found. // Returns a *NotFoundError when no entities are found. func (pq *PasswordQuery) OnlyID(ctx context.Context) (id int, err error) { var ids []int @@ -242,8 +242,9 @@ func (pq *PasswordQuery) Clone() *PasswordQuery { order: append([]OrderFunc{}, pq.order...), predicates: append([]predicate.Password{}, pq.predicates...), // clone intermediate query. - sql: pq.sql.Clone(), - path: pq.path, + sql: pq.sql.Clone(), + path: pq.path, + unique: pq.unique, } } @@ -336,6 +337,10 @@ func (pq *PasswordQuery) sqlAll(ctx context.Context) ([]*Password, error) { func (pq *PasswordQuery) sqlCount(ctx context.Context) (int, error) { _spec := pq.querySpec() + _spec.Node.Columns = pq.fields + if len(pq.fields) > 0 { + _spec.Unique = pq.unique != nil && *pq.unique + } return sqlgraph.CountNodes(ctx, pq.driver, _spec) } @@ -407,6 +412,9 @@ func (pq *PasswordQuery) sqlQuery(ctx context.Context) *sql.Selector { selector = pq.sql selector.Select(selector.Columns(columns...)...) } + if pq.unique != nil && *pq.unique { + selector.Distinct() + } for _, p := range pq.predicates { p(selector) } @@ -685,9 +693,7 @@ func (pgb *PasswordGroupBy) sqlQuery() *sql.Selector { for _, f := range pgb.fields { columns = append(columns, selector.C(f)) } - for _, c := range aggregation { - columns = append(columns, c) - } + columns = append(columns, aggregation...) selector.Select(columns...) } return selector.GroupBy(selector.Columns(pgb.fields...)...) diff --git a/storage/ent/db/password_update.go b/storage/ent/db/password_update.go index f15fb017..f1c376af 100644 --- a/storage/ent/db/password_update.go +++ b/storage/ent/db/password_update.go @@ -4,6 +4,7 @@ package db import ( "context" + "errors" "fmt" "entgo.io/ent/dialect/sql" @@ -119,17 +120,17 @@ func (pu *PasswordUpdate) ExecX(ctx context.Context) { func (pu *PasswordUpdate) check() error { if v, ok := pu.mutation.Email(); ok { if err := password.EmailValidator(v); err != nil { - return &ValidationError{Name: "email", err: fmt.Errorf("db: validator failed for field \"email\": %w", err)} + return &ValidationError{Name: "email", err: fmt.Errorf(`db: validator failed for field "Password.email": %w`, err)} } } if v, ok := pu.mutation.Username(); ok { if err := password.UsernameValidator(v); err != nil { - return &ValidationError{Name: "username", err: fmt.Errorf("db: validator failed for field \"username\": %w", err)} + return &ValidationError{Name: "username", err: fmt.Errorf(`db: validator failed for field "Password.username": %w`, err)} } } if v, ok := pu.mutation.UserID(); ok { if err := password.UserIDValidator(v); err != nil { - return &ValidationError{Name: "user_id", err: fmt.Errorf("db: validator failed for field \"user_id\": %w", err)} + return &ValidationError{Name: "user_id", err: fmt.Errorf(`db: validator failed for field "Password.user_id": %w`, err)} } } return nil @@ -300,17 +301,17 @@ func (puo *PasswordUpdateOne) ExecX(ctx context.Context) { func (puo *PasswordUpdateOne) check() error { if v, ok := puo.mutation.Email(); ok { if err := password.EmailValidator(v); err != nil { - return &ValidationError{Name: "email", err: fmt.Errorf("db: validator failed for field \"email\": %w", err)} + return &ValidationError{Name: "email", err: fmt.Errorf(`db: validator failed for field "Password.email": %w`, err)} } } if v, ok := puo.mutation.Username(); ok { if err := password.UsernameValidator(v); err != nil { - return &ValidationError{Name: "username", err: fmt.Errorf("db: validator failed for field \"username\": %w", err)} + return &ValidationError{Name: "username", err: fmt.Errorf(`db: validator failed for field "Password.username": %w`, err)} } } if v, ok := puo.mutation.UserID(); ok { if err := password.UserIDValidator(v); err != nil { - return &ValidationError{Name: "user_id", err: fmt.Errorf("db: validator failed for field \"user_id\": %w", err)} + return &ValidationError{Name: "user_id", err: fmt.Errorf(`db: validator failed for field "Password.user_id": %w`, err)} } } return nil @@ -329,7 +330,7 @@ func (puo *PasswordUpdateOne) sqlSave(ctx context.Context) (_node *Password, err } id, ok := puo.mutation.ID() if !ok { - return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing Password.ID for update")} + return nil, &ValidationError{Name: "id", err: errors.New(`db: missing "Password.id" for update`)} } _spec.Node.ID.Value = id if fields := puo.fields; len(fields) > 0 { diff --git a/storage/ent/db/refreshtoken_create.go b/storage/ent/db/refreshtoken_create.go index 00d29775..7e925f37 100644 --- a/storage/ent/db/refreshtoken_create.go +++ b/storage/ent/db/refreshtoken_create.go @@ -252,74 +252,74 @@ func (rtc *RefreshTokenCreate) defaults() { // check runs all checks and user-defined validators on the builder. func (rtc *RefreshTokenCreate) check() error { if _, ok := rtc.mutation.ClientID(); !ok { - return &ValidationError{Name: "client_id", err: errors.New(`db: missing required field "client_id"`)} + return &ValidationError{Name: "client_id", err: errors.New(`db: missing required field "RefreshToken.client_id"`)} } if v, ok := rtc.mutation.ClientID(); ok { if err := refreshtoken.ClientIDValidator(v); err != nil { - return &ValidationError{Name: "client_id", err: fmt.Errorf(`db: validator failed for field "client_id": %w`, err)} + return &ValidationError{Name: "client_id", err: fmt.Errorf(`db: validator failed for field "RefreshToken.client_id": %w`, err)} } } if _, ok := rtc.mutation.Nonce(); !ok { - return &ValidationError{Name: "nonce", err: errors.New(`db: missing required field "nonce"`)} + return &ValidationError{Name: "nonce", err: errors.New(`db: missing required field "RefreshToken.nonce"`)} } if v, ok := rtc.mutation.Nonce(); ok { if err := refreshtoken.NonceValidator(v); err != nil { - return &ValidationError{Name: "nonce", err: fmt.Errorf(`db: validator failed for field "nonce": %w`, err)} + return &ValidationError{Name: "nonce", err: fmt.Errorf(`db: validator failed for field "RefreshToken.nonce": %w`, err)} } } if _, ok := rtc.mutation.ClaimsUserID(); !ok { - return &ValidationError{Name: "claims_user_id", err: errors.New(`db: missing required field "claims_user_id"`)} + return &ValidationError{Name: "claims_user_id", err: errors.New(`db: missing required field "RefreshToken.claims_user_id"`)} } if v, ok := rtc.mutation.ClaimsUserID(); ok { if err := refreshtoken.ClaimsUserIDValidator(v); err != nil { - return &ValidationError{Name: "claims_user_id", err: fmt.Errorf(`db: validator failed for field "claims_user_id": %w`, err)} + return &ValidationError{Name: "claims_user_id", err: fmt.Errorf(`db: validator failed for field "RefreshToken.claims_user_id": %w`, err)} } } if _, ok := rtc.mutation.ClaimsUsername(); !ok { - return &ValidationError{Name: "claims_username", err: errors.New(`db: missing required field "claims_username"`)} + return &ValidationError{Name: "claims_username", err: errors.New(`db: missing required field "RefreshToken.claims_username"`)} } if v, ok := rtc.mutation.ClaimsUsername(); ok { if err := refreshtoken.ClaimsUsernameValidator(v); err != nil { - return &ValidationError{Name: "claims_username", err: fmt.Errorf(`db: validator failed for field "claims_username": %w`, err)} + return &ValidationError{Name: "claims_username", err: fmt.Errorf(`db: validator failed for field "RefreshToken.claims_username": %w`, err)} } } if _, ok := rtc.mutation.ClaimsEmail(); !ok { - return &ValidationError{Name: "claims_email", err: errors.New(`db: missing required field "claims_email"`)} + return &ValidationError{Name: "claims_email", err: errors.New(`db: missing required field "RefreshToken.claims_email"`)} } if v, ok := rtc.mutation.ClaimsEmail(); ok { if err := refreshtoken.ClaimsEmailValidator(v); err != nil { - return &ValidationError{Name: "claims_email", err: fmt.Errorf(`db: validator failed for field "claims_email": %w`, err)} + return &ValidationError{Name: "claims_email", err: fmt.Errorf(`db: validator failed for field "RefreshToken.claims_email": %w`, err)} } } if _, ok := rtc.mutation.ClaimsEmailVerified(); !ok { - return &ValidationError{Name: "claims_email_verified", err: errors.New(`db: missing required field "claims_email_verified"`)} + return &ValidationError{Name: "claims_email_verified", err: errors.New(`db: missing required field "RefreshToken.claims_email_verified"`)} } if _, ok := rtc.mutation.ClaimsPreferredUsername(); !ok { - return &ValidationError{Name: "claims_preferred_username", err: errors.New(`db: missing required field "claims_preferred_username"`)} + return &ValidationError{Name: "claims_preferred_username", err: errors.New(`db: missing required field "RefreshToken.claims_preferred_username"`)} } if _, ok := rtc.mutation.ConnectorID(); !ok { - return &ValidationError{Name: "connector_id", err: errors.New(`db: missing required field "connector_id"`)} + return &ValidationError{Name: "connector_id", err: errors.New(`db: missing required field "RefreshToken.connector_id"`)} } if v, ok := rtc.mutation.ConnectorID(); ok { if err := refreshtoken.ConnectorIDValidator(v); err != nil { - return &ValidationError{Name: "connector_id", err: fmt.Errorf(`db: validator failed for field "connector_id": %w`, err)} + return &ValidationError{Name: "connector_id", err: fmt.Errorf(`db: validator failed for field "RefreshToken.connector_id": %w`, err)} } } if _, ok := rtc.mutation.Token(); !ok { - return &ValidationError{Name: "token", err: errors.New(`db: missing required field "token"`)} + return &ValidationError{Name: "token", err: errors.New(`db: missing required field "RefreshToken.token"`)} } if _, ok := rtc.mutation.ObsoleteToken(); !ok { - return &ValidationError{Name: "obsolete_token", err: errors.New(`db: missing required field "obsolete_token"`)} + return &ValidationError{Name: "obsolete_token", err: errors.New(`db: missing required field "RefreshToken.obsolete_token"`)} } if _, ok := rtc.mutation.CreatedAt(); !ok { - return &ValidationError{Name: "created_at", err: errors.New(`db: missing required field "created_at"`)} + return &ValidationError{Name: "created_at", err: errors.New(`db: missing required field "RefreshToken.created_at"`)} } if _, ok := rtc.mutation.LastUsed(); !ok { - return &ValidationError{Name: "last_used", err: errors.New(`db: missing required field "last_used"`)} + return &ValidationError{Name: "last_used", err: errors.New(`db: missing required field "RefreshToken.last_used"`)} } if v, ok := rtc.mutation.ID(); ok { if err := refreshtoken.IDValidator(v); err != nil { - return &ValidationError{Name: "id", err: fmt.Errorf(`db: validator failed for field "id": %w`, err)} + return &ValidationError{Name: "id", err: fmt.Errorf(`db: validator failed for field "RefreshToken.id": %w`, err)} } } return nil @@ -333,6 +333,13 @@ func (rtc *RefreshTokenCreate) sqlSave(ctx context.Context) (*RefreshToken, erro } return nil, err } + if _spec.ID.Value != nil { + if id, ok := _spec.ID.Value.(string); ok { + _node.ID = id + } else { + return nil, fmt.Errorf("unexpected RefreshToken.ID type: %T", _spec.ID.Value) + } + } return _node, nil } diff --git a/storage/ent/db/refreshtoken_query.go b/storage/ent/db/refreshtoken_query.go index 2ee4d4f9..d585fdc1 100644 --- a/storage/ent/db/refreshtoken_query.go +++ b/storage/ent/db/refreshtoken_query.go @@ -106,7 +106,7 @@ func (rtq *RefreshTokenQuery) FirstIDX(ctx context.Context) string { } // Only returns a single RefreshToken entity found by the query, ensuring it only returns one. -// Returns a *NotSingularError when exactly one RefreshToken entity is not found. +// Returns a *NotSingularError when more than one RefreshToken entity is found. // Returns a *NotFoundError when no RefreshToken entities are found. func (rtq *RefreshTokenQuery) Only(ctx context.Context) (*RefreshToken, error) { nodes, err := rtq.Limit(2).All(ctx) @@ -133,7 +133,7 @@ func (rtq *RefreshTokenQuery) OnlyX(ctx context.Context) *RefreshToken { } // OnlyID is like Only, but returns the only RefreshToken ID in the query. -// Returns a *NotSingularError when exactly one RefreshToken ID is not found. +// Returns a *NotSingularError when more than one RefreshToken ID is found. // Returns a *NotFoundError when no entities are found. func (rtq *RefreshTokenQuery) OnlyID(ctx context.Context) (id string, err error) { var ids []string @@ -242,8 +242,9 @@ func (rtq *RefreshTokenQuery) Clone() *RefreshTokenQuery { order: append([]OrderFunc{}, rtq.order...), predicates: append([]predicate.RefreshToken{}, rtq.predicates...), // clone intermediate query. - sql: rtq.sql.Clone(), - path: rtq.path, + sql: rtq.sql.Clone(), + path: rtq.path, + unique: rtq.unique, } } @@ -336,6 +337,10 @@ func (rtq *RefreshTokenQuery) sqlAll(ctx context.Context) ([]*RefreshToken, erro func (rtq *RefreshTokenQuery) sqlCount(ctx context.Context) (int, error) { _spec := rtq.querySpec() + _spec.Node.Columns = rtq.fields + if len(rtq.fields) > 0 { + _spec.Unique = rtq.unique != nil && *rtq.unique + } return sqlgraph.CountNodes(ctx, rtq.driver, _spec) } @@ -407,6 +412,9 @@ func (rtq *RefreshTokenQuery) sqlQuery(ctx context.Context) *sql.Selector { selector = rtq.sql selector.Select(selector.Columns(columns...)...) } + if rtq.unique != nil && *rtq.unique { + selector.Distinct() + } for _, p := range rtq.predicates { p(selector) } @@ -685,9 +693,7 @@ func (rtgb *RefreshTokenGroupBy) sqlQuery() *sql.Selector { for _, f := range rtgb.fields { columns = append(columns, selector.C(f)) } - for _, c := range aggregation { - columns = append(columns, c) - } + columns = append(columns, aggregation...) selector.Select(columns...) } return selector.GroupBy(selector.Columns(rtgb.fields...)...) diff --git a/storage/ent/db/refreshtoken_update.go b/storage/ent/db/refreshtoken_update.go index 913666bb..f6e6e61b 100644 --- a/storage/ent/db/refreshtoken_update.go +++ b/storage/ent/db/refreshtoken_update.go @@ -4,6 +4,7 @@ package db import ( "context" + "errors" "fmt" "time" @@ -244,32 +245,32 @@ func (rtu *RefreshTokenUpdate) ExecX(ctx context.Context) { func (rtu *RefreshTokenUpdate) check() error { if v, ok := rtu.mutation.ClientID(); ok { if err := refreshtoken.ClientIDValidator(v); err != nil { - return &ValidationError{Name: "client_id", err: fmt.Errorf("db: validator failed for field \"client_id\": %w", err)} + return &ValidationError{Name: "client_id", err: fmt.Errorf(`db: validator failed for field "RefreshToken.client_id": %w`, err)} } } if v, ok := rtu.mutation.Nonce(); ok { if err := refreshtoken.NonceValidator(v); err != nil { - return &ValidationError{Name: "nonce", err: fmt.Errorf("db: validator failed for field \"nonce\": %w", err)} + return &ValidationError{Name: "nonce", err: fmt.Errorf(`db: validator failed for field "RefreshToken.nonce": %w`, err)} } } if v, ok := rtu.mutation.ClaimsUserID(); ok { if err := refreshtoken.ClaimsUserIDValidator(v); err != nil { - return &ValidationError{Name: "claims_user_id", err: fmt.Errorf("db: validator failed for field \"claims_user_id\": %w", err)} + return &ValidationError{Name: "claims_user_id", err: fmt.Errorf(`db: validator failed for field "RefreshToken.claims_user_id": %w`, err)} } } if v, ok := rtu.mutation.ClaimsUsername(); ok { if err := refreshtoken.ClaimsUsernameValidator(v); err != nil { - return &ValidationError{Name: "claims_username", err: fmt.Errorf("db: validator failed for field \"claims_username\": %w", err)} + return &ValidationError{Name: "claims_username", err: fmt.Errorf(`db: validator failed for field "RefreshToken.claims_username": %w`, err)} } } if v, ok := rtu.mutation.ClaimsEmail(); ok { if err := refreshtoken.ClaimsEmailValidator(v); err != nil { - return &ValidationError{Name: "claims_email", err: fmt.Errorf("db: validator failed for field \"claims_email\": %w", err)} + return &ValidationError{Name: "claims_email", err: fmt.Errorf(`db: validator failed for field "RefreshToken.claims_email": %w`, err)} } } if v, ok := rtu.mutation.ConnectorID(); ok { if err := refreshtoken.ConnectorIDValidator(v); err != nil { - return &ValidationError{Name: "connector_id", err: fmt.Errorf("db: validator failed for field \"connector_id\": %w", err)} + return &ValidationError{Name: "connector_id", err: fmt.Errorf(`db: validator failed for field "RefreshToken.connector_id": %w`, err)} } } return nil @@ -659,32 +660,32 @@ func (rtuo *RefreshTokenUpdateOne) ExecX(ctx context.Context) { func (rtuo *RefreshTokenUpdateOne) check() error { if v, ok := rtuo.mutation.ClientID(); ok { if err := refreshtoken.ClientIDValidator(v); err != nil { - return &ValidationError{Name: "client_id", err: fmt.Errorf("db: validator failed for field \"client_id\": %w", err)} + return &ValidationError{Name: "client_id", err: fmt.Errorf(`db: validator failed for field "RefreshToken.client_id": %w`, err)} } } if v, ok := rtuo.mutation.Nonce(); ok { if err := refreshtoken.NonceValidator(v); err != nil { - return &ValidationError{Name: "nonce", err: fmt.Errorf("db: validator failed for field \"nonce\": %w", err)} + return &ValidationError{Name: "nonce", err: fmt.Errorf(`db: validator failed for field "RefreshToken.nonce": %w`, err)} } } if v, ok := rtuo.mutation.ClaimsUserID(); ok { if err := refreshtoken.ClaimsUserIDValidator(v); err != nil { - return &ValidationError{Name: "claims_user_id", err: fmt.Errorf("db: validator failed for field \"claims_user_id\": %w", err)} + return &ValidationError{Name: "claims_user_id", err: fmt.Errorf(`db: validator failed for field "RefreshToken.claims_user_id": %w`, err)} } } if v, ok := rtuo.mutation.ClaimsUsername(); ok { if err := refreshtoken.ClaimsUsernameValidator(v); err != nil { - return &ValidationError{Name: "claims_username", err: fmt.Errorf("db: validator failed for field \"claims_username\": %w", err)} + return &ValidationError{Name: "claims_username", err: fmt.Errorf(`db: validator failed for field "RefreshToken.claims_username": %w`, err)} } } if v, ok := rtuo.mutation.ClaimsEmail(); ok { if err := refreshtoken.ClaimsEmailValidator(v); err != nil { - return &ValidationError{Name: "claims_email", err: fmt.Errorf("db: validator failed for field \"claims_email\": %w", err)} + return &ValidationError{Name: "claims_email", err: fmt.Errorf(`db: validator failed for field "RefreshToken.claims_email": %w`, err)} } } if v, ok := rtuo.mutation.ConnectorID(); ok { if err := refreshtoken.ConnectorIDValidator(v); err != nil { - return &ValidationError{Name: "connector_id", err: fmt.Errorf("db: validator failed for field \"connector_id\": %w", err)} + return &ValidationError{Name: "connector_id", err: fmt.Errorf(`db: validator failed for field "RefreshToken.connector_id": %w`, err)} } } return nil @@ -703,7 +704,7 @@ func (rtuo *RefreshTokenUpdateOne) sqlSave(ctx context.Context) (_node *RefreshT } id, ok := rtuo.mutation.ID() if !ok { - return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing RefreshToken.ID for update")} + return nil, &ValidationError{Name: "id", err: errors.New(`db: missing "RefreshToken.id" for update`)} } _spec.Node.ID.Value = id if fields := rtuo.fields; len(fields) > 0 { diff --git a/storage/ent/db/runtime/runtime.go b/storage/ent/db/runtime/runtime.go index b52d54b6..8c201fe1 100644 --- a/storage/ent/db/runtime/runtime.go +++ b/storage/ent/db/runtime/runtime.go @@ -5,6 +5,6 @@ package runtime // The schema-stitching logic is generated in github.com/dexidp/dex/storage/ent/db/runtime.go const ( - Version = "v0.9.0" // Version of ent codegen. - Sum = "h1:2S1zfpMMW6p+wctj6kcYUprNPNjLWFW06T5MdyAfmWc=" // Sum of ent codegen. + Version = "v0.10.1" // Version of ent codegen. + Sum = "h1:dM5h4Zk6yHGIgw4dCqVzGw3nWgpGYJiV4/kyHEF6PFo=" // Sum of ent codegen. ) diff --git a/storage/ent/db/tx.go b/storage/ent/db/tx.go index 5b1f7f16..0107193b 100644 --- a/storage/ent/db/tx.go +++ b/storage/ent/db/tx.go @@ -48,7 +48,7 @@ type Tx struct { } type ( - // Committer is the interface that wraps the Committer method. + // Committer is the interface that wraps the Commit method. Committer interface { Commit(context.Context, *Tx) error } @@ -62,7 +62,7 @@ type ( // and returns a Committer. For example: // // hook := func(next ent.Committer) ent.Committer { - // return ent.CommitFunc(func(context.Context, tx *ent.Tx) error { + // return ent.CommitFunc(func(ctx context.Context, tx *ent.Tx) error { // // Do some stuff before. // if err := next.Commit(ctx, tx); err != nil { // return err @@ -103,7 +103,7 @@ func (tx *Tx) OnCommit(f CommitHook) { } type ( - // Rollbacker is the interface that wraps the Rollbacker method. + // Rollbacker is the interface that wraps the Rollback method. Rollbacker interface { Rollback(context.Context, *Tx) error } @@ -117,7 +117,7 @@ type ( // and returns a Rollbacker. For example: // // hook := func(next ent.Rollbacker) ent.Rollbacker { - // return ent.RollbackFunc(func(context.Context, tx *ent.Tx) error { + // return ent.RollbackFunc(func(ctx context.Context, tx *ent.Tx) error { // // Do some stuff before. // if err := next.Rollback(ctx, tx); err != nil { // return err diff --git a/storage/ent/mysql.go b/storage/ent/mysql.go index f7c4909e..c922eb16 100644 --- a/storage/ent/mysql.go +++ b/storage/ent/mysql.go @@ -13,6 +13,7 @@ import ( "time" entSQL "entgo.io/ent/dialect/sql" + "entgo.io/ent/dialect/sql/schema" "github.com/go-sql-driver/mysql" // Register postgres driver. @@ -56,7 +57,7 @@ func (m *MySQL) Open(logger log.Logger) (storage.Storage, error) { client.WithTxIsolationLevel(sql.LevelSerializable), ) - if err := databaseClient.Schema().Create(context.TODO()); err != nil { + if err := databaseClient.Schema().Create(context.TODO(), schema.WithAtlas(false)); err != nil { return nil, err } diff --git a/storage/ent/postgres.go b/storage/ent/postgres.go index 83aca96c..3e8df441 100644 --- a/storage/ent/postgres.go +++ b/storage/ent/postgres.go @@ -12,6 +12,7 @@ import ( "time" entSQL "entgo.io/ent/dialect/sql" + "entgo.io/ent/dialect/sql/schema" // Register postgres driver. _ "github.com/lib/pq" @@ -56,7 +57,7 @@ func (p *Postgres) Open(logger log.Logger) (storage.Storage, error) { client.WithTxIsolationLevel(sql.LevelSerializable), ) - if err := databaseClient.Schema().Create(context.TODO()); err != nil { + if err := databaseClient.Schema().Create(context.TODO(), schema.WithAtlas(false)); err != nil { return nil, err } diff --git a/storage/ent/sqlite.go b/storage/ent/sqlite.go index 22866b6f..3e54e1b7 100644 --- a/storage/ent/sqlite.go +++ b/storage/ent/sqlite.go @@ -6,6 +6,7 @@ import ( "strings" "entgo.io/ent/dialect/sql" + "entgo.io/ent/dialect/sql/schema" // Register sqlite driver. _ "github.com/mattn/go-sqlite3" @@ -43,7 +44,7 @@ func (s *SQLite3) Open(logger log.Logger) (storage.Storage, error) { client.WithHasher(sha256.New), ) - if err := databaseClient.Schema().Create(context.TODO()); err != nil { + if err := databaseClient.Schema().Create(context.TODO(), schema.WithAtlas(false)); err != nil { return nil, err }