From f669dc4b57582c97a07eb48ac7617d7d23fe950b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 22 Jul 2021 18:53:33 +0000 Subject: [PATCH 01/29] build(deps): bump helm/kind-action from 1.1.0 to 1.2.0 Bumps [helm/kind-action](https://github.com/helm/kind-action) from 1.1.0 to 1.2.0. - [Release notes](https://github.com/helm/kind-action/releases) - [Commits](https://github.com/helm/kind-action/compare/v1.1.0...v1.2.0) --- updated-dependencies: - dependency-name: helm/kind-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 320158745e..8c6ee6c6f0 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -58,7 +58,7 @@ jobs: run: docker-compose -f docker-compose.test.yaml up -d - name: Create kind cluster - uses: helm/kind-action@v1.1.0 + uses: helm/kind-action@v1.2.0 with: version: v0.11.1 node_image: kindest/node:v1.19.11@sha256:07db187ae84b4b7de440a73886f008cf903fcf5764ba8106a9fd5243d6f32729 From bf3b81ca3b22d71b818578254baf20d32bcd3660 Mon Sep 17 00:00:00 2001 From: acohen4 Date: Thu, 22 Jul 2021 11:59:16 -0700 Subject: [PATCH 02/29] Adding an oidcConnector config to decide whether to validate that the Connector Callback must contain the same host as the issuer --- connector/oidc/oidc.go | 63 +++++++++++++++++++++++------------------- 1 file changed, 34 insertions(+), 29 deletions(-) diff --git a/connector/oidc/oidc.go b/connector/oidc/oidc.go index b752f9dac5..dfea950244 100644 --- a/connector/oidc/oidc.go +++ b/connector/oidc/oidc.go @@ -44,6 +44,9 @@ type Config struct { // InsecureEnableGroups enables groups claims. This is disabled by default until https://github.com/dexidp/dex/issues/1065 is resolved InsecureEnableGroups bool `json:"insecureEnableGroups"` + // Skips checking whether the requested domain in the Login Callback matches the configured Issuer + InsecureSkipIssuerCallbackDomainCheck bool `json:"insecureSkipIssuerCallbackDomainCheck"` + // GetUserInfo uses the userinfo endpoint to get additional claims for // the token. This is especially useful where upstreams return "thin" // id tokens @@ -144,18 +147,19 @@ func (c *Config) Open(id string, logger log.Logger) (conn connector.Connector, e verifier: provider.Verifier( &oidc.Config{ClientID: clientID}, ), - logger: logger, - cancel: cancel, - hostedDomains: c.HostedDomains, - insecureSkipEmailVerified: c.InsecureSkipEmailVerified, - insecureEnableGroups: c.InsecureEnableGroups, - getUserInfo: c.GetUserInfo, - promptType: c.PromptType, - userIDKey: c.UserIDKey, - userNameKey: c.UserNameKey, - preferredUsernameKey: c.ClaimMapping.PreferredUsernameKey, - emailKey: c.ClaimMapping.EmailKey, - groupsKey: c.ClaimMapping.GroupsKey, + logger: logger, + cancel: cancel, + hostedDomains: c.HostedDomains, + insecureSkipEmailVerified: c.InsecureSkipEmailVerified, + insecureEnableGroups: c.InsecureEnableGroups, + insecureSkipIssuerCallbackDomainCheck: c.InsecureSkipIssuerCallbackDomainCheck, + getUserInfo: c.GetUserInfo, + promptType: c.PromptType, + userIDKey: c.UserIDKey, + userNameKey: c.UserNameKey, + preferredUsernameKey: c.ClaimMapping.PreferredUsernameKey, + emailKey: c.ClaimMapping.EmailKey, + groupsKey: c.ClaimMapping.GroupsKey, }, nil } @@ -165,22 +169,23 @@ var ( ) type oidcConnector struct { - provider *oidc.Provider - redirectURI string - oauth2Config *oauth2.Config - verifier *oidc.IDTokenVerifier - cancel context.CancelFunc - logger log.Logger - hostedDomains []string - insecureSkipEmailVerified bool - insecureEnableGroups bool - getUserInfo bool - promptType string - userIDKey string - userNameKey string - preferredUsernameKey string - emailKey string - groupsKey string + provider *oidc.Provider + redirectURI string + oauth2Config *oauth2.Config + verifier *oidc.IDTokenVerifier + cancel context.CancelFunc + logger log.Logger + hostedDomains []string + insecureSkipEmailVerified bool + insecureEnableGroups bool + insecureSkipIssuerCallbackDomainCheck bool + getUserInfo bool + promptType string + userIDKey string + userNameKey string + preferredUsernameKey string + emailKey string + groupsKey string } func (c *oidcConnector) Close() error { @@ -189,7 +194,7 @@ func (c *oidcConnector) Close() error { } func (c *oidcConnector) LoginURL(s connector.Scopes, callbackURL, state string) (string, error) { - if c.redirectURI != callbackURL { + if c.redirectURI != callbackURL && !c.insecureSkipIssuerCallbackDomainCheck { return "", fmt.Errorf("expected callback URL %q did not match the URL in the config %q", callbackURL, c.redirectURI) } From 56fc504b721fbc12b26d91c556192637a7e9fe9a Mon Sep 17 00:00:00 2001 From: Alon Cohen Date: Wed, 11 Aug 2021 14:23:33 -0400 Subject: [PATCH 03/29] pass login_hint to OIDC connector's /auth endpoint in auth_code flow (#12) * pass login_hint to OIDC connector's /auth endpoint in auth_code flow * Also pass non-OIDC Standard params that may be used by specific connectors --- connector/authproxy/authproxy.go | 2 +- connector/bitbucketcloud/bitbucketcloud.go | 3 +- connector/connector.go | 3 +- connector/gitea/gitea.go | 3 +- connector/github/github.go | 3 +- connector/gitlab/gitlab.go | 3 +- connector/google/google.go | 3 +- connector/linkedin/linkedin.go | 3 +- connector/microsoft/microsoft.go | 3 +- connector/mock/connectortest.go | 2 +- connector/oidc/oidc.go | 21 +++- connector/openshift/openshift.go | 3 +- server/handlers.go | 4 +- server/oauth2.go | 43 ++++---- server/oauth2_test.go | 2 +- storage/ent/db/authrequest.go | 12 ++- storage/ent/db/authrequest/authrequest.go | 5 + storage/ent/db/authrequest/where.go | 118 +++++++++++++++++++++ storage/ent/db/authrequest_create.go | 29 +++++ storage/ent/db/authrequest_update.go | 42 ++++++++ storage/ent/db/migrate/schema.go | 1 + storage/ent/db/mutation.go | 56 +++++++++- storage/ent/db/runtime.go | 4 + storage/ent/schema/authrequest.go | 3 + storage/sql/crud.go | 16 +-- storage/sql/migrate.go | 7 ++ storage/storage.go | 1 + 27 files changed, 351 insertions(+), 44 deletions(-) diff --git a/connector/authproxy/authproxy.go b/connector/authproxy/authproxy.go index 853e5ee29f..221058c9e1 100644 --- a/connector/authproxy/authproxy.go +++ b/connector/authproxy/authproxy.go @@ -37,7 +37,7 @@ type callback struct { } // LoginURL returns the URL to redirect the user to login with. -func (m *callback) LoginURL(s connector.Scopes, callbackURL, state string) (string, error) { +func (m *callback) LoginURL(s connector.Scopes, callbackURL, state string, _ url.Values) (string, error) { u, err := url.Parse(callbackURL) if err != nil { return "", fmt.Errorf("failed to parse callbackURL %q: %v", callbackURL, err) diff --git a/connector/bitbucketcloud/bitbucketcloud.go b/connector/bitbucketcloud/bitbucketcloud.go index e81893da07..51113d8bfa 100644 --- a/connector/bitbucketcloud/bitbucketcloud.go +++ b/connector/bitbucketcloud/bitbucketcloud.go @@ -8,6 +8,7 @@ import ( "fmt" "io/ioutil" "net/http" + "net/url" "sync" "time" @@ -111,7 +112,7 @@ func (b *bitbucketConnector) oauth2Config(scopes connector.Scopes) *oauth2.Confi } } -func (b *bitbucketConnector) LoginURL(scopes connector.Scopes, callbackURL, state string) (string, error) { +func (b *bitbucketConnector) LoginURL(scopes connector.Scopes, callbackURL, state string, _ url.Values) (string, error) { if b.redirectURI != callbackURL { return "", fmt.Errorf("expected callback URL %q did not match the URL in the config %q", callbackURL, b.redirectURI) } diff --git a/connector/connector.go b/connector/connector.go index aab994b468..0f34ebc88a 100644 --- a/connector/connector.go +++ b/connector/connector.go @@ -4,6 +4,7 @@ package connector import ( "context" "net/http" + "net/url" ) // Connector is a mechanism for federating login to a remote identity service. @@ -63,7 +64,7 @@ type CallbackConnector interface { // requested if one has already been issues. There's no good general answer // for these kind of restrictions, and may require this package to become more // aware of the global set of user/connector interactions. - LoginURL(s Scopes, callbackURL, state string) (string, error) + LoginURL(s Scopes, callbackURL, state string, forwardedParams url.Values) (string, error) // Handle the callback to the server and return an identity. HandleCallback(s Scopes, r *http.Request) (identity Identity, err error) diff --git a/connector/gitea/gitea.go b/connector/gitea/gitea.go index 33cc3126e6..90385c6c72 100644 --- a/connector/gitea/gitea.go +++ b/connector/gitea/gitea.go @@ -8,6 +8,7 @@ import ( "fmt" "io/ioutil" "net/http" + "net/url" "strconv" "sync" "time" @@ -82,7 +83,7 @@ func (c *giteaConnector) oauth2Config(_ connector.Scopes) *oauth2.Config { } } -func (c *giteaConnector) LoginURL(scopes connector.Scopes, callbackURL, state string) (string, error) { +func (c *giteaConnector) LoginURL(scopes connector.Scopes, callbackURL, state string, _ url.Values) (string, error) { if c.redirectURI != callbackURL { return "", fmt.Errorf("expected callback URL %q did not match the URL in the config %q", c.redirectURI, callbackURL) } diff --git a/connector/github/github.go b/connector/github/github.go index 02f2cae804..3df415d322 100644 --- a/connector/github/github.go +++ b/connector/github/github.go @@ -11,6 +11,7 @@ import ( "io/ioutil" "net" "net/http" + "net/url" "regexp" "strconv" "strings" @@ -187,7 +188,7 @@ func (c *githubConnector) oauth2Config(scopes connector.Scopes) *oauth2.Config { } } -func (c *githubConnector) LoginURL(scopes connector.Scopes, callbackURL, state string) (string, error) { +func (c *githubConnector) LoginURL(scopes connector.Scopes, callbackURL, state string, _ url.Values) (string, error) { if c.redirectURI != callbackURL { return "", fmt.Errorf("expected callback URL %q did not match the URL in the config %q", callbackURL, c.redirectURI) } diff --git a/connector/gitlab/gitlab.go b/connector/gitlab/gitlab.go index e40601402d..648a825388 100644 --- a/connector/gitlab/gitlab.go +++ b/connector/gitlab/gitlab.go @@ -8,6 +8,7 @@ import ( "fmt" "io/ioutil" "net/http" + "net/url" "strconv" "golang.org/x/oauth2" @@ -98,7 +99,7 @@ func (c *gitlabConnector) oauth2Config(scopes connector.Scopes) *oauth2.Config { } } -func (c *gitlabConnector) LoginURL(scopes connector.Scopes, callbackURL, state string) (string, error) { +func (c *gitlabConnector) LoginURL(scopes connector.Scopes, callbackURL, state string, _ url.Values) (string, error) { if c.redirectURI != callbackURL { return "", fmt.Errorf("expected callback URL %q did not match the URL in the config %q", c.redirectURI, callbackURL) } diff --git a/connector/google/google.go b/connector/google/google.go index eccb1fc7d7..594181c59e 100644 --- a/connector/google/google.go +++ b/connector/google/google.go @@ -7,6 +7,7 @@ import ( "fmt" "io/ioutil" "net/http" + "net/url" "time" "github.com/coreos/go-oidc/v3/oidc" @@ -120,7 +121,7 @@ func (c *googleConnector) Close() error { return nil } -func (c *googleConnector) LoginURL(s connector.Scopes, callbackURL, state string) (string, error) { +func (c *googleConnector) LoginURL(s connector.Scopes, callbackURL, state string, _ url.Values) (string, error) { if c.redirectURI != callbackURL { return "", fmt.Errorf("expected callback URL %q did not match the URL in the config %q", callbackURL, c.redirectURI) } diff --git a/connector/linkedin/linkedin.go b/connector/linkedin/linkedin.go index 1c8312c11e..c3c63ff35e 100644 --- a/connector/linkedin/linkedin.go +++ b/connector/linkedin/linkedin.go @@ -7,6 +7,7 @@ import ( "fmt" "io/ioutil" "net/http" + "net/url" "strings" "golang.org/x/oauth2" @@ -62,7 +63,7 @@ var ( ) // LoginURL returns an access token request URL -func (c *linkedInConnector) LoginURL(scopes connector.Scopes, callbackURL, state string) (string, error) { +func (c *linkedInConnector) LoginURL(scopes connector.Scopes, callbackURL, state string, _ url.Values) (string, error) { if c.oauth2Config.RedirectURL != callbackURL { return "", fmt.Errorf("expected callback URL %q did not match the URL in the config %q", callbackURL, c.oauth2Config.RedirectURL) diff --git a/connector/microsoft/microsoft.go b/connector/microsoft/microsoft.go index 328ea15274..2195f74451 100644 --- a/connector/microsoft/microsoft.go +++ b/connector/microsoft/microsoft.go @@ -9,6 +9,7 @@ import ( "fmt" "io" "net/http" + "net/url" "strings" "sync" "time" @@ -151,7 +152,7 @@ func (c *microsoftConnector) oauth2Config(scopes connector.Scopes) *oauth2.Confi } } -func (c *microsoftConnector) LoginURL(scopes connector.Scopes, callbackURL, state string) (string, error) { +func (c *microsoftConnector) LoginURL(scopes connector.Scopes, callbackURL, state string, _ url.Values) (string, error) { if c.redirectURI != callbackURL { return "", fmt.Errorf("expected callback URL %q did not match the URL in the config %q", callbackURL, c.redirectURI) } diff --git a/connector/mock/connectortest.go b/connector/mock/connectortest.go index 5089914ca1..b35ac5519d 100644 --- a/connector/mock/connectortest.go +++ b/connector/mock/connectortest.go @@ -43,7 +43,7 @@ type Callback struct { } // LoginURL returns the URL to redirect the user to login with. -func (m *Callback) LoginURL(s connector.Scopes, callbackURL, state string) (string, error) { +func (m *Callback) LoginURL(s connector.Scopes, callbackURL, state string, _ url.Values) (string, error) { u, err := url.Parse(callbackURL) if err != nil { return "", fmt.Errorf("failed to parse callbackURL %q: %v", callbackURL, err) diff --git a/connector/oidc/oidc.go b/connector/oidc/oidc.go index dfea950244..ec00814b19 100644 --- a/connector/oidc/oidc.go +++ b/connector/oidc/oidc.go @@ -59,6 +59,8 @@ type Config struct { // PromptType will be used fot the prompt parameter (when offline_access, by default prompt=consent) PromptType string `json:"promptType"` + ForwardedLoginParams []string `json:"forwardedLoginParams"` + ClaimMapping struct { // Configurable key which contains the preferred username claims PreferredUsernameKey string `json:"preferred_username"` // defaults to "preferred_username" @@ -160,6 +162,7 @@ func (c *Config) Open(id string, logger log.Logger) (conn connector.Connector, e preferredUsernameKey: c.ClaimMapping.PreferredUsernameKey, emailKey: c.ClaimMapping.EmailKey, groupsKey: c.ClaimMapping.GroupsKey, + forwardedLoginParams: c.ForwardedLoginParams, }, nil } @@ -186,6 +189,7 @@ type oidcConnector struct { preferredUsernameKey string emailKey string groupsKey string + forwardedLoginParams []string } func (c *oidcConnector) Close() error { @@ -193,7 +197,7 @@ func (c *oidcConnector) Close() error { return nil } -func (c *oidcConnector) LoginURL(s connector.Scopes, callbackURL, state string) (string, error) { +func (c *oidcConnector) LoginURL(s connector.Scopes, callbackURL, state string, forwardParams url.Values) (string, error) { if c.redirectURI != callbackURL && !c.insecureSkipIssuerCallbackDomainCheck { return "", fmt.Errorf("expected callback URL %q did not match the URL in the config %q", callbackURL, c.redirectURI) } @@ -210,6 +214,21 @@ func (c *oidcConnector) LoginURL(s connector.Scopes, callbackURL, state string) if s.OfflineAccess { opts = append(opts, oauth2.AccessTypeOffline, oauth2.SetAuthURLParam("prompt", c.promptType)) } + + for p := range forwardParams { + paramApproved := false + for _, approvedParam := range c.forwardedLoginParams { + if p == approvedParam { + paramApproved = true + break + } + } + if paramApproved { + opts = append(opts, oauth2.SetAuthURLParam(p, forwardParams.Get(p))) + } else { + c.logger.Infof("oidc: auth query parameter %s, is unapproved and was not forwarded to the connector idp", p) + } + } return c.oauth2Config.AuthCodeURL(state, opts...), nil } diff --git a/connector/openshift/openshift.go b/connector/openshift/openshift.go index f06e8f8045..1469e55609 100644 --- a/connector/openshift/openshift.go +++ b/connector/openshift/openshift.go @@ -9,6 +9,7 @@ import ( "io/ioutil" "net" "net/http" + "net/url" "strings" "time" @@ -117,7 +118,7 @@ func (c *openshiftConnector) Close() error { } // LoginURL returns the URL to redirect the user to login with. -func (c *openshiftConnector) LoginURL(scopes connector.Scopes, callbackURL, state string) (string, error) { +func (c *openshiftConnector) LoginURL(scopes connector.Scopes, callbackURL, state string, _ url.Values) (string, error) { if c.redirectURI != callbackURL { return "", fmt.Errorf("expected callback URL %q did not match the URL in the config %q", callbackURL, c.redirectURI) } diff --git a/server/handlers.go b/server/handlers.go index 4144dd1f87..fda32fe8c5 100644 --- a/server/handlers.go +++ b/server/handlers.go @@ -184,7 +184,7 @@ func (s *Server) handleAuthorization(w http.ResponseWriter, r *http.Request) { } func (s *Server) handleConnectorLogin(w http.ResponseWriter, r *http.Request) { - authReq, err := s.parseAuthorizationRequest(r) + authReq, forwardParams, err := s.parseAuthorizationRequest(r) if err != nil { s.logger.Errorf("Failed to parse authorization request: %v", err) status := http.StatusInternalServerError @@ -250,7 +250,7 @@ func (s *Server) handleConnectorLogin(w http.ResponseWriter, r *http.Request) { // Use the auth request ID as the "state" token. // // TODO(ericchiang): Is this appropriate or should we also be using a nonce? - callbackURL, err := conn.LoginURL(scopes, s.absURL("/callback"), authReq.ID) + callbackURL, err := conn.LoginURL(scopes, s.absURL("/callback"), authReq.ID, forwardParams) if err != nil { s.logger.Errorf("Connector %q returned error when creating callback: %v", connID, err) s.renderError(r, w, http.StatusInternalServerError, "Login error.") diff --git a/server/oauth2.go b/server/oauth2.go index 00beb6ff4b..4e9b612b7c 100644 --- a/server/oauth2.go +++ b/server/oauth2.go @@ -406,14 +406,14 @@ func (s *Server) newIDToken(clientID string, claims storage.Claims, scopes []str } // parse the initial request from the OAuth2 client. -func (s *Server) parseAuthorizationRequest(r *http.Request) (*storage.AuthRequest, error) { +func (s *Server) parseAuthorizationRequest(r *http.Request) (*storage.AuthRequest, url.Values, error) { if err := r.ParseForm(); err != nil { - return nil, &authErr{"", "", errInvalidRequest, "Failed to parse request body."} + return nil, nil, &authErr{"", "", errInvalidRequest, "Failed to parse request body."} } q := r.Form redirectURI, err := url.QueryUnescape(q.Get("redirect_uri")) if err != nil { - return nil, &authErr{"", "", errInvalidRequest, "No redirect_uri provided."} + return nil, nil, &authErr{"", "", errInvalidRequest, "No redirect_uri provided."} } clientID := q.Get("client_id") @@ -435,25 +435,25 @@ func (s *Server) parseAuthorizationRequest(r *http.Request) (*storage.AuthReques if err != nil { if err == storage.ErrNotFound { description := fmt.Sprintf("Invalid client_id (%q).", clientID) - return nil, &authErr{"", "", errUnauthorizedClient, description} + return nil, nil, &authErr{"", "", errUnauthorizedClient, description} } s.logger.Errorf("Failed to get client: %v", err) - return nil, &authErr{"", "", errServerError, ""} + return nil, nil, &authErr{"", "", errServerError, ""} } if connectorID != "" { connectors, err := s.storage.ListConnectors() if err != nil { - return nil, &authErr{"", "", errServerError, "Unable to retrieve connectors"} + return nil, nil, &authErr{"", "", errServerError, "Unable to retrieve connectors"} } if !validateConnectorID(connectors, connectorID) { - return nil, &authErr{"", "", errInvalidRequest, "Invalid ConnectorID"} + return nil, nil, &authErr{"", "", errInvalidRequest, "Invalid ConnectorID"} } } if !validateRedirectURI(client, redirectURI) { description := fmt.Sprintf("Unregistered redirect_uri (%q).", redirectURI) - return nil, &authErr{"", "", errInvalidRequest, description} + return nil, nil, &authErr{"", "", errInvalidRequest, description} } if redirectURI == deviceCallbackURI && client.Public { redirectURI = s.issuerURL.Path + deviceCallbackURI @@ -467,12 +467,12 @@ func (s *Server) parseAuthorizationRequest(r *http.Request) (*storage.AuthReques // dex doesn't support request parameter and must return request_not_supported error // https://openid.net/specs/openid-connect-core-1_0.html#6.1 if q.Get("request") != "" { - return nil, newErr(errRequestNotSupported, "Server does not support request parameter.") + return nil, nil, newErr(errRequestNotSupported, "Server does not support request parameter.") } if codeChallengeMethod != codeChallengeMethodS256 && codeChallengeMethod != codeChallengeMethodPlain { description := fmt.Sprintf("Unsupported PKCE challenge method (%q).", codeChallengeMethod) - return nil, newErr(errInvalidRequest, description) + return nil, nil, newErr(errInvalidRequest, description) } var ( @@ -494,7 +494,7 @@ func (s *Server) parseAuthorizationRequest(r *http.Request) (*storage.AuthReques isTrusted, err := s.validateCrossClientTrust(clientID, peerID) if err != nil { - return nil, newErr(errServerError, "Internal server error.") + return nil, nil, newErr(errServerError, "Internal server error.") } if !isTrusted { invalidScopes = append(invalidScopes, scope) @@ -502,13 +502,13 @@ func (s *Server) parseAuthorizationRequest(r *http.Request) (*storage.AuthReques } } if !hasOpenIDScope { - return nil, newErr(errInvalidScope, `Missing required scope(s) ["openid"].`) + return nil, nil, newErr(errInvalidScope, `Missing required scope(s) ["openid"].`) } if len(unrecognized) > 0 { - return nil, newErr(errInvalidScope, "Unrecognized scope(s) %q", unrecognized) + return nil, nil, newErr(errInvalidScope, "Unrecognized scope(s) %q", unrecognized) } if len(invalidScopes) > 0 { - return nil, newErr(errInvalidScope, "Client can't request scope(s) %q", invalidScopes) + return nil, nil, newErr(errInvalidScope, "Client can't request scope(s) %q", invalidScopes) } var rt struct { @@ -526,23 +526,23 @@ func (s *Server) parseAuthorizationRequest(r *http.Request) (*storage.AuthReques case responseTypeToken: rt.token = true default: - return nil, newErr(errInvalidRequest, "Invalid response type %q", responseType) + return nil, nil, newErr(errInvalidRequest, "Invalid response type %q", responseType) } if !s.supportedResponseTypes[responseType] { - return nil, newErr(errUnsupportedResponseType, "Unsupported response type %q", responseType) + return nil, nil, newErr(errUnsupportedResponseType, "Unsupported response type %q", responseType) } } if len(responseTypes) == 0 { - return nil, newErr(errInvalidRequest, "No response_type provided") + return nil, nil, newErr(errInvalidRequest, "No response_type provided") } if rt.token && !rt.code && !rt.idToken { // "token" can't be provided by its own. // // https://openid.net/specs/openid-connect-core-1_0.html#Authentication - return nil, newErr(errInvalidRequest, "Response type 'token' must be provided with type 'id_token' and/or 'code'") + return nil, nil, newErr(errInvalidRequest, "Response type 'token' must be provided with type 'id_token' and/or 'code'") } if !rt.code { // Either "id_token token" or "id_token" has been provided which implies the @@ -550,13 +550,13 @@ func (s *Server) parseAuthorizationRequest(r *http.Request) (*storage.AuthReques // // https://openid.net/specs/openid-connect-core-1_0.html#ImplicitAuthRequest if nonce == "" { - return nil, newErr(errInvalidRequest, "Response type 'token' requires a 'nonce' value.") + return nil, nil, newErr(errInvalidRequest, "Response type 'token' requires a 'nonce' value.") } } if rt.token { if redirectURI == redirectURIOOB { err := fmt.Sprintf("Cannot use response type 'token' with redirect_uri '%s'.", redirectURIOOB) - return nil, newErr(errInvalidRequest, err) + return nil, nil, newErr(errInvalidRequest, err) } } @@ -570,11 +570,12 @@ func (s *Server) parseAuthorizationRequest(r *http.Request) (*storage.AuthReques RedirectURI: redirectURI, ResponseTypes: responseTypes, ConnectorID: connectorID, + LoginHint: q.Get("login_hint"), PKCE: storage.PKCE{ CodeChallenge: codeChallenge, CodeChallengeMethod: codeChallengeMethod, }, - }, nil + }, r.Form, nil } func parseCrossClientScope(scope string) (peerID string, ok bool) { diff --git a/server/oauth2_test.go b/server/oauth2_test.go index 518e22ee86..6c3650add2 100644 --- a/server/oauth2_test.go +++ b/server/oauth2_test.go @@ -320,7 +320,7 @@ func TestParseAuthorizationRequest(t *testing.T) { req = httptest.NewRequest("GET", httpServer.URL+"/auth?"+params.Encode(), nil) } - _, err := server.parseAuthorizationRequest(req) + _, _, err := server.parseAuthorizationRequest(req) if tc.wantErr { require.Error(t, err) if tc.exactError != nil { diff --git a/storage/ent/db/authrequest.go b/storage/ent/db/authrequest.go index ed64d9f679..ad8be7f3b4 100644 --- a/storage/ent/db/authrequest.go +++ b/storage/ent/db/authrequest.go @@ -55,6 +55,8 @@ type AuthRequest struct { CodeChallenge string `json:"code_challenge,omitempty"` // CodeChallengeMethod holds the value of the "code_challenge_method" field. CodeChallengeMethod string `json:"code_challenge_method,omitempty"` + // LoginHint holds the value of the "login_hint" field. + LoginHint string `json:"login_hint,omitempty"` } // scanValues returns the types for scanning values from sql.Rows. @@ -66,7 +68,7 @@ func (*AuthRequest) scanValues(columns []string) ([]interface{}, error) { values[i] = new([]byte) case authrequest.FieldForceApprovalPrompt, authrequest.FieldLoggedIn, authrequest.FieldClaimsEmailVerified: values[i] = new(sql.NullBool) - case authrequest.FieldID, authrequest.FieldClientID, authrequest.FieldRedirectURI, authrequest.FieldNonce, authrequest.FieldState, authrequest.FieldClaimsUserID, authrequest.FieldClaimsUsername, authrequest.FieldClaimsEmail, authrequest.FieldClaimsPreferredUsername, authrequest.FieldConnectorID, authrequest.FieldCodeChallenge, authrequest.FieldCodeChallengeMethod: + case authrequest.FieldID, authrequest.FieldClientID, authrequest.FieldRedirectURI, authrequest.FieldNonce, authrequest.FieldState, authrequest.FieldClaimsUserID, authrequest.FieldClaimsUsername, authrequest.FieldClaimsEmail, authrequest.FieldClaimsPreferredUsername, authrequest.FieldConnectorID, authrequest.FieldCodeChallenge, authrequest.FieldCodeChallengeMethod, authrequest.FieldLoginHint: values[i] = new(sql.NullString) case authrequest.FieldExpiry: values[i] = new(sql.NullTime) @@ -214,6 +216,12 @@ func (ar *AuthRequest) assignValues(columns []string, values []interface{}) erro } else if value.Valid { ar.CodeChallengeMethod = value.String } + case authrequest.FieldLoginHint: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field login_hint", values[i]) + } else if value.Valid { + ar.LoginHint = value.String + } } } return nil @@ -282,6 +290,8 @@ func (ar *AuthRequest) String() string { builder.WriteString(ar.CodeChallenge) builder.WriteString(", code_challenge_method=") builder.WriteString(ar.CodeChallengeMethod) + builder.WriteString(", login_hint=") + builder.WriteString(ar.LoginHint) builder.WriteByte(')') return builder.String() } diff --git a/storage/ent/db/authrequest/authrequest.go b/storage/ent/db/authrequest/authrequest.go index 00094a7372..7e872acb8f 100644 --- a/storage/ent/db/authrequest/authrequest.go +++ b/storage/ent/db/authrequest/authrequest.go @@ -45,6 +45,8 @@ const ( FieldCodeChallenge = "code_challenge" // FieldCodeChallengeMethod holds the string denoting the code_challenge_method field in the database. FieldCodeChallengeMethod = "code_challenge_method" + // FieldLoginHint holds the string denoting the login_hint field in the database. + FieldLoginHint = "login_hint" // Table holds the table name of the authrequest in the database. Table = "auth_requests" ) @@ -71,6 +73,7 @@ var Columns = []string{ FieldExpiry, FieldCodeChallenge, FieldCodeChallengeMethod, + FieldLoginHint, } // ValidColumn reports if the column name is valid (part of the table columns). @@ -90,6 +93,8 @@ var ( DefaultCodeChallenge string // DefaultCodeChallengeMethod holds the default value on creation for the "code_challenge_method" field. DefaultCodeChallengeMethod string + // DefaultLoginHint holds the default value on creation for the "login_hint" field. + DefaultLoginHint string // IDValidator is a validator for the "id" field. It is called by the builders before save. IDValidator func(string) error ) diff --git a/storage/ent/db/authrequest/where.go b/storage/ent/db/authrequest/where.go index 31ae7a0396..471af1fbae 100644 --- a/storage/ent/db/authrequest/where.go +++ b/storage/ent/db/authrequest/where.go @@ -204,6 +204,13 @@ func CodeChallengeMethod(v string) predicate.AuthRequest { }) } +// LoginHint applies equality check predicate on the "login_hint" field. It's identical to LoginHintEQ. +func LoginHint(v string) predicate.AuthRequest { + return predicate.AuthRequest(func(s *sql.Selector) { + s.Where(sql.EQ(s.C(FieldLoginHint), v)) + }) +} + // ClientIDEQ applies the EQ predicate on the "client_id" field. func ClientIDEQ(v string) predicate.AuthRequest { return predicate.AuthRequest(func(s *sql.Selector) { @@ -1675,6 +1682,117 @@ func CodeChallengeMethodContainsFold(v string) predicate.AuthRequest { }) } +// LoginHintEQ applies the EQ predicate on the "login_hint" field. +func LoginHintEQ(v string) predicate.AuthRequest { + return predicate.AuthRequest(func(s *sql.Selector) { + s.Where(sql.EQ(s.C(FieldLoginHint), v)) + }) +} + +// LoginHintNEQ applies the NEQ predicate on the "login_hint" field. +func LoginHintNEQ(v string) predicate.AuthRequest { + return predicate.AuthRequest(func(s *sql.Selector) { + s.Where(sql.NEQ(s.C(FieldLoginHint), v)) + }) +} + +// LoginHintIn applies the In predicate on the "login_hint" field. +func LoginHintIn(vs ...string) predicate.AuthRequest { + v := make([]interface{}, len(vs)) + for i := range v { + v[i] = vs[i] + } + return predicate.AuthRequest(func(s *sql.Selector) { + // if not arguments were provided, append the FALSE constants, + // since we can't apply "IN ()". This will make this predicate falsy. + if len(v) == 0 { + s.Where(sql.False()) + return + } + s.Where(sql.In(s.C(FieldLoginHint), v...)) + }) +} + +// LoginHintNotIn applies the NotIn predicate on the "login_hint" field. +func LoginHintNotIn(vs ...string) predicate.AuthRequest { + v := make([]interface{}, len(vs)) + for i := range v { + v[i] = vs[i] + } + return predicate.AuthRequest(func(s *sql.Selector) { + // if not arguments were provided, append the FALSE constants, + // since we can't apply "IN ()". This will make this predicate falsy. + if len(v) == 0 { + s.Where(sql.False()) + return + } + s.Where(sql.NotIn(s.C(FieldLoginHint), v...)) + }) +} + +// LoginHintGT applies the GT predicate on the "login_hint" field. +func LoginHintGT(v string) predicate.AuthRequest { + return predicate.AuthRequest(func(s *sql.Selector) { + s.Where(sql.GT(s.C(FieldLoginHint), v)) + }) +} + +// LoginHintGTE applies the GTE predicate on the "login_hint" field. +func LoginHintGTE(v string) predicate.AuthRequest { + return predicate.AuthRequest(func(s *sql.Selector) { + s.Where(sql.GTE(s.C(FieldLoginHint), v)) + }) +} + +// LoginHintLT applies the LT predicate on the "login_hint" field. +func LoginHintLT(v string) predicate.AuthRequest { + return predicate.AuthRequest(func(s *sql.Selector) { + s.Where(sql.LT(s.C(FieldLoginHint), v)) + }) +} + +// LoginHintLTE applies the LTE predicate on the "login_hint" field. +func LoginHintLTE(v string) predicate.AuthRequest { + return predicate.AuthRequest(func(s *sql.Selector) { + s.Where(sql.LTE(s.C(FieldLoginHint), v)) + }) +} + +// LoginHintContains applies the Contains predicate on the "login_hint" field. +func LoginHintContains(v string) predicate.AuthRequest { + return predicate.AuthRequest(func(s *sql.Selector) { + s.Where(sql.Contains(s.C(FieldLoginHint), v)) + }) +} + +// LoginHintHasPrefix applies the HasPrefix predicate on the "login_hint" field. +func LoginHintHasPrefix(v string) predicate.AuthRequest { + return predicate.AuthRequest(func(s *sql.Selector) { + s.Where(sql.HasPrefix(s.C(FieldLoginHint), v)) + }) +} + +// LoginHintHasSuffix applies the HasSuffix predicate on the "login_hint" field. +func LoginHintHasSuffix(v string) predicate.AuthRequest { + return predicate.AuthRequest(func(s *sql.Selector) { + s.Where(sql.HasSuffix(s.C(FieldLoginHint), v)) + }) +} + +// LoginHintEqualFold applies the EqualFold predicate on the "login_hint" field. +func LoginHintEqualFold(v string) predicate.AuthRequest { + return predicate.AuthRequest(func(s *sql.Selector) { + s.Where(sql.EqualFold(s.C(FieldLoginHint), v)) + }) +} + +// LoginHintContainsFold applies the ContainsFold predicate on the "login_hint" field. +func LoginHintContainsFold(v string) predicate.AuthRequest { + return predicate.AuthRequest(func(s *sql.Selector) { + s.Where(sql.ContainsFold(s.C(FieldLoginHint), v)) + }) +} + // And groups predicates with the AND operator between them. func And(predicates ...predicate.AuthRequest) predicate.AuthRequest { return predicate.AuthRequest(func(s *sql.Selector) { diff --git a/storage/ent/db/authrequest_create.go b/storage/ent/db/authrequest_create.go index e7a2c8cebe..2cdfe6d980 100644 --- a/storage/ent/db/authrequest_create.go +++ b/storage/ent/db/authrequest_create.go @@ -158,6 +158,20 @@ func (arc *AuthRequestCreate) SetNillableCodeChallengeMethod(s *string) *AuthReq return arc } +// SetLoginHint sets the "login_hint" field. +func (arc *AuthRequestCreate) SetLoginHint(s string) *AuthRequestCreate { + arc.mutation.SetLoginHint(s) + return arc +} + +// SetNillableLoginHint sets the "login_hint" field if the given value is not nil. +func (arc *AuthRequestCreate) SetNillableLoginHint(s *string) *AuthRequestCreate { + if s != nil { + arc.SetLoginHint(*s) + } + return arc +} + // SetID sets the "id" field. func (arc *AuthRequestCreate) SetID(s string) *AuthRequestCreate { arc.mutation.SetID(s) @@ -228,6 +242,10 @@ func (arc *AuthRequestCreate) defaults() { v := authrequest.DefaultCodeChallengeMethod arc.mutation.SetCodeChallengeMethod(v) } + if _, ok := arc.mutation.LoginHint(); !ok { + v := authrequest.DefaultLoginHint + arc.mutation.SetLoginHint(v) + } } // check runs all checks and user-defined validators on the builder. @@ -277,6 +295,9 @@ func (arc *AuthRequestCreate) check() error { if _, ok := arc.mutation.CodeChallengeMethod(); !ok { return &ValidationError{Name: "code_challenge_method", err: errors.New("db: missing required field \"code_challenge_method\"")} } + if _, ok := arc.mutation.LoginHint(); !ok { + return &ValidationError{Name: "login_hint", err: errors.New("db: missing required field \"login_hint\"")} + } 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)} @@ -463,6 +484,14 @@ func (arc *AuthRequestCreate) createSpec() (*AuthRequest, *sqlgraph.CreateSpec) }) _node.CodeChallengeMethod = value } + if value, ok := arc.mutation.LoginHint(); ok { + _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ + Type: field.TypeString, + Value: value, + Column: authrequest.FieldLoginHint, + }) + _node.LoginHint = value + } return _node, _spec } diff --git a/storage/ent/db/authrequest_update.go b/storage/ent/db/authrequest_update.go index 2d3f859443..4eb5b2b3fc 100644 --- a/storage/ent/db/authrequest_update.go +++ b/storage/ent/db/authrequest_update.go @@ -189,6 +189,20 @@ func (aru *AuthRequestUpdate) SetNillableCodeChallengeMethod(s *string) *AuthReq return aru } +// SetLoginHint sets the "login_hint" field. +func (aru *AuthRequestUpdate) SetLoginHint(s string) *AuthRequestUpdate { + aru.mutation.SetLoginHint(s) + return aru +} + +// SetNillableLoginHint sets the "login_hint" field if the given value is not nil. +func (aru *AuthRequestUpdate) SetNillableLoginHint(s *string) *AuthRequestUpdate { + if s != nil { + aru.SetLoginHint(*s) + } + return aru +} + // Mutation returns the AuthRequestMutation object of the builder. func (aru *AuthRequestUpdate) Mutation() *AuthRequestMutation { return aru.mutation @@ -420,6 +434,13 @@ func (aru *AuthRequestUpdate) sqlSave(ctx context.Context) (n int, err error) { Column: authrequest.FieldCodeChallengeMethod, }) } + if value, ok := aru.mutation.LoginHint(); ok { + _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ + Type: field.TypeString, + Value: value, + Column: authrequest.FieldLoginHint, + }) + } if n, err = sqlgraph.UpdateNodes(ctx, aru.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{authrequest.Label} @@ -601,6 +622,20 @@ func (aruo *AuthRequestUpdateOne) SetNillableCodeChallengeMethod(s *string) *Aut return aruo } +// SetLoginHint sets the "login_hint" field. +func (aruo *AuthRequestUpdateOne) SetLoginHint(s string) *AuthRequestUpdateOne { + aruo.mutation.SetLoginHint(s) + return aruo +} + +// SetNillableLoginHint sets the "login_hint" field if the given value is not nil. +func (aruo *AuthRequestUpdateOne) SetNillableLoginHint(s *string) *AuthRequestUpdateOne { + if s != nil { + aruo.SetLoginHint(*s) + } + return aruo +} + // Mutation returns the AuthRequestMutation object of the builder. func (aruo *AuthRequestUpdateOne) Mutation() *AuthRequestMutation { return aruo.mutation @@ -856,6 +891,13 @@ func (aruo *AuthRequestUpdateOne) sqlSave(ctx context.Context) (_node *AuthReque Column: authrequest.FieldCodeChallengeMethod, }) } + if value, ok := aruo.mutation.LoginHint(); ok { + _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ + Type: field.TypeString, + Value: value, + Column: authrequest.FieldLoginHint, + }) + } _node = &AuthRequest{config: aruo.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues diff --git a/storage/ent/db/migrate/schema.go b/storage/ent/db/migrate/schema.go index d5b1f535d9..ec8a56ae30 100644 --- a/storage/ent/db/migrate/schema.go +++ b/storage/ent/db/migrate/schema.go @@ -56,6 +56,7 @@ var ( {Name: "expiry", Type: field.TypeTime}, {Name: "code_challenge", Type: field.TypeString, Size: 2147483647, Default: "", SchemaType: map[string]string{"sqlite3": "text"}}, {Name: "code_challenge_method", Type: field.TypeString, Size: 2147483647, Default: "", SchemaType: map[string]string{"sqlite3": "text"}}, + {Name: "login_hint", Type: field.TypeString, Size: 2147483647, Default: "", SchemaType: map[string]string{"sqlite3": "text"}}, } // AuthRequestsTable holds the schema information for the "auth_requests" table. AuthRequestsTable = &schema.Table{ diff --git a/storage/ent/db/mutation.go b/storage/ent/db/mutation.go index 7ccab3f2b3..c749d343f4 100644 --- a/storage/ent/db/mutation.go +++ b/storage/ent/db/mutation.go @@ -1180,6 +1180,7 @@ type AuthRequestMutation struct { expiry *time.Time code_challenge *string code_challenge_method *string + login_hint *string clearedFields map[string]struct{} done bool oldValue func(context.Context) (*AuthRequest, error) @@ -2007,6 +2008,42 @@ func (m *AuthRequestMutation) ResetCodeChallengeMethod() { m.code_challenge_method = nil } +// SetLoginHint sets the "login_hint" field. +func (m *AuthRequestMutation) SetLoginHint(s string) { + m.login_hint = &s +} + +// LoginHint returns the value of the "login_hint" field in the mutation. +func (m *AuthRequestMutation) LoginHint() (r string, exists bool) { + v := m.login_hint + if v == nil { + return + } + return *v, true +} + +// OldLoginHint returns the old "login_hint" field's value of the AuthRequest entity. +// If the AuthRequest object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *AuthRequestMutation) OldLoginHint(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, fmt.Errorf("OldLoginHint is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, fmt.Errorf("OldLoginHint requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldLoginHint: %w", err) + } + return oldValue.LoginHint, nil +} + +// ResetLoginHint resets all changes to the "login_hint" field. +func (m *AuthRequestMutation) ResetLoginHint() { + m.login_hint = nil +} + // Op returns the operation name. func (m *AuthRequestMutation) Op() Op { return m.op @@ -2021,7 +2058,7 @@ func (m *AuthRequestMutation) Type() string { // order to get all numeric fields that were incremented/decremented, call // AddedFields(). func (m *AuthRequestMutation) Fields() []string { - fields := make([]string, 0, 19) + fields := make([]string, 0, 20) if m.client_id != nil { fields = append(fields, authrequest.FieldClientID) } @@ -2079,6 +2116,9 @@ func (m *AuthRequestMutation) Fields() []string { if m.code_challenge_method != nil { fields = append(fields, authrequest.FieldCodeChallengeMethod) } + if m.login_hint != nil { + fields = append(fields, authrequest.FieldLoginHint) + } return fields } @@ -2125,6 +2165,8 @@ func (m *AuthRequestMutation) Field(name string) (ent.Value, bool) { return m.CodeChallenge() case authrequest.FieldCodeChallengeMethod: return m.CodeChallengeMethod() + case authrequest.FieldLoginHint: + return m.LoginHint() } return nil, false } @@ -2172,6 +2214,8 @@ func (m *AuthRequestMutation) OldField(ctx context.Context, name string) (ent.Va return m.OldCodeChallenge(ctx) case authrequest.FieldCodeChallengeMethod: return m.OldCodeChallengeMethod(ctx) + case authrequest.FieldLoginHint: + return m.OldLoginHint(ctx) } return nil, fmt.Errorf("unknown AuthRequest field %s", name) } @@ -2314,6 +2358,13 @@ func (m *AuthRequestMutation) SetField(name string, value ent.Value) error { } m.SetCodeChallengeMethod(v) return nil + case authrequest.FieldLoginHint: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetLoginHint(v) + return nil } return fmt.Errorf("unknown AuthRequest field %s", name) } @@ -2447,6 +2498,9 @@ func (m *AuthRequestMutation) ResetField(name string) error { case authrequest.FieldCodeChallengeMethod: m.ResetCodeChallengeMethod() return nil + case authrequest.FieldLoginHint: + m.ResetLoginHint() + return nil } return fmt.Errorf("unknown AuthRequest field %s", name) } diff --git a/storage/ent/db/runtime.go b/storage/ent/db/runtime.go index 49f4157ac0..0566e0fef6 100644 --- a/storage/ent/db/runtime.go +++ b/storage/ent/db/runtime.go @@ -82,6 +82,10 @@ func init() { authrequestDescCodeChallengeMethod := authrequestFields[19].Descriptor() // authrequest.DefaultCodeChallengeMethod holds the default value on creation for the code_challenge_method field. authrequest.DefaultCodeChallengeMethod = authrequestDescCodeChallengeMethod.Default.(string) + // authrequestDescLoginHint is the schema descriptor for login_hint field. + authrequestDescLoginHint := authrequestFields[20].Descriptor() + // authrequest.DefaultLoginHint holds the default value on creation for the login_hint field. + authrequest.DefaultLoginHint = authrequestDescLoginHint.Default.(string) // authrequestDescID is the schema descriptor for id field. authrequestDescID := authrequestFields[0].Descriptor() // authrequest.IDValidator is a validator for the "id" field. It is called by the builders before save. diff --git a/storage/ent/schema/authrequest.go b/storage/ent/schema/authrequest.go index a16fe55180..7af677c8cc 100644 --- a/storage/ent/schema/authrequest.go +++ b/storage/ent/schema/authrequest.go @@ -85,6 +85,9 @@ func (AuthRequest) Fields() []ent.Field { field.Text("code_challenge_method"). SchemaType(textSchema). Default(""), + field.Text("login_hint"). + SchemaType(textSchema). + Default(""), } } diff --git a/storage/sql/crud.go b/storage/sql/crud.go index 5a234f9deb..009c2f914a 100644 --- a/storage/sql/crud.go +++ b/storage/sql/crud.go @@ -131,10 +131,11 @@ func (c *conn) CreateAuthRequest(a storage.AuthRequest) error { claims_email, claims_email_verified, claims_groups, connector_id, connector_data, expiry, - code_challenge, code_challenge_method + code_challenge, code_challenge_method, + login_hint ) values ( - $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20 + $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21 ); `, a.ID, a.ClientID, encoder(a.ResponseTypes), encoder(a.Scopes), a.RedirectURI, a.Nonce, a.State, @@ -144,6 +145,7 @@ func (c *conn) CreateAuthRequest(a storage.AuthRequest) error { a.ConnectorID, a.ConnectorData, a.Expiry, a.PKCE.CodeChallenge, a.PKCE.CodeChallengeMethod, + a.LoginHint, ) if err != nil { if c.alreadyExistsCheck(err) { @@ -175,8 +177,9 @@ func (c *conn) UpdateAuthRequest(id string, updater func(a storage.AuthRequest) claims_groups = $14, connector_id = $15, connector_data = $16, expiry = $17, - code_challenge = $18, code_challenge_method = $19 - where id = $20; + code_challenge = $18, code_challenge_method = $19, + login_hint = $20 + where id = $21; `, a.ClientID, encoder(a.ResponseTypes), encoder(a.Scopes), a.RedirectURI, a.Nonce, a.State, a.ForceApprovalPrompt, a.LoggedIn, @@ -186,6 +189,7 @@ func (c *conn) UpdateAuthRequest(id string, updater func(a storage.AuthRequest) a.ConnectorID, a.ConnectorData, a.Expiry, a.PKCE.CodeChallenge, a.PKCE.CodeChallengeMethod, + a.LoginHint, r.ID, ) if err != nil { @@ -207,7 +211,7 @@ func getAuthRequest(q querier, id string) (a storage.AuthRequest, err error) { claims_user_id, claims_username, claims_preferred_username, claims_email, claims_email_verified, claims_groups, connector_id, connector_data, expiry, - code_challenge, code_challenge_method + code_challenge, code_challenge_method, login_hint from auth_request where id = $1; `, id).Scan( &a.ID, &a.ClientID, decoder(&a.ResponseTypes), decoder(&a.Scopes), &a.RedirectURI, &a.Nonce, &a.State, @@ -216,7 +220,7 @@ func getAuthRequest(q querier, id string) (a storage.AuthRequest, err error) { &a.Claims.Email, &a.Claims.EmailVerified, decoder(&a.Claims.Groups), &a.ConnectorID, &a.ConnectorData, &a.Expiry, - &a.PKCE.CodeChallenge, &a.PKCE.CodeChallengeMethod, + &a.PKCE.CodeChallenge, &a.PKCE.CodeChallengeMethod, &a.LoginHint, ) if err != nil { if err == sql.ErrNoRows { diff --git a/storage/sql/migrate.go b/storage/sql/migrate.go index 498db25276..db48a68f9e 100644 --- a/storage/sql/migrate.go +++ b/storage/sql/migrate.go @@ -281,4 +281,11 @@ var migrations = []migration{ add column obsolete_token text default '';`, }, }, + { + stmts: []string{ + ` + alter table auth_request + add column login_hint text not null default '';`, + }, + }, } diff --git a/storage/storage.go b/storage/storage.go index cdd83ca6ea..4de9f1f55a 100644 --- a/storage/storage.go +++ b/storage/storage.go @@ -199,6 +199,7 @@ type AuthRequest struct { RedirectURI string Nonce string State string + LoginHint string // The client has indicated that the end user must be shown an approval prompt // on all requests. The server cannot cache their initial action for subsequent From 1efa47174919f872be7abfcf90f51d2ec85db20a Mon Sep 17 00:00:00 2001 From: Armaan Varadaraj Date: Tue, 12 Oct 2021 10:21:38 -0700 Subject: [PATCH 04/29] add offline_access scope to oidc connector --- connector/oidc/oidc.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/connector/oidc/oidc.go b/connector/oidc/oidc.go index ec00814b19..1a0e5cb38b 100644 --- a/connector/oidc/oidc.go +++ b/connector/oidc/oidc.go @@ -130,6 +130,8 @@ func (c *Config) Open(id string, logger log.Logger) (conn connector.Connector, e scopes = append(scopes, "profile", "email") } + scopes = append(scopes, "offline_access") + // PromptType should be "consent" by default, if not set if c.PromptType == "" { c.PromptType = "consent" From f73bd86bbf4c6ffda696476a825aa15ce14438dd Mon Sep 17 00:00:00 2001 From: Armaan Varadaraj Date: Tue, 12 Oct 2021 16:00:25 -0700 Subject: [PATCH 05/29] add some logging --- connector/oidc/oidc.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/connector/oidc/oidc.go b/connector/oidc/oidc.go index 1a0e5cb38b..80d74ea2b6 100644 --- a/connector/oidc/oidc.go +++ b/connector/oidc/oidc.go @@ -273,6 +273,7 @@ func (c *oidcConnector) Refresh(ctx context.Context, s connector.Scopes, identit } token, err := c.oauth2Config.TokenSource(ctx, t).Token() if err != nil { + c.logger.Error("sent refresh token %s", t.RefreshToken) return identity, fmt.Errorf("oidc: failed to get refresh token: %v", err) } @@ -383,6 +384,8 @@ func (c *oidcConnector) createIdentity(ctx context.Context, identity connector.I } } + c.logger.Error("got id token %s", token.Extra("id_token").(string)) + c.logger.Error("got refresh token %s", token.RefreshToken) cd := connectorData{ RefreshToken: []byte(token.RefreshToken), } From 2060aa2debe90c72d38db0dd5f01f076ca47304c Mon Sep 17 00:00:00 2001 From: Armaan Varadaraj Date: Tue, 12 Oct 2021 18:20:46 -0700 Subject: [PATCH 06/29] dont refresh with connector --- server/refreshhandlers.go | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/server/refreshhandlers.go b/server/refreshhandlers.go index 8ea7ea9ef1..eb1fb72ac2 100644 --- a/server/refreshhandlers.go +++ b/server/refreshhandlers.go @@ -170,26 +170,6 @@ func (s *Server) refreshWithConnector(ctx context.Context, token *internal.Refre ConnectorData: connectorData, } - // user's token was previously updated by a connector and is allowed to reuse - // it is excessive to refresh identity in upstream - if s.refreshTokenPolicy.AllowedToReuse(refresh.LastUsed) && token.Token == refresh.ObsoleteToken { - return ident, nil - } - - // Can the connector refresh the identity? If so, attempt to refresh the data - // in the connector. - // - // TODO(ericchiang): We may want a strict mode where connectors that don't implement - // this interface can't perform refreshing. - if refreshConn, ok := conn.Connector.(connector.RefreshConnector); ok { - newIdent, err := refreshConn.Refresh(ctx, parseScopes(scopes), ident) - if err != nil { - s.logger.Errorf("failed to refresh identity: %v", err) - return connector.Identity{}, newInternalServerError() - } - ident = newIdent - } - return ident, nil } From 825fea71e695c4cb2d924920c5a114151f7177a4 Mon Sep 17 00:00:00 2001 From: Armaan Varadaraj Date: Tue, 12 Oct 2021 18:27:34 -0700 Subject: [PATCH 07/29] lint --- server/refreshhandlers.go | 6 ------ 1 file changed, 6 deletions(-) diff --git a/server/refreshhandlers.go b/server/refreshhandlers.go index eb1fb72ac2..7fef35975f 100644 --- a/server/refreshhandlers.go +++ b/server/refreshhandlers.go @@ -154,12 +154,6 @@ func (s *Server) refreshWithConnector(ctx context.Context, token *internal.Refre connectorData = session.ConnectorData } - conn, err := s.getConnector(refresh.ConnectorID) - if err != nil { - s.logger.Errorf("connector with ID %q not found: %v", refresh.ConnectorID, err) - return connector.Identity{}, newInternalServerError() - } - ident := connector.Identity{ UserID: refresh.Claims.UserID, Username: refresh.Claims.Username, From 31634c5ecc5fff17c620a6f7dce9b8dde2ecb14f Mon Sep 17 00:00:00 2001 From: Armaan Varadaraj Date: Mon, 18 Oct 2021 09:32:44 -0700 Subject: [PATCH 08/29] remove offline acess type --- connector/oidc/oidc.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/connector/oidc/oidc.go b/connector/oidc/oidc.go index 80d74ea2b6..86364c350c 100644 --- a/connector/oidc/oidc.go +++ b/connector/oidc/oidc.go @@ -213,10 +213,6 @@ func (c *oidcConnector) LoginURL(s connector.Scopes, callbackURL, state string, opts = append(opts, oauth2.SetAuthURLParam("hd", preferredDomain)) } - if s.OfflineAccess { - opts = append(opts, oauth2.AccessTypeOffline, oauth2.SetAuthURLParam("prompt", c.promptType)) - } - for p := range forwardParams { paramApproved := false for _, approvedParam := range c.forwardedLoginParams { From 3f72bb841e639abc7313d9494bbe5b0879078c8d Mon Sep 17 00:00:00 2001 From: Armaan Varadaraj Date: Mon, 18 Oct 2021 10:09:18 -0700 Subject: [PATCH 09/29] Revert "lint" This reverts commit 825fea71e695c4cb2d924920c5a114151f7177a4. --- server/refreshhandlers.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/server/refreshhandlers.go b/server/refreshhandlers.go index 7fef35975f..eb1fb72ac2 100644 --- a/server/refreshhandlers.go +++ b/server/refreshhandlers.go @@ -154,6 +154,12 @@ func (s *Server) refreshWithConnector(ctx context.Context, token *internal.Refre connectorData = session.ConnectorData } + conn, err := s.getConnector(refresh.ConnectorID) + if err != nil { + s.logger.Errorf("connector with ID %q not found: %v", refresh.ConnectorID, err) + return connector.Identity{}, newInternalServerError() + } + ident := connector.Identity{ UserID: refresh.Claims.UserID, Username: refresh.Claims.Username, From 6981cae1f7f10b9dcf205fe34bccd9e474ca0540 Mon Sep 17 00:00:00 2001 From: Armaan Varadaraj Date: Mon, 18 Oct 2021 10:09:26 -0700 Subject: [PATCH 10/29] Revert "dont refresh with connector" This reverts commit 2060aa2debe90c72d38db0dd5f01f076ca47304c. --- server/refreshhandlers.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/server/refreshhandlers.go b/server/refreshhandlers.go index eb1fb72ac2..8ea7ea9ef1 100644 --- a/server/refreshhandlers.go +++ b/server/refreshhandlers.go @@ -170,6 +170,26 @@ func (s *Server) refreshWithConnector(ctx context.Context, token *internal.Refre ConnectorData: connectorData, } + // user's token was previously updated by a connector and is allowed to reuse + // it is excessive to refresh identity in upstream + if s.refreshTokenPolicy.AllowedToReuse(refresh.LastUsed) && token.Token == refresh.ObsoleteToken { + return ident, nil + } + + // Can the connector refresh the identity? If so, attempt to refresh the data + // in the connector. + // + // TODO(ericchiang): We may want a strict mode where connectors that don't implement + // this interface can't perform refreshing. + if refreshConn, ok := conn.Connector.(connector.RefreshConnector); ok { + newIdent, err := refreshConn.Refresh(ctx, parseScopes(scopes), ident) + if err != nil { + s.logger.Errorf("failed to refresh identity: %v", err) + return connector.Identity{}, newInternalServerError() + } + ident = newIdent + } + return ident, nil } From 37923ca5568e1c994eb234ca97865e4b85327d76 Mon Sep 17 00:00:00 2001 From: Armaan Varadaraj Date: Wed, 20 Oct 2021 11:53:47 -0700 Subject: [PATCH 11/29] remove token logs --- connector/oidc/oidc.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/connector/oidc/oidc.go b/connector/oidc/oidc.go index 86364c350c..af372b08ff 100644 --- a/connector/oidc/oidc.go +++ b/connector/oidc/oidc.go @@ -269,7 +269,6 @@ func (c *oidcConnector) Refresh(ctx context.Context, s connector.Scopes, identit } token, err := c.oauth2Config.TokenSource(ctx, t).Token() if err != nil { - c.logger.Error("sent refresh token %s", t.RefreshToken) return identity, fmt.Errorf("oidc: failed to get refresh token: %v", err) } @@ -380,8 +379,6 @@ func (c *oidcConnector) createIdentity(ctx context.Context, identity connector.I } } - c.logger.Error("got id token %s", token.Extra("id_token").(string)) - c.logger.Error("got refresh token %s", token.RefreshToken) cd := connectorData{ RefreshToken: []byte(token.RefreshToken), } From f7cfc0b07e5f1b87eaaa9e51bd61b9b5bb49c5a2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 9 Nov 2021 10:18:48 +0000 Subject: [PATCH 12/29] build(deps): bump golang from 1.16.5-alpine3.13 to 1.17.3-alpine3.13 Bumps golang from 1.16.5-alpine3.13 to 1.17.3-alpine3.13. --- updated-dependencies: - dependency-name: golang dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 71bc06035d..b0cee50f52 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.16.5-alpine3.13 AS builder +FROM golang:1.17.3-alpine3.13 AS builder WORKDIR /usr/local/src/dex From 12cd7b320b84df97e01012e57e8a5f85df855bdf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 Jan 2022 10:19:47 +0000 Subject: [PATCH 13/29] build(deps): bump github.com/mattn/go-sqlite3 Bumps [github.com/mattn/go-sqlite3](https://github.com/mattn/go-sqlite3) from 1.14.7 to 2.0.3+incompatible. - [Release notes](https://github.com/mattn/go-sqlite3/releases) - [Commits](https://github.com/mattn/go-sqlite3/compare/v1.14.7...v2.0.3) --- updated-dependencies: - dependency-name: github.com/mattn/go-sqlite3 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 8df5d1d0bd..88e9760649 100644 --- a/go.mod +++ b/go.mod @@ -19,7 +19,7 @@ require ( github.com/kylelemons/godebug v1.1.0 github.com/lib/pq v1.10.2 github.com/mattermost/xml-roundtrip-validator v0.1.0 - github.com/mattn/go-sqlite3 v1.14.7 + github.com/mattn/go-sqlite3 v2.0.3+incompatible github.com/oklog/run v1.1.0 github.com/pkg/errors v0.9.1 github.com/prometheus/client_golang v1.11.0 diff --git a/go.sum b/go.sum index ae4a82281e..4b68b7308a 100644 --- a/go.sum +++ b/go.sum @@ -293,8 +293,8 @@ github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaO 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.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= -github.com/mattn/go-sqlite3 v1.14.7 h1:fxWBnXkxfM6sRiuH3bqJ4CfzZojMOLVc0UTsTglEghA= -github.com/mattn/go-sqlite3 v1.14.7/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= +github.com/mattn/go-sqlite3 v2.0.3+incompatible h1:gXHsfypPkaMZrKbD5209QV9jbUTJKjyR5WD3HYQSd+U= +github.com/mattn/go-sqlite3 v2.0.3+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= 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= From 9670608df8e36c5e05157c3796e5360636cc8ba2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 2 Mar 2022 10:18:06 +0000 Subject: [PATCH 14/29] build(deps): bump actions/checkout from 2 to 3 Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v2...v3) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/ci.yaml | 2 +- .github/workflows/codeql-analysis.yaml | 2 +- .github/workflows/docker.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8c6ee6c6f0..c57ac77ef1 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -52,7 +52,7 @@ jobs: go-version: 1.16 - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Start services run: docker-compose -f docker-compose.test.yaml up -d diff --git a/.github/workflows/codeql-analysis.yaml b/.github/workflows/codeql-analysis.yaml index 0c0b47c94e..fc04e54249 100644 --- a/.github/workflows/codeql-analysis.yaml +++ b/.github/workflows/codeql-analysis.yaml @@ -35,7 +35,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 26c7a334de..0b4ad6a327 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -15,7 +15,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Calculate Docker image tags id: tags From b1ca9c7893e73e61eb23742280f47ee8469443c4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Apr 2022 10:22:28 +0000 Subject: [PATCH 15/29] build(deps): bump actions/setup-go from 2 to 3 Bumps [actions/setup-go](https://github.com/actions/setup-go) from 2 to 3. - [Release notes](https://github.com/actions/setup-go/releases) - [Commits](https://github.com/actions/setup-go/compare/v2...v3) --- updated-dependencies: - dependency-name: actions/setup-go dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8c6ee6c6f0..d9fce68aaa 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -47,7 +47,7 @@ jobs: steps: - name: Set up Go - uses: actions/setup-go@v2 + uses: actions/setup-go@v3 with: go-version: 1.16 From d4e0ce799561499b0d086647b9b9a6a35d8cb935 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 26 Apr 2022 10:31:17 +0000 Subject: [PATCH 16/29] build(deps): bump github/codeql-action from 1 to 2 Bumps [github/codeql-action](https://github.com/github/codeql-action) from 1 to 2. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/v1...v2) --- updated-dependencies: - dependency-name: github/codeql-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/codeql-analysis.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yaml b/.github/workflows/codeql-analysis.yaml index 0c0b47c94e..edf542d570 100644 --- a/.github/workflows/codeql-analysis.yaml +++ b/.github/workflows/codeql-analysis.yaml @@ -39,7 +39,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v1 + uses: github/codeql-action/init@v2 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -50,7 +50,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@v1 + uses: github/codeql-action/autobuild@v2 # ℹ️ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -64,4 +64,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 + uses: github/codeql-action/analyze@v2 From 13ebd9a498151ab6fb52d56d346f047429ed636a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 6 May 2022 10:14:13 +0000 Subject: [PATCH 17/29] build(deps): bump docker/build-push-action from 2 to 3 Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 2 to 3. - [Release notes](https://github.com/docker/build-push-action/releases) - [Commits](https://github.com/docker/build-push-action/compare/v2...v3) --- updated-dependencies: - dependency-name: docker/build-push-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/docker.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 26c7a334de..8f2905dffc 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -72,7 +72,7 @@ jobs: if: github.event_name == 'push' - name: Build and push - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v3 with: context: . platforms: linux/amd64,linux/arm/v7,linux/arm64 From 80d8c5f03864df965fa264eef6da6b200a104281 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 6 May 2022 10:14:15 +0000 Subject: [PATCH 18/29] build(deps): bump docker/login-action from 1 to 2 Bumps [docker/login-action](https://github.com/docker/login-action) from 1 to 2. - [Release notes](https://github.com/docker/login-action/releases) - [Commits](https://github.com/docker/login-action/compare/v1...v2) --- updated-dependencies: - dependency-name: docker/login-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/docker.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 26c7a334de..a4fe27372e 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -57,7 +57,7 @@ jobs: driver-opts: image=moby/buildkit:master - name: Login to GitHub Container Registry - uses: docker/login-action@v1 + uses: docker/login-action@v2 with: registry: ghcr.io username: ${{ github.repository_owner }} @@ -65,7 +65,7 @@ jobs: if: github.event_name == 'push' - name: Login to Docker Hub - uses: docker/login-action@v1 + uses: docker/login-action@v2 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} From ed5adfea8fef567cbc5af08295919d774aa487e4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 24 May 2022 10:28:47 +0000 Subject: [PATCH 19/29] build(deps): bump alpine from 3.14.0 to 3.16.0 Bumps alpine from 3.14.0 to 3.16.0. --- updated-dependencies: - dependency-name: alpine dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 71bc06035d..7e32b5b1e2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,7 +20,7 @@ COPY . . RUN make release-binary -FROM alpine:3.14.0 AS gomplate +FROM alpine:3.16.0 AS gomplate ARG TARGETOS ARG TARGETARCH @@ -33,7 +33,7 @@ RUN wget -O /usr/local/bin/gomplate \ && chmod +x /usr/local/bin/gomplate -FROM alpine:3.14.0 +FROM alpine:3.16.0 # Dex connectors, such as GitHub and Google logins require root certificates. # Proper installations should manage those certificates, but it's a bad user From 62b1ba811852d6a0b10dcc6ee0217dee51a151ad Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 21 Jun 2022 10:18:40 +0000 Subject: [PATCH 20/29] build(deps): bump github.com/spf13/cobra from 1.1.3 to 1.5.0 Bumps [github.com/spf13/cobra](https://github.com/spf13/cobra) from 1.1.3 to 1.5.0. - [Release notes](https://github.com/spf13/cobra/releases) - [Commits](https://github.com/spf13/cobra/compare/v1.1.3...v1.5.0) --- updated-dependencies: - dependency-name: github.com/spf13/cobra dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 8df5d1d0bd..313eb47318 100644 --- a/go.mod +++ b/go.mod @@ -25,7 +25,7 @@ require ( github.com/prometheus/client_golang v1.11.0 github.com/russellhaering/goxmldsig v1.1.0 github.com/sirupsen/logrus v1.8.1 - github.com/spf13/cobra v1.1.3 + github.com/spf13/cobra v1.5.0 github.com/stretchr/testify v1.7.0 go.etcd.io/etcd/client/pkg/v3 v3.5.0 go.etcd.io/etcd/client/v3 v3.5.0 diff --git a/go.sum b/go.sum index ae4a82281e..de7a9a7b2f 100644 --- a/go.sum +++ b/go.sum @@ -98,6 +98,7 @@ github.com/coreos/go-systemd/v22 v22.3.2 h1:D9/bQk5vlXQFZ6Kwuu6zaiXJ9oTPe68++AzA 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.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= 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= @@ -360,6 +361,7 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR github.com/russellhaering/goxmldsig v1.1.0 h1:lK/zeJie2sqG52ZAlPNn1oBBqsIsEKypUUBGpYYF6lk= github.com/russellhaering/goxmldsig v1.1.0/go.mod h1:QK8GhXPB3+AfuCrfo0oRISa9NfzeCpWmxeGnqEpDF9o= 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/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ= @@ -378,8 +380,9 @@ github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B 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/cobra v1.1.3 h1:xghbfqPkxzxP3C/f3n5DdpAbdKLj4ZE4BWQI362l53M= github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSWzOo= +github.com/spf13/cobra v1.5.0 h1:X+jTBEBqF0bHN+9cSMgmfuvv2VHJ9ezmFNf9Y/XstYU= +github.com/spf13/cobra v1.5.0/go.mod h1:dWXEIy2H428czQCjInthrTRUg7yKbok+2Qi/yBIJoUM= 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.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= From 8a4719c6bcf4f0d08373fbcdd8e13d5038fe0a5f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 13 Jul 2022 10:26:57 +0000 Subject: [PATCH 21/29] build(deps): bump google.golang.org/api from 0.49.0 to 0.87.0 Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.49.0 to 0.87.0. - [Release notes](https://github.com/googleapis/google-api-go-client/releases) - [Changelog](https://github.com/googleapis/google-api-go-client/blob/main/CHANGES.md) - [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.49.0...v0.87.0) --- updated-dependencies: - dependency-name: google.golang.org/api dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 10 ++-- go.sum | 175 +++++++++++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 164 insertions(+), 21 deletions(-) diff --git a/go.mod b/go.mod index 8df5d1d0bd..ca648f0c38 100644 --- a/go.mod +++ b/go.mod @@ -30,11 +30,11 @@ require ( go.etcd.io/etcd/client/pkg/v3 v3.5.0 go.etcd.io/etcd/client/v3 v3.5.0 golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2 - golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420 - golang.org/x/oauth2 v0.0.0-20210615190721-d04028783cf1 - google.golang.org/api v0.49.0 - google.golang.org/grpc v1.38.0 - google.golang.org/protobuf v1.27.1 + golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e + golang.org/x/oauth2 v0.0.0-20220622183110-fd043fe589d2 + google.golang.org/api v0.87.0 + google.golang.org/grpc v1.47.0 + google.golang.org/protobuf v1.28.0 gopkg.in/square/go-jose.v2 v2.6.0 ) diff --git a/go.sum b/go.sum index ae4a82281e..cf30c88ef4 100644 --- a/go.sum +++ b/go.sum @@ -19,17 +19,33 @@ cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECH cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8= cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0= cloud.google.com/go v0.83.0/go.mod h1:Z7MJUsANfY0pYPdw0lbnivPx4/vhy/e2FEkSkF7vAVY= -cloud.google.com/go v0.84.0 h1:hVhK90DwCdOAYGME/FJd9vNIZye9HBR6Yy3fu4js3N8= cloud.google.com/go v0.84.0/go.mod h1:RazrYuxIK6Kb7YrzzhPoLmCVzl7Sup4NrbKPg8KHSUM= +cloud.google.com/go v0.87.0/go.mod h1:TpDYlFy7vuLzZMMZ+B6iRiELaY7z/gJPaqbMx6mlWcY= +cloud.google.com/go v0.90.0/go.mod h1:kRX0mNRHe0e2rC6oNakvwQqzyDmg57xJ+SZU1eT2aDQ= +cloud.google.com/go v0.93.3/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+YI= +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/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w99A= +cloud.google.com/go v0.102.0 h1:DAq3r8y4mDgyB/ZPJ9v/5VJNqjgJAxTn6ZYLlUywOu8= +cloud.google.com/go v0.102.0/go.mod h1:oWcCzKlqJ5zgHQt9YsaeTY9KzIvjyy0ArmiBUgpQ+nc= 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= cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= +cloud.google.com/go/compute v0.1.0/go.mod h1:GAesmwr110a34z04OlxYkATPBEfVhkymfTBXtfbBFow= +cloud.google.com/go/compute v1.3.0/go.mod h1:cCZiE1NHEtai4wiufUhW8I8S1JKkAnhnQJWM7YD99wM= +cloud.google.com/go/compute v1.5.0/go.mod h1:9SMHyhJlzhlkJqrPAc839t2BZFTSk6Jdj6mkzQJeu0M= +cloud.google.com/go/compute v1.6.0/go.mod h1:T29tfhtVbq1wvAPo0E3+7vhgmkOYeXjhFvz/FMzPu0s= +cloud.google.com/go/compute v1.6.1/go.mod h1:g85FgpzFvNULZ+S8AYq87axRKuf2Kh7deLqV/jJ3thU= +cloud.google.com/go/compute v1.7.0 h1:v/k9Eueb8aAJ0vZuxKMrgm6kPhCLZU9HxFU+AFDs9Uk= +cloud.google.com/go/compute v1.7.0/go.mod h1:435lt8av5oL9P3fv1OEzSbSUe+ybHXGMPQHHZWZxy9U= 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/iam v0.3.0/go.mod h1:XzJPvDayI+9zsASAFO68Hk07u3z+f+JrT2xXNdp4bnY= 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= @@ -39,6 +55,7 @@ cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0Zeo cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= 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= +cloud.google.com/go/storage v1.22.1/go.mod h1:S8N1cAStu7BOeFfE8KAQzmyyLkK8p/vmRq6kuBTW58Y= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= entgo.io/ent v0.8.0 h1:xirrW//1oda7pp0bz+XssSOv4/C3nmgYQOxjIfljFt8= entgo.io/ent v0.8.0/go.mod h1:KNjsukat/NJi6zJh1utwRadsbGOZsBbAZNDxkW7tMCc= @@ -86,6 +103,12 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= +github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +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-20211001041855-01bcc9b48dfe/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.0.0 h1:/mAA0XMgYJw2Uqm7WKGCsKnjitE/+A0FFbOmiRJm7LQ= @@ -110,6 +133,9 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +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/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= 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= @@ -158,6 +184,7 @@ github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= 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.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= @@ -190,8 +217,10 @@ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= @@ -209,14 +238,26 @@ github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.2.0 h1:qJYtXnJRWmpe7m/3XlyhrsLrEURqHRM2kxzoxXqyUDs= github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= +github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/enterprise-certificate-proxy v0.0.0-20220520183353-fd19c99a87aa/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= +github.com/googleapis/enterprise-certificate-proxy v0.1.0 h1:zO8WHNx/MYiAKJ3d5spxZXZE6KHmIQGQcAzwUzV7qQw= +github.com/googleapis/enterprise-certificate-proxy v0.1.0/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= -github.com/googleapis/gax-go/v2 v2.0.5 h1:sjZBwGj9Jlw33ImPtvFviGYvseOtDM7hkSKB7+Tv3SM= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= +github.com/googleapis/gax-go/v2 v2.1.1/go.mod h1:hddJymUZASv3XPyGkUpKj8pPO47Rmb0eJc8R6ouapiM= +github.com/googleapis/gax-go/v2 v2.2.0/go.mod h1:as02EH8zWkzwUoLbBaFeQ+arQaj/OthfcblKl4IGNaM= +github.com/googleapis/gax-go/v2 v2.3.0/go.mod h1:b8LNqSzNabLiUpXKkY7HAR5jr6bIT99EXz9pXxye9YM= +github.com/googleapis/gax-go/v2 v2.4.0 h1:dS9eYAjhrE2RjmzYw2XAPvcXfmcQLtFEQWn0CR82awk= +github.com/googleapis/gax-go/v2 v2.4.0/go.mod h1:XOTVJ59hdnfJLIP/dh8n5CGryZR2LxK9wbMD5+iXC6c= +github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4= 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= @@ -419,6 +460,7 @@ go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= 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= @@ -514,8 +556,15 @@ golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420 h1:a8jGStKg0XqKDlKqjLrXn0ioF5MH36pT7Z0BRTqLhbk= golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/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/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220412020605-290c469a71a5/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e h1:TsQ7F31D3bUCLeqPT0u+yjp1guoArKaNKmCr22PYgTQ= +golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -528,8 +577,16 @@ golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210615190721-d04028783cf1 h1:x622Z2o4hgCr/4CiKWc51jHVKaWdtVpBNmEI8wI9Qns= -golang.org/x/oauth2 v0.0.0-20210615190721-d04028783cf1/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= +golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= +golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= +golang.org/x/oauth2 v0.0.0-20220608161450-d0670ef3b1eb/go.mod h1:jaDAt6Dkxork7LmZnYtzbRWj0W47D86a3TGe0YHBvmE= +golang.org/x/oauth2 v0.0.0-20220622183110-fd043fe589d2 h1:+jnHzr9VPj32ykQVai5DNahi9+NSp7yYuCsl5eAQtL0= +golang.org/x/oauth2 v0.0.0-20220622183110-fd043fe589d2/go.mod h1:jaDAt6Dkxork7LmZnYtzbRWj0W47D86a3TGe0YHBvmE= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -541,6 +598,7 @@ 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/sync v0.0.0-20220601150217-0de741cfad7f/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= @@ -594,9 +652,28 @@ golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210616094352-59db8d763f22 h1:RqytpXGR1iVNX7psjB3ff8y7sNFinVFvkx1c8SjBkio= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/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-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/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220502124256-b6088ccd6cba/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220610221304-9f5ed59c137d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220624220833-87e55d714810 h1:rHZQSjJdAI4Xf5Qzeh2bBc5YJIkPFVM6oDtMFYmgws0= +golang.org/x/sys v0.0.0-20220624220833-87e55d714810/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -604,8 +681,9 @@ golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= +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= @@ -664,11 +742,16 @@ golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= +golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f h1:uF6paiQQebLeSXkrTqHqz0MXhXXS1KgF41eUdBNvxK0= +golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= @@ -692,8 +775,24 @@ google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBz google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= google.golang.org/api v0.47.0/go.mod h1:Wbvgpq1HddcWVtzsVLyfLp8lDg6AA241LmgIL59tHXo= google.golang.org/api v0.48.0/go.mod h1:71Pr1vy+TAZRPkPs/xlCf5SsU8WjuAWv1Pfjbtukyy4= -google.golang.org/api v0.49.0 h1:gjIBDxlTG7vnzMmEnYwTnvLTF8Rjzo+ETCgEX1YZ/fY= -google.golang.org/api v0.49.0/go.mod h1:BECiH72wsfwUvOVn3+btPD5WHi0LzavZReBndi42L18= +google.golang.org/api v0.50.0/go.mod h1:4bNT5pAuq5ji4SRZm+5QIkjny9JAyVD/3gaSihNefaw= +google.golang.org/api v0.51.0/go.mod h1:t4HdrdoNgyN5cbEfm7Lum0lcLDLiise1F8qDKX00sOU= +google.golang.org/api v0.54.0/go.mod h1:7C4bFFOvVDGXjfDTAsgGwDgAxRDeQ4X8NvUedIt6z3k= +google.golang.org/api v0.55.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= +google.golang.org/api v0.56.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= +google.golang.org/api v0.57.0/go.mod h1:dVPlbZyBo2/OjBpmvNdpn2GRm6rPy75jyU7bmhdrMgI= +google.golang.org/api v0.61.0/go.mod h1:xQRti5UdCmoCEqFxcz93fTl338AVqDgyaDRuOZ3hg9I= +google.golang.org/api v0.63.0/go.mod h1:gs4ij2ffTRXwuzzgJl/56BdwJaA194ijkfn++9tDuPo= +google.golang.org/api v0.67.0/go.mod h1:ShHKP8E60yPsKNw/w8w+VYaj9H6buA5UqDp8dhbQZ6g= +google.golang.org/api v0.70.0/go.mod h1:Bs4ZM2HGifEvXwd50TtW70ovgJffJYw2oRCOFU/SkfA= +google.golang.org/api v0.71.0/go.mod h1:4PyU6e6JogV1f9eA4voyrTY2batOLdgZ5qZ5HOCc4j8= +google.golang.org/api v0.74.0/go.mod h1:ZpfMZOVRMywNyvJFeqL9HRWBgAuRfSjJFpe9QtRRyDs= +google.golang.org/api v0.75.0/go.mod h1:pU9QmyHLnzlpar1Mjt4IbapUCy8J+6HD6GeELN69ljA= +google.golang.org/api v0.78.0/go.mod h1:1Sg78yoMLOhlQTeF+ARBoytAcH1NNyyl390YMy6rKmw= +google.golang.org/api v0.80.0/go.mod h1:xY3nI94gbvBrE0J6NHXhxOmW97HG7Khjkku6AFB3Hyg= +google.golang.org/api v0.84.0/go.mod h1:NTsGnUFJMYROtiquksZHBWtHfeMC7iYthki7Eq3pa8o= +google.golang.org/api v0.87.0 h1:pUQVF/F+X7Tl1lo4LJoJf5BOpjtmINU80p9XpYTU2p4= +google.golang.org/api v0.87.0/go.mod h1:+Sem1dnrKlrXMR/X0bPnMWyluQe4RsNoYfmNLhOIkzw= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -741,13 +840,47 @@ google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210329143202-679c6ae281ee/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20210617175327-b9e0b3197ced h1:c5geK1iMU3cDKtFrCVQIcjR3W+JOZMuhIyICMCTbtus= -google.golang.org/genproto v0.0.0-20210617175327-b9e0b3197ced/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= +google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= +google.golang.org/genproto v0.0.0-20210713002101-d411969a0d9a/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k= +google.golang.org/genproto v0.0.0-20210716133855-ce7ef5c701ea/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k= +google.golang.org/genproto v0.0.0-20210728212813-7823e685a01f/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= +google.golang.org/genproto v0.0.0-20210805201207-89edb61ffb67/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= +google.golang.org/genproto v0.0.0-20210813162853-db860fec028c/go.mod h1:cFeNkxwySK631ADgubI+/XFU/xp8FD5KIVV4rj8UC5w= +google.golang.org/genproto v0.0.0-20210821163610-241b8fcbd6c8/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211206160659-862468c7d6e0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +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-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= +google.golang.org/genproto v0.0.0-20220310185008-1973136f34c6/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= +google.golang.org/genproto v0.0.0-20220324131243-acbaeb5b85eb/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= +google.golang.org/genproto v0.0.0-20220407144326-9054f6ed7bac/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= +google.golang.org/genproto v0.0.0-20220413183235-5e96e2839df9/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= +google.golang.org/genproto v0.0.0-20220414192740-2d67ff6cf2b4/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= +google.golang.org/genproto v0.0.0-20220421151946-72621c1f0bd3/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= +google.golang.org/genproto v0.0.0-20220429170224-98d788798c3e/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= +google.golang.org/genproto v0.0.0-20220505152158-f39f71e6c8f3/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= +google.golang.org/genproto v0.0.0-20220518221133-4f43b3371335/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= +google.golang.org/genproto v0.0.0-20220523171625-347a074981d8/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= +google.golang.org/genproto v0.0.0-20220608133413-ed9918b62aac/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= +google.golang.org/genproto v0.0.0-20220616135557-88e70c0c3a90/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= +google.golang.org/genproto v0.0.0-20220624142145-8cd45d7dbd1f h1:hJ/Y5SqPXbarffmAsApliUlcvMU+wScNGfyop4bZm8o= +google.golang.org/genproto v0.0.0-20220624142145-8cd45d7dbd1f/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -769,8 +902,17 @@ google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAG google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= google.golang.org/grpc v1.37.1/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc v1.38.0 h1:/9BgsAsa5nWe26HqOlvlgJnqBuktYOLCgjCPqsa56W0= google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= +google.golang.org/grpc v1.39.1/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= +google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +google.golang.org/grpc v1.40.1/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= +google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.47.0 h1:9n77onPX5F3qfFCqjy9dhn8PbNQsIKeVU04J9G7umt8= +google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= @@ -784,8 +926,9 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= +google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= From 888209abb420f52713a5ffc84e3427896a0e0a42 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 13 Jul 2022 10:27:13 +0000 Subject: [PATCH 22/29] build(deps): bump google.golang.org/grpc from 1.38.0 to 1.48.0 Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.38.0 to 1.48.0. - [Release notes](https://github.com/grpc/grpc-go/releases) - [Commits](https://github.com/grpc/grpc-go/compare/v1.38.0...v1.48.0) --- updated-dependencies: - dependency-name: google.golang.org/grpc dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 8df5d1d0bd..6c3940c660 100644 --- a/go.mod +++ b/go.mod @@ -33,7 +33,7 @@ require ( golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420 golang.org/x/oauth2 v0.0.0-20210615190721-d04028783cf1 google.golang.org/api v0.49.0 - google.golang.org/grpc v1.38.0 + google.golang.org/grpc v1.48.0 google.golang.org/protobuf v1.27.1 gopkg.in/square/go-jose.v2 v2.6.0 ) diff --git a/go.sum b/go.sum index ae4a82281e..9f5001666c 100644 --- a/go.sum +++ b/go.sum @@ -86,6 +86,10 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= +github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/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.0.0 h1:/mAA0XMgYJw2Uqm7WKGCsKnjitE/+A0FFbOmiRJm7LQ= @@ -110,6 +114,7 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= 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= @@ -419,6 +424,7 @@ go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= 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= @@ -769,8 +775,9 @@ google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAG google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= google.golang.org/grpc v1.37.1/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc v1.38.0 h1:/9BgsAsa5nWe26HqOlvlgJnqBuktYOLCgjCPqsa56W0= google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/grpc v1.48.0 h1:rQOsyJ/8+ufEDJd/Gdsz7HG220Mh9HAhFHRGnIjda0w= +google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= From 39241b962284592fe2028dc4bbc9d25b4f514eef Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 14 Jul 2022 10:20:08 +0000 Subject: [PATCH 23/29] build(deps): bump entgo.io/ent from 0.8.0 to 0.11.1 Bumps [entgo.io/ent](https://github.com/ent/ent) from 0.8.0 to 0.11.1. - [Release notes](https://github.com/ent/ent/releases) - [Commits](https://github.com/ent/ent/compare/v0.8.0...v0.11.1) --- updated-dependencies: - dependency-name: entgo.io/ent dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 12 ++-- go.sum | 189 ++++++++++++++++++++------------------------------------- 2 files changed, 71 insertions(+), 130 deletions(-) diff --git a/go.mod b/go.mod index 8df5d1d0bd..35dcef23c3 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/dexidp/dex go 1.16 require ( - entgo.io/ent v0.8.0 + entgo.io/ent v0.11.1 github.com/AppsFlyer/go-sundheit v0.4.0 github.com/Masterminds/sprig/v3 v3.2.2 github.com/beevik/etree v1.1.0 @@ -17,20 +17,20 @@ require ( github.com/gorilla/mux v1.8.0 github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 github.com/kylelemons/godebug v1.1.0 - github.com/lib/pq v1.10.2 + github.com/lib/pq v1.10.5 github.com/mattermost/xml-roundtrip-validator v0.1.0 - github.com/mattn/go-sqlite3 v1.14.7 + github.com/mattn/go-sqlite3 v1.14.13 github.com/oklog/run v1.1.0 github.com/pkg/errors v0.9.1 github.com/prometheus/client_golang v1.11.0 github.com/russellhaering/goxmldsig v1.1.0 github.com/sirupsen/logrus v1.8.1 - github.com/spf13/cobra v1.1.3 - github.com/stretchr/testify v1.7.0 + github.com/spf13/cobra v1.5.0 + github.com/stretchr/testify v1.7.1-0.20210427113832-6241f9ab9942 go.etcd.io/etcd/client/pkg/v3 v3.5.0 go.etcd.io/etcd/client/v3 v3.5.0 golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2 - golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420 + golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f golang.org/x/oauth2 v0.0.0-20210615190721-d04028783cf1 google.golang.org/api v0.49.0 google.golang.org/grpc v1.38.0 diff --git a/go.sum b/go.sum index ae4a82281e..cfc7a18ee1 100644 --- a/go.sum +++ b/go.sum @@ -1,3 +1,5 @@ +ariga.io/atlas v0.5.0 h1:9HZclkGI/xsW7IqKZLIMfnUJ0Nkgm1X1nysq4SMkKsg= +ariga.io/atlas v0.5.0/go.mod h1:ofVetkJqlaWle3mvYmaS2uyFGFcc7dSq436tmxa/Mzk= 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= @@ -29,7 +31,6 @@ cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4g cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= 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= @@ -40,8 +41,8 @@ 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.8.0 h1:xirrW//1oda7pp0bz+XssSOv4/C3nmgYQOxjIfljFt8= -entgo.io/ent v0.8.0/go.mod h1:KNjsukat/NJi6zJh1utwRadsbGOZsBbAZNDxkW7tMCc= +entgo.io/ent v0.11.1 h1:im67R+2W3Nee2bNS2YnoYz8oAF0Qz4AOlIvKRIAEISY= +entgo.io/ent v0.11.1/go.mod h1:X5b1YfMayrRTgKGO//8IqpL7XJx0uqdeReEkxNpXROA= github.com/AppsFlyer/go-sundheit v0.4.0 h1:7ECd0YWaXJQ9LzdCFrpGxJVeAgXvNarN6uwxrJsh69A= github.com/AppsFlyer/go-sundheit v0.4.0/go.mod h1:iZ8zWMS7idcvmqewf5mEymWWgoOiG/0WD4+aeh+heX4= github.com/Azure/go-ntlmssp v0.0.0-20200615164410-66371956d46c h1:/IBSNwUN8+eKzUzbJPqhK839ygXJ82sde8x3ogr6R28= @@ -56,27 +57,26 @@ github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030I github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= 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 h1:rRmlIsPEEhUTIKQb7T++Nz/A5Q6C9IuX2wFoYVvnCs0= +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/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 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= @@ -86,23 +86,17 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -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.0.0 h1:/mAA0XMgYJw2Uqm7WKGCsKnjitE/+A0FFbOmiRJm7LQ= github.com/coreos/go-oidc/v3 v3.0.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.2/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= @@ -111,18 +105,15 @@ github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5y github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= 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-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= @@ -134,22 +125,23 @@ github.com/go-ldap/ldap/v3 v3.3.0/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 h1:1r7pUrabqp18hOBcwBwiTsbnFeTZHV9eER/QT5JVZxY= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= @@ -158,6 +150,7 @@ github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= 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/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= @@ -212,42 +205,23 @@ github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLe github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.2.0 h1:qJYtXnJRWmpe7m/3XlyhrsLrEURqHRM2kxzoxXqyUDs= -github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= +github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5 h1:sjZBwGj9Jlw33ImPtvFviGYvseOtDM7hkSKB7+Tv3SM= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -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/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= 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/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= @@ -257,20 +231,17 @@ github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH 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.0 h1:J2SLSdy7HgElq8ekSl2Mxh6vrRNFxqbXGenYH2I02Vs= github.com/jonboulle/clockwork v0.2.0/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +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= @@ -279,59 +250,45 @@ github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFB github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= 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.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/lib/pq v1.10.2 h1:AqzbZs4ZoCBp+GtejcpCpcxM3zlSMx29dXbUSeVtJb8= -github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/lib/pq v1.10.5 h1:J+gdV2cUmX7ZqL2B0lFcW0m+egaHC2V3lpO8nWxyYiQ= +github.com/lib/pq v1.10.5/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= 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.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= -github.com/mattn/go-sqlite3 v1.14.7 h1:fxWBnXkxfM6sRiuH3bqJ4CfzZojMOLVc0UTsTglEghA= -github.com/mattn/go-sqlite3 v1.14.7/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= +github.com/mattn/go-sqlite3 v1.14.13 h1:1tj15ngiFfcZzii7yd82foL+ks+ouQcj8j/TPq3fk1I= +github.com/mattn/go-sqlite3 v1.14.13/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/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/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/reflectwalk v1.0.0 h1:9D+8oIskB4VJBN5SFlmc27fSlIBZaov1Wpk/IfikLNY= github.com/mitchellh/reflectwalk v1.0.0/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= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= 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/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 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 h1:HNkLOAEQMIDv/K+04rukrLx6ch7msSRwf3/SASFAGtQ= @@ -341,50 +298,36 @@ 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 h1:iMAkS2TDoNWnKM+Kopnx/8tnEStIfpYA0ur0xQzzhMQ= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= 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 h1:mxy4L2jP6qMonqmq+aTtOx1ifVWUgG/TAmntgbh3xv4= github.com/prometheus/procfs v0.6.0/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/russellhaering/goxmldsig v1.1.0 h1:lK/zeJie2sqG52ZAlPNn1oBBqsIsEKypUUBGpYYF6lk= github.com/russellhaering/goxmldsig v1.1.0/go.mod h1:QK8GhXPB3+AfuCrfo0oRISa9NfzeCpWmxeGnqEpDF9o= -github.com/russross/blackfriday/v2 v2.0.1/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/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +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/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/cobra v1.1.3 h1:xghbfqPkxzxP3C/f3n5DdpAbdKLj4ZE4BWQI362l53M= -github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSWzOo= -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/cobra v1.5.0 h1:X+jTBEBqF0bHN+9cSMgmfuvv2VHJ9ezmFNf9Y/XstYU= +github.com/spf13/cobra v1.5.0/go.mod h1:dWXEIy2H428czQCjInthrTRUg7yKbok+2Qi/yBIJoUM= +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= @@ -394,17 +337,22 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/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/stretchr/testify v1.7.1-0.20210427113832-6241f9ab9942 h1:t0lM6y/M5IiUZyvbBTcngso8SZEZICH7is9B6g/obVU= +github.com/stretchr/testify v1.7.1-0.20210427113832-6241f9ab9942/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +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/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +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.0 h1:GsV3S+OfZEOCNXdtNkBSR7kgLobAa/SO6tCxRa0GAYw= go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= go.etcd.io/etcd/client/pkg/v3 v3.5.0 h1:2aQv6F436YnN7I4VbI8PPYrBhu+SmrTaADcf8Mi/6PU= @@ -419,18 +367,15 @@ go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= 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.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/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/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= 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= @@ -474,12 +419,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= @@ -514,8 +459,9 @@ golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420 h1:a8jGStKg0XqKDlKqjLrXn0ioF5MH36pT7Z0BRTqLhbk= golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f h1:OfiFi4JbukWwe3lzw+xunroH1mnC1e2Gy5cxNJApiSY= +golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -541,17 +487,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= @@ -594,8 +538,10 @@ golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210616094352-59db8d763f22 h1:RqytpXGR1iVNX7psjB3ff8y7sNFinVFvkx1c8SjBkio= golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -604,20 +550,18 @@ golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= +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= @@ -627,7 +571,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= @@ -664,6 +607,7 @@ golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.9-0.20211216111533-8d383106f7e7/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -792,12 +736,9 @@ gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 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= From 36fe38e082220207de5e67fac3add0ee10bfd055 Mon Sep 17 00:00:00 2001 From: "Robert A. Uhl" Date: Fri, 15 Jul 2022 10:20:24 -0400 Subject: [PATCH 24/29] Fix linter, and delint --- Makefile | 8 +++++--- connector/keystone/keystone.go | 3 +-- connector/keystone/keystone_test.go | 8 ++++---- connector/ldap/ldap.go | 3 ++- storage/conformance/jwks.go | 1 - storage/ent/sqlite.go | 1 - storage/kubernetes/storage_test.go | 2 +- storage/sql/crud_test.go | 1 + storage/sql/migrate_test.go | 1 + storage/sql/postgres_test.go | 1 + storage/sql/sqlite.go | 1 + storage/sql/sqlite_test.go | 1 + 12 files changed, 18 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index b0ced741de..36fd381720 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@ export GOBIN=$(PWD)/bin LD_FLAGS="-w -X main.version=$(VERSION)" # Dependency versions -GOLANGCI_VERSION = 1.40.1 +GOLANGCI_VERSION = 1.46.2 PROTOC_VERSION = 3.15.6 PROTOC_GEN_GO_VERSION = 1.26.0 @@ -85,13 +85,15 @@ kind-tests: testall bin/golangci-lint: bin/golangci-lint-${GOLANGCI_VERSION} @ln -sf golangci-lint-${GOLANGCI_VERSION} bin/golangci-lint + bin/golangci-lint-${GOLANGCI_VERSION}: - curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | BINARY=golangci-lint bash -s -- v${GOLANGCI_VERSION} + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b bin v${GOLANGCI_VERSION} + #curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | BINARY=golangci-lint bash -s -- v${GOLANGCI_VERSION} @mv bin/golangci-lint $@ .PHONY: lint lint-fix lint: bin/golangci-lint ## Run linter - bin/golangci-lint run + ./bin/golangci-lint run .PHONY: fix fix: bin/golangci-lint ## Fix lint violations diff --git a/connector/keystone/keystone.go b/connector/keystone/keystone.go index 3750710e74..f9fc200a93 100644 --- a/connector/keystone/keystone.go +++ b/connector/keystone/keystone.go @@ -167,8 +167,7 @@ func (p *conn) Login(ctx context.Context, scopes connector.Scopes, username, pas func (p *conn) Prompt() string { return "username" } -func (p *conn) Refresh( - ctx context.Context, scopes connector.Scopes, identity connector.Identity) (connector.Identity, error) { +func (p *conn) Refresh(ctx context.Context, scopes connector.Scopes, identity connector.Identity) (connector.Identity, error) { token, err := p.getAdminToken(ctx) if err != nil { return identity, fmt.Errorf("keystone: failed to obtain admin token: %v", err) diff --git a/connector/keystone/keystone_test.go b/connector/keystone/keystone_test.go index b138012426..c029650203 100644 --- a/connector/keystone/keystone_test.go +++ b/connector/keystone/keystone_test.go @@ -454,22 +454,22 @@ func setupVariables(t *testing.T) { keystoneAdminPassEnv := "DEX_KEYSTONE_ADMIN_PASS" keystoneURL = os.Getenv(keystoneURLEnv) if keystoneURL == "" { - t.Skip(fmt.Sprintf("variable %q not set, skipping keystone connector tests\n", keystoneURLEnv)) + t.Skipf(fmt.Sprintf("variable %q not set, skipping keystone connector tests\n", keystoneURLEnv)) return } keystoneAdminURL = os.Getenv(keystoneAdminURLEnv) if keystoneAdminURL == "" { - t.Skip(fmt.Sprintf("variable %q not set, skipping keystone connector tests\n", keystoneAdminURLEnv)) + t.Skipf("variable %q not set, skipping keystone connector tests\n", keystoneAdminURLEnv) return } adminUser = os.Getenv(keystoneAdminUserEnv) if adminUser == "" { - t.Skip(fmt.Sprintf("variable %q not set, skipping keystone connector tests\n", keystoneAdminUserEnv)) + t.Skipf("variable %q not set, skipping keystone connector tests\n", keystoneAdminUserEnv) return } adminPass = os.Getenv(keystoneAdminPassEnv) if adminPass == "" { - t.Skip(fmt.Sprintf("variable %q not set, skipping keystone connector tests\n", keystoneAdminPassEnv)) + t.Skipf("variable %q not set, skipping keystone connector tests\n", keystoneAdminPassEnv) return } authTokenURL = keystoneURL + "/v3/auth/tokens/" diff --git a/connector/ldap/ldap.go b/connector/ldap/ldap.go index eaee078d37..58ce5ee7ca 100644 --- a/connector/ldap/ldap.go +++ b/connector/ldap/ldap.go @@ -219,7 +219,8 @@ func (c *Config) OpenConnector(logger log.Logger) (interface { connector.Connector connector.PasswordConnector connector.RefreshConnector -}, error) { +}, error, +) { return c.openConnector(logger) } diff --git a/storage/conformance/jwks.go b/storage/conformance/jwks.go index f42d3d1802..0f05703e1b 100644 --- a/storage/conformance/jwks.go +++ b/storage/conformance/jwks.go @@ -11,7 +11,6 @@ type keyPair struct { // keys are generated beforehand so we don't have to generate RSA keys for every test. var jsonWebKeys = []keyPair{ - { Public: mustLoadJWK(`{ "use": "sig", diff --git a/storage/ent/sqlite.go b/storage/ent/sqlite.go index e6c43cd922..7de35ece5b 100644 --- a/storage/ent/sqlite.go +++ b/storage/ent/sqlite.go @@ -6,7 +6,6 @@ import ( "strings" "entgo.io/ent/dialect/sql" - // Register sqlite driver. _ "github.com/mattn/go-sqlite3" diff --git a/storage/kubernetes/storage_test.go b/storage/kubernetes/storage_test.go index 5033ad06f8..0a64bd5b28 100644 --- a/storage/kubernetes/storage_test.go +++ b/storage/kubernetes/storage_test.go @@ -24,7 +24,7 @@ const kubeconfigPathVariableName = "DEX_KUBERNETES_CONFIG_PATH" func TestStorage(t *testing.T) { if os.Getenv(kubeconfigPathVariableName) == "" { - t.Skip(fmt.Sprintf("variable %q not set, skipping kubernetes storage tests\n", kubeconfigPathVariableName)) + t.Skipf("variable %q not set, skipping kubernetes storage tests\n", kubeconfigPathVariableName) } suite.Run(t, new(StorageTestSuite)) diff --git a/storage/sql/crud_test.go b/storage/sql/crud_test.go index 9e3282e58b..7cca1d6fcd 100644 --- a/storage/sql/crud_test.go +++ b/storage/sql/crud_test.go @@ -1,3 +1,4 @@ +//go:build cgo // +build cgo package sql diff --git a/storage/sql/migrate_test.go b/storage/sql/migrate_test.go index 7ec6d95706..4b77eb2fbe 100644 --- a/storage/sql/migrate_test.go +++ b/storage/sql/migrate_test.go @@ -1,3 +1,4 @@ +//go:build cgo // +build cgo package sql diff --git a/storage/sql/postgres_test.go b/storage/sql/postgres_test.go index d58abc70bf..3e5f8a8f65 100644 --- a/storage/sql/postgres_test.go +++ b/storage/sql/postgres_test.go @@ -1,3 +1,4 @@ +//go:build go1.11 // +build go1.11 package sql diff --git a/storage/sql/sqlite.go b/storage/sql/sqlite.go index faefd89ae3..4bbd53fd6f 100644 --- a/storage/sql/sqlite.go +++ b/storage/sql/sqlite.go @@ -1,3 +1,4 @@ +//go:build cgo // +build cgo package sql diff --git a/storage/sql/sqlite_test.go b/storage/sql/sqlite_test.go index 8be9939041..89d06aee29 100644 --- a/storage/sql/sqlite_test.go +++ b/storage/sql/sqlite_test.go @@ -1,3 +1,4 @@ +//go:build cgo // +build cgo package sql From 465168c961bbc98888c3b2d4f263d4b8f6e9fc51 Mon Sep 17 00:00:00 2001 From: "Robert A. Uhl" Date: Fri, 15 Jul 2022 10:25:57 -0400 Subject: [PATCH 25/29] Update entgo && regenerate files --- go.mod | 16 +- go.sum | 65 ++ storage/ent/db/authcode.go | 54 +- storage/ent/db/authcode/authcode.go | 2 +- storage/ent/db/authcode/where.go | 14 +- storage/ent/db/authcode_create.go | 105 ++- storage/ent/db/authcode_delete.go | 15 +- storage/ent/db/authcode_query.go | 488 ++----------- storage/ent/db/authcode_update.go | 59 +- storage/ent/db/authrequest.go | 70 +- storage/ent/db/authrequest/authrequest.go | 2 +- storage/ent/db/authrequest/where.go | 14 +- storage/ent/db/authrequest_create.go | 99 ++- storage/ent/db/authrequest_delete.go | 15 +- storage/ent/db/authrequest_query.go | 488 ++----------- storage/ent/db/authrequest_update.go | 31 +- storage/ent/db/client.go | 63 +- storage/ent/db/config.go | 2 +- storage/ent/db/connector.go | 19 +- storage/ent/db/connector/connector.go | 2 +- storage/ent/db/connector/where.go | 14 +- storage/ent/db/connector_create.go | 79 ++- storage/ent/db/connector_delete.go | 15 +- storage/ent/db/connector_query.go | 488 ++----------- storage/ent/db/connector_update.go | 39 +- storage/ent/db/context.go | 2 +- storage/ent/db/devicerequest.go | 26 +- storage/ent/db/devicerequest/devicerequest.go | 2 +- storage/ent/db/devicerequest/where.go | 14 +- storage/ent/db/devicerequest_create.go | 82 ++- storage/ent/db/devicerequest_delete.go | 15 +- storage/ent/db/devicerequest_query.go | 488 ++----------- storage/ent/db/devicerequest_update.go | 47 +- storage/ent/db/devicetoken.go | 25 +- storage/ent/db/devicetoken/devicetoken.go | 2 +- storage/ent/db/devicetoken/where.go | 14 +- storage/ent/db/devicetoken_create.go | 78 ++- storage/ent/db/devicetoken_delete.go | 15 +- storage/ent/db/devicetoken_query.go | 488 ++----------- storage/ent/db/devicetoken_update.go | 39 +- storage/ent/db/ent.go | 217 +++++- storage/ent/db/enttest/enttest.go | 20 +- storage/ent/db/hook/hook.go | 2 +- storage/ent/db/keys.go | 24 +- storage/ent/db/keys/keys.go | 2 +- storage/ent/db/keys/where.go | 14 +- storage/ent/db/keys_create.go | 77 +- storage/ent/db/keys_delete.go | 15 +- storage/ent/db/keys_query.go | 488 ++----------- storage/ent/db/keys_update.go | 33 +- storage/ent/db/migrate/migrate.go | 25 +- storage/ent/db/migrate/schema.go | 72 +- storage/ent/db/mutation.go | 661 ++++++++++++------ storage/ent/db/oauth2client.go | 27 +- storage/ent/db/oauth2client/oauth2client.go | 2 +- storage/ent/db/oauth2client/where.go | 14 +- storage/ent/db/oauth2client_create.go | 81 ++- storage/ent/db/oauth2client_delete.go | 15 +- storage/ent/db/oauth2client_query.go | 488 ++----------- storage/ent/db/oauth2client_update.go | 43 +- storage/ent/db/offlinesession.go | 19 +- .../ent/db/offlinesession/offlinesession.go | 2 +- storage/ent/db/offlinesession/where.go | 14 +- storage/ent/db/offlinesession_create.go | 77 +- storage/ent/db/offlinesession_delete.go | 15 +- storage/ent/db/offlinesession_query.go | 488 ++----------- storage/ent/db/offlinesession_update.go | 39 +- storage/ent/db/password.go | 19 +- storage/ent/db/password/password.go | 2 +- storage/ent/db/password/where.go | 14 +- storage/ent/db/password_create.go | 78 ++- storage/ent/db/password_delete.go | 15 +- storage/ent/db/password_query.go | 488 ++----------- storage/ent/db/password_update.go | 43 +- storage/ent/db/predicate/predicate.go | 2 +- storage/ent/db/refreshtoken.go | 54 +- storage/ent/db/refreshtoken/refreshtoken.go | 2 +- storage/ent/db/refreshtoken/where.go | 14 +- storage/ent/db/refreshtoken_create.go | 103 ++- storage/ent/db/refreshtoken_delete.go | 15 +- storage/ent/db/refreshtoken_query.go | 488 ++----------- storage/ent/db/refreshtoken_update.go | 55 +- storage/ent/db/runtime.go | 2 +- storage/ent/db/runtime/runtime.go | 6 +- storage/ent/db/tx.go | 10 +- 85 files changed, 2641 insertions(+), 5338 deletions(-) diff --git a/go.mod b/go.mod index 8df5d1d0bd..866e207220 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/dexidp/dex go 1.16 require ( - entgo.io/ent v0.8.0 + entgo.io/ent v0.11.1 github.com/AppsFlyer/go-sundheit v0.4.0 github.com/Masterminds/sprig/v3 v3.2.2 github.com/beevik/etree v1.1.0 @@ -11,26 +11,30 @@ require ( github.com/dexidp/dex/api/v2 v2.0.0 github.com/felixge/httpsnoop v1.0.2 github.com/ghodss/yaml v1.0.0 + github.com/go-bindata/go-bindata v1.0.1-0.20190711162640-ee3c2418e368 // indirect github.com/go-ldap/ldap/v3 v3.3.0 github.com/go-sql-driver/mysql v1.6.0 github.com/gorilla/handlers v1.5.1 github.com/gorilla/mux v1.8.0 github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 github.com/kylelemons/godebug v1.1.0 - github.com/lib/pq v1.10.2 + github.com/lib/pq v1.10.5 github.com/mattermost/xml-roundtrip-validator v0.1.0 - github.com/mattn/go-sqlite3 v1.14.7 + github.com/mattn/go-sqlite3 v1.14.13 + github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/oklog/run v1.1.0 github.com/pkg/errors v0.9.1 github.com/prometheus/client_golang v1.11.0 github.com/russellhaering/goxmldsig v1.1.0 + github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect github.com/sirupsen/logrus v1.8.1 - github.com/spf13/cobra v1.1.3 - github.com/stretchr/testify v1.7.0 + github.com/spf13/cobra v1.5.0 + github.com/spf13/viper v1.7.0 // indirect + github.com/stretchr/testify v1.7.1-0.20210427113832-6241f9ab9942 go.etcd.io/etcd/client/pkg/v3 v3.5.0 go.etcd.io/etcd/client/v3 v3.5.0 golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2 - golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420 + golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f golang.org/x/oauth2 v0.0.0-20210615190721-d04028783cf1 google.golang.org/api v0.49.0 google.golang.org/grpc v1.38.0 diff --git a/go.sum b/go.sum index ae4a82281e..82a698632b 100644 --- a/go.sum +++ b/go.sum @@ -1,3 +1,5 @@ +ariga.io/atlas v0.5.0 h1:9HZclkGI/xsW7IqKZLIMfnUJ0Nkgm1X1nysq4SMkKsg= +ariga.io/atlas v0.5.0/go.mod h1:ofVetkJqlaWle3mvYmaS2uyFGFcc7dSq436tmxa/Mzk= 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= @@ -42,6 +44,8 @@ cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9 dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= entgo.io/ent v0.8.0 h1:xirrW//1oda7pp0bz+XssSOv4/C3nmgYQOxjIfljFt8= entgo.io/ent v0.8.0/go.mod h1:KNjsukat/NJi6zJh1utwRadsbGOZsBbAZNDxkW7tMCc= +entgo.io/ent v0.11.1 h1:im67R+2W3Nee2bNS2YnoYz8oAF0Qz4AOlIvKRIAEISY= +entgo.io/ent v0.11.1/go.mod h1:X5b1YfMayrRTgKGO//8IqpL7XJx0uqdeReEkxNpXROA= github.com/AppsFlyer/go-sundheit v0.4.0 h1:7ECd0YWaXJQ9LzdCFrpGxJVeAgXvNarN6uwxrJsh69A= github.com/AppsFlyer/go-sundheit v0.4.0/go.mod h1:iZ8zWMS7idcvmqewf5mEymWWgoOiG/0WD4+aeh+heX4= github.com/Azure/go-ntlmssp v0.0.0-20200615164410-66371956d46c h1:/IBSNwUN8+eKzUzbJPqhK839ygXJ82sde8x3ogr6R28= @@ -57,12 +61,19 @@ 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/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3/go.mod h1:oL81AME2rN47vu18xqj1S1jPIPuN7afo62yKTNn3XMM= +github.com/apparentlymart/go-textseg v1.0.0 h1:rRmlIsPEEhUTIKQb7T++Nz/A5Q6C9IuX2wFoYVvnCs0= +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/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= @@ -98,6 +109,8 @@ github.com/coreos/go-systemd/v22 v22.3.2 h1:D9/bQk5vlXQFZ6Kwuu6zaiXJ9oTPe68++AzA 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.2/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= @@ -134,11 +147,13 @@ github.com/go-ldap/ldap/v3 v3.3.0/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/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= @@ -150,6 +165,7 @@ github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4er github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e h1:1r7pUrabqp18hOBcwBwiTsbnFeTZHV9eER/QT5JVZxY= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= @@ -158,6 +174,7 @@ github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= 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/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= @@ -214,6 +231,8 @@ github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.2.0 h1:qJYtXnJRWmpe7m/3XlyhrsLrEURqHRM2kxzoxXqyUDs= github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= +github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5 h1:sjZBwGj9Jlw33ImPtvFviGYvseOtDM7hkSKB7+Tv3SM= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= @@ -223,6 +242,7 @@ github.com/gorilla/handlers v1.5.1/go.mod h1:t8XrUpc4KVXb7HGyJ4/cEnwQiaxrX/hz1Zv 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/gorilla/websocket v1.5.0/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= @@ -243,7 +263,10 @@ github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/b 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 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +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/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= @@ -264,6 +287,7 @@ github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +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= @@ -281,20 +305,26 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +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.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/lib/pq v1.10.2 h1:AqzbZs4ZoCBp+GtejcpCpcxM3zlSMx29dXbUSeVtJb8= github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/lib/pq v1.10.5/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 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= github.com/mattn/go-sqlite3 v1.14.7 h1:fxWBnXkxfM6sRiuH3bqJ4CfzZojMOLVc0UTsTglEghA= github.com/mattn/go-sqlite3 v1.14.7/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= +github.com/mattn/go-sqlite3 v1.14.13 h1:1tj15ngiFfcZzii7yd82foL+ks+ouQcj8j/TPq3fk1I= +github.com/mattn/go-sqlite3 v1.14.13/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= @@ -304,22 +334,27 @@ github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFW 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/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/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/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/reflectwalk v1.0.0 h1:9D+8oIskB4VJBN5SFlmc27fSlIBZaov1Wpk/IfikLNY= github.com/mitchellh/reflectwalk v1.0.0/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= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= 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 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= 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= @@ -360,8 +395,10 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR github.com/russellhaering/goxmldsig v1.1.0 h1:lK/zeJie2sqG52ZAlPNn1oBBqsIsEKypUUBGpYYF6lk= github.com/russellhaering/goxmldsig v1.1.0/go.mod h1:QK8GhXPB3+AfuCrfo0oRISa9NfzeCpWmxeGnqEpDF9o= 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/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/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= @@ -380,7 +417,10 @@ 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/cobra v1.1.3 h1:xghbfqPkxzxP3C/f3n5DdpAbdKLj4ZE4BWQI362l53M= github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSWzOo= +github.com/spf13/cobra v1.5.0 h1:X+jTBEBqF0bHN+9cSMgmfuvv2VHJ9ezmFNf9Y/XstYU= +github.com/spf13/cobra v1.5.0/go.mod h1:dWXEIy2H428czQCjInthrTRUg7yKbok+2Qi/yBIJoUM= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.3/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= @@ -396,14 +436,23 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1-0.20210427113832-6241f9ab9942/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/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/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= 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= +github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +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/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/etcd/api/v3 v3.5.0 h1:GsV3S+OfZEOCNXdtNkBSR7kgLobAa/SO6tCxRa0GAYw= go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= @@ -431,6 +480,7 @@ go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= 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= @@ -473,8 +523,12 @@ golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.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 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo= 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= @@ -516,6 +570,8 @@ 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 h1:a8jGStKg0XqKDlKqjLrXn0ioF5MH36pT7Z0BRTqLhbk= golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f h1:OfiFi4JbukWwe3lzw+xunroH1mnC1e2Gy5cxNJApiSY= +golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -552,6 +608,7 @@ golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7w 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= @@ -596,6 +653,9 @@ golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210616094352-59db8d763f22 h1:RqytpXGR1iVNX7psjB3ff8y7sNFinVFvkx1c8SjBkio= golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -606,6 +666,8 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= +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= @@ -663,7 +725,10 @@ golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.3 h1:L69ShwSZEyCsLKoAxDKeMvLDZkumEe8gXUZAjab0tX8= golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.9-0.20211216111533-8d383106f7e7 h1:M1gcVrIb2lSn2FIL19DG0+/b8nNVKJ7W7b4WcAGZAYM= +golang.org/x/tools v0.1.9-0.20211216111533-8d383106f7e7/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/storage/ent/db/authcode.go b/storage/ent/db/authcode.go index 29b5e4f5b8..6ddbeb57dc 100644 --- a/storage/ent/db/authcode.go +++ b/storage/ent/db/authcode.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package db @@ -90,7 +90,6 @@ func (ac *AuthCode) assignValues(columns []string, values []interface{}) error { ac.ClientID = value.String } case authcode.FieldScopes: - if value, ok := values[i].(*[]byte); !ok { return fmt.Errorf("unexpected type %T for field scopes", values[i]) } else if value != nil && len(*value) > 0 { @@ -135,7 +134,6 @@ func (ac *AuthCode) assignValues(columns []string, values []interface{}) error { ac.ClaimsEmailVerified = value.Bool } case authcode.FieldClaimsGroups: - if value, ok := values[i].(*[]byte); !ok { return fmt.Errorf("unexpected type %T for field claims_groups", values[i]) } else if value != nil && len(*value) > 0 { @@ -194,11 +192,11 @@ func (ac *AuthCode) Update() *AuthCodeUpdateOne { // Unwrap unwraps the AuthCode entity that was returned from a transaction after it was closed, // so that all future queries will be executed through the driver which created the transaction. func (ac *AuthCode) Unwrap() *AuthCode { - tx, ok := ac.config.driver.(*txDriver) + _tx, ok := ac.config.driver.(*txDriver) if !ok { panic("db: AuthCode is not a transactional entity") } - ac.config.driver = tx.drv + ac.config.driver = _tx.drv return ac } @@ -206,38 +204,52 @@ func (ac *AuthCode) Unwrap() *AuthCode { func (ac *AuthCode) String() string { var builder strings.Builder builder.WriteString("AuthCode(") - builder.WriteString(fmt.Sprintf("id=%v", ac.ID)) - builder.WriteString(", client_id=") + builder.WriteString(fmt.Sprintf("id=%v, ", ac.ID)) + builder.WriteString("client_id=") builder.WriteString(ac.ClientID) - builder.WriteString(", scopes=") + builder.WriteString(", ") + builder.WriteString("scopes=") builder.WriteString(fmt.Sprintf("%v", ac.Scopes)) - builder.WriteString(", nonce=") + builder.WriteString(", ") + builder.WriteString("nonce=") builder.WriteString(ac.Nonce) - builder.WriteString(", redirect_uri=") + builder.WriteString(", ") + builder.WriteString("redirect_uri=") builder.WriteString(ac.RedirectURI) - builder.WriteString(", claims_user_id=") + builder.WriteString(", ") + builder.WriteString("claims_user_id=") builder.WriteString(ac.ClaimsUserID) - builder.WriteString(", claims_username=") + builder.WriteString(", ") + builder.WriteString("claims_username=") builder.WriteString(ac.ClaimsUsername) - builder.WriteString(", claims_email=") + builder.WriteString(", ") + builder.WriteString("claims_email=") builder.WriteString(ac.ClaimsEmail) - builder.WriteString(", claims_email_verified=") + builder.WriteString(", ") + builder.WriteString("claims_email_verified=") builder.WriteString(fmt.Sprintf("%v", ac.ClaimsEmailVerified)) - builder.WriteString(", claims_groups=") + builder.WriteString(", ") + builder.WriteString("claims_groups=") builder.WriteString(fmt.Sprintf("%v", ac.ClaimsGroups)) - builder.WriteString(", claims_preferred_username=") + builder.WriteString(", ") + builder.WriteString("claims_preferred_username=") builder.WriteString(ac.ClaimsPreferredUsername) - builder.WriteString(", connector_id=") + builder.WriteString(", ") + builder.WriteString("connector_id=") builder.WriteString(ac.ConnectorID) + builder.WriteString(", ") if v := ac.ConnectorData; v != nil { - builder.WriteString(", connector_data=") + builder.WriteString("connector_data=") builder.WriteString(fmt.Sprintf("%v", *v)) } - builder.WriteString(", expiry=") + builder.WriteString(", ") + builder.WriteString("expiry=") builder.WriteString(ac.Expiry.Format(time.ANSIC)) - builder.WriteString(", code_challenge=") + builder.WriteString(", ") + builder.WriteString("code_challenge=") builder.WriteString(ac.CodeChallenge) - builder.WriteString(", code_challenge_method=") + builder.WriteString(", ") + builder.WriteString("code_challenge_method=") builder.WriteString(ac.CodeChallengeMethod) builder.WriteByte(')') return builder.String() diff --git a/storage/ent/db/authcode/authcode.go b/storage/ent/db/authcode/authcode.go index 3411f15b28..b78eb97027 100644 --- a/storage/ent/db/authcode/authcode.go +++ b/storage/ent/db/authcode/authcode.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package authcode diff --git a/storage/ent/db/authcode/where.go b/storage/ent/db/authcode/where.go index 0b9a37efd7..670a9cd292 100644 --- a/storage/ent/db/authcode/where.go +++ b/storage/ent/db/authcode/where.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package authcode @@ -33,12 +33,6 @@ func IDNEQ(id string) predicate.AuthCode { // IDIn applies the In predicate on the ID field. func IDIn(ids ...string) predicate.AuthCode { return predicate.AuthCode(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(ids) == 0 { - s.Where(sql.False()) - return - } v := make([]interface{}, len(ids)) for i := range v { v[i] = ids[i] @@ -50,12 +44,6 @@ func IDIn(ids ...string) predicate.AuthCode { // IDNotIn applies the NotIn predicate on the ID field. func IDNotIn(ids ...string) predicate.AuthCode { return predicate.AuthCode(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(ids) == 0 { - s.Where(sql.False()) - return - } v := make([]interface{}, len(ids)) for i := range v { v[i] = ids[i] diff --git a/storage/ent/db/authcode_create.go b/storage/ent/db/authcode_create.go index a15e682dd2..c075c3d3fc 100644 --- a/storage/ent/db/authcode_create.go +++ b/storage/ent/db/authcode_create.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package db @@ -167,16 +167,28 @@ func (acc *AuthCodeCreate) Save(ctx context.Context) (*AuthCode, error) { return nil, err } acc.mutation = mutation - node, err = acc.sqlSave(ctx) + if node, err = acc.sqlSave(ctx); err != nil { + return nil, err + } + mutation.id = &node.ID mutation.done = true return node, err }) for i := len(acc.hooks) - 1; i >= 0; i-- { + if acc.hooks[i] == nil { + return nil, fmt.Errorf("db: uninitialized hook (forgotten import db/runtime?)") + } mut = acc.hooks[i](mut) } - if _, err := mut.Mutate(ctx, acc.mutation); err != nil { + v, err := mut.Mutate(ctx, acc.mutation) + if err != nil { return nil, err } + nv, ok := v.(*AuthCode) + if !ok { + return nil, fmt.Errorf("unexpected node type %T returned from AuthCodeMutation", v) + } + node = nv } return node, err } @@ -190,6 +202,19 @@ func (acc *AuthCodeCreate) SaveX(ctx context.Context) *AuthCode { return v } +// Exec executes the query. +func (acc *AuthCodeCreate) Exec(ctx context.Context) error { + _, err := acc.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (acc *AuthCodeCreate) ExecX(ctx context.Context) { + if err := acc.Exec(ctx); err != nil { + panic(err) + } +} + // defaults sets the default values of the builder before save. func (acc *AuthCodeCreate) defaults() { if _, ok := acc.mutation.ClaimsPreferredUsername(); !ok { @@ -209,79 +234,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 @@ -290,11 +315,18 @@ func (acc *AuthCodeCreate) check() error { func (acc *AuthCodeCreate) sqlSave(ctx context.Context) (*AuthCode, error) { _node, _spec := acc.createSpec() if err := sqlgraph.CreateNode(ctx, acc.driver, _spec); err != nil { - if cerr, ok := isSQLConstraintError(err); ok { - err = cerr + if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} } 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 } @@ -465,17 +497,19 @@ func (accb *AuthCodeCreateBulk) Save(ctx context.Context) ([]*AuthCode, error) { if i < len(mutators)-1 { _, err = mutators[i+1].Mutate(root, accb.builders[i+1].mutation) } else { + spec := &sqlgraph.BatchCreateSpec{Nodes: specs} // Invoke the actual operation on the latest mutation in the chain. - if err = sqlgraph.BatchCreate(ctx, accb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil { - if cerr, ok := isSQLConstraintError(err); ok { - err = cerr + if err = sqlgraph.BatchCreate(ctx, accb.driver, spec); err != nil { + if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} } } } - mutation.done = true if err != nil { return nil, err } + mutation.id = &nodes[i].ID + mutation.done = true return nodes[i], nil }) for i := len(builder.hooks) - 1; i >= 0; i-- { @@ -500,3 +534,16 @@ func (accb *AuthCodeCreateBulk) SaveX(ctx context.Context) []*AuthCode { } return v } + +// Exec executes the query. +func (accb *AuthCodeCreateBulk) Exec(ctx context.Context) error { + _, err := accb.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (accb *AuthCodeCreateBulk) ExecX(ctx context.Context) { + if err := accb.Exec(ctx); err != nil { + panic(err) + } +} diff --git a/storage/ent/db/authcode_delete.go b/storage/ent/db/authcode_delete.go index c76007b3aa..3471394ad2 100644 --- a/storage/ent/db/authcode_delete.go +++ b/storage/ent/db/authcode_delete.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package db @@ -20,9 +20,9 @@ type AuthCodeDelete struct { mutation *AuthCodeMutation } -// Where adds a new predicate to the AuthCodeDelete builder. +// Where appends a list predicates to the AuthCodeDelete builder. func (acd *AuthCodeDelete) Where(ps ...predicate.AuthCode) *AuthCodeDelete { - acd.mutation.predicates = append(acd.mutation.predicates, ps...) + acd.mutation.Where(ps...) return acd } @@ -46,6 +46,9 @@ func (acd *AuthCodeDelete) Exec(ctx context.Context) (int, error) { return affected, err }) for i := len(acd.hooks) - 1; i >= 0; i-- { + if acd.hooks[i] == nil { + return 0, fmt.Errorf("db: uninitialized hook (forgotten import db/runtime?)") + } mut = acd.hooks[i](mut) } if _, err := mut.Mutate(ctx, acd.mutation); err != nil { @@ -81,7 +84,11 @@ func (acd *AuthCodeDelete) sqlExec(ctx context.Context) (int, error) { } } } - return sqlgraph.DeleteNodes(ctx, acd.driver, _spec) + affected, err := sqlgraph.DeleteNodes(ctx, acd.driver, _spec) + if err != nil && sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} + } + return affected, err } // AuthCodeDeleteOne is the builder for deleting a single AuthCode entity. diff --git a/storage/ent/db/authcode_query.go b/storage/ent/db/authcode_query.go index 96b6a48504..a82a450686 100644 --- a/storage/ent/db/authcode_query.go +++ b/storage/ent/db/authcode_query.go @@ -1,10 +1,9 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package db import ( "context" - "errors" "fmt" "math" @@ -106,7 +105,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 +132,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 +241,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, } } @@ -263,15 +263,17 @@ func (acq *AuthCodeQuery) Clone() *AuthCodeQuery { // Scan(ctx, &v) // func (acq *AuthCodeQuery) GroupBy(field string, fields ...string) *AuthCodeGroupBy { - group := &AuthCodeGroupBy{config: acq.config} - group.fields = append([]string{field}, fields...) - group.path = func(ctx context.Context) (prev *sql.Selector, err error) { + grbuild := &AuthCodeGroupBy{config: acq.config} + grbuild.fields = append([]string{field}, fields...) + grbuild.path = func(ctx context.Context) (prev *sql.Selector, err error) { if err := acq.prepareQuery(ctx); err != nil { return nil, err } return acq.sqlQuery(ctx), nil } - return group + grbuild.label = authcode.Label + grbuild.flds, grbuild.scan = &grbuild.fields, grbuild.Scan + return grbuild } // Select allows the selection one or more fields/columns for the given query, @@ -287,9 +289,12 @@ func (acq *AuthCodeQuery) GroupBy(field string, fields ...string) *AuthCodeGroup // Select(authcode.FieldClientID). // Scan(ctx, &v) // -func (acq *AuthCodeQuery) Select(field string, fields ...string) *AuthCodeSelect { - acq.fields = append([]string{field}, fields...) - return &AuthCodeSelect{AuthCodeQuery: acq} +func (acq *AuthCodeQuery) Select(fields ...string) *AuthCodeSelect { + acq.fields = append(acq.fields, fields...) + selbuild := &AuthCodeSelect{AuthCodeQuery: acq} + selbuild.label = authcode.Label + selbuild.flds, selbuild.scan = &acq.fields, selbuild.Scan + return selbuild } func (acq *AuthCodeQuery) prepareQuery(ctx context.Context) error { @@ -308,23 +313,22 @@ func (acq *AuthCodeQuery) prepareQuery(ctx context.Context) error { return nil } -func (acq *AuthCodeQuery) sqlAll(ctx context.Context) ([]*AuthCode, error) { +func (acq *AuthCodeQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*AuthCode, error) { var ( nodes = []*AuthCode{} _spec = acq.querySpec() ) _spec.ScanValues = func(columns []string) ([]interface{}, error) { - node := &AuthCode{config: acq.config} - nodes = append(nodes, node) - return node.scanValues(columns) + return (*AuthCode).scanValues(nil, columns) } _spec.Assign = func(columns []string, values []interface{}) error { - if len(nodes) == 0 { - return fmt.Errorf("db: Assign called without calling ScanValues") - } - node := nodes[len(nodes)-1] + node := &AuthCode{config: acq.config} + nodes = append(nodes, node) return node.assignValues(columns, values) } + for i := range hooks { + hooks[i](ctx, _spec) + } if err := sqlgraph.QueryNodes(ctx, acq.driver, _spec); err != nil { return nil, err } @@ -336,6 +340,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) } @@ -398,10 +406,17 @@ func (acq *AuthCodeQuery) querySpec() *sqlgraph.QuerySpec { func (acq *AuthCodeQuery) sqlQuery(ctx context.Context) *sql.Selector { builder := sql.Dialect(acq.driver.Dialect()) t1 := builder.Table(authcode.Table) - selector := builder.Select(t1.Columns(authcode.Columns...)...).From(t1) + columns := acq.fields + if len(columns) == 0 { + columns = authcode.Columns + } + selector := builder.Select(t1.Columns(columns...)...).From(t1) if acq.sql != nil { selector = acq.sql - selector.Select(selector.Columns(authcode.Columns...)...) + selector.Select(selector.Columns(columns...)...) + } + if acq.unique != nil && *acq.unique { + selector.Distinct() } for _, p := range acq.predicates { p(selector) @@ -423,6 +438,7 @@ func (acq *AuthCodeQuery) sqlQuery(ctx context.Context) *sql.Selector { // AuthCodeGroupBy is the group-by builder for AuthCode entities. type AuthCodeGroupBy struct { config + selector fields []string fns []AggregateFunc // intermediate query (i.e. traversal path). @@ -446,209 +462,6 @@ func (acgb *AuthCodeGroupBy) Scan(ctx context.Context, v interface{}) error { return acgb.sqlScan(ctx, v) } -// ScanX is like Scan, but panics if an error occurs. -func (acgb *AuthCodeGroupBy) ScanX(ctx context.Context, v interface{}) { - if err := acgb.Scan(ctx, v); err != nil { - panic(err) - } -} - -// Strings returns list of strings from group-by. -// It is only allowed when executing a group-by query with one field. -func (acgb *AuthCodeGroupBy) Strings(ctx context.Context) ([]string, error) { - if len(acgb.fields) > 1 { - return nil, errors.New("db: AuthCodeGroupBy.Strings is not achievable when grouping more than 1 field") - } - var v []string - if err := acgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// StringsX is like Strings, but panics if an error occurs. -func (acgb *AuthCodeGroupBy) StringsX(ctx context.Context) []string { - v, err := acgb.Strings(ctx) - if err != nil { - panic(err) - } - return v -} - -// String returns a single string from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (acgb *AuthCodeGroupBy) String(ctx context.Context) (_ string, err error) { - var v []string - if v, err = acgb.Strings(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{authcode.Label} - default: - err = fmt.Errorf("db: AuthCodeGroupBy.Strings returned %d results when one was expected", len(v)) - } - return -} - -// StringX is like String, but panics if an error occurs. -func (acgb *AuthCodeGroupBy) StringX(ctx context.Context) string { - v, err := acgb.String(ctx) - if err != nil { - panic(err) - } - return v -} - -// Ints returns list of ints from group-by. -// It is only allowed when executing a group-by query with one field. -func (acgb *AuthCodeGroupBy) Ints(ctx context.Context) ([]int, error) { - if len(acgb.fields) > 1 { - return nil, errors.New("db: AuthCodeGroupBy.Ints is not achievable when grouping more than 1 field") - } - var v []int - if err := acgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// IntsX is like Ints, but panics if an error occurs. -func (acgb *AuthCodeGroupBy) IntsX(ctx context.Context) []int { - v, err := acgb.Ints(ctx) - if err != nil { - panic(err) - } - return v -} - -// Int returns a single int from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (acgb *AuthCodeGroupBy) Int(ctx context.Context) (_ int, err error) { - var v []int - if v, err = acgb.Ints(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{authcode.Label} - default: - err = fmt.Errorf("db: AuthCodeGroupBy.Ints returned %d results when one was expected", len(v)) - } - return -} - -// IntX is like Int, but panics if an error occurs. -func (acgb *AuthCodeGroupBy) IntX(ctx context.Context) int { - v, err := acgb.Int(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64s returns list of float64s from group-by. -// It is only allowed when executing a group-by query with one field. -func (acgb *AuthCodeGroupBy) Float64s(ctx context.Context) ([]float64, error) { - if len(acgb.fields) > 1 { - return nil, errors.New("db: AuthCodeGroupBy.Float64s is not achievable when grouping more than 1 field") - } - var v []float64 - if err := acgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// Float64sX is like Float64s, but panics if an error occurs. -func (acgb *AuthCodeGroupBy) Float64sX(ctx context.Context) []float64 { - v, err := acgb.Float64s(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64 returns a single float64 from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (acgb *AuthCodeGroupBy) Float64(ctx context.Context) (_ float64, err error) { - var v []float64 - if v, err = acgb.Float64s(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{authcode.Label} - default: - err = fmt.Errorf("db: AuthCodeGroupBy.Float64s returned %d results when one was expected", len(v)) - } - return -} - -// Float64X is like Float64, but panics if an error occurs. -func (acgb *AuthCodeGroupBy) Float64X(ctx context.Context) float64 { - v, err := acgb.Float64(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bools returns list of bools from group-by. -// It is only allowed when executing a group-by query with one field. -func (acgb *AuthCodeGroupBy) Bools(ctx context.Context) ([]bool, error) { - if len(acgb.fields) > 1 { - return nil, errors.New("db: AuthCodeGroupBy.Bools is not achievable when grouping more than 1 field") - } - var v []bool - if err := acgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// BoolsX is like Bools, but panics if an error occurs. -func (acgb *AuthCodeGroupBy) BoolsX(ctx context.Context) []bool { - v, err := acgb.Bools(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bool returns a single bool from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (acgb *AuthCodeGroupBy) Bool(ctx context.Context) (_ bool, err error) { - var v []bool - if v, err = acgb.Bools(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{authcode.Label} - default: - err = fmt.Errorf("db: AuthCodeGroupBy.Bools returned %d results when one was expected", len(v)) - } - return -} - -// BoolX is like Bool, but panics if an error occurs. -func (acgb *AuthCodeGroupBy) BoolX(ctx context.Context) bool { - v, err := acgb.Bool(ctx) - if err != nil { - panic(err) - } - return v -} - func (acgb *AuthCodeGroupBy) sqlScan(ctx context.Context, v interface{}) error { for _, f := range acgb.fields { if !authcode.ValidColumn(f) { @@ -669,18 +482,28 @@ func (acgb *AuthCodeGroupBy) sqlScan(ctx context.Context, v interface{}) error { } func (acgb *AuthCodeGroupBy) sqlQuery() *sql.Selector { - selector := acgb.sql - columns := make([]string, 0, len(acgb.fields)+len(acgb.fns)) - columns = append(columns, acgb.fields...) + selector := acgb.sql.Select() + aggregation := make([]string, 0, len(acgb.fns)) for _, fn := range acgb.fns { - columns = append(columns, fn(selector)) + aggregation = append(aggregation, fn(selector)) + } + // If no columns were selected in a custom aggregation function, the default + // selection is the fields used for "group-by", and the aggregation functions. + if len(selector.SelectedColumns()) == 0 { + columns := make([]string, 0, len(acgb.fields)+len(acgb.fns)) + for _, f := range acgb.fields { + columns = append(columns, selector.C(f)) + } + columns = append(columns, aggregation...) + selector.Select(columns...) } - return selector.Select(columns...).GroupBy(acgb.fields...) + return selector.GroupBy(selector.Columns(acgb.fields...)...) } // AuthCodeSelect is the builder for selecting fields of AuthCode entities. type AuthCodeSelect struct { *AuthCodeQuery + selector // intermediate query (i.e. traversal path). sql *sql.Selector } @@ -694,213 +517,12 @@ func (acs *AuthCodeSelect) Scan(ctx context.Context, v interface{}) error { return acs.sqlScan(ctx, v) } -// ScanX is like Scan, but panics if an error occurs. -func (acs *AuthCodeSelect) ScanX(ctx context.Context, v interface{}) { - if err := acs.Scan(ctx, v); err != nil { - panic(err) - } -} - -// Strings returns list of strings from a selector. It is only allowed when selecting one field. -func (acs *AuthCodeSelect) Strings(ctx context.Context) ([]string, error) { - if len(acs.fields) > 1 { - return nil, errors.New("db: AuthCodeSelect.Strings is not achievable when selecting more than 1 field") - } - var v []string - if err := acs.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// StringsX is like Strings, but panics if an error occurs. -func (acs *AuthCodeSelect) StringsX(ctx context.Context) []string { - v, err := acs.Strings(ctx) - if err != nil { - panic(err) - } - return v -} - -// String returns a single string from a selector. It is only allowed when selecting one field. -func (acs *AuthCodeSelect) String(ctx context.Context) (_ string, err error) { - var v []string - if v, err = acs.Strings(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{authcode.Label} - default: - err = fmt.Errorf("db: AuthCodeSelect.Strings returned %d results when one was expected", len(v)) - } - return -} - -// StringX is like String, but panics if an error occurs. -func (acs *AuthCodeSelect) StringX(ctx context.Context) string { - v, err := acs.String(ctx) - if err != nil { - panic(err) - } - return v -} - -// Ints returns list of ints from a selector. It is only allowed when selecting one field. -func (acs *AuthCodeSelect) Ints(ctx context.Context) ([]int, error) { - if len(acs.fields) > 1 { - return nil, errors.New("db: AuthCodeSelect.Ints is not achievable when selecting more than 1 field") - } - var v []int - if err := acs.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// IntsX is like Ints, but panics if an error occurs. -func (acs *AuthCodeSelect) IntsX(ctx context.Context) []int { - v, err := acs.Ints(ctx) - if err != nil { - panic(err) - } - return v -} - -// Int returns a single int from a selector. It is only allowed when selecting one field. -func (acs *AuthCodeSelect) Int(ctx context.Context) (_ int, err error) { - var v []int - if v, err = acs.Ints(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{authcode.Label} - default: - err = fmt.Errorf("db: AuthCodeSelect.Ints returned %d results when one was expected", len(v)) - } - return -} - -// IntX is like Int, but panics if an error occurs. -func (acs *AuthCodeSelect) IntX(ctx context.Context) int { - v, err := acs.Int(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64s returns list of float64s from a selector. It is only allowed when selecting one field. -func (acs *AuthCodeSelect) Float64s(ctx context.Context) ([]float64, error) { - if len(acs.fields) > 1 { - return nil, errors.New("db: AuthCodeSelect.Float64s is not achievable when selecting more than 1 field") - } - var v []float64 - if err := acs.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// Float64sX is like Float64s, but panics if an error occurs. -func (acs *AuthCodeSelect) Float64sX(ctx context.Context) []float64 { - v, err := acs.Float64s(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64 returns a single float64 from a selector. It is only allowed when selecting one field. -func (acs *AuthCodeSelect) Float64(ctx context.Context) (_ float64, err error) { - var v []float64 - if v, err = acs.Float64s(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{authcode.Label} - default: - err = fmt.Errorf("db: AuthCodeSelect.Float64s returned %d results when one was expected", len(v)) - } - return -} - -// Float64X is like Float64, but panics if an error occurs. -func (acs *AuthCodeSelect) Float64X(ctx context.Context) float64 { - v, err := acs.Float64(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bools returns list of bools from a selector. It is only allowed when selecting one field. -func (acs *AuthCodeSelect) Bools(ctx context.Context) ([]bool, error) { - if len(acs.fields) > 1 { - return nil, errors.New("db: AuthCodeSelect.Bools is not achievable when selecting more than 1 field") - } - var v []bool - if err := acs.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// BoolsX is like Bools, but panics if an error occurs. -func (acs *AuthCodeSelect) BoolsX(ctx context.Context) []bool { - v, err := acs.Bools(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bool returns a single bool from a selector. It is only allowed when selecting one field. -func (acs *AuthCodeSelect) Bool(ctx context.Context) (_ bool, err error) { - var v []bool - if v, err = acs.Bools(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{authcode.Label} - default: - err = fmt.Errorf("db: AuthCodeSelect.Bools returned %d results when one was expected", len(v)) - } - return -} - -// BoolX is like Bool, but panics if an error occurs. -func (acs *AuthCodeSelect) BoolX(ctx context.Context) bool { - v, err := acs.Bool(ctx) - if err != nil { - panic(err) - } - return v -} - func (acs *AuthCodeSelect) sqlScan(ctx context.Context, v interface{}) error { rows := &sql.Rows{} - query, args := acs.sqlQuery().Query() + query, args := acs.sql.Query() if err := acs.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() return sql.ScanSlice(rows, v) } - -func (acs *AuthCodeSelect) sqlQuery() sql.Querier { - selector := acs.sql - selector.Select(selector.Columns(acs.fields...)...) - return selector -} diff --git a/storage/ent/db/authcode_update.go b/storage/ent/db/authcode_update.go index 08374bd31d..5d9764bcf4 100644 --- a/storage/ent/db/authcode_update.go +++ b/storage/ent/db/authcode_update.go @@ -1,9 +1,10 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package db import ( "context" + "errors" "fmt" "time" @@ -21,9 +22,9 @@ type AuthCodeUpdate struct { mutation *AuthCodeMutation } -// Where adds a new predicate for the AuthCodeUpdate builder. +// Where appends a list predicates to the AuthCodeUpdate builder. func (acu *AuthCodeUpdate) Where(ps ...predicate.AuthCode) *AuthCodeUpdate { - acu.mutation.predicates = append(acu.mutation.predicates, ps...) + acu.mutation.Where(ps...) return acu } @@ -190,6 +191,9 @@ func (acu *AuthCodeUpdate) Save(ctx context.Context) (int, error) { return affected, err }) for i := len(acu.hooks) - 1; i >= 0; i-- { + if acu.hooks[i] == nil { + return 0, fmt.Errorf("db: uninitialized hook (forgotten import db/runtime?)") + } mut = acu.hooks[i](mut) } if _, err := mut.Mutate(ctx, acu.mutation); err != nil { @@ -225,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 @@ -405,8 +409,8 @@ func (acu *AuthCodeUpdate) sqlSave(ctx context.Context) (n int, err error) { if n, err = sqlgraph.UpdateNodes(ctx, acu.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{authcode.Label} - } else if cerr, ok := isSQLConstraintError(err); ok { - err = cerr + } else if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} } return 0, err } @@ -591,11 +595,20 @@ func (acuo *AuthCodeUpdateOne) Save(ctx context.Context) (*AuthCode, error) { return node, err }) for i := len(acuo.hooks) - 1; i >= 0; i-- { + if acuo.hooks[i] == nil { + return nil, fmt.Errorf("db: uninitialized hook (forgotten import db/runtime?)") + } mut = acuo.hooks[i](mut) } - if _, err := mut.Mutate(ctx, acuo.mutation); err != nil { + v, err := mut.Mutate(ctx, acuo.mutation) + if err != nil { return nil, err } + nv, ok := v.(*AuthCode) + if !ok { + return nil, fmt.Errorf("unexpected node type %T returned from AuthCodeMutation", v) + } + node = nv } return node, err } @@ -626,37 +639,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 @@ -675,7 +688,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 { @@ -826,8 +839,8 @@ func (acuo *AuthCodeUpdateOne) sqlSave(ctx context.Context) (_node *AuthCode, er if err = sqlgraph.UpdateNode(ctx, acuo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{authcode.Label} - } else if cerr, ok := isSQLConstraintError(err); ok { - err = cerr + } else if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } diff --git a/storage/ent/db/authrequest.go b/storage/ent/db/authrequest.go index ad8be7f3b4..2e28faad06 100644 --- a/storage/ent/db/authrequest.go +++ b/storage/ent/db/authrequest.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package db @@ -100,7 +100,6 @@ func (ar *AuthRequest) assignValues(columns []string, values []interface{}) erro ar.ClientID = value.String } case authrequest.FieldScopes: - if value, ok := values[i].(*[]byte); !ok { return fmt.Errorf("unexpected type %T for field scopes", values[i]) } else if value != nil && len(*value) > 0 { @@ -109,7 +108,6 @@ func (ar *AuthRequest) assignValues(columns []string, values []interface{}) erro } } case authrequest.FieldResponseTypes: - if value, ok := values[i].(*[]byte); !ok { return fmt.Errorf("unexpected type %T for field response_types", values[i]) } else if value != nil && len(*value) > 0 { @@ -172,7 +170,6 @@ func (ar *AuthRequest) assignValues(columns []string, values []interface{}) erro ar.ClaimsEmailVerified = value.Bool } case authrequest.FieldClaimsGroups: - if value, ok := values[i].(*[]byte); !ok { return fmt.Errorf("unexpected type %T for field claims_groups", values[i]) } else if value != nil && len(*value) > 0 { @@ -237,11 +234,11 @@ func (ar *AuthRequest) Update() *AuthRequestUpdateOne { // Unwrap unwraps the AuthRequest entity that was returned from a transaction after it was closed, // so that all future queries will be executed through the driver which created the transaction. func (ar *AuthRequest) Unwrap() *AuthRequest { - tx, ok := ar.config.driver.(*txDriver) + _tx, ok := ar.config.driver.(*txDriver) if !ok { panic("db: AuthRequest is not a transactional entity") } - ar.config.driver = tx.drv + ar.config.driver = _tx.drv return ar } @@ -249,48 +246,67 @@ func (ar *AuthRequest) Unwrap() *AuthRequest { func (ar *AuthRequest) String() string { var builder strings.Builder builder.WriteString("AuthRequest(") - builder.WriteString(fmt.Sprintf("id=%v", ar.ID)) - builder.WriteString(", client_id=") + builder.WriteString(fmt.Sprintf("id=%v, ", ar.ID)) + builder.WriteString("client_id=") builder.WriteString(ar.ClientID) - builder.WriteString(", scopes=") + builder.WriteString(", ") + builder.WriteString("scopes=") builder.WriteString(fmt.Sprintf("%v", ar.Scopes)) - builder.WriteString(", response_types=") + builder.WriteString(", ") + builder.WriteString("response_types=") builder.WriteString(fmt.Sprintf("%v", ar.ResponseTypes)) - builder.WriteString(", redirect_uri=") + builder.WriteString(", ") + builder.WriteString("redirect_uri=") builder.WriteString(ar.RedirectURI) - builder.WriteString(", nonce=") + builder.WriteString(", ") + builder.WriteString("nonce=") builder.WriteString(ar.Nonce) - builder.WriteString(", state=") + builder.WriteString(", ") + builder.WriteString("state=") builder.WriteString(ar.State) - builder.WriteString(", force_approval_prompt=") + builder.WriteString(", ") + builder.WriteString("force_approval_prompt=") builder.WriteString(fmt.Sprintf("%v", ar.ForceApprovalPrompt)) - builder.WriteString(", logged_in=") + builder.WriteString(", ") + builder.WriteString("logged_in=") builder.WriteString(fmt.Sprintf("%v", ar.LoggedIn)) - builder.WriteString(", claims_user_id=") + builder.WriteString(", ") + builder.WriteString("claims_user_id=") builder.WriteString(ar.ClaimsUserID) - builder.WriteString(", claims_username=") + builder.WriteString(", ") + builder.WriteString("claims_username=") builder.WriteString(ar.ClaimsUsername) - builder.WriteString(", claims_email=") + builder.WriteString(", ") + builder.WriteString("claims_email=") builder.WriteString(ar.ClaimsEmail) - builder.WriteString(", claims_email_verified=") + builder.WriteString(", ") + builder.WriteString("claims_email_verified=") builder.WriteString(fmt.Sprintf("%v", ar.ClaimsEmailVerified)) - builder.WriteString(", claims_groups=") + builder.WriteString(", ") + builder.WriteString("claims_groups=") builder.WriteString(fmt.Sprintf("%v", ar.ClaimsGroups)) - builder.WriteString(", claims_preferred_username=") + builder.WriteString(", ") + builder.WriteString("claims_preferred_username=") builder.WriteString(ar.ClaimsPreferredUsername) - builder.WriteString(", connector_id=") + builder.WriteString(", ") + builder.WriteString("connector_id=") builder.WriteString(ar.ConnectorID) + builder.WriteString(", ") if v := ar.ConnectorData; v != nil { - builder.WriteString(", connector_data=") + builder.WriteString("connector_data=") builder.WriteString(fmt.Sprintf("%v", *v)) } - builder.WriteString(", expiry=") + builder.WriteString(", ") + builder.WriteString("expiry=") builder.WriteString(ar.Expiry.Format(time.ANSIC)) - builder.WriteString(", code_challenge=") + builder.WriteString(", ") + builder.WriteString("code_challenge=") builder.WriteString(ar.CodeChallenge) - builder.WriteString(", code_challenge_method=") + builder.WriteString(", ") + builder.WriteString("code_challenge_method=") builder.WriteString(ar.CodeChallengeMethod) - builder.WriteString(", login_hint=") + builder.WriteString(", ") + builder.WriteString("login_hint=") builder.WriteString(ar.LoginHint) builder.WriteByte(')') return builder.String() diff --git a/storage/ent/db/authrequest/authrequest.go b/storage/ent/db/authrequest/authrequest.go index 7e872acb8f..6a5cfba631 100644 --- a/storage/ent/db/authrequest/authrequest.go +++ b/storage/ent/db/authrequest/authrequest.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package authrequest diff --git a/storage/ent/db/authrequest/where.go b/storage/ent/db/authrequest/where.go index 471af1fbae..fcb25550c0 100644 --- a/storage/ent/db/authrequest/where.go +++ b/storage/ent/db/authrequest/where.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package authrequest @@ -33,12 +33,6 @@ func IDNEQ(id string) predicate.AuthRequest { // IDIn applies the In predicate on the ID field. func IDIn(ids ...string) predicate.AuthRequest { return predicate.AuthRequest(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(ids) == 0 { - s.Where(sql.False()) - return - } v := make([]interface{}, len(ids)) for i := range v { v[i] = ids[i] @@ -50,12 +44,6 @@ func IDIn(ids ...string) predicate.AuthRequest { // IDNotIn applies the NotIn predicate on the ID field. func IDNotIn(ids ...string) predicate.AuthRequest { return predicate.AuthRequest(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(ids) == 0 { - s.Where(sql.False()) - return - } v := make([]interface{}, len(ids)) for i := range v { v[i] = ids[i] diff --git a/storage/ent/db/authrequest_create.go b/storage/ent/db/authrequest_create.go index 2cdfe6d980..ec74c6d791 100644 --- a/storage/ent/db/authrequest_create.go +++ b/storage/ent/db/authrequest_create.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package db @@ -205,16 +205,28 @@ func (arc *AuthRequestCreate) Save(ctx context.Context) (*AuthRequest, error) { return nil, err } arc.mutation = mutation - node, err = arc.sqlSave(ctx) + if node, err = arc.sqlSave(ctx); err != nil { + return nil, err + } + mutation.id = &node.ID mutation.done = true return node, err }) for i := len(arc.hooks) - 1; i >= 0; i-- { + if arc.hooks[i] == nil { + return nil, fmt.Errorf("db: uninitialized hook (forgotten import db/runtime?)") + } mut = arc.hooks[i](mut) } - if _, err := mut.Mutate(ctx, arc.mutation); err != nil { + v, err := mut.Mutate(ctx, arc.mutation) + if err != nil { return nil, err } + nv, ok := v.(*AuthRequest) + if !ok { + return nil, fmt.Errorf("unexpected node type %T returned from AuthRequestMutation", v) + } + node = nv } return node, err } @@ -228,6 +240,19 @@ func (arc *AuthRequestCreate) SaveX(ctx context.Context) *AuthRequest { return v } +// Exec executes the query. +func (arc *AuthRequestCreate) Exec(ctx context.Context) error { + _, err := arc.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (arc *AuthRequestCreate) ExecX(ctx context.Context) { + if err := arc.Exec(ctx); err != nil { + panic(err) + } +} + // defaults sets the default values of the builder before save. func (arc *AuthRequestCreate) defaults() { if _, ok := arc.mutation.ClaimsPreferredUsername(); !ok { @@ -251,56 +276,56 @@ 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 _, ok := arc.mutation.LoginHint(); !ok { - return &ValidationError{Name: "login_hint", err: errors.New("db: missing required field \"login_hint\"")} + return &ValidationError{Name: "login_hint", err: errors.New(`db: missing required field "AuthRequest.login_hint"`)} } 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 @@ -309,11 +334,18 @@ func (arc *AuthRequestCreate) check() error { func (arc *AuthRequestCreate) sqlSave(ctx context.Context) (*AuthRequest, error) { _node, _spec := arc.createSpec() if err := sqlgraph.CreateNode(ctx, arc.driver, _spec); err != nil { - if cerr, ok := isSQLConstraintError(err); ok { - err = cerr + if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} } 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 } @@ -524,17 +556,19 @@ func (arcb *AuthRequestCreateBulk) Save(ctx context.Context) ([]*AuthRequest, er if i < len(mutators)-1 { _, err = mutators[i+1].Mutate(root, arcb.builders[i+1].mutation) } else { + spec := &sqlgraph.BatchCreateSpec{Nodes: specs} // Invoke the actual operation on the latest mutation in the chain. - if err = sqlgraph.BatchCreate(ctx, arcb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil { - if cerr, ok := isSQLConstraintError(err); ok { - err = cerr + if err = sqlgraph.BatchCreate(ctx, arcb.driver, spec); err != nil { + if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} } } } - mutation.done = true if err != nil { return nil, err } + mutation.id = &nodes[i].ID + mutation.done = true return nodes[i], nil }) for i := len(builder.hooks) - 1; i >= 0; i-- { @@ -559,3 +593,16 @@ func (arcb *AuthRequestCreateBulk) SaveX(ctx context.Context) []*AuthRequest { } return v } + +// Exec executes the query. +func (arcb *AuthRequestCreateBulk) Exec(ctx context.Context) error { + _, err := arcb.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (arcb *AuthRequestCreateBulk) ExecX(ctx context.Context) { + if err := arcb.Exec(ctx); err != nil { + panic(err) + } +} diff --git a/storage/ent/db/authrequest_delete.go b/storage/ent/db/authrequest_delete.go index e0d0ba6698..495f467609 100644 --- a/storage/ent/db/authrequest_delete.go +++ b/storage/ent/db/authrequest_delete.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package db @@ -20,9 +20,9 @@ type AuthRequestDelete struct { mutation *AuthRequestMutation } -// Where adds a new predicate to the AuthRequestDelete builder. +// Where appends a list predicates to the AuthRequestDelete builder. func (ard *AuthRequestDelete) Where(ps ...predicate.AuthRequest) *AuthRequestDelete { - ard.mutation.predicates = append(ard.mutation.predicates, ps...) + ard.mutation.Where(ps...) return ard } @@ -46,6 +46,9 @@ func (ard *AuthRequestDelete) Exec(ctx context.Context) (int, error) { return affected, err }) for i := len(ard.hooks) - 1; i >= 0; i-- { + if ard.hooks[i] == nil { + return 0, fmt.Errorf("db: uninitialized hook (forgotten import db/runtime?)") + } mut = ard.hooks[i](mut) } if _, err := mut.Mutate(ctx, ard.mutation); err != nil { @@ -81,7 +84,11 @@ func (ard *AuthRequestDelete) sqlExec(ctx context.Context) (int, error) { } } } - return sqlgraph.DeleteNodes(ctx, ard.driver, _spec) + affected, err := sqlgraph.DeleteNodes(ctx, ard.driver, _spec) + if err != nil && sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} + } + return affected, err } // AuthRequestDeleteOne is the builder for deleting a single AuthRequest entity. diff --git a/storage/ent/db/authrequest_query.go b/storage/ent/db/authrequest_query.go index b55861cf0c..577da17b06 100644 --- a/storage/ent/db/authrequest_query.go +++ b/storage/ent/db/authrequest_query.go @@ -1,10 +1,9 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package db import ( "context" - "errors" "fmt" "math" @@ -106,7 +105,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 +132,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 +241,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, } } @@ -263,15 +263,17 @@ func (arq *AuthRequestQuery) Clone() *AuthRequestQuery { // Scan(ctx, &v) // func (arq *AuthRequestQuery) GroupBy(field string, fields ...string) *AuthRequestGroupBy { - group := &AuthRequestGroupBy{config: arq.config} - group.fields = append([]string{field}, fields...) - group.path = func(ctx context.Context) (prev *sql.Selector, err error) { + grbuild := &AuthRequestGroupBy{config: arq.config} + grbuild.fields = append([]string{field}, fields...) + grbuild.path = func(ctx context.Context) (prev *sql.Selector, err error) { if err := arq.prepareQuery(ctx); err != nil { return nil, err } return arq.sqlQuery(ctx), nil } - return group + grbuild.label = authrequest.Label + grbuild.flds, grbuild.scan = &grbuild.fields, grbuild.Scan + return grbuild } // Select allows the selection one or more fields/columns for the given query, @@ -287,9 +289,12 @@ func (arq *AuthRequestQuery) GroupBy(field string, fields ...string) *AuthReques // Select(authrequest.FieldClientID). // Scan(ctx, &v) // -func (arq *AuthRequestQuery) Select(field string, fields ...string) *AuthRequestSelect { - arq.fields = append([]string{field}, fields...) - return &AuthRequestSelect{AuthRequestQuery: arq} +func (arq *AuthRequestQuery) Select(fields ...string) *AuthRequestSelect { + arq.fields = append(arq.fields, fields...) + selbuild := &AuthRequestSelect{AuthRequestQuery: arq} + selbuild.label = authrequest.Label + selbuild.flds, selbuild.scan = &arq.fields, selbuild.Scan + return selbuild } func (arq *AuthRequestQuery) prepareQuery(ctx context.Context) error { @@ -308,23 +313,22 @@ func (arq *AuthRequestQuery) prepareQuery(ctx context.Context) error { return nil } -func (arq *AuthRequestQuery) sqlAll(ctx context.Context) ([]*AuthRequest, error) { +func (arq *AuthRequestQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*AuthRequest, error) { var ( nodes = []*AuthRequest{} _spec = arq.querySpec() ) _spec.ScanValues = func(columns []string) ([]interface{}, error) { - node := &AuthRequest{config: arq.config} - nodes = append(nodes, node) - return node.scanValues(columns) + return (*AuthRequest).scanValues(nil, columns) } _spec.Assign = func(columns []string, values []interface{}) error { - if len(nodes) == 0 { - return fmt.Errorf("db: Assign called without calling ScanValues") - } - node := nodes[len(nodes)-1] + node := &AuthRequest{config: arq.config} + nodes = append(nodes, node) return node.assignValues(columns, values) } + for i := range hooks { + hooks[i](ctx, _spec) + } if err := sqlgraph.QueryNodes(ctx, arq.driver, _spec); err != nil { return nil, err } @@ -336,6 +340,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) } @@ -398,10 +406,17 @@ func (arq *AuthRequestQuery) querySpec() *sqlgraph.QuerySpec { func (arq *AuthRequestQuery) sqlQuery(ctx context.Context) *sql.Selector { builder := sql.Dialect(arq.driver.Dialect()) t1 := builder.Table(authrequest.Table) - selector := builder.Select(t1.Columns(authrequest.Columns...)...).From(t1) + columns := arq.fields + if len(columns) == 0 { + columns = authrequest.Columns + } + selector := builder.Select(t1.Columns(columns...)...).From(t1) if arq.sql != nil { selector = arq.sql - selector.Select(selector.Columns(authrequest.Columns...)...) + selector.Select(selector.Columns(columns...)...) + } + if arq.unique != nil && *arq.unique { + selector.Distinct() } for _, p := range arq.predicates { p(selector) @@ -423,6 +438,7 @@ func (arq *AuthRequestQuery) sqlQuery(ctx context.Context) *sql.Selector { // AuthRequestGroupBy is the group-by builder for AuthRequest entities. type AuthRequestGroupBy struct { config + selector fields []string fns []AggregateFunc // intermediate query (i.e. traversal path). @@ -446,209 +462,6 @@ func (argb *AuthRequestGroupBy) Scan(ctx context.Context, v interface{}) error { return argb.sqlScan(ctx, v) } -// ScanX is like Scan, but panics if an error occurs. -func (argb *AuthRequestGroupBy) ScanX(ctx context.Context, v interface{}) { - if err := argb.Scan(ctx, v); err != nil { - panic(err) - } -} - -// Strings returns list of strings from group-by. -// It is only allowed when executing a group-by query with one field. -func (argb *AuthRequestGroupBy) Strings(ctx context.Context) ([]string, error) { - if len(argb.fields) > 1 { - return nil, errors.New("db: AuthRequestGroupBy.Strings is not achievable when grouping more than 1 field") - } - var v []string - if err := argb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// StringsX is like Strings, but panics if an error occurs. -func (argb *AuthRequestGroupBy) StringsX(ctx context.Context) []string { - v, err := argb.Strings(ctx) - if err != nil { - panic(err) - } - return v -} - -// String returns a single string from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (argb *AuthRequestGroupBy) String(ctx context.Context) (_ string, err error) { - var v []string - if v, err = argb.Strings(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{authrequest.Label} - default: - err = fmt.Errorf("db: AuthRequestGroupBy.Strings returned %d results when one was expected", len(v)) - } - return -} - -// StringX is like String, but panics if an error occurs. -func (argb *AuthRequestGroupBy) StringX(ctx context.Context) string { - v, err := argb.String(ctx) - if err != nil { - panic(err) - } - return v -} - -// Ints returns list of ints from group-by. -// It is only allowed when executing a group-by query with one field. -func (argb *AuthRequestGroupBy) Ints(ctx context.Context) ([]int, error) { - if len(argb.fields) > 1 { - return nil, errors.New("db: AuthRequestGroupBy.Ints is not achievable when grouping more than 1 field") - } - var v []int - if err := argb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// IntsX is like Ints, but panics if an error occurs. -func (argb *AuthRequestGroupBy) IntsX(ctx context.Context) []int { - v, err := argb.Ints(ctx) - if err != nil { - panic(err) - } - return v -} - -// Int returns a single int from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (argb *AuthRequestGroupBy) Int(ctx context.Context) (_ int, err error) { - var v []int - if v, err = argb.Ints(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{authrequest.Label} - default: - err = fmt.Errorf("db: AuthRequestGroupBy.Ints returned %d results when one was expected", len(v)) - } - return -} - -// IntX is like Int, but panics if an error occurs. -func (argb *AuthRequestGroupBy) IntX(ctx context.Context) int { - v, err := argb.Int(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64s returns list of float64s from group-by. -// It is only allowed when executing a group-by query with one field. -func (argb *AuthRequestGroupBy) Float64s(ctx context.Context) ([]float64, error) { - if len(argb.fields) > 1 { - return nil, errors.New("db: AuthRequestGroupBy.Float64s is not achievable when grouping more than 1 field") - } - var v []float64 - if err := argb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// Float64sX is like Float64s, but panics if an error occurs. -func (argb *AuthRequestGroupBy) Float64sX(ctx context.Context) []float64 { - v, err := argb.Float64s(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64 returns a single float64 from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (argb *AuthRequestGroupBy) Float64(ctx context.Context) (_ float64, err error) { - var v []float64 - if v, err = argb.Float64s(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{authrequest.Label} - default: - err = fmt.Errorf("db: AuthRequestGroupBy.Float64s returned %d results when one was expected", len(v)) - } - return -} - -// Float64X is like Float64, but panics if an error occurs. -func (argb *AuthRequestGroupBy) Float64X(ctx context.Context) float64 { - v, err := argb.Float64(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bools returns list of bools from group-by. -// It is only allowed when executing a group-by query with one field. -func (argb *AuthRequestGroupBy) Bools(ctx context.Context) ([]bool, error) { - if len(argb.fields) > 1 { - return nil, errors.New("db: AuthRequestGroupBy.Bools is not achievable when grouping more than 1 field") - } - var v []bool - if err := argb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// BoolsX is like Bools, but panics if an error occurs. -func (argb *AuthRequestGroupBy) BoolsX(ctx context.Context) []bool { - v, err := argb.Bools(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bool returns a single bool from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (argb *AuthRequestGroupBy) Bool(ctx context.Context) (_ bool, err error) { - var v []bool - if v, err = argb.Bools(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{authrequest.Label} - default: - err = fmt.Errorf("db: AuthRequestGroupBy.Bools returned %d results when one was expected", len(v)) - } - return -} - -// BoolX is like Bool, but panics if an error occurs. -func (argb *AuthRequestGroupBy) BoolX(ctx context.Context) bool { - v, err := argb.Bool(ctx) - if err != nil { - panic(err) - } - return v -} - func (argb *AuthRequestGroupBy) sqlScan(ctx context.Context, v interface{}) error { for _, f := range argb.fields { if !authrequest.ValidColumn(f) { @@ -669,18 +482,28 @@ func (argb *AuthRequestGroupBy) sqlScan(ctx context.Context, v interface{}) erro } func (argb *AuthRequestGroupBy) sqlQuery() *sql.Selector { - selector := argb.sql - columns := make([]string, 0, len(argb.fields)+len(argb.fns)) - columns = append(columns, argb.fields...) + selector := argb.sql.Select() + aggregation := make([]string, 0, len(argb.fns)) for _, fn := range argb.fns { - columns = append(columns, fn(selector)) + aggregation = append(aggregation, fn(selector)) + } + // If no columns were selected in a custom aggregation function, the default + // selection is the fields used for "group-by", and the aggregation functions. + if len(selector.SelectedColumns()) == 0 { + columns := make([]string, 0, len(argb.fields)+len(argb.fns)) + for _, f := range argb.fields { + columns = append(columns, selector.C(f)) + } + columns = append(columns, aggregation...) + selector.Select(columns...) } - return selector.Select(columns...).GroupBy(argb.fields...) + return selector.GroupBy(selector.Columns(argb.fields...)...) } // AuthRequestSelect is the builder for selecting fields of AuthRequest entities. type AuthRequestSelect struct { *AuthRequestQuery + selector // intermediate query (i.e. traversal path). sql *sql.Selector } @@ -694,213 +517,12 @@ func (ars *AuthRequestSelect) Scan(ctx context.Context, v interface{}) error { return ars.sqlScan(ctx, v) } -// ScanX is like Scan, but panics if an error occurs. -func (ars *AuthRequestSelect) ScanX(ctx context.Context, v interface{}) { - if err := ars.Scan(ctx, v); err != nil { - panic(err) - } -} - -// Strings returns list of strings from a selector. It is only allowed when selecting one field. -func (ars *AuthRequestSelect) Strings(ctx context.Context) ([]string, error) { - if len(ars.fields) > 1 { - return nil, errors.New("db: AuthRequestSelect.Strings is not achievable when selecting more than 1 field") - } - var v []string - if err := ars.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// StringsX is like Strings, but panics if an error occurs. -func (ars *AuthRequestSelect) StringsX(ctx context.Context) []string { - v, err := ars.Strings(ctx) - if err != nil { - panic(err) - } - return v -} - -// String returns a single string from a selector. It is only allowed when selecting one field. -func (ars *AuthRequestSelect) String(ctx context.Context) (_ string, err error) { - var v []string - if v, err = ars.Strings(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{authrequest.Label} - default: - err = fmt.Errorf("db: AuthRequestSelect.Strings returned %d results when one was expected", len(v)) - } - return -} - -// StringX is like String, but panics if an error occurs. -func (ars *AuthRequestSelect) StringX(ctx context.Context) string { - v, err := ars.String(ctx) - if err != nil { - panic(err) - } - return v -} - -// Ints returns list of ints from a selector. It is only allowed when selecting one field. -func (ars *AuthRequestSelect) Ints(ctx context.Context) ([]int, error) { - if len(ars.fields) > 1 { - return nil, errors.New("db: AuthRequestSelect.Ints is not achievable when selecting more than 1 field") - } - var v []int - if err := ars.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// IntsX is like Ints, but panics if an error occurs. -func (ars *AuthRequestSelect) IntsX(ctx context.Context) []int { - v, err := ars.Ints(ctx) - if err != nil { - panic(err) - } - return v -} - -// Int returns a single int from a selector. It is only allowed when selecting one field. -func (ars *AuthRequestSelect) Int(ctx context.Context) (_ int, err error) { - var v []int - if v, err = ars.Ints(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{authrequest.Label} - default: - err = fmt.Errorf("db: AuthRequestSelect.Ints returned %d results when one was expected", len(v)) - } - return -} - -// IntX is like Int, but panics if an error occurs. -func (ars *AuthRequestSelect) IntX(ctx context.Context) int { - v, err := ars.Int(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64s returns list of float64s from a selector. It is only allowed when selecting one field. -func (ars *AuthRequestSelect) Float64s(ctx context.Context) ([]float64, error) { - if len(ars.fields) > 1 { - return nil, errors.New("db: AuthRequestSelect.Float64s is not achievable when selecting more than 1 field") - } - var v []float64 - if err := ars.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// Float64sX is like Float64s, but panics if an error occurs. -func (ars *AuthRequestSelect) Float64sX(ctx context.Context) []float64 { - v, err := ars.Float64s(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64 returns a single float64 from a selector. It is only allowed when selecting one field. -func (ars *AuthRequestSelect) Float64(ctx context.Context) (_ float64, err error) { - var v []float64 - if v, err = ars.Float64s(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{authrequest.Label} - default: - err = fmt.Errorf("db: AuthRequestSelect.Float64s returned %d results when one was expected", len(v)) - } - return -} - -// Float64X is like Float64, but panics if an error occurs. -func (ars *AuthRequestSelect) Float64X(ctx context.Context) float64 { - v, err := ars.Float64(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bools returns list of bools from a selector. It is only allowed when selecting one field. -func (ars *AuthRequestSelect) Bools(ctx context.Context) ([]bool, error) { - if len(ars.fields) > 1 { - return nil, errors.New("db: AuthRequestSelect.Bools is not achievable when selecting more than 1 field") - } - var v []bool - if err := ars.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// BoolsX is like Bools, but panics if an error occurs. -func (ars *AuthRequestSelect) BoolsX(ctx context.Context) []bool { - v, err := ars.Bools(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bool returns a single bool from a selector. It is only allowed when selecting one field. -func (ars *AuthRequestSelect) Bool(ctx context.Context) (_ bool, err error) { - var v []bool - if v, err = ars.Bools(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{authrequest.Label} - default: - err = fmt.Errorf("db: AuthRequestSelect.Bools returned %d results when one was expected", len(v)) - } - return -} - -// BoolX is like Bool, but panics if an error occurs. -func (ars *AuthRequestSelect) BoolX(ctx context.Context) bool { - v, err := ars.Bool(ctx) - if err != nil { - panic(err) - } - return v -} - func (ars *AuthRequestSelect) sqlScan(ctx context.Context, v interface{}) error { rows := &sql.Rows{} - query, args := ars.sqlQuery().Query() + query, args := ars.sql.Query() if err := ars.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() return sql.ScanSlice(rows, v) } - -func (ars *AuthRequestSelect) sqlQuery() sql.Querier { - selector := ars.sql - selector.Select(selector.Columns(ars.fields...)...) - return selector -} diff --git a/storage/ent/db/authrequest_update.go b/storage/ent/db/authrequest_update.go index 4eb5b2b3fc..640948d263 100644 --- a/storage/ent/db/authrequest_update.go +++ b/storage/ent/db/authrequest_update.go @@ -1,9 +1,10 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package db import ( "context" + "errors" "fmt" "time" @@ -21,9 +22,9 @@ type AuthRequestUpdate struct { mutation *AuthRequestMutation } -// Where adds a new predicate for the AuthRequestUpdate builder. +// Where appends a list predicates to the AuthRequestUpdate builder. func (aru *AuthRequestUpdate) Where(ps ...predicate.AuthRequest) *AuthRequestUpdate { - aru.mutation.predicates = append(aru.mutation.predicates, ps...) + aru.mutation.Where(ps...) return aru } @@ -228,6 +229,9 @@ func (aru *AuthRequestUpdate) Save(ctx context.Context) (int, error) { return affected, err }) for i := len(aru.hooks) - 1; i >= 0; i-- { + if aru.hooks[i] == nil { + return 0, fmt.Errorf("db: uninitialized hook (forgotten import db/runtime?)") + } mut = aru.hooks[i](mut) } if _, err := mut.Mutate(ctx, aru.mutation); err != nil { @@ -444,8 +448,8 @@ func (aru *AuthRequestUpdate) sqlSave(ctx context.Context) (n int, err error) { if n, err = sqlgraph.UpdateNodes(ctx, aru.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{authrequest.Label} - } else if cerr, ok := isSQLConstraintError(err); ok { - err = cerr + } else if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} } return 0, err } @@ -668,11 +672,20 @@ func (aruo *AuthRequestUpdateOne) Save(ctx context.Context) (*AuthRequest, error return node, err }) for i := len(aruo.hooks) - 1; i >= 0; i-- { + if aruo.hooks[i] == nil { + return nil, fmt.Errorf("db: uninitialized hook (forgotten import db/runtime?)") + } mut = aruo.hooks[i](mut) } - if _, err := mut.Mutate(ctx, aruo.mutation); err != nil { + v, err := mut.Mutate(ctx, aruo.mutation) + if err != nil { return nil, err } + nv, ok := v.(*AuthRequest) + if !ok { + return nil, fmt.Errorf("unexpected node type %T returned from AuthRequestMutation", v) + } + node = nv } return node, err } @@ -712,7 +725,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 { @@ -904,8 +917,8 @@ func (aruo *AuthRequestUpdateOne) sqlSave(ctx context.Context) (_node *AuthReque if err = sqlgraph.UpdateNode(ctx, aruo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{authrequest.Label} - } else if cerr, ok := isSQLConstraintError(err); ok { - err = cerr + } else if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } diff --git a/storage/ent/db/client.go b/storage/ent/db/client.go index a27286a0c0..a8fd53576e 100644 --- a/storage/ent/db/client.go +++ b/storage/ent/db/client.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package db @@ -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), @@ -200,7 +201,7 @@ func (c *AuthCodeClient) Use(hooks ...Hook) { c.hooks.AuthCode = append(c.hooks.AuthCode, hooks...) } -// Create returns a create builder for AuthCode. +// Create returns a builder for creating a AuthCode entity. func (c *AuthCodeClient) Create() *AuthCodeCreate { mutation := newAuthCodeMutation(c.config, OpCreate) return &AuthCodeCreate{config: c.config, hooks: c.Hooks(), mutation: mutation} @@ -235,12 +236,12 @@ func (c *AuthCodeClient) Delete() *AuthCodeDelete { return &AuthCodeDelete{config: c.config, hooks: c.Hooks(), mutation: mutation} } -// DeleteOne returns a delete builder for the given entity. +// DeleteOne returns a builder for deleting the given entity. func (c *AuthCodeClient) DeleteOne(ac *AuthCode) *AuthCodeDeleteOne { return c.DeleteOneID(ac.ID) } -// DeleteOneID returns a delete builder for the given id. +// DeleteOne returns a builder for deleting the given entity by its id. func (c *AuthCodeClient) DeleteOneID(id string) *AuthCodeDeleteOne { builder := c.Delete().Where(authcode.ID(id)) builder.mutation.id = &id @@ -290,7 +291,7 @@ func (c *AuthRequestClient) Use(hooks ...Hook) { c.hooks.AuthRequest = append(c.hooks.AuthRequest, hooks...) } -// Create returns a create builder for AuthRequest. +// Create returns a builder for creating a AuthRequest entity. func (c *AuthRequestClient) Create() *AuthRequestCreate { mutation := newAuthRequestMutation(c.config, OpCreate) return &AuthRequestCreate{config: c.config, hooks: c.Hooks(), mutation: mutation} @@ -325,12 +326,12 @@ func (c *AuthRequestClient) Delete() *AuthRequestDelete { return &AuthRequestDelete{config: c.config, hooks: c.Hooks(), mutation: mutation} } -// DeleteOne returns a delete builder for the given entity. +// DeleteOne returns a builder for deleting the given entity. func (c *AuthRequestClient) DeleteOne(ar *AuthRequest) *AuthRequestDeleteOne { return c.DeleteOneID(ar.ID) } -// DeleteOneID returns a delete builder for the given id. +// DeleteOne returns a builder for deleting the given entity by its id. func (c *AuthRequestClient) DeleteOneID(id string) *AuthRequestDeleteOne { builder := c.Delete().Where(authrequest.ID(id)) builder.mutation.id = &id @@ -380,7 +381,7 @@ func (c *ConnectorClient) Use(hooks ...Hook) { c.hooks.Connector = append(c.hooks.Connector, hooks...) } -// Create returns a create builder for Connector. +// Create returns a builder for creating a Connector entity. func (c *ConnectorClient) Create() *ConnectorCreate { mutation := newConnectorMutation(c.config, OpCreate) return &ConnectorCreate{config: c.config, hooks: c.Hooks(), mutation: mutation} @@ -415,12 +416,12 @@ func (c *ConnectorClient) Delete() *ConnectorDelete { return &ConnectorDelete{config: c.config, hooks: c.Hooks(), mutation: mutation} } -// DeleteOne returns a delete builder for the given entity. +// DeleteOne returns a builder for deleting the given entity. func (c *ConnectorClient) DeleteOne(co *Connector) *ConnectorDeleteOne { return c.DeleteOneID(co.ID) } -// DeleteOneID returns a delete builder for the given id. +// DeleteOne returns a builder for deleting the given entity by its id. func (c *ConnectorClient) DeleteOneID(id string) *ConnectorDeleteOne { builder := c.Delete().Where(connector.ID(id)) builder.mutation.id = &id @@ -470,7 +471,7 @@ func (c *DeviceRequestClient) Use(hooks ...Hook) { c.hooks.DeviceRequest = append(c.hooks.DeviceRequest, hooks...) } -// Create returns a create builder for DeviceRequest. +// Create returns a builder for creating a DeviceRequest entity. func (c *DeviceRequestClient) Create() *DeviceRequestCreate { mutation := newDeviceRequestMutation(c.config, OpCreate) return &DeviceRequestCreate{config: c.config, hooks: c.Hooks(), mutation: mutation} @@ -505,12 +506,12 @@ func (c *DeviceRequestClient) Delete() *DeviceRequestDelete { return &DeviceRequestDelete{config: c.config, hooks: c.Hooks(), mutation: mutation} } -// DeleteOne returns a delete builder for the given entity. +// DeleteOne returns a builder for deleting the given entity. func (c *DeviceRequestClient) DeleteOne(dr *DeviceRequest) *DeviceRequestDeleteOne { return c.DeleteOneID(dr.ID) } -// DeleteOneID returns a delete builder for the given id. +// DeleteOne returns a builder for deleting the given entity by its id. func (c *DeviceRequestClient) DeleteOneID(id int) *DeviceRequestDeleteOne { builder := c.Delete().Where(devicerequest.ID(id)) builder.mutation.id = &id @@ -560,7 +561,7 @@ func (c *DeviceTokenClient) Use(hooks ...Hook) { c.hooks.DeviceToken = append(c.hooks.DeviceToken, hooks...) } -// Create returns a create builder for DeviceToken. +// Create returns a builder for creating a DeviceToken entity. func (c *DeviceTokenClient) Create() *DeviceTokenCreate { mutation := newDeviceTokenMutation(c.config, OpCreate) return &DeviceTokenCreate{config: c.config, hooks: c.Hooks(), mutation: mutation} @@ -595,12 +596,12 @@ func (c *DeviceTokenClient) Delete() *DeviceTokenDelete { return &DeviceTokenDelete{config: c.config, hooks: c.Hooks(), mutation: mutation} } -// DeleteOne returns a delete builder for the given entity. +// DeleteOne returns a builder for deleting the given entity. func (c *DeviceTokenClient) DeleteOne(dt *DeviceToken) *DeviceTokenDeleteOne { return c.DeleteOneID(dt.ID) } -// DeleteOneID returns a delete builder for the given id. +// DeleteOne returns a builder for deleting the given entity by its id. func (c *DeviceTokenClient) DeleteOneID(id int) *DeviceTokenDeleteOne { builder := c.Delete().Where(devicetoken.ID(id)) builder.mutation.id = &id @@ -650,7 +651,7 @@ func (c *KeysClient) Use(hooks ...Hook) { c.hooks.Keys = append(c.hooks.Keys, hooks...) } -// Create returns a create builder for Keys. +// Create returns a builder for creating a Keys entity. func (c *KeysClient) Create() *KeysCreate { mutation := newKeysMutation(c.config, OpCreate) return &KeysCreate{config: c.config, hooks: c.Hooks(), mutation: mutation} @@ -685,12 +686,12 @@ func (c *KeysClient) Delete() *KeysDelete { return &KeysDelete{config: c.config, hooks: c.Hooks(), mutation: mutation} } -// DeleteOne returns a delete builder for the given entity. +// DeleteOne returns a builder for deleting the given entity. func (c *KeysClient) DeleteOne(k *Keys) *KeysDeleteOne { return c.DeleteOneID(k.ID) } -// DeleteOneID returns a delete builder for the given id. +// DeleteOne returns a builder for deleting the given entity by its id. func (c *KeysClient) DeleteOneID(id string) *KeysDeleteOne { builder := c.Delete().Where(keys.ID(id)) builder.mutation.id = &id @@ -740,7 +741,7 @@ func (c *OAuth2ClientClient) Use(hooks ...Hook) { c.hooks.OAuth2Client = append(c.hooks.OAuth2Client, hooks...) } -// Create returns a create builder for OAuth2Client. +// Create returns a builder for creating a OAuth2Client entity. func (c *OAuth2ClientClient) Create() *OAuth2ClientCreate { mutation := newOAuth2ClientMutation(c.config, OpCreate) return &OAuth2ClientCreate{config: c.config, hooks: c.Hooks(), mutation: mutation} @@ -775,12 +776,12 @@ func (c *OAuth2ClientClient) Delete() *OAuth2ClientDelete { return &OAuth2ClientDelete{config: c.config, hooks: c.Hooks(), mutation: mutation} } -// DeleteOne returns a delete builder for the given entity. +// DeleteOne returns a builder for deleting the given entity. func (c *OAuth2ClientClient) DeleteOne(o *OAuth2Client) *OAuth2ClientDeleteOne { return c.DeleteOneID(o.ID) } -// DeleteOneID returns a delete builder for the given id. +// DeleteOne returns a builder for deleting the given entity by its id. func (c *OAuth2ClientClient) DeleteOneID(id string) *OAuth2ClientDeleteOne { builder := c.Delete().Where(oauth2client.ID(id)) builder.mutation.id = &id @@ -830,7 +831,7 @@ func (c *OfflineSessionClient) Use(hooks ...Hook) { c.hooks.OfflineSession = append(c.hooks.OfflineSession, hooks...) } -// Create returns a create builder for OfflineSession. +// Create returns a builder for creating a OfflineSession entity. func (c *OfflineSessionClient) Create() *OfflineSessionCreate { mutation := newOfflineSessionMutation(c.config, OpCreate) return &OfflineSessionCreate{config: c.config, hooks: c.Hooks(), mutation: mutation} @@ -865,12 +866,12 @@ func (c *OfflineSessionClient) Delete() *OfflineSessionDelete { return &OfflineSessionDelete{config: c.config, hooks: c.Hooks(), mutation: mutation} } -// DeleteOne returns a delete builder for the given entity. +// DeleteOne returns a builder for deleting the given entity. func (c *OfflineSessionClient) DeleteOne(os *OfflineSession) *OfflineSessionDeleteOne { return c.DeleteOneID(os.ID) } -// DeleteOneID returns a delete builder for the given id. +// DeleteOne returns a builder for deleting the given entity by its id. func (c *OfflineSessionClient) DeleteOneID(id string) *OfflineSessionDeleteOne { builder := c.Delete().Where(offlinesession.ID(id)) builder.mutation.id = &id @@ -920,7 +921,7 @@ func (c *PasswordClient) Use(hooks ...Hook) { c.hooks.Password = append(c.hooks.Password, hooks...) } -// Create returns a create builder for Password. +// Create returns a builder for creating a Password entity. func (c *PasswordClient) Create() *PasswordCreate { mutation := newPasswordMutation(c.config, OpCreate) return &PasswordCreate{config: c.config, hooks: c.Hooks(), mutation: mutation} @@ -955,12 +956,12 @@ func (c *PasswordClient) Delete() *PasswordDelete { return &PasswordDelete{config: c.config, hooks: c.Hooks(), mutation: mutation} } -// DeleteOne returns a delete builder for the given entity. +// DeleteOne returns a builder for deleting the given entity. func (c *PasswordClient) DeleteOne(pa *Password) *PasswordDeleteOne { return c.DeleteOneID(pa.ID) } -// DeleteOneID returns a delete builder for the given id. +// DeleteOne returns a builder for deleting the given entity by its id. func (c *PasswordClient) DeleteOneID(id int) *PasswordDeleteOne { builder := c.Delete().Where(password.ID(id)) builder.mutation.id = &id @@ -1010,7 +1011,7 @@ func (c *RefreshTokenClient) Use(hooks ...Hook) { c.hooks.RefreshToken = append(c.hooks.RefreshToken, hooks...) } -// Create returns a create builder for RefreshToken. +// Create returns a builder for creating a RefreshToken entity. func (c *RefreshTokenClient) Create() *RefreshTokenCreate { mutation := newRefreshTokenMutation(c.config, OpCreate) return &RefreshTokenCreate{config: c.config, hooks: c.Hooks(), mutation: mutation} @@ -1045,12 +1046,12 @@ func (c *RefreshTokenClient) Delete() *RefreshTokenDelete { return &RefreshTokenDelete{config: c.config, hooks: c.Hooks(), mutation: mutation} } -// DeleteOne returns a delete builder for the given entity. +// DeleteOne returns a builder for deleting the given entity. func (c *RefreshTokenClient) DeleteOne(rt *RefreshToken) *RefreshTokenDeleteOne { return c.DeleteOneID(rt.ID) } -// DeleteOneID returns a delete builder for the given id. +// DeleteOne returns a builder for deleting the given entity by its id. func (c *RefreshTokenClient) DeleteOneID(id string) *RefreshTokenDeleteOne { builder := c.Delete().Where(refreshtoken.ID(id)) builder.mutation.id = &id diff --git a/storage/ent/db/config.go b/storage/ent/db/config.go index 6e1ffb6cf8..b26f166d29 100644 --- a/storage/ent/db/config.go +++ b/storage/ent/db/config.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package db diff --git a/storage/ent/db/connector.go b/storage/ent/db/connector.go index 3bcb7ee503..65cd4d25e8 100644 --- a/storage/ent/db/connector.go +++ b/storage/ent/db/connector.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package db @@ -94,11 +94,11 @@ func (c *Connector) Update() *ConnectorUpdateOne { // Unwrap unwraps the Connector entity that was returned from a transaction after it was closed, // so that all future queries will be executed through the driver which created the transaction. func (c *Connector) Unwrap() *Connector { - tx, ok := c.config.driver.(*txDriver) + _tx, ok := c.config.driver.(*txDriver) if !ok { panic("db: Connector is not a transactional entity") } - c.config.driver = tx.drv + c.config.driver = _tx.drv return c } @@ -106,14 +106,17 @@ func (c *Connector) Unwrap() *Connector { func (c *Connector) String() string { var builder strings.Builder builder.WriteString("Connector(") - builder.WriteString(fmt.Sprintf("id=%v", c.ID)) - builder.WriteString(", type=") + builder.WriteString(fmt.Sprintf("id=%v, ", c.ID)) + builder.WriteString("type=") builder.WriteString(c.Type) - builder.WriteString(", name=") + builder.WriteString(", ") + builder.WriteString("name=") builder.WriteString(c.Name) - builder.WriteString(", resource_version=") + builder.WriteString(", ") + builder.WriteString("resource_version=") builder.WriteString(c.ResourceVersion) - builder.WriteString(", config=") + builder.WriteString(", ") + builder.WriteString("config=") builder.WriteString(fmt.Sprintf("%v", c.Config)) builder.WriteByte(')') return builder.String() diff --git a/storage/ent/db/connector/connector.go b/storage/ent/db/connector/connector.go index 1ee43270fe..8f52a8f710 100644 --- a/storage/ent/db/connector/connector.go +++ b/storage/ent/db/connector/connector.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package connector diff --git a/storage/ent/db/connector/where.go b/storage/ent/db/connector/where.go index 889a6dd7be..8e8b23f07c 100644 --- a/storage/ent/db/connector/where.go +++ b/storage/ent/db/connector/where.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package connector @@ -31,12 +31,6 @@ func IDNEQ(id string) predicate.Connector { // IDIn applies the In predicate on the ID field. func IDIn(ids ...string) predicate.Connector { return predicate.Connector(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(ids) == 0 { - s.Where(sql.False()) - return - } v := make([]interface{}, len(ids)) for i := range v { v[i] = ids[i] @@ -48,12 +42,6 @@ func IDIn(ids ...string) predicate.Connector { // IDNotIn applies the NotIn predicate on the ID field. func IDNotIn(ids ...string) predicate.Connector { return predicate.Connector(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(ids) == 0 { - s.Where(sql.False()) - return - } v := make([]interface{}, len(ids)) for i := range v { v[i] = ids[i] diff --git a/storage/ent/db/connector_create.go b/storage/ent/db/connector_create.go index eebe4d050d..ecff1c2f18 100644 --- a/storage/ent/db/connector_create.go +++ b/storage/ent/db/connector_create.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package db @@ -75,16 +75,28 @@ func (cc *ConnectorCreate) Save(ctx context.Context) (*Connector, error) { return nil, err } cc.mutation = mutation - node, err = cc.sqlSave(ctx) + if node, err = cc.sqlSave(ctx); err != nil { + return nil, err + } + mutation.id = &node.ID mutation.done = true return node, err }) for i := len(cc.hooks) - 1; i >= 0; i-- { + if cc.hooks[i] == nil { + return nil, fmt.Errorf("db: uninitialized hook (forgotten import db/runtime?)") + } mut = cc.hooks[i](mut) } - if _, err := mut.Mutate(ctx, cc.mutation); err != nil { + v, err := mut.Mutate(ctx, cc.mutation) + if err != nil { return nil, err } + nv, ok := v.(*Connector) + if !ok { + return nil, fmt.Errorf("unexpected node type %T returned from ConnectorMutation", v) + } + node = nv } return node, err } @@ -98,33 +110,46 @@ func (cc *ConnectorCreate) SaveX(ctx context.Context) *Connector { return v } +// Exec executes the query. +func (cc *ConnectorCreate) Exec(ctx context.Context) error { + _, err := cc.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (cc *ConnectorCreate) ExecX(ctx context.Context) { + if err := cc.Exec(ctx); err != nil { + panic(err) + } +} + // 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 @@ -133,11 +158,18 @@ func (cc *ConnectorCreate) check() error { func (cc *ConnectorCreate) sqlSave(ctx context.Context) (*Connector, error) { _node, _spec := cc.createSpec() if err := sqlgraph.CreateNode(ctx, cc.driver, _spec); err != nil { - if cerr, ok := isSQLConstraintError(err); ok { - err = cerr + if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} } 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 } @@ -219,17 +251,19 @@ func (ccb *ConnectorCreateBulk) Save(ctx context.Context) ([]*Connector, error) if i < len(mutators)-1 { _, err = mutators[i+1].Mutate(root, ccb.builders[i+1].mutation) } else { + spec := &sqlgraph.BatchCreateSpec{Nodes: specs} // Invoke the actual operation on the latest mutation in the chain. - if err = sqlgraph.BatchCreate(ctx, ccb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil { - if cerr, ok := isSQLConstraintError(err); ok { - err = cerr + if err = sqlgraph.BatchCreate(ctx, ccb.driver, spec); err != nil { + if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} } } } - mutation.done = true if err != nil { return nil, err } + mutation.id = &nodes[i].ID + mutation.done = true return nodes[i], nil }) for i := len(builder.hooks) - 1; i >= 0; i-- { @@ -254,3 +288,16 @@ func (ccb *ConnectorCreateBulk) SaveX(ctx context.Context) []*Connector { } return v } + +// Exec executes the query. +func (ccb *ConnectorCreateBulk) Exec(ctx context.Context) error { + _, err := ccb.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (ccb *ConnectorCreateBulk) ExecX(ctx context.Context) { + if err := ccb.Exec(ctx); err != nil { + panic(err) + } +} diff --git a/storage/ent/db/connector_delete.go b/storage/ent/db/connector_delete.go index 1368fcc1dc..0c5381eef5 100644 --- a/storage/ent/db/connector_delete.go +++ b/storage/ent/db/connector_delete.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package db @@ -20,9 +20,9 @@ type ConnectorDelete struct { mutation *ConnectorMutation } -// Where adds a new predicate to the ConnectorDelete builder. +// Where appends a list predicates to the ConnectorDelete builder. func (cd *ConnectorDelete) Where(ps ...predicate.Connector) *ConnectorDelete { - cd.mutation.predicates = append(cd.mutation.predicates, ps...) + cd.mutation.Where(ps...) return cd } @@ -46,6 +46,9 @@ func (cd *ConnectorDelete) Exec(ctx context.Context) (int, error) { return affected, err }) for i := len(cd.hooks) - 1; i >= 0; i-- { + if cd.hooks[i] == nil { + return 0, fmt.Errorf("db: uninitialized hook (forgotten import db/runtime?)") + } mut = cd.hooks[i](mut) } if _, err := mut.Mutate(ctx, cd.mutation); err != nil { @@ -81,7 +84,11 @@ func (cd *ConnectorDelete) sqlExec(ctx context.Context) (int, error) { } } } - return sqlgraph.DeleteNodes(ctx, cd.driver, _spec) + affected, err := sqlgraph.DeleteNodes(ctx, cd.driver, _spec) + if err != nil && sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} + } + return affected, err } // ConnectorDeleteOne is the builder for deleting a single Connector entity. diff --git a/storage/ent/db/connector_query.go b/storage/ent/db/connector_query.go index 2b4c787221..32d6020499 100644 --- a/storage/ent/db/connector_query.go +++ b/storage/ent/db/connector_query.go @@ -1,10 +1,9 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package db import ( "context" - "errors" "fmt" "math" @@ -106,7 +105,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 +132,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 +241,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, } } @@ -263,15 +263,17 @@ func (cq *ConnectorQuery) Clone() *ConnectorQuery { // Scan(ctx, &v) // func (cq *ConnectorQuery) GroupBy(field string, fields ...string) *ConnectorGroupBy { - group := &ConnectorGroupBy{config: cq.config} - group.fields = append([]string{field}, fields...) - group.path = func(ctx context.Context) (prev *sql.Selector, err error) { + grbuild := &ConnectorGroupBy{config: cq.config} + grbuild.fields = append([]string{field}, fields...) + grbuild.path = func(ctx context.Context) (prev *sql.Selector, err error) { if err := cq.prepareQuery(ctx); err != nil { return nil, err } return cq.sqlQuery(ctx), nil } - return group + grbuild.label = connector.Label + grbuild.flds, grbuild.scan = &grbuild.fields, grbuild.Scan + return grbuild } // Select allows the selection one or more fields/columns for the given query, @@ -287,9 +289,12 @@ func (cq *ConnectorQuery) GroupBy(field string, fields ...string) *ConnectorGrou // Select(connector.FieldType). // Scan(ctx, &v) // -func (cq *ConnectorQuery) Select(field string, fields ...string) *ConnectorSelect { - cq.fields = append([]string{field}, fields...) - return &ConnectorSelect{ConnectorQuery: cq} +func (cq *ConnectorQuery) Select(fields ...string) *ConnectorSelect { + cq.fields = append(cq.fields, fields...) + selbuild := &ConnectorSelect{ConnectorQuery: cq} + selbuild.label = connector.Label + selbuild.flds, selbuild.scan = &cq.fields, selbuild.Scan + return selbuild } func (cq *ConnectorQuery) prepareQuery(ctx context.Context) error { @@ -308,23 +313,22 @@ func (cq *ConnectorQuery) prepareQuery(ctx context.Context) error { return nil } -func (cq *ConnectorQuery) sqlAll(ctx context.Context) ([]*Connector, error) { +func (cq *ConnectorQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Connector, error) { var ( nodes = []*Connector{} _spec = cq.querySpec() ) _spec.ScanValues = func(columns []string) ([]interface{}, error) { - node := &Connector{config: cq.config} - nodes = append(nodes, node) - return node.scanValues(columns) + return (*Connector).scanValues(nil, columns) } _spec.Assign = func(columns []string, values []interface{}) error { - if len(nodes) == 0 { - return fmt.Errorf("db: Assign called without calling ScanValues") - } - node := nodes[len(nodes)-1] + node := &Connector{config: cq.config} + nodes = append(nodes, node) return node.assignValues(columns, values) } + for i := range hooks { + hooks[i](ctx, _spec) + } if err := sqlgraph.QueryNodes(ctx, cq.driver, _spec); err != nil { return nil, err } @@ -336,6 +340,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) } @@ -398,10 +406,17 @@ func (cq *ConnectorQuery) querySpec() *sqlgraph.QuerySpec { func (cq *ConnectorQuery) sqlQuery(ctx context.Context) *sql.Selector { builder := sql.Dialect(cq.driver.Dialect()) t1 := builder.Table(connector.Table) - selector := builder.Select(t1.Columns(connector.Columns...)...).From(t1) + columns := cq.fields + if len(columns) == 0 { + columns = connector.Columns + } + selector := builder.Select(t1.Columns(columns...)...).From(t1) if cq.sql != nil { selector = cq.sql - selector.Select(selector.Columns(connector.Columns...)...) + selector.Select(selector.Columns(columns...)...) + } + if cq.unique != nil && *cq.unique { + selector.Distinct() } for _, p := range cq.predicates { p(selector) @@ -423,6 +438,7 @@ func (cq *ConnectorQuery) sqlQuery(ctx context.Context) *sql.Selector { // ConnectorGroupBy is the group-by builder for Connector entities. type ConnectorGroupBy struct { config + selector fields []string fns []AggregateFunc // intermediate query (i.e. traversal path). @@ -446,209 +462,6 @@ func (cgb *ConnectorGroupBy) Scan(ctx context.Context, v interface{}) error { return cgb.sqlScan(ctx, v) } -// ScanX is like Scan, but panics if an error occurs. -func (cgb *ConnectorGroupBy) ScanX(ctx context.Context, v interface{}) { - if err := cgb.Scan(ctx, v); err != nil { - panic(err) - } -} - -// Strings returns list of strings from group-by. -// It is only allowed when executing a group-by query with one field. -func (cgb *ConnectorGroupBy) Strings(ctx context.Context) ([]string, error) { - if len(cgb.fields) > 1 { - return nil, errors.New("db: ConnectorGroupBy.Strings is not achievable when grouping more than 1 field") - } - var v []string - if err := cgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// StringsX is like Strings, but panics if an error occurs. -func (cgb *ConnectorGroupBy) StringsX(ctx context.Context) []string { - v, err := cgb.Strings(ctx) - if err != nil { - panic(err) - } - return v -} - -// String returns a single string from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (cgb *ConnectorGroupBy) String(ctx context.Context) (_ string, err error) { - var v []string - if v, err = cgb.Strings(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{connector.Label} - default: - err = fmt.Errorf("db: ConnectorGroupBy.Strings returned %d results when one was expected", len(v)) - } - return -} - -// StringX is like String, but panics if an error occurs. -func (cgb *ConnectorGroupBy) StringX(ctx context.Context) string { - v, err := cgb.String(ctx) - if err != nil { - panic(err) - } - return v -} - -// Ints returns list of ints from group-by. -// It is only allowed when executing a group-by query with one field. -func (cgb *ConnectorGroupBy) Ints(ctx context.Context) ([]int, error) { - if len(cgb.fields) > 1 { - return nil, errors.New("db: ConnectorGroupBy.Ints is not achievable when grouping more than 1 field") - } - var v []int - if err := cgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// IntsX is like Ints, but panics if an error occurs. -func (cgb *ConnectorGroupBy) IntsX(ctx context.Context) []int { - v, err := cgb.Ints(ctx) - if err != nil { - panic(err) - } - return v -} - -// Int returns a single int from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (cgb *ConnectorGroupBy) Int(ctx context.Context) (_ int, err error) { - var v []int - if v, err = cgb.Ints(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{connector.Label} - default: - err = fmt.Errorf("db: ConnectorGroupBy.Ints returned %d results when one was expected", len(v)) - } - return -} - -// IntX is like Int, but panics if an error occurs. -func (cgb *ConnectorGroupBy) IntX(ctx context.Context) int { - v, err := cgb.Int(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64s returns list of float64s from group-by. -// It is only allowed when executing a group-by query with one field. -func (cgb *ConnectorGroupBy) Float64s(ctx context.Context) ([]float64, error) { - if len(cgb.fields) > 1 { - return nil, errors.New("db: ConnectorGroupBy.Float64s is not achievable when grouping more than 1 field") - } - var v []float64 - if err := cgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// Float64sX is like Float64s, but panics if an error occurs. -func (cgb *ConnectorGroupBy) Float64sX(ctx context.Context) []float64 { - v, err := cgb.Float64s(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64 returns a single float64 from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (cgb *ConnectorGroupBy) Float64(ctx context.Context) (_ float64, err error) { - var v []float64 - if v, err = cgb.Float64s(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{connector.Label} - default: - err = fmt.Errorf("db: ConnectorGroupBy.Float64s returned %d results when one was expected", len(v)) - } - return -} - -// Float64X is like Float64, but panics if an error occurs. -func (cgb *ConnectorGroupBy) Float64X(ctx context.Context) float64 { - v, err := cgb.Float64(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bools returns list of bools from group-by. -// It is only allowed when executing a group-by query with one field. -func (cgb *ConnectorGroupBy) Bools(ctx context.Context) ([]bool, error) { - if len(cgb.fields) > 1 { - return nil, errors.New("db: ConnectorGroupBy.Bools is not achievable when grouping more than 1 field") - } - var v []bool - if err := cgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// BoolsX is like Bools, but panics if an error occurs. -func (cgb *ConnectorGroupBy) BoolsX(ctx context.Context) []bool { - v, err := cgb.Bools(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bool returns a single bool from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (cgb *ConnectorGroupBy) Bool(ctx context.Context) (_ bool, err error) { - var v []bool - if v, err = cgb.Bools(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{connector.Label} - default: - err = fmt.Errorf("db: ConnectorGroupBy.Bools returned %d results when one was expected", len(v)) - } - return -} - -// BoolX is like Bool, but panics if an error occurs. -func (cgb *ConnectorGroupBy) BoolX(ctx context.Context) bool { - v, err := cgb.Bool(ctx) - if err != nil { - panic(err) - } - return v -} - func (cgb *ConnectorGroupBy) sqlScan(ctx context.Context, v interface{}) error { for _, f := range cgb.fields { if !connector.ValidColumn(f) { @@ -669,18 +482,28 @@ func (cgb *ConnectorGroupBy) sqlScan(ctx context.Context, v interface{}) error { } func (cgb *ConnectorGroupBy) sqlQuery() *sql.Selector { - selector := cgb.sql - columns := make([]string, 0, len(cgb.fields)+len(cgb.fns)) - columns = append(columns, cgb.fields...) + selector := cgb.sql.Select() + aggregation := make([]string, 0, len(cgb.fns)) for _, fn := range cgb.fns { - columns = append(columns, fn(selector)) + aggregation = append(aggregation, fn(selector)) + } + // If no columns were selected in a custom aggregation function, the default + // selection is the fields used for "group-by", and the aggregation functions. + if len(selector.SelectedColumns()) == 0 { + columns := make([]string, 0, len(cgb.fields)+len(cgb.fns)) + for _, f := range cgb.fields { + columns = append(columns, selector.C(f)) + } + columns = append(columns, aggregation...) + selector.Select(columns...) } - return selector.Select(columns...).GroupBy(cgb.fields...) + return selector.GroupBy(selector.Columns(cgb.fields...)...) } // ConnectorSelect is the builder for selecting fields of Connector entities. type ConnectorSelect struct { *ConnectorQuery + selector // intermediate query (i.e. traversal path). sql *sql.Selector } @@ -694,213 +517,12 @@ func (cs *ConnectorSelect) Scan(ctx context.Context, v interface{}) error { return cs.sqlScan(ctx, v) } -// ScanX is like Scan, but panics if an error occurs. -func (cs *ConnectorSelect) ScanX(ctx context.Context, v interface{}) { - if err := cs.Scan(ctx, v); err != nil { - panic(err) - } -} - -// Strings returns list of strings from a selector. It is only allowed when selecting one field. -func (cs *ConnectorSelect) Strings(ctx context.Context) ([]string, error) { - if len(cs.fields) > 1 { - return nil, errors.New("db: ConnectorSelect.Strings is not achievable when selecting more than 1 field") - } - var v []string - if err := cs.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// StringsX is like Strings, but panics if an error occurs. -func (cs *ConnectorSelect) StringsX(ctx context.Context) []string { - v, err := cs.Strings(ctx) - if err != nil { - panic(err) - } - return v -} - -// String returns a single string from a selector. It is only allowed when selecting one field. -func (cs *ConnectorSelect) String(ctx context.Context) (_ string, err error) { - var v []string - if v, err = cs.Strings(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{connector.Label} - default: - err = fmt.Errorf("db: ConnectorSelect.Strings returned %d results when one was expected", len(v)) - } - return -} - -// StringX is like String, but panics if an error occurs. -func (cs *ConnectorSelect) StringX(ctx context.Context) string { - v, err := cs.String(ctx) - if err != nil { - panic(err) - } - return v -} - -// Ints returns list of ints from a selector. It is only allowed when selecting one field. -func (cs *ConnectorSelect) Ints(ctx context.Context) ([]int, error) { - if len(cs.fields) > 1 { - return nil, errors.New("db: ConnectorSelect.Ints is not achievable when selecting more than 1 field") - } - var v []int - if err := cs.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// IntsX is like Ints, but panics if an error occurs. -func (cs *ConnectorSelect) IntsX(ctx context.Context) []int { - v, err := cs.Ints(ctx) - if err != nil { - panic(err) - } - return v -} - -// Int returns a single int from a selector. It is only allowed when selecting one field. -func (cs *ConnectorSelect) Int(ctx context.Context) (_ int, err error) { - var v []int - if v, err = cs.Ints(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{connector.Label} - default: - err = fmt.Errorf("db: ConnectorSelect.Ints returned %d results when one was expected", len(v)) - } - return -} - -// IntX is like Int, but panics if an error occurs. -func (cs *ConnectorSelect) IntX(ctx context.Context) int { - v, err := cs.Int(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64s returns list of float64s from a selector. It is only allowed when selecting one field. -func (cs *ConnectorSelect) Float64s(ctx context.Context) ([]float64, error) { - if len(cs.fields) > 1 { - return nil, errors.New("db: ConnectorSelect.Float64s is not achievable when selecting more than 1 field") - } - var v []float64 - if err := cs.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// Float64sX is like Float64s, but panics if an error occurs. -func (cs *ConnectorSelect) Float64sX(ctx context.Context) []float64 { - v, err := cs.Float64s(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64 returns a single float64 from a selector. It is only allowed when selecting one field. -func (cs *ConnectorSelect) Float64(ctx context.Context) (_ float64, err error) { - var v []float64 - if v, err = cs.Float64s(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{connector.Label} - default: - err = fmt.Errorf("db: ConnectorSelect.Float64s returned %d results when one was expected", len(v)) - } - return -} - -// Float64X is like Float64, but panics if an error occurs. -func (cs *ConnectorSelect) Float64X(ctx context.Context) float64 { - v, err := cs.Float64(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bools returns list of bools from a selector. It is only allowed when selecting one field. -func (cs *ConnectorSelect) Bools(ctx context.Context) ([]bool, error) { - if len(cs.fields) > 1 { - return nil, errors.New("db: ConnectorSelect.Bools is not achievable when selecting more than 1 field") - } - var v []bool - if err := cs.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// BoolsX is like Bools, but panics if an error occurs. -func (cs *ConnectorSelect) BoolsX(ctx context.Context) []bool { - v, err := cs.Bools(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bool returns a single bool from a selector. It is only allowed when selecting one field. -func (cs *ConnectorSelect) Bool(ctx context.Context) (_ bool, err error) { - var v []bool - if v, err = cs.Bools(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{connector.Label} - default: - err = fmt.Errorf("db: ConnectorSelect.Bools returned %d results when one was expected", len(v)) - } - return -} - -// BoolX is like Bool, but panics if an error occurs. -func (cs *ConnectorSelect) BoolX(ctx context.Context) bool { - v, err := cs.Bool(ctx) - if err != nil { - panic(err) - } - return v -} - func (cs *ConnectorSelect) sqlScan(ctx context.Context, v interface{}) error { rows := &sql.Rows{} - query, args := cs.sqlQuery().Query() + query, args := cs.sql.Query() if err := cs.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() return sql.ScanSlice(rows, v) } - -func (cs *ConnectorSelect) sqlQuery() sql.Querier { - selector := cs.sql - selector.Select(selector.Columns(cs.fields...)...) - return selector -} diff --git a/storage/ent/db/connector_update.go b/storage/ent/db/connector_update.go index 90c972e4f2..736d0a62fb 100644 --- a/storage/ent/db/connector_update.go +++ b/storage/ent/db/connector_update.go @@ -1,9 +1,10 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package db import ( "context" + "errors" "fmt" "entgo.io/ent/dialect/sql" @@ -20,9 +21,9 @@ type ConnectorUpdate struct { mutation *ConnectorMutation } -// Where adds a new predicate for the ConnectorUpdate builder. +// Where appends a list predicates to the ConnectorUpdate builder. func (cu *ConnectorUpdate) Where(ps ...predicate.Connector) *ConnectorUpdate { - cu.mutation.predicates = append(cu.mutation.predicates, ps...) + cu.mutation.Where(ps...) return cu } @@ -81,6 +82,9 @@ func (cu *ConnectorUpdate) Save(ctx context.Context) (int, error) { return affected, err }) for i := len(cu.hooks) - 1; i >= 0; i-- { + if cu.hooks[i] == nil { + return 0, fmt.Errorf("db: uninitialized hook (forgotten import db/runtime?)") + } mut = cu.hooks[i](mut) } if _, err := mut.Mutate(ctx, cu.mutation); err != nil { @@ -116,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 @@ -176,8 +180,8 @@ func (cu *ConnectorUpdate) sqlSave(ctx context.Context) (n int, err error) { if n, err = sqlgraph.UpdateNodes(ctx, cu.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{connector.Label} - } else if cerr, ok := isSQLConstraintError(err); ok { - err = cerr + } else if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} } return 0, err } @@ -254,11 +258,20 @@ func (cuo *ConnectorUpdateOne) Save(ctx context.Context) (*Connector, error) { return node, err }) for i := len(cuo.hooks) - 1; i >= 0; i-- { + if cuo.hooks[i] == nil { + return nil, fmt.Errorf("db: uninitialized hook (forgotten import db/runtime?)") + } mut = cuo.hooks[i](mut) } - if _, err := mut.Mutate(ctx, cuo.mutation); err != nil { + v, err := mut.Mutate(ctx, cuo.mutation) + if err != nil { return nil, err } + nv, ok := v.(*Connector) + if !ok { + return nil, fmt.Errorf("unexpected node type %T returned from ConnectorMutation", v) + } + node = nv } return node, err } @@ -289,12 +302,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 @@ -313,7 +326,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 { @@ -369,8 +382,8 @@ func (cuo *ConnectorUpdateOne) sqlSave(ctx context.Context) (_node *Connector, e if err = sqlgraph.UpdateNode(ctx, cuo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{connector.Label} - } else if cerr, ok := isSQLConstraintError(err); ok { - err = cerr + } else if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } diff --git a/storage/ent/db/context.go b/storage/ent/db/context.go index 544570dba4..95e1ad8b09 100644 --- a/storage/ent/db/context.go +++ b/storage/ent/db/context.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package db diff --git a/storage/ent/db/devicerequest.go b/storage/ent/db/devicerequest.go index d50a7c836d..d358f1741f 100644 --- a/storage/ent/db/devicerequest.go +++ b/storage/ent/db/devicerequest.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package db @@ -90,7 +90,6 @@ func (dr *DeviceRequest) assignValues(columns []string, values []interface{}) er dr.ClientSecret = value.String } case devicerequest.FieldScopes: - if value, ok := values[i].(*[]byte); !ok { return fmt.Errorf("unexpected type %T for field scopes", values[i]) } else if value != nil && len(*value) > 0 { @@ -119,11 +118,11 @@ func (dr *DeviceRequest) Update() *DeviceRequestUpdateOne { // Unwrap unwraps the DeviceRequest entity that was returned from a transaction after it was closed, // so that all future queries will be executed through the driver which created the transaction. func (dr *DeviceRequest) Unwrap() *DeviceRequest { - tx, ok := dr.config.driver.(*txDriver) + _tx, ok := dr.config.driver.(*txDriver) if !ok { panic("db: DeviceRequest is not a transactional entity") } - dr.config.driver = tx.drv + dr.config.driver = _tx.drv return dr } @@ -131,18 +130,23 @@ func (dr *DeviceRequest) Unwrap() *DeviceRequest { func (dr *DeviceRequest) String() string { var builder strings.Builder builder.WriteString("DeviceRequest(") - builder.WriteString(fmt.Sprintf("id=%v", dr.ID)) - builder.WriteString(", user_code=") + builder.WriteString(fmt.Sprintf("id=%v, ", dr.ID)) + builder.WriteString("user_code=") builder.WriteString(dr.UserCode) - builder.WriteString(", device_code=") + builder.WriteString(", ") + builder.WriteString("device_code=") builder.WriteString(dr.DeviceCode) - builder.WriteString(", client_id=") + builder.WriteString(", ") + builder.WriteString("client_id=") builder.WriteString(dr.ClientID) - builder.WriteString(", client_secret=") + builder.WriteString(", ") + builder.WriteString("client_secret=") builder.WriteString(dr.ClientSecret) - builder.WriteString(", scopes=") + builder.WriteString(", ") + builder.WriteString("scopes=") builder.WriteString(fmt.Sprintf("%v", dr.Scopes)) - builder.WriteString(", expiry=") + builder.WriteString(", ") + builder.WriteString("expiry=") builder.WriteString(dr.Expiry.Format(time.ANSIC)) builder.WriteByte(')') return builder.String() diff --git a/storage/ent/db/devicerequest/devicerequest.go b/storage/ent/db/devicerequest/devicerequest.go index 487662ce17..5dd032d613 100644 --- a/storage/ent/db/devicerequest/devicerequest.go +++ b/storage/ent/db/devicerequest/devicerequest.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package devicerequest diff --git a/storage/ent/db/devicerequest/where.go b/storage/ent/db/devicerequest/where.go index a9273bbd63..8cf7942be4 100644 --- a/storage/ent/db/devicerequest/where.go +++ b/storage/ent/db/devicerequest/where.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package devicerequest @@ -33,12 +33,6 @@ func IDNEQ(id int) predicate.DeviceRequest { // IDIn applies the In predicate on the ID field. func IDIn(ids ...int) predicate.DeviceRequest { return predicate.DeviceRequest(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(ids) == 0 { - s.Where(sql.False()) - return - } v := make([]interface{}, len(ids)) for i := range v { v[i] = ids[i] @@ -50,12 +44,6 @@ func IDIn(ids ...int) predicate.DeviceRequest { // IDNotIn applies the NotIn predicate on the ID field. func IDNotIn(ids ...int) predicate.DeviceRequest { return predicate.DeviceRequest(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(ids) == 0 { - s.Where(sql.False()) - return - } v := make([]interface{}, len(ids)) for i := range v { v[i] = ids[i] diff --git a/storage/ent/db/devicerequest_create.go b/storage/ent/db/devicerequest_create.go index 70599fede2..ae7644ca0c 100644 --- a/storage/ent/db/devicerequest_create.go +++ b/storage/ent/db/devicerequest_create.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package db @@ -82,16 +82,28 @@ func (drc *DeviceRequestCreate) Save(ctx context.Context) (*DeviceRequest, error return nil, err } drc.mutation = mutation - node, err = drc.sqlSave(ctx) + if node, err = drc.sqlSave(ctx); err != nil { + return nil, err + } + mutation.id = &node.ID mutation.done = true return node, err }) for i := len(drc.hooks) - 1; i >= 0; i-- { + if drc.hooks[i] == nil { + return nil, fmt.Errorf("db: uninitialized hook (forgotten import db/runtime?)") + } mut = drc.hooks[i](mut) } - if _, err := mut.Mutate(ctx, drc.mutation); err != nil { + v, err := mut.Mutate(ctx, drc.mutation) + if err != nil { return nil, err } + nv, ok := v.(*DeviceRequest) + if !ok { + return nil, fmt.Errorf("unexpected node type %T returned from DeviceRequestMutation", v) + } + node = nv } return node, err } @@ -105,42 +117,55 @@ func (drc *DeviceRequestCreate) SaveX(ctx context.Context) *DeviceRequest { return v } +// Exec executes the query. +func (drc *DeviceRequestCreate) Exec(ctx context.Context) error { + _, err := drc.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (drc *DeviceRequestCreate) ExecX(ctx context.Context) { + if err := drc.Exec(ctx); err != nil { + panic(err) + } +} + // 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 } @@ -148,8 +173,8 @@ func (drc *DeviceRequestCreate) check() error { func (drc *DeviceRequestCreate) sqlSave(ctx context.Context) (*DeviceRequest, error) { _node, _spec := drc.createSpec() if err := sqlgraph.CreateNode(ctx, drc.driver, _spec); err != nil { - if cerr, ok := isSQLConstraintError(err); ok { - err = cerr + if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } @@ -248,19 +273,23 @@ func (drcb *DeviceRequestCreateBulk) Save(ctx context.Context) ([]*DeviceRequest if i < len(mutators)-1 { _, err = mutators[i+1].Mutate(root, drcb.builders[i+1].mutation) } else { + spec := &sqlgraph.BatchCreateSpec{Nodes: specs} // Invoke the actual operation on the latest mutation in the chain. - if err = sqlgraph.BatchCreate(ctx, drcb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil { - if cerr, ok := isSQLConstraintError(err); ok { - err = cerr + if err = sqlgraph.BatchCreate(ctx, drcb.driver, spec); err != nil { + if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} } } } - mutation.done = true if err != nil { return nil, err } - id := specs[i].ID.Value.(int64) - nodes[i].ID = int(id) + mutation.id = &nodes[i].ID + if specs[i].ID.Value != nil { + id := specs[i].ID.Value.(int64) + nodes[i].ID = int(id) + } + mutation.done = true return nodes[i], nil }) for i := len(builder.hooks) - 1; i >= 0; i-- { @@ -285,3 +314,16 @@ func (drcb *DeviceRequestCreateBulk) SaveX(ctx context.Context) []*DeviceRequest } return v } + +// Exec executes the query. +func (drcb *DeviceRequestCreateBulk) Exec(ctx context.Context) error { + _, err := drcb.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (drcb *DeviceRequestCreateBulk) ExecX(ctx context.Context) { + if err := drcb.Exec(ctx); err != nil { + panic(err) + } +} diff --git a/storage/ent/db/devicerequest_delete.go b/storage/ent/db/devicerequest_delete.go index 34c0b89044..635a8a498d 100644 --- a/storage/ent/db/devicerequest_delete.go +++ b/storage/ent/db/devicerequest_delete.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package db @@ -20,9 +20,9 @@ type DeviceRequestDelete struct { mutation *DeviceRequestMutation } -// Where adds a new predicate to the DeviceRequestDelete builder. +// Where appends a list predicates to the DeviceRequestDelete builder. func (drd *DeviceRequestDelete) Where(ps ...predicate.DeviceRequest) *DeviceRequestDelete { - drd.mutation.predicates = append(drd.mutation.predicates, ps...) + drd.mutation.Where(ps...) return drd } @@ -46,6 +46,9 @@ func (drd *DeviceRequestDelete) Exec(ctx context.Context) (int, error) { return affected, err }) for i := len(drd.hooks) - 1; i >= 0; i-- { + if drd.hooks[i] == nil { + return 0, fmt.Errorf("db: uninitialized hook (forgotten import db/runtime?)") + } mut = drd.hooks[i](mut) } if _, err := mut.Mutate(ctx, drd.mutation); err != nil { @@ -81,7 +84,11 @@ func (drd *DeviceRequestDelete) sqlExec(ctx context.Context) (int, error) { } } } - return sqlgraph.DeleteNodes(ctx, drd.driver, _spec) + affected, err := sqlgraph.DeleteNodes(ctx, drd.driver, _spec) + if err != nil && sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} + } + return affected, err } // DeviceRequestDeleteOne is the builder for deleting a single DeviceRequest entity. diff --git a/storage/ent/db/devicerequest_query.go b/storage/ent/db/devicerequest_query.go index 08c76871bb..3fd43dd89d 100644 --- a/storage/ent/db/devicerequest_query.go +++ b/storage/ent/db/devicerequest_query.go @@ -1,10 +1,9 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package db import ( "context" - "errors" "fmt" "math" @@ -106,7 +105,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 +132,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 +241,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, } } @@ -263,15 +263,17 @@ func (drq *DeviceRequestQuery) Clone() *DeviceRequestQuery { // Scan(ctx, &v) // func (drq *DeviceRequestQuery) GroupBy(field string, fields ...string) *DeviceRequestGroupBy { - group := &DeviceRequestGroupBy{config: drq.config} - group.fields = append([]string{field}, fields...) - group.path = func(ctx context.Context) (prev *sql.Selector, err error) { + grbuild := &DeviceRequestGroupBy{config: drq.config} + grbuild.fields = append([]string{field}, fields...) + grbuild.path = func(ctx context.Context) (prev *sql.Selector, err error) { if err := drq.prepareQuery(ctx); err != nil { return nil, err } return drq.sqlQuery(ctx), nil } - return group + grbuild.label = devicerequest.Label + grbuild.flds, grbuild.scan = &grbuild.fields, grbuild.Scan + return grbuild } // Select allows the selection one or more fields/columns for the given query, @@ -287,9 +289,12 @@ func (drq *DeviceRequestQuery) GroupBy(field string, fields ...string) *DeviceRe // Select(devicerequest.FieldUserCode). // Scan(ctx, &v) // -func (drq *DeviceRequestQuery) Select(field string, fields ...string) *DeviceRequestSelect { - drq.fields = append([]string{field}, fields...) - return &DeviceRequestSelect{DeviceRequestQuery: drq} +func (drq *DeviceRequestQuery) Select(fields ...string) *DeviceRequestSelect { + drq.fields = append(drq.fields, fields...) + selbuild := &DeviceRequestSelect{DeviceRequestQuery: drq} + selbuild.label = devicerequest.Label + selbuild.flds, selbuild.scan = &drq.fields, selbuild.Scan + return selbuild } func (drq *DeviceRequestQuery) prepareQuery(ctx context.Context) error { @@ -308,23 +313,22 @@ func (drq *DeviceRequestQuery) prepareQuery(ctx context.Context) error { return nil } -func (drq *DeviceRequestQuery) sqlAll(ctx context.Context) ([]*DeviceRequest, error) { +func (drq *DeviceRequestQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*DeviceRequest, error) { var ( nodes = []*DeviceRequest{} _spec = drq.querySpec() ) _spec.ScanValues = func(columns []string) ([]interface{}, error) { - node := &DeviceRequest{config: drq.config} - nodes = append(nodes, node) - return node.scanValues(columns) + return (*DeviceRequest).scanValues(nil, columns) } _spec.Assign = func(columns []string, values []interface{}) error { - if len(nodes) == 0 { - return fmt.Errorf("db: Assign called without calling ScanValues") - } - node := nodes[len(nodes)-1] + node := &DeviceRequest{config: drq.config} + nodes = append(nodes, node) return node.assignValues(columns, values) } + for i := range hooks { + hooks[i](ctx, _spec) + } if err := sqlgraph.QueryNodes(ctx, drq.driver, _spec); err != nil { return nil, err } @@ -336,6 +340,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) } @@ -398,10 +406,17 @@ func (drq *DeviceRequestQuery) querySpec() *sqlgraph.QuerySpec { func (drq *DeviceRequestQuery) sqlQuery(ctx context.Context) *sql.Selector { builder := sql.Dialect(drq.driver.Dialect()) t1 := builder.Table(devicerequest.Table) - selector := builder.Select(t1.Columns(devicerequest.Columns...)...).From(t1) + columns := drq.fields + if len(columns) == 0 { + columns = devicerequest.Columns + } + selector := builder.Select(t1.Columns(columns...)...).From(t1) if drq.sql != nil { selector = drq.sql - selector.Select(selector.Columns(devicerequest.Columns...)...) + selector.Select(selector.Columns(columns...)...) + } + if drq.unique != nil && *drq.unique { + selector.Distinct() } for _, p := range drq.predicates { p(selector) @@ -423,6 +438,7 @@ func (drq *DeviceRequestQuery) sqlQuery(ctx context.Context) *sql.Selector { // DeviceRequestGroupBy is the group-by builder for DeviceRequest entities. type DeviceRequestGroupBy struct { config + selector fields []string fns []AggregateFunc // intermediate query (i.e. traversal path). @@ -446,209 +462,6 @@ func (drgb *DeviceRequestGroupBy) Scan(ctx context.Context, v interface{}) error return drgb.sqlScan(ctx, v) } -// ScanX is like Scan, but panics if an error occurs. -func (drgb *DeviceRequestGroupBy) ScanX(ctx context.Context, v interface{}) { - if err := drgb.Scan(ctx, v); err != nil { - panic(err) - } -} - -// Strings returns list of strings from group-by. -// It is only allowed when executing a group-by query with one field. -func (drgb *DeviceRequestGroupBy) Strings(ctx context.Context) ([]string, error) { - if len(drgb.fields) > 1 { - return nil, errors.New("db: DeviceRequestGroupBy.Strings is not achievable when grouping more than 1 field") - } - var v []string - if err := drgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// StringsX is like Strings, but panics if an error occurs. -func (drgb *DeviceRequestGroupBy) StringsX(ctx context.Context) []string { - v, err := drgb.Strings(ctx) - if err != nil { - panic(err) - } - return v -} - -// String returns a single string from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (drgb *DeviceRequestGroupBy) String(ctx context.Context) (_ string, err error) { - var v []string - if v, err = drgb.Strings(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{devicerequest.Label} - default: - err = fmt.Errorf("db: DeviceRequestGroupBy.Strings returned %d results when one was expected", len(v)) - } - return -} - -// StringX is like String, but panics if an error occurs. -func (drgb *DeviceRequestGroupBy) StringX(ctx context.Context) string { - v, err := drgb.String(ctx) - if err != nil { - panic(err) - } - return v -} - -// Ints returns list of ints from group-by. -// It is only allowed when executing a group-by query with one field. -func (drgb *DeviceRequestGroupBy) Ints(ctx context.Context) ([]int, error) { - if len(drgb.fields) > 1 { - return nil, errors.New("db: DeviceRequestGroupBy.Ints is not achievable when grouping more than 1 field") - } - var v []int - if err := drgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// IntsX is like Ints, but panics if an error occurs. -func (drgb *DeviceRequestGroupBy) IntsX(ctx context.Context) []int { - v, err := drgb.Ints(ctx) - if err != nil { - panic(err) - } - return v -} - -// Int returns a single int from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (drgb *DeviceRequestGroupBy) Int(ctx context.Context) (_ int, err error) { - var v []int - if v, err = drgb.Ints(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{devicerequest.Label} - default: - err = fmt.Errorf("db: DeviceRequestGroupBy.Ints returned %d results when one was expected", len(v)) - } - return -} - -// IntX is like Int, but panics if an error occurs. -func (drgb *DeviceRequestGroupBy) IntX(ctx context.Context) int { - v, err := drgb.Int(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64s returns list of float64s from group-by. -// It is only allowed when executing a group-by query with one field. -func (drgb *DeviceRequestGroupBy) Float64s(ctx context.Context) ([]float64, error) { - if len(drgb.fields) > 1 { - return nil, errors.New("db: DeviceRequestGroupBy.Float64s is not achievable when grouping more than 1 field") - } - var v []float64 - if err := drgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// Float64sX is like Float64s, but panics if an error occurs. -func (drgb *DeviceRequestGroupBy) Float64sX(ctx context.Context) []float64 { - v, err := drgb.Float64s(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64 returns a single float64 from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (drgb *DeviceRequestGroupBy) Float64(ctx context.Context) (_ float64, err error) { - var v []float64 - if v, err = drgb.Float64s(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{devicerequest.Label} - default: - err = fmt.Errorf("db: DeviceRequestGroupBy.Float64s returned %d results when one was expected", len(v)) - } - return -} - -// Float64X is like Float64, but panics if an error occurs. -func (drgb *DeviceRequestGroupBy) Float64X(ctx context.Context) float64 { - v, err := drgb.Float64(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bools returns list of bools from group-by. -// It is only allowed when executing a group-by query with one field. -func (drgb *DeviceRequestGroupBy) Bools(ctx context.Context) ([]bool, error) { - if len(drgb.fields) > 1 { - return nil, errors.New("db: DeviceRequestGroupBy.Bools is not achievable when grouping more than 1 field") - } - var v []bool - if err := drgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// BoolsX is like Bools, but panics if an error occurs. -func (drgb *DeviceRequestGroupBy) BoolsX(ctx context.Context) []bool { - v, err := drgb.Bools(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bool returns a single bool from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (drgb *DeviceRequestGroupBy) Bool(ctx context.Context) (_ bool, err error) { - var v []bool - if v, err = drgb.Bools(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{devicerequest.Label} - default: - err = fmt.Errorf("db: DeviceRequestGroupBy.Bools returned %d results when one was expected", len(v)) - } - return -} - -// BoolX is like Bool, but panics if an error occurs. -func (drgb *DeviceRequestGroupBy) BoolX(ctx context.Context) bool { - v, err := drgb.Bool(ctx) - if err != nil { - panic(err) - } - return v -} - func (drgb *DeviceRequestGroupBy) sqlScan(ctx context.Context, v interface{}) error { for _, f := range drgb.fields { if !devicerequest.ValidColumn(f) { @@ -669,18 +482,28 @@ func (drgb *DeviceRequestGroupBy) sqlScan(ctx context.Context, v interface{}) er } func (drgb *DeviceRequestGroupBy) sqlQuery() *sql.Selector { - selector := drgb.sql - columns := make([]string, 0, len(drgb.fields)+len(drgb.fns)) - columns = append(columns, drgb.fields...) + selector := drgb.sql.Select() + aggregation := make([]string, 0, len(drgb.fns)) for _, fn := range drgb.fns { - columns = append(columns, fn(selector)) + aggregation = append(aggregation, fn(selector)) + } + // If no columns were selected in a custom aggregation function, the default + // selection is the fields used for "group-by", and the aggregation functions. + if len(selector.SelectedColumns()) == 0 { + columns := make([]string, 0, len(drgb.fields)+len(drgb.fns)) + for _, f := range drgb.fields { + columns = append(columns, selector.C(f)) + } + columns = append(columns, aggregation...) + selector.Select(columns...) } - return selector.Select(columns...).GroupBy(drgb.fields...) + return selector.GroupBy(selector.Columns(drgb.fields...)...) } // DeviceRequestSelect is the builder for selecting fields of DeviceRequest entities. type DeviceRequestSelect struct { *DeviceRequestQuery + selector // intermediate query (i.e. traversal path). sql *sql.Selector } @@ -694,213 +517,12 @@ func (drs *DeviceRequestSelect) Scan(ctx context.Context, v interface{}) error { return drs.sqlScan(ctx, v) } -// ScanX is like Scan, but panics if an error occurs. -func (drs *DeviceRequestSelect) ScanX(ctx context.Context, v interface{}) { - if err := drs.Scan(ctx, v); err != nil { - panic(err) - } -} - -// Strings returns list of strings from a selector. It is only allowed when selecting one field. -func (drs *DeviceRequestSelect) Strings(ctx context.Context) ([]string, error) { - if len(drs.fields) > 1 { - return nil, errors.New("db: DeviceRequestSelect.Strings is not achievable when selecting more than 1 field") - } - var v []string - if err := drs.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// StringsX is like Strings, but panics if an error occurs. -func (drs *DeviceRequestSelect) StringsX(ctx context.Context) []string { - v, err := drs.Strings(ctx) - if err != nil { - panic(err) - } - return v -} - -// String returns a single string from a selector. It is only allowed when selecting one field. -func (drs *DeviceRequestSelect) String(ctx context.Context) (_ string, err error) { - var v []string - if v, err = drs.Strings(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{devicerequest.Label} - default: - err = fmt.Errorf("db: DeviceRequestSelect.Strings returned %d results when one was expected", len(v)) - } - return -} - -// StringX is like String, but panics if an error occurs. -func (drs *DeviceRequestSelect) StringX(ctx context.Context) string { - v, err := drs.String(ctx) - if err != nil { - panic(err) - } - return v -} - -// Ints returns list of ints from a selector. It is only allowed when selecting one field. -func (drs *DeviceRequestSelect) Ints(ctx context.Context) ([]int, error) { - if len(drs.fields) > 1 { - return nil, errors.New("db: DeviceRequestSelect.Ints is not achievable when selecting more than 1 field") - } - var v []int - if err := drs.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// IntsX is like Ints, but panics if an error occurs. -func (drs *DeviceRequestSelect) IntsX(ctx context.Context) []int { - v, err := drs.Ints(ctx) - if err != nil { - panic(err) - } - return v -} - -// Int returns a single int from a selector. It is only allowed when selecting one field. -func (drs *DeviceRequestSelect) Int(ctx context.Context) (_ int, err error) { - var v []int - if v, err = drs.Ints(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{devicerequest.Label} - default: - err = fmt.Errorf("db: DeviceRequestSelect.Ints returned %d results when one was expected", len(v)) - } - return -} - -// IntX is like Int, but panics if an error occurs. -func (drs *DeviceRequestSelect) IntX(ctx context.Context) int { - v, err := drs.Int(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64s returns list of float64s from a selector. It is only allowed when selecting one field. -func (drs *DeviceRequestSelect) Float64s(ctx context.Context) ([]float64, error) { - if len(drs.fields) > 1 { - return nil, errors.New("db: DeviceRequestSelect.Float64s is not achievable when selecting more than 1 field") - } - var v []float64 - if err := drs.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// Float64sX is like Float64s, but panics if an error occurs. -func (drs *DeviceRequestSelect) Float64sX(ctx context.Context) []float64 { - v, err := drs.Float64s(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64 returns a single float64 from a selector. It is only allowed when selecting one field. -func (drs *DeviceRequestSelect) Float64(ctx context.Context) (_ float64, err error) { - var v []float64 - if v, err = drs.Float64s(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{devicerequest.Label} - default: - err = fmt.Errorf("db: DeviceRequestSelect.Float64s returned %d results when one was expected", len(v)) - } - return -} - -// Float64X is like Float64, but panics if an error occurs. -func (drs *DeviceRequestSelect) Float64X(ctx context.Context) float64 { - v, err := drs.Float64(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bools returns list of bools from a selector. It is only allowed when selecting one field. -func (drs *DeviceRequestSelect) Bools(ctx context.Context) ([]bool, error) { - if len(drs.fields) > 1 { - return nil, errors.New("db: DeviceRequestSelect.Bools is not achievable when selecting more than 1 field") - } - var v []bool - if err := drs.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// BoolsX is like Bools, but panics if an error occurs. -func (drs *DeviceRequestSelect) BoolsX(ctx context.Context) []bool { - v, err := drs.Bools(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bool returns a single bool from a selector. It is only allowed when selecting one field. -func (drs *DeviceRequestSelect) Bool(ctx context.Context) (_ bool, err error) { - var v []bool - if v, err = drs.Bools(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{devicerequest.Label} - default: - err = fmt.Errorf("db: DeviceRequestSelect.Bools returned %d results when one was expected", len(v)) - } - return -} - -// BoolX is like Bool, but panics if an error occurs. -func (drs *DeviceRequestSelect) BoolX(ctx context.Context) bool { - v, err := drs.Bool(ctx) - if err != nil { - panic(err) - } - return v -} - func (drs *DeviceRequestSelect) sqlScan(ctx context.Context, v interface{}) error { rows := &sql.Rows{} - query, args := drs.sqlQuery().Query() + query, args := drs.sql.Query() if err := drs.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() return sql.ScanSlice(rows, v) } - -func (drs *DeviceRequestSelect) sqlQuery() sql.Querier { - selector := drs.sql - selector.Select(selector.Columns(drs.fields...)...) - return selector -} diff --git a/storage/ent/db/devicerequest_update.go b/storage/ent/db/devicerequest_update.go index d71ca0edc0..2bf38af697 100644 --- a/storage/ent/db/devicerequest_update.go +++ b/storage/ent/db/devicerequest_update.go @@ -1,9 +1,10 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package db import ( "context" + "errors" "fmt" "time" @@ -21,9 +22,9 @@ type DeviceRequestUpdate struct { mutation *DeviceRequestMutation } -// Where adds a new predicate for the DeviceRequestUpdate builder. +// Where appends a list predicates to the DeviceRequestUpdate builder. func (dru *DeviceRequestUpdate) Where(ps ...predicate.DeviceRequest) *DeviceRequestUpdate { - dru.mutation.predicates = append(dru.mutation.predicates, ps...) + dru.mutation.Where(ps...) return dru } @@ -100,6 +101,9 @@ func (dru *DeviceRequestUpdate) Save(ctx context.Context) (int, error) { return affected, err }) for i := len(dru.hooks) - 1; i >= 0; i-- { + if dru.hooks[i] == nil { + return 0, fmt.Errorf("db: uninitialized hook (forgotten import db/runtime?)") + } mut = dru.hooks[i](mut) } if _, err := mut.Mutate(ctx, dru.mutation); err != nil { @@ -135,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 @@ -225,8 +229,8 @@ func (dru *DeviceRequestUpdate) sqlSave(ctx context.Context) (n int, err error) if n, err = sqlgraph.UpdateNodes(ctx, dru.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{devicerequest.Label} - } else if cerr, ok := isSQLConstraintError(err); ok { - err = cerr + } else if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} } return 0, err } @@ -321,11 +325,20 @@ func (druo *DeviceRequestUpdateOne) Save(ctx context.Context) (*DeviceRequest, e return node, err }) for i := len(druo.hooks) - 1; i >= 0; i-- { + if druo.hooks[i] == nil { + return nil, fmt.Errorf("db: uninitialized hook (forgotten import db/runtime?)") + } mut = druo.hooks[i](mut) } - if _, err := mut.Mutate(ctx, druo.mutation); err != nil { + v, err := mut.Mutate(ctx, druo.mutation) + if err != nil { return nil, err } + nv, ok := v.(*DeviceRequest) + if !ok { + return nil, fmt.Errorf("unexpected node type %T returned from DeviceRequestMutation", v) + } + node = nv } return node, err } @@ -356,22 +369,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 @@ -390,7 +403,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 { @@ -466,8 +479,8 @@ func (druo *DeviceRequestUpdateOne) sqlSave(ctx context.Context) (_node *DeviceR if err = sqlgraph.UpdateNode(ctx, druo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{devicerequest.Label} - } else if cerr, ok := isSQLConstraintError(err); ok { - err = cerr + } else if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } diff --git a/storage/ent/db/devicetoken.go b/storage/ent/db/devicetoken.go index 1731d1f0ea..2ed932e211 100644 --- a/storage/ent/db/devicetoken.go +++ b/storage/ent/db/devicetoken.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package db @@ -115,11 +115,11 @@ func (dt *DeviceToken) Update() *DeviceTokenUpdateOne { // Unwrap unwraps the DeviceToken entity that was returned from a transaction after it was closed, // so that all future queries will be executed through the driver which created the transaction. func (dt *DeviceToken) Unwrap() *DeviceToken { - tx, ok := dt.config.driver.(*txDriver) + _tx, ok := dt.config.driver.(*txDriver) if !ok { panic("db: DeviceToken is not a transactional entity") } - dt.config.driver = tx.drv + dt.config.driver = _tx.drv return dt } @@ -127,20 +127,25 @@ func (dt *DeviceToken) Unwrap() *DeviceToken { func (dt *DeviceToken) String() string { var builder strings.Builder builder.WriteString("DeviceToken(") - builder.WriteString(fmt.Sprintf("id=%v", dt.ID)) - builder.WriteString(", device_code=") + builder.WriteString(fmt.Sprintf("id=%v, ", dt.ID)) + builder.WriteString("device_code=") builder.WriteString(dt.DeviceCode) - builder.WriteString(", status=") + builder.WriteString(", ") + builder.WriteString("status=") builder.WriteString(dt.Status) + builder.WriteString(", ") if v := dt.Token; v != nil { - builder.WriteString(", token=") + builder.WriteString("token=") builder.WriteString(fmt.Sprintf("%v", *v)) } - builder.WriteString(", expiry=") + builder.WriteString(", ") + builder.WriteString("expiry=") builder.WriteString(dt.Expiry.Format(time.ANSIC)) - builder.WriteString(", last_request=") + builder.WriteString(", ") + builder.WriteString("last_request=") builder.WriteString(dt.LastRequest.Format(time.ANSIC)) - builder.WriteString(", poll_interval=") + builder.WriteString(", ") + builder.WriteString("poll_interval=") builder.WriteString(fmt.Sprintf("%v", dt.PollInterval)) builder.WriteByte(')') return builder.String() diff --git a/storage/ent/db/devicetoken/devicetoken.go b/storage/ent/db/devicetoken/devicetoken.go index 7af657991e..1b13ee4e91 100644 --- a/storage/ent/db/devicetoken/devicetoken.go +++ b/storage/ent/db/devicetoken/devicetoken.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package devicetoken diff --git a/storage/ent/db/devicetoken/where.go b/storage/ent/db/devicetoken/where.go index b22879a6c2..ebd34c4f9f 100644 --- a/storage/ent/db/devicetoken/where.go +++ b/storage/ent/db/devicetoken/where.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package devicetoken @@ -33,12 +33,6 @@ func IDNEQ(id int) predicate.DeviceToken { // IDIn applies the In predicate on the ID field. func IDIn(ids ...int) predicate.DeviceToken { return predicate.DeviceToken(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(ids) == 0 { - s.Where(sql.False()) - return - } v := make([]interface{}, len(ids)) for i := range v { v[i] = ids[i] @@ -50,12 +44,6 @@ func IDIn(ids ...int) predicate.DeviceToken { // IDNotIn applies the NotIn predicate on the ID field. func IDNotIn(ids ...int) predicate.DeviceToken { return predicate.DeviceToken(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(ids) == 0 { - s.Where(sql.False()) - return - } v := make([]interface{}, len(ids)) for i := range v { v[i] = ids[i] diff --git a/storage/ent/db/devicetoken_create.go b/storage/ent/db/devicetoken_create.go index 50ed1aad62..9e845d9a64 100644 --- a/storage/ent/db/devicetoken_create.go +++ b/storage/ent/db/devicetoken_create.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package db @@ -82,16 +82,28 @@ func (dtc *DeviceTokenCreate) Save(ctx context.Context) (*DeviceToken, error) { return nil, err } dtc.mutation = mutation - node, err = dtc.sqlSave(ctx) + if node, err = dtc.sqlSave(ctx); err != nil { + return nil, err + } + mutation.id = &node.ID mutation.done = true return node, err }) for i := len(dtc.hooks) - 1; i >= 0; i-- { + if dtc.hooks[i] == nil { + return nil, fmt.Errorf("db: uninitialized hook (forgotten import db/runtime?)") + } mut = dtc.hooks[i](mut) } - if _, err := mut.Mutate(ctx, dtc.mutation); err != nil { + v, err := mut.Mutate(ctx, dtc.mutation) + if err != nil { return nil, err } + nv, ok := v.(*DeviceToken) + if !ok { + return nil, fmt.Errorf("unexpected node type %T returned from DeviceTokenMutation", v) + } + node = nv } return node, err } @@ -105,32 +117,45 @@ func (dtc *DeviceTokenCreate) SaveX(ctx context.Context) *DeviceToken { return v } +// Exec executes the query. +func (dtc *DeviceTokenCreate) Exec(ctx context.Context) error { + _, err := dtc.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (dtc *DeviceTokenCreate) ExecX(ctx context.Context) { + if err := dtc.Exec(ctx); err != nil { + panic(err) + } +} + // 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 } @@ -138,8 +163,8 @@ func (dtc *DeviceTokenCreate) check() error { func (dtc *DeviceTokenCreate) sqlSave(ctx context.Context) (*DeviceToken, error) { _node, _spec := dtc.createSpec() if err := sqlgraph.CreateNode(ctx, dtc.driver, _spec); err != nil { - if cerr, ok := isSQLConstraintError(err); ok { - err = cerr + if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } @@ -238,19 +263,23 @@ func (dtcb *DeviceTokenCreateBulk) Save(ctx context.Context) ([]*DeviceToken, er if i < len(mutators)-1 { _, err = mutators[i+1].Mutate(root, dtcb.builders[i+1].mutation) } else { + spec := &sqlgraph.BatchCreateSpec{Nodes: specs} // Invoke the actual operation on the latest mutation in the chain. - if err = sqlgraph.BatchCreate(ctx, dtcb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil { - if cerr, ok := isSQLConstraintError(err); ok { - err = cerr + if err = sqlgraph.BatchCreate(ctx, dtcb.driver, spec); err != nil { + if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} } } } - mutation.done = true if err != nil { return nil, err } - id := specs[i].ID.Value.(int64) - nodes[i].ID = int(id) + mutation.id = &nodes[i].ID + if specs[i].ID.Value != nil { + id := specs[i].ID.Value.(int64) + nodes[i].ID = int(id) + } + mutation.done = true return nodes[i], nil }) for i := len(builder.hooks) - 1; i >= 0; i-- { @@ -275,3 +304,16 @@ func (dtcb *DeviceTokenCreateBulk) SaveX(ctx context.Context) []*DeviceToken { } return v } + +// Exec executes the query. +func (dtcb *DeviceTokenCreateBulk) Exec(ctx context.Context) error { + _, err := dtcb.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (dtcb *DeviceTokenCreateBulk) ExecX(ctx context.Context) { + if err := dtcb.Exec(ctx); err != nil { + panic(err) + } +} diff --git a/storage/ent/db/devicetoken_delete.go b/storage/ent/db/devicetoken_delete.go index 0ea9069d71..3c196aac09 100644 --- a/storage/ent/db/devicetoken_delete.go +++ b/storage/ent/db/devicetoken_delete.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package db @@ -20,9 +20,9 @@ type DeviceTokenDelete struct { mutation *DeviceTokenMutation } -// Where adds a new predicate to the DeviceTokenDelete builder. +// Where appends a list predicates to the DeviceTokenDelete builder. func (dtd *DeviceTokenDelete) Where(ps ...predicate.DeviceToken) *DeviceTokenDelete { - dtd.mutation.predicates = append(dtd.mutation.predicates, ps...) + dtd.mutation.Where(ps...) return dtd } @@ -46,6 +46,9 @@ func (dtd *DeviceTokenDelete) Exec(ctx context.Context) (int, error) { return affected, err }) for i := len(dtd.hooks) - 1; i >= 0; i-- { + if dtd.hooks[i] == nil { + return 0, fmt.Errorf("db: uninitialized hook (forgotten import db/runtime?)") + } mut = dtd.hooks[i](mut) } if _, err := mut.Mutate(ctx, dtd.mutation); err != nil { @@ -81,7 +84,11 @@ func (dtd *DeviceTokenDelete) sqlExec(ctx context.Context) (int, error) { } } } - return sqlgraph.DeleteNodes(ctx, dtd.driver, _spec) + affected, err := sqlgraph.DeleteNodes(ctx, dtd.driver, _spec) + if err != nil && sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} + } + return affected, err } // DeviceTokenDeleteOne is the builder for deleting a single DeviceToken entity. diff --git a/storage/ent/db/devicetoken_query.go b/storage/ent/db/devicetoken_query.go index e085440dbc..1860a841ad 100644 --- a/storage/ent/db/devicetoken_query.go +++ b/storage/ent/db/devicetoken_query.go @@ -1,10 +1,9 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package db import ( "context" - "errors" "fmt" "math" @@ -106,7 +105,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 +132,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 +241,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, } } @@ -263,15 +263,17 @@ func (dtq *DeviceTokenQuery) Clone() *DeviceTokenQuery { // Scan(ctx, &v) // func (dtq *DeviceTokenQuery) GroupBy(field string, fields ...string) *DeviceTokenGroupBy { - group := &DeviceTokenGroupBy{config: dtq.config} - group.fields = append([]string{field}, fields...) - group.path = func(ctx context.Context) (prev *sql.Selector, err error) { + grbuild := &DeviceTokenGroupBy{config: dtq.config} + grbuild.fields = append([]string{field}, fields...) + grbuild.path = func(ctx context.Context) (prev *sql.Selector, err error) { if err := dtq.prepareQuery(ctx); err != nil { return nil, err } return dtq.sqlQuery(ctx), nil } - return group + grbuild.label = devicetoken.Label + grbuild.flds, grbuild.scan = &grbuild.fields, grbuild.Scan + return grbuild } // Select allows the selection one or more fields/columns for the given query, @@ -287,9 +289,12 @@ func (dtq *DeviceTokenQuery) GroupBy(field string, fields ...string) *DeviceToke // Select(devicetoken.FieldDeviceCode). // Scan(ctx, &v) // -func (dtq *DeviceTokenQuery) Select(field string, fields ...string) *DeviceTokenSelect { - dtq.fields = append([]string{field}, fields...) - return &DeviceTokenSelect{DeviceTokenQuery: dtq} +func (dtq *DeviceTokenQuery) Select(fields ...string) *DeviceTokenSelect { + dtq.fields = append(dtq.fields, fields...) + selbuild := &DeviceTokenSelect{DeviceTokenQuery: dtq} + selbuild.label = devicetoken.Label + selbuild.flds, selbuild.scan = &dtq.fields, selbuild.Scan + return selbuild } func (dtq *DeviceTokenQuery) prepareQuery(ctx context.Context) error { @@ -308,23 +313,22 @@ func (dtq *DeviceTokenQuery) prepareQuery(ctx context.Context) error { return nil } -func (dtq *DeviceTokenQuery) sqlAll(ctx context.Context) ([]*DeviceToken, error) { +func (dtq *DeviceTokenQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*DeviceToken, error) { var ( nodes = []*DeviceToken{} _spec = dtq.querySpec() ) _spec.ScanValues = func(columns []string) ([]interface{}, error) { - node := &DeviceToken{config: dtq.config} - nodes = append(nodes, node) - return node.scanValues(columns) + return (*DeviceToken).scanValues(nil, columns) } _spec.Assign = func(columns []string, values []interface{}) error { - if len(nodes) == 0 { - return fmt.Errorf("db: Assign called without calling ScanValues") - } - node := nodes[len(nodes)-1] + node := &DeviceToken{config: dtq.config} + nodes = append(nodes, node) return node.assignValues(columns, values) } + for i := range hooks { + hooks[i](ctx, _spec) + } if err := sqlgraph.QueryNodes(ctx, dtq.driver, _spec); err != nil { return nil, err } @@ -336,6 +340,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) } @@ -398,10 +406,17 @@ func (dtq *DeviceTokenQuery) querySpec() *sqlgraph.QuerySpec { func (dtq *DeviceTokenQuery) sqlQuery(ctx context.Context) *sql.Selector { builder := sql.Dialect(dtq.driver.Dialect()) t1 := builder.Table(devicetoken.Table) - selector := builder.Select(t1.Columns(devicetoken.Columns...)...).From(t1) + columns := dtq.fields + if len(columns) == 0 { + columns = devicetoken.Columns + } + selector := builder.Select(t1.Columns(columns...)...).From(t1) if dtq.sql != nil { selector = dtq.sql - selector.Select(selector.Columns(devicetoken.Columns...)...) + selector.Select(selector.Columns(columns...)...) + } + if dtq.unique != nil && *dtq.unique { + selector.Distinct() } for _, p := range dtq.predicates { p(selector) @@ -423,6 +438,7 @@ func (dtq *DeviceTokenQuery) sqlQuery(ctx context.Context) *sql.Selector { // DeviceTokenGroupBy is the group-by builder for DeviceToken entities. type DeviceTokenGroupBy struct { config + selector fields []string fns []AggregateFunc // intermediate query (i.e. traversal path). @@ -446,209 +462,6 @@ func (dtgb *DeviceTokenGroupBy) Scan(ctx context.Context, v interface{}) error { return dtgb.sqlScan(ctx, v) } -// ScanX is like Scan, but panics if an error occurs. -func (dtgb *DeviceTokenGroupBy) ScanX(ctx context.Context, v interface{}) { - if err := dtgb.Scan(ctx, v); err != nil { - panic(err) - } -} - -// Strings returns list of strings from group-by. -// It is only allowed when executing a group-by query with one field. -func (dtgb *DeviceTokenGroupBy) Strings(ctx context.Context) ([]string, error) { - if len(dtgb.fields) > 1 { - return nil, errors.New("db: DeviceTokenGroupBy.Strings is not achievable when grouping more than 1 field") - } - var v []string - if err := dtgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// StringsX is like Strings, but panics if an error occurs. -func (dtgb *DeviceTokenGroupBy) StringsX(ctx context.Context) []string { - v, err := dtgb.Strings(ctx) - if err != nil { - panic(err) - } - return v -} - -// String returns a single string from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (dtgb *DeviceTokenGroupBy) String(ctx context.Context) (_ string, err error) { - var v []string - if v, err = dtgb.Strings(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{devicetoken.Label} - default: - err = fmt.Errorf("db: DeviceTokenGroupBy.Strings returned %d results when one was expected", len(v)) - } - return -} - -// StringX is like String, but panics if an error occurs. -func (dtgb *DeviceTokenGroupBy) StringX(ctx context.Context) string { - v, err := dtgb.String(ctx) - if err != nil { - panic(err) - } - return v -} - -// Ints returns list of ints from group-by. -// It is only allowed when executing a group-by query with one field. -func (dtgb *DeviceTokenGroupBy) Ints(ctx context.Context) ([]int, error) { - if len(dtgb.fields) > 1 { - return nil, errors.New("db: DeviceTokenGroupBy.Ints is not achievable when grouping more than 1 field") - } - var v []int - if err := dtgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// IntsX is like Ints, but panics if an error occurs. -func (dtgb *DeviceTokenGroupBy) IntsX(ctx context.Context) []int { - v, err := dtgb.Ints(ctx) - if err != nil { - panic(err) - } - return v -} - -// Int returns a single int from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (dtgb *DeviceTokenGroupBy) Int(ctx context.Context) (_ int, err error) { - var v []int - if v, err = dtgb.Ints(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{devicetoken.Label} - default: - err = fmt.Errorf("db: DeviceTokenGroupBy.Ints returned %d results when one was expected", len(v)) - } - return -} - -// IntX is like Int, but panics if an error occurs. -func (dtgb *DeviceTokenGroupBy) IntX(ctx context.Context) int { - v, err := dtgb.Int(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64s returns list of float64s from group-by. -// It is only allowed when executing a group-by query with one field. -func (dtgb *DeviceTokenGroupBy) Float64s(ctx context.Context) ([]float64, error) { - if len(dtgb.fields) > 1 { - return nil, errors.New("db: DeviceTokenGroupBy.Float64s is not achievable when grouping more than 1 field") - } - var v []float64 - if err := dtgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// Float64sX is like Float64s, but panics if an error occurs. -func (dtgb *DeviceTokenGroupBy) Float64sX(ctx context.Context) []float64 { - v, err := dtgb.Float64s(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64 returns a single float64 from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (dtgb *DeviceTokenGroupBy) Float64(ctx context.Context) (_ float64, err error) { - var v []float64 - if v, err = dtgb.Float64s(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{devicetoken.Label} - default: - err = fmt.Errorf("db: DeviceTokenGroupBy.Float64s returned %d results when one was expected", len(v)) - } - return -} - -// Float64X is like Float64, but panics if an error occurs. -func (dtgb *DeviceTokenGroupBy) Float64X(ctx context.Context) float64 { - v, err := dtgb.Float64(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bools returns list of bools from group-by. -// It is only allowed when executing a group-by query with one field. -func (dtgb *DeviceTokenGroupBy) Bools(ctx context.Context) ([]bool, error) { - if len(dtgb.fields) > 1 { - return nil, errors.New("db: DeviceTokenGroupBy.Bools is not achievable when grouping more than 1 field") - } - var v []bool - if err := dtgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// BoolsX is like Bools, but panics if an error occurs. -func (dtgb *DeviceTokenGroupBy) BoolsX(ctx context.Context) []bool { - v, err := dtgb.Bools(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bool returns a single bool from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (dtgb *DeviceTokenGroupBy) Bool(ctx context.Context) (_ bool, err error) { - var v []bool - if v, err = dtgb.Bools(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{devicetoken.Label} - default: - err = fmt.Errorf("db: DeviceTokenGroupBy.Bools returned %d results when one was expected", len(v)) - } - return -} - -// BoolX is like Bool, but panics if an error occurs. -func (dtgb *DeviceTokenGroupBy) BoolX(ctx context.Context) bool { - v, err := dtgb.Bool(ctx) - if err != nil { - panic(err) - } - return v -} - func (dtgb *DeviceTokenGroupBy) sqlScan(ctx context.Context, v interface{}) error { for _, f := range dtgb.fields { if !devicetoken.ValidColumn(f) { @@ -669,18 +482,28 @@ func (dtgb *DeviceTokenGroupBy) sqlScan(ctx context.Context, v interface{}) erro } func (dtgb *DeviceTokenGroupBy) sqlQuery() *sql.Selector { - selector := dtgb.sql - columns := make([]string, 0, len(dtgb.fields)+len(dtgb.fns)) - columns = append(columns, dtgb.fields...) + selector := dtgb.sql.Select() + aggregation := make([]string, 0, len(dtgb.fns)) for _, fn := range dtgb.fns { - columns = append(columns, fn(selector)) + aggregation = append(aggregation, fn(selector)) + } + // If no columns were selected in a custom aggregation function, the default + // selection is the fields used for "group-by", and the aggregation functions. + if len(selector.SelectedColumns()) == 0 { + columns := make([]string, 0, len(dtgb.fields)+len(dtgb.fns)) + for _, f := range dtgb.fields { + columns = append(columns, selector.C(f)) + } + columns = append(columns, aggregation...) + selector.Select(columns...) } - return selector.Select(columns...).GroupBy(dtgb.fields...) + return selector.GroupBy(selector.Columns(dtgb.fields...)...) } // DeviceTokenSelect is the builder for selecting fields of DeviceToken entities. type DeviceTokenSelect struct { *DeviceTokenQuery + selector // intermediate query (i.e. traversal path). sql *sql.Selector } @@ -694,213 +517,12 @@ func (dts *DeviceTokenSelect) Scan(ctx context.Context, v interface{}) error { return dts.sqlScan(ctx, v) } -// ScanX is like Scan, but panics if an error occurs. -func (dts *DeviceTokenSelect) ScanX(ctx context.Context, v interface{}) { - if err := dts.Scan(ctx, v); err != nil { - panic(err) - } -} - -// Strings returns list of strings from a selector. It is only allowed when selecting one field. -func (dts *DeviceTokenSelect) Strings(ctx context.Context) ([]string, error) { - if len(dts.fields) > 1 { - return nil, errors.New("db: DeviceTokenSelect.Strings is not achievable when selecting more than 1 field") - } - var v []string - if err := dts.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// StringsX is like Strings, but panics if an error occurs. -func (dts *DeviceTokenSelect) StringsX(ctx context.Context) []string { - v, err := dts.Strings(ctx) - if err != nil { - panic(err) - } - return v -} - -// String returns a single string from a selector. It is only allowed when selecting one field. -func (dts *DeviceTokenSelect) String(ctx context.Context) (_ string, err error) { - var v []string - if v, err = dts.Strings(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{devicetoken.Label} - default: - err = fmt.Errorf("db: DeviceTokenSelect.Strings returned %d results when one was expected", len(v)) - } - return -} - -// StringX is like String, but panics if an error occurs. -func (dts *DeviceTokenSelect) StringX(ctx context.Context) string { - v, err := dts.String(ctx) - if err != nil { - panic(err) - } - return v -} - -// Ints returns list of ints from a selector. It is only allowed when selecting one field. -func (dts *DeviceTokenSelect) Ints(ctx context.Context) ([]int, error) { - if len(dts.fields) > 1 { - return nil, errors.New("db: DeviceTokenSelect.Ints is not achievable when selecting more than 1 field") - } - var v []int - if err := dts.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// IntsX is like Ints, but panics if an error occurs. -func (dts *DeviceTokenSelect) IntsX(ctx context.Context) []int { - v, err := dts.Ints(ctx) - if err != nil { - panic(err) - } - return v -} - -// Int returns a single int from a selector. It is only allowed when selecting one field. -func (dts *DeviceTokenSelect) Int(ctx context.Context) (_ int, err error) { - var v []int - if v, err = dts.Ints(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{devicetoken.Label} - default: - err = fmt.Errorf("db: DeviceTokenSelect.Ints returned %d results when one was expected", len(v)) - } - return -} - -// IntX is like Int, but panics if an error occurs. -func (dts *DeviceTokenSelect) IntX(ctx context.Context) int { - v, err := dts.Int(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64s returns list of float64s from a selector. It is only allowed when selecting one field. -func (dts *DeviceTokenSelect) Float64s(ctx context.Context) ([]float64, error) { - if len(dts.fields) > 1 { - return nil, errors.New("db: DeviceTokenSelect.Float64s is not achievable when selecting more than 1 field") - } - var v []float64 - if err := dts.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// Float64sX is like Float64s, but panics if an error occurs. -func (dts *DeviceTokenSelect) Float64sX(ctx context.Context) []float64 { - v, err := dts.Float64s(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64 returns a single float64 from a selector. It is only allowed when selecting one field. -func (dts *DeviceTokenSelect) Float64(ctx context.Context) (_ float64, err error) { - var v []float64 - if v, err = dts.Float64s(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{devicetoken.Label} - default: - err = fmt.Errorf("db: DeviceTokenSelect.Float64s returned %d results when one was expected", len(v)) - } - return -} - -// Float64X is like Float64, but panics if an error occurs. -func (dts *DeviceTokenSelect) Float64X(ctx context.Context) float64 { - v, err := dts.Float64(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bools returns list of bools from a selector. It is only allowed when selecting one field. -func (dts *DeviceTokenSelect) Bools(ctx context.Context) ([]bool, error) { - if len(dts.fields) > 1 { - return nil, errors.New("db: DeviceTokenSelect.Bools is not achievable when selecting more than 1 field") - } - var v []bool - if err := dts.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// BoolsX is like Bools, but panics if an error occurs. -func (dts *DeviceTokenSelect) BoolsX(ctx context.Context) []bool { - v, err := dts.Bools(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bool returns a single bool from a selector. It is only allowed when selecting one field. -func (dts *DeviceTokenSelect) Bool(ctx context.Context) (_ bool, err error) { - var v []bool - if v, err = dts.Bools(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{devicetoken.Label} - default: - err = fmt.Errorf("db: DeviceTokenSelect.Bools returned %d results when one was expected", len(v)) - } - return -} - -// BoolX is like Bool, but panics if an error occurs. -func (dts *DeviceTokenSelect) BoolX(ctx context.Context) bool { - v, err := dts.Bool(ctx) - if err != nil { - panic(err) - } - return v -} - func (dts *DeviceTokenSelect) sqlScan(ctx context.Context, v interface{}) error { rows := &sql.Rows{} - query, args := dts.sqlQuery().Query() + query, args := dts.sql.Query() if err := dts.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() return sql.ScanSlice(rows, v) } - -func (dts *DeviceTokenSelect) sqlQuery() sql.Querier { - selector := dts.sql - selector.Select(selector.Columns(dts.fields...)...) - return selector -} diff --git a/storage/ent/db/devicetoken_update.go b/storage/ent/db/devicetoken_update.go index 51a4efe0e1..99fa025306 100644 --- a/storage/ent/db/devicetoken_update.go +++ b/storage/ent/db/devicetoken_update.go @@ -1,9 +1,10 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package db import ( "context" + "errors" "fmt" "time" @@ -21,9 +22,9 @@ type DeviceTokenUpdate struct { mutation *DeviceTokenMutation } -// Where adds a new predicate for the DeviceTokenUpdate builder. +// Where appends a list predicates to the DeviceTokenUpdate builder. func (dtu *DeviceTokenUpdate) Where(ps ...predicate.DeviceToken) *DeviceTokenUpdate { - dtu.mutation.predicates = append(dtu.mutation.predicates, ps...) + dtu.mutation.Where(ps...) return dtu } @@ -107,6 +108,9 @@ func (dtu *DeviceTokenUpdate) Save(ctx context.Context) (int, error) { return affected, err }) for i := len(dtu.hooks) - 1; i >= 0; i-- { + if dtu.hooks[i] == nil { + return 0, fmt.Errorf("db: uninitialized hook (forgotten import db/runtime?)") + } mut = dtu.hooks[i](mut) } if _, err := mut.Mutate(ctx, dtu.mutation); err != nil { @@ -142,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 @@ -229,8 +233,8 @@ func (dtu *DeviceTokenUpdate) sqlSave(ctx context.Context) (n int, err error) { if n, err = sqlgraph.UpdateNodes(ctx, dtu.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{devicetoken.Label} - } else if cerr, ok := isSQLConstraintError(err); ok { - err = cerr + } else if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} } return 0, err } @@ -332,11 +336,20 @@ func (dtuo *DeviceTokenUpdateOne) Save(ctx context.Context) (*DeviceToken, error return node, err }) for i := len(dtuo.hooks) - 1; i >= 0; i-- { + if dtuo.hooks[i] == nil { + return nil, fmt.Errorf("db: uninitialized hook (forgotten import db/runtime?)") + } mut = dtuo.hooks[i](mut) } - if _, err := mut.Mutate(ctx, dtuo.mutation); err != nil { + v, err := mut.Mutate(ctx, dtuo.mutation) + if err != nil { return nil, err } + nv, ok := v.(*DeviceToken) + if !ok { + return nil, fmt.Errorf("unexpected node type %T returned from DeviceTokenMutation", v) + } + node = nv } return node, err } @@ -367,12 +380,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 @@ -391,7 +404,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 { @@ -474,8 +487,8 @@ func (dtuo *DeviceTokenUpdateOne) sqlSave(ctx context.Context) (_node *DeviceTok if err = sqlgraph.UpdateNode(ctx, dtuo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{devicetoken.Label} - } else if cerr, ok := isSQLConstraintError(err); ok { - err = cerr + } else if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } diff --git a/storage/ent/db/ent.go b/storage/ent/db/ent.go index d84e721d06..ed76b32b51 100644 --- a/storage/ent/db/ent.go +++ b/storage/ent/db/ent.go @@ -1,13 +1,13 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package db import ( + "context" "errors" "fmt" "entgo.io/ent" - "entgo.io/ent/dialect" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "github.com/dexidp/dex/storage/ent/db/authcode" @@ -161,7 +161,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 @@ -177,7 +177,7 @@ func (e *ValidationError) Unwrap() error { return e.err } -// IsValidationError returns a boolean indicating whether the error is a validaton error. +// IsValidationError returns a boolean indicating whether the error is a validation error. func IsValidationError(err error) bool { if err == nil { return false @@ -278,20 +278,207 @@ func IsConstraintError(err error) bool { return errors.As(err, &e) } -func isSQLConstraintError(err error) (*ConstraintError, bool) { - if sqlgraph.IsConstraintError(err) { - return &ConstraintError{err.Error(), err}, true +// selector embedded by the different Select/GroupBy builders. +type selector struct { + label string + flds *[]string + scan func(context.Context, interface{}) error +} + +// ScanX is like Scan, but panics if an error occurs. +func (s *selector) ScanX(ctx context.Context, v interface{}) { + if err := s.scan(ctx, v); err != nil { + panic(err) } - return nil, false } -// rollback calls tx.Rollback and wraps the given error with the rollback error if present. -func rollback(tx dialect.Tx, err error) error { - if rerr := tx.Rollback(); rerr != nil { - err = fmt.Errorf("%w: %v", err, rerr) +// Strings returns list of strings from a selector. It is only allowed when selecting one field. +func (s *selector) Strings(ctx context.Context) ([]string, error) { + if len(*s.flds) > 1 { + return nil, errors.New("db: Strings is not achievable when selecting more than 1 field") } - if err, ok := isSQLConstraintError(err); ok { - return err + var v []string + if err := s.scan(ctx, &v); err != nil { + return nil, err } - return err + return v, nil } + +// StringsX is like Strings, but panics if an error occurs. +func (s *selector) StringsX(ctx context.Context) []string { + v, err := s.Strings(ctx) + if err != nil { + panic(err) + } + return v +} + +// String returns a single string from a selector. It is only allowed when selecting one field. +func (s *selector) String(ctx context.Context) (_ string, err error) { + var v []string + if v, err = s.Strings(ctx); err != nil { + return + } + switch len(v) { + case 1: + return v[0], nil + case 0: + err = &NotFoundError{s.label} + default: + err = fmt.Errorf("db: Strings returned %d results when one was expected", len(v)) + } + return +} + +// StringX is like String, but panics if an error occurs. +func (s *selector) StringX(ctx context.Context) string { + v, err := s.String(ctx) + if err != nil { + panic(err) + } + return v +} + +// Ints returns list of ints from a selector. It is only allowed when selecting one field. +func (s *selector) Ints(ctx context.Context) ([]int, error) { + if len(*s.flds) > 1 { + return nil, errors.New("db: Ints is not achievable when selecting more than 1 field") + } + var v []int + if err := s.scan(ctx, &v); err != nil { + return nil, err + } + return v, nil +} + +// IntsX is like Ints, but panics if an error occurs. +func (s *selector) IntsX(ctx context.Context) []int { + v, err := s.Ints(ctx) + if err != nil { + panic(err) + } + return v +} + +// Int returns a single int from a selector. It is only allowed when selecting one field. +func (s *selector) Int(ctx context.Context) (_ int, err error) { + var v []int + if v, err = s.Ints(ctx); err != nil { + return + } + switch len(v) { + case 1: + return v[0], nil + case 0: + err = &NotFoundError{s.label} + default: + err = fmt.Errorf("db: Ints returned %d results when one was expected", len(v)) + } + return +} + +// IntX is like Int, but panics if an error occurs. +func (s *selector) IntX(ctx context.Context) int { + v, err := s.Int(ctx) + if err != nil { + panic(err) + } + return v +} + +// Float64s returns list of float64s from a selector. It is only allowed when selecting one field. +func (s *selector) Float64s(ctx context.Context) ([]float64, error) { + if len(*s.flds) > 1 { + return nil, errors.New("db: Float64s is not achievable when selecting more than 1 field") + } + var v []float64 + if err := s.scan(ctx, &v); err != nil { + return nil, err + } + return v, nil +} + +// Float64sX is like Float64s, but panics if an error occurs. +func (s *selector) Float64sX(ctx context.Context) []float64 { + v, err := s.Float64s(ctx) + if err != nil { + panic(err) + } + return v +} + +// Float64 returns a single float64 from a selector. It is only allowed when selecting one field. +func (s *selector) Float64(ctx context.Context) (_ float64, err error) { + var v []float64 + if v, err = s.Float64s(ctx); err != nil { + return + } + switch len(v) { + case 1: + return v[0], nil + case 0: + err = &NotFoundError{s.label} + default: + err = fmt.Errorf("db: Float64s returned %d results when one was expected", len(v)) + } + return +} + +// Float64X is like Float64, but panics if an error occurs. +func (s *selector) Float64X(ctx context.Context) float64 { + v, err := s.Float64(ctx) + if err != nil { + panic(err) + } + return v +} + +// Bools returns list of bools from a selector. It is only allowed when selecting one field. +func (s *selector) Bools(ctx context.Context) ([]bool, error) { + if len(*s.flds) > 1 { + return nil, errors.New("db: Bools is not achievable when selecting more than 1 field") + } + var v []bool + if err := s.scan(ctx, &v); err != nil { + return nil, err + } + return v, nil +} + +// BoolsX is like Bools, but panics if an error occurs. +func (s *selector) BoolsX(ctx context.Context) []bool { + v, err := s.Bools(ctx) + if err != nil { + panic(err) + } + return v +} + +// Bool returns a single bool from a selector. It is only allowed when selecting one field. +func (s *selector) Bool(ctx context.Context) (_ bool, err error) { + var v []bool + if v, err = s.Bools(ctx); err != nil { + return + } + switch len(v) { + case 1: + return v[0], nil + case 0: + err = &NotFoundError{s.label} + default: + err = fmt.Errorf("db: Bools returned %d results when one was expected", len(v)) + } + return +} + +// BoolX is like Bool, but panics if an error occurs. +func (s *selector) BoolX(ctx context.Context) bool { + v, err := s.Bool(ctx) + if err != nil { + panic(err) + } + return v +} + +// queryHook describes an internal hook for the different sqlAll methods. +type queryHook func(context.Context, *sqlgraph.QuerySpec) diff --git a/storage/ent/db/enttest/enttest.go b/storage/ent/db/enttest/enttest.go index 7dffdd1b23..ecbb02d930 100644 --- a/storage/ent/db/enttest/enttest.go +++ b/storage/ent/db/enttest/enttest.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package enttest @@ -10,6 +10,7 @@ import ( _ "github.com/dexidp/dex/storage/ent/db/runtime" "entgo.io/ent/dialect/sql/schema" + "github.com/dexidp/dex/storage/ent/db/migrate" ) type ( @@ -59,10 +60,7 @@ func Open(t TestingT, driverName, dataSourceName string, opts ...Option) *db.Cli t.Error(err) t.FailNow() } - if err := c.Schema.Create(context.Background(), o.migrateOpts...); err != nil { - t.Error(err) - t.FailNow() - } + migrateSchema(t, c, o) return c } @@ -70,9 +68,17 @@ func Open(t TestingT, driverName, dataSourceName string, opts ...Option) *db.Cli func NewClient(t TestingT, opts ...Option) *db.Client { o := newOptions(opts) c := db.NewClient(o.opts...) - if err := c.Schema.Create(context.Background(), o.migrateOpts...); err != nil { + migrateSchema(t, c, o) + return c +} +func migrateSchema(t TestingT, c *db.Client, o *options) { + tables, err := schema.CopyTables(migrate.Tables) + if err != nil { + t.Error(err) + t.FailNow() + } + if err := migrate.Create(context.Background(), c.Schema, tables, o.migrateOpts...); err != nil { t.Error(err) t.FailNow() } - return c } diff --git a/storage/ent/db/hook/hook.go b/storage/ent/db/hook/hook.go index 8a7d8e4062..856e5e5949 100644 --- a/storage/ent/db/hook/hook.go +++ b/storage/ent/db/hook/hook.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package hook diff --git a/storage/ent/db/keys.go b/storage/ent/db/keys.go index d0312c92a9..d307ad8ed2 100644 --- a/storage/ent/db/keys.go +++ b/storage/ent/db/keys.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package db @@ -11,7 +11,7 @@ import ( "entgo.io/ent/dialect/sql" "github.com/dexidp/dex/storage" "github.com/dexidp/dex/storage/ent/db/keys" - "gopkg.in/square/go-jose.v2" + jose "gopkg.in/square/go-jose.v2" ) // Keys is the model entity for the Keys schema. @@ -62,7 +62,6 @@ func (k *Keys) assignValues(columns []string, values []interface{}) error { k.ID = value.String } case keys.FieldVerificationKeys: - if value, ok := values[i].(*[]byte); !ok { return fmt.Errorf("unexpected type %T for field verification_keys", values[i]) } else if value != nil && len(*value) > 0 { @@ -71,7 +70,6 @@ func (k *Keys) assignValues(columns []string, values []interface{}) error { } } case keys.FieldSigningKey: - if value, ok := values[i].(*[]byte); !ok { return fmt.Errorf("unexpected type %T for field signing_key", values[i]) } else if value != nil && len(*value) > 0 { @@ -80,7 +78,6 @@ func (k *Keys) assignValues(columns []string, values []interface{}) error { } } case keys.FieldSigningKeyPub: - if value, ok := values[i].(*[]byte); !ok { return fmt.Errorf("unexpected type %T for field signing_key_pub", values[i]) } else if value != nil && len(*value) > 0 { @@ -109,11 +106,11 @@ func (k *Keys) Update() *KeysUpdateOne { // Unwrap unwraps the Keys entity that was returned from a transaction after it was closed, // so that all future queries will be executed through the driver which created the transaction. func (k *Keys) Unwrap() *Keys { - tx, ok := k.config.driver.(*txDriver) + _tx, ok := k.config.driver.(*txDriver) if !ok { panic("db: Keys is not a transactional entity") } - k.config.driver = tx.drv + k.config.driver = _tx.drv return k } @@ -121,14 +118,17 @@ func (k *Keys) Unwrap() *Keys { func (k *Keys) String() string { var builder strings.Builder builder.WriteString("Keys(") - builder.WriteString(fmt.Sprintf("id=%v", k.ID)) - builder.WriteString(", verification_keys=") + builder.WriteString(fmt.Sprintf("id=%v, ", k.ID)) + builder.WriteString("verification_keys=") builder.WriteString(fmt.Sprintf("%v", k.VerificationKeys)) - builder.WriteString(", signing_key=") + builder.WriteString(", ") + builder.WriteString("signing_key=") builder.WriteString(fmt.Sprintf("%v", k.SigningKey)) - builder.WriteString(", signing_key_pub=") + builder.WriteString(", ") + builder.WriteString("signing_key_pub=") builder.WriteString(fmt.Sprintf("%v", k.SigningKeyPub)) - builder.WriteString(", next_rotation=") + builder.WriteString(", ") + builder.WriteString("next_rotation=") builder.WriteString(k.NextRotation.Format(time.ANSIC)) builder.WriteByte(')') return builder.String() diff --git a/storage/ent/db/keys/keys.go b/storage/ent/db/keys/keys.go index b877a2f66b..eb96d92a11 100644 --- a/storage/ent/db/keys/keys.go +++ b/storage/ent/db/keys/keys.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package keys diff --git a/storage/ent/db/keys/where.go b/storage/ent/db/keys/where.go index 55aa8ce362..e9be342a3b 100644 --- a/storage/ent/db/keys/where.go +++ b/storage/ent/db/keys/where.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package keys @@ -33,12 +33,6 @@ func IDNEQ(id string) predicate.Keys { // IDIn applies the In predicate on the ID field. func IDIn(ids ...string) predicate.Keys { return predicate.Keys(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(ids) == 0 { - s.Where(sql.False()) - return - } v := make([]interface{}, len(ids)) for i := range v { v[i] = ids[i] @@ -50,12 +44,6 @@ func IDIn(ids ...string) predicate.Keys { // IDNotIn applies the NotIn predicate on the ID field. func IDNotIn(ids ...string) predicate.Keys { return predicate.Keys(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(ids) == 0 { - s.Where(sql.False()) - return - } v := make([]interface{}, len(ids)) for i := range v { v[i] = ids[i] diff --git a/storage/ent/db/keys_create.go b/storage/ent/db/keys_create.go index 4dfae78bee..818ca27891 100644 --- a/storage/ent/db/keys_create.go +++ b/storage/ent/db/keys_create.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package db @@ -12,7 +12,7 @@ import ( "entgo.io/ent/schema/field" "github.com/dexidp/dex/storage" "github.com/dexidp/dex/storage/ent/db/keys" - "gopkg.in/square/go-jose.v2" + jose "gopkg.in/square/go-jose.v2" ) // KeysCreate is the builder for creating a Keys entity. @@ -78,16 +78,28 @@ func (kc *KeysCreate) Save(ctx context.Context) (*Keys, error) { return nil, err } kc.mutation = mutation - node, err = kc.sqlSave(ctx) + if node, err = kc.sqlSave(ctx); err != nil { + return nil, err + } + mutation.id = &node.ID mutation.done = true return node, err }) for i := len(kc.hooks) - 1; i >= 0; i-- { + if kc.hooks[i] == nil { + return nil, fmt.Errorf("db: uninitialized hook (forgotten import db/runtime?)") + } mut = kc.hooks[i](mut) } - if _, err := mut.Mutate(ctx, kc.mutation); err != nil { + v, err := mut.Mutate(ctx, kc.mutation) + if err != nil { return nil, err } + nv, ok := v.(*Keys) + if !ok { + return nil, fmt.Errorf("unexpected node type %T returned from KeysMutation", v) + } + node = nv } return node, err } @@ -101,23 +113,36 @@ func (kc *KeysCreate) SaveX(ctx context.Context) *Keys { return v } +// Exec executes the query. +func (kc *KeysCreate) Exec(ctx context.Context) error { + _, err := kc.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (kc *KeysCreate) ExecX(ctx context.Context) { + if err := kc.Exec(ctx); err != nil { + panic(err) + } +} + // 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 @@ -126,11 +151,18 @@ func (kc *KeysCreate) check() error { func (kc *KeysCreate) sqlSave(ctx context.Context) (*Keys, error) { _node, _spec := kc.createSpec() if err := sqlgraph.CreateNode(ctx, kc.driver, _spec); err != nil { - if cerr, ok := isSQLConstraintError(err); ok { - err = cerr + if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} } 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 } @@ -212,17 +244,19 @@ func (kcb *KeysCreateBulk) Save(ctx context.Context) ([]*Keys, error) { if i < len(mutators)-1 { _, err = mutators[i+1].Mutate(root, kcb.builders[i+1].mutation) } else { + spec := &sqlgraph.BatchCreateSpec{Nodes: specs} // Invoke the actual operation on the latest mutation in the chain. - if err = sqlgraph.BatchCreate(ctx, kcb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil { - if cerr, ok := isSQLConstraintError(err); ok { - err = cerr + if err = sqlgraph.BatchCreate(ctx, kcb.driver, spec); err != nil { + if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} } } } - mutation.done = true if err != nil { return nil, err } + mutation.id = &nodes[i].ID + mutation.done = true return nodes[i], nil }) for i := len(builder.hooks) - 1; i >= 0; i-- { @@ -247,3 +281,16 @@ func (kcb *KeysCreateBulk) SaveX(ctx context.Context) []*Keys { } return v } + +// Exec executes the query. +func (kcb *KeysCreateBulk) Exec(ctx context.Context) error { + _, err := kcb.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (kcb *KeysCreateBulk) ExecX(ctx context.Context) { + if err := kcb.Exec(ctx); err != nil { + panic(err) + } +} diff --git a/storage/ent/db/keys_delete.go b/storage/ent/db/keys_delete.go index 620f8f106d..5bcf970f58 100644 --- a/storage/ent/db/keys_delete.go +++ b/storage/ent/db/keys_delete.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package db @@ -20,9 +20,9 @@ type KeysDelete struct { mutation *KeysMutation } -// Where adds a new predicate to the KeysDelete builder. +// Where appends a list predicates to the KeysDelete builder. func (kd *KeysDelete) Where(ps ...predicate.Keys) *KeysDelete { - kd.mutation.predicates = append(kd.mutation.predicates, ps...) + kd.mutation.Where(ps...) return kd } @@ -46,6 +46,9 @@ func (kd *KeysDelete) Exec(ctx context.Context) (int, error) { return affected, err }) for i := len(kd.hooks) - 1; i >= 0; i-- { + if kd.hooks[i] == nil { + return 0, fmt.Errorf("db: uninitialized hook (forgotten import db/runtime?)") + } mut = kd.hooks[i](mut) } if _, err := mut.Mutate(ctx, kd.mutation); err != nil { @@ -81,7 +84,11 @@ func (kd *KeysDelete) sqlExec(ctx context.Context) (int, error) { } } } - return sqlgraph.DeleteNodes(ctx, kd.driver, _spec) + affected, err := sqlgraph.DeleteNodes(ctx, kd.driver, _spec) + if err != nil && sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} + } + return affected, err } // KeysDeleteOne is the builder for deleting a single Keys entity. diff --git a/storage/ent/db/keys_query.go b/storage/ent/db/keys_query.go index 6d6b00f925..7d9ea9082d 100644 --- a/storage/ent/db/keys_query.go +++ b/storage/ent/db/keys_query.go @@ -1,10 +1,9 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package db import ( "context" - "errors" "fmt" "math" @@ -106,7 +105,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 +132,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 +241,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, } } @@ -263,15 +263,17 @@ func (kq *KeysQuery) Clone() *KeysQuery { // Scan(ctx, &v) // func (kq *KeysQuery) GroupBy(field string, fields ...string) *KeysGroupBy { - group := &KeysGroupBy{config: kq.config} - group.fields = append([]string{field}, fields...) - group.path = func(ctx context.Context) (prev *sql.Selector, err error) { + grbuild := &KeysGroupBy{config: kq.config} + grbuild.fields = append([]string{field}, fields...) + grbuild.path = func(ctx context.Context) (prev *sql.Selector, err error) { if err := kq.prepareQuery(ctx); err != nil { return nil, err } return kq.sqlQuery(ctx), nil } - return group + grbuild.label = keys.Label + grbuild.flds, grbuild.scan = &grbuild.fields, grbuild.Scan + return grbuild } // Select allows the selection one or more fields/columns for the given query, @@ -287,9 +289,12 @@ func (kq *KeysQuery) GroupBy(field string, fields ...string) *KeysGroupBy { // Select(keys.FieldVerificationKeys). // Scan(ctx, &v) // -func (kq *KeysQuery) Select(field string, fields ...string) *KeysSelect { - kq.fields = append([]string{field}, fields...) - return &KeysSelect{KeysQuery: kq} +func (kq *KeysQuery) Select(fields ...string) *KeysSelect { + kq.fields = append(kq.fields, fields...) + selbuild := &KeysSelect{KeysQuery: kq} + selbuild.label = keys.Label + selbuild.flds, selbuild.scan = &kq.fields, selbuild.Scan + return selbuild } func (kq *KeysQuery) prepareQuery(ctx context.Context) error { @@ -308,23 +313,22 @@ func (kq *KeysQuery) prepareQuery(ctx context.Context) error { return nil } -func (kq *KeysQuery) sqlAll(ctx context.Context) ([]*Keys, error) { +func (kq *KeysQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Keys, error) { var ( nodes = []*Keys{} _spec = kq.querySpec() ) _spec.ScanValues = func(columns []string) ([]interface{}, error) { - node := &Keys{config: kq.config} - nodes = append(nodes, node) - return node.scanValues(columns) + return (*Keys).scanValues(nil, columns) } _spec.Assign = func(columns []string, values []interface{}) error { - if len(nodes) == 0 { - return fmt.Errorf("db: Assign called without calling ScanValues") - } - node := nodes[len(nodes)-1] + node := &Keys{config: kq.config} + nodes = append(nodes, node) return node.assignValues(columns, values) } + for i := range hooks { + hooks[i](ctx, _spec) + } if err := sqlgraph.QueryNodes(ctx, kq.driver, _spec); err != nil { return nil, err } @@ -336,6 +340,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) } @@ -398,10 +406,17 @@ func (kq *KeysQuery) querySpec() *sqlgraph.QuerySpec { func (kq *KeysQuery) sqlQuery(ctx context.Context) *sql.Selector { builder := sql.Dialect(kq.driver.Dialect()) t1 := builder.Table(keys.Table) - selector := builder.Select(t1.Columns(keys.Columns...)...).From(t1) + columns := kq.fields + if len(columns) == 0 { + columns = keys.Columns + } + selector := builder.Select(t1.Columns(columns...)...).From(t1) if kq.sql != nil { selector = kq.sql - selector.Select(selector.Columns(keys.Columns...)...) + selector.Select(selector.Columns(columns...)...) + } + if kq.unique != nil && *kq.unique { + selector.Distinct() } for _, p := range kq.predicates { p(selector) @@ -423,6 +438,7 @@ func (kq *KeysQuery) sqlQuery(ctx context.Context) *sql.Selector { // KeysGroupBy is the group-by builder for Keys entities. type KeysGroupBy struct { config + selector fields []string fns []AggregateFunc // intermediate query (i.e. traversal path). @@ -446,209 +462,6 @@ func (kgb *KeysGroupBy) Scan(ctx context.Context, v interface{}) error { return kgb.sqlScan(ctx, v) } -// ScanX is like Scan, but panics if an error occurs. -func (kgb *KeysGroupBy) ScanX(ctx context.Context, v interface{}) { - if err := kgb.Scan(ctx, v); err != nil { - panic(err) - } -} - -// Strings returns list of strings from group-by. -// It is only allowed when executing a group-by query with one field. -func (kgb *KeysGroupBy) Strings(ctx context.Context) ([]string, error) { - if len(kgb.fields) > 1 { - return nil, errors.New("db: KeysGroupBy.Strings is not achievable when grouping more than 1 field") - } - var v []string - if err := kgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// StringsX is like Strings, but panics if an error occurs. -func (kgb *KeysGroupBy) StringsX(ctx context.Context) []string { - v, err := kgb.Strings(ctx) - if err != nil { - panic(err) - } - return v -} - -// String returns a single string from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (kgb *KeysGroupBy) String(ctx context.Context) (_ string, err error) { - var v []string - if v, err = kgb.Strings(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{keys.Label} - default: - err = fmt.Errorf("db: KeysGroupBy.Strings returned %d results when one was expected", len(v)) - } - return -} - -// StringX is like String, but panics if an error occurs. -func (kgb *KeysGroupBy) StringX(ctx context.Context) string { - v, err := kgb.String(ctx) - if err != nil { - panic(err) - } - return v -} - -// Ints returns list of ints from group-by. -// It is only allowed when executing a group-by query with one field. -func (kgb *KeysGroupBy) Ints(ctx context.Context) ([]int, error) { - if len(kgb.fields) > 1 { - return nil, errors.New("db: KeysGroupBy.Ints is not achievable when grouping more than 1 field") - } - var v []int - if err := kgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// IntsX is like Ints, but panics if an error occurs. -func (kgb *KeysGroupBy) IntsX(ctx context.Context) []int { - v, err := kgb.Ints(ctx) - if err != nil { - panic(err) - } - return v -} - -// Int returns a single int from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (kgb *KeysGroupBy) Int(ctx context.Context) (_ int, err error) { - var v []int - if v, err = kgb.Ints(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{keys.Label} - default: - err = fmt.Errorf("db: KeysGroupBy.Ints returned %d results when one was expected", len(v)) - } - return -} - -// IntX is like Int, but panics if an error occurs. -func (kgb *KeysGroupBy) IntX(ctx context.Context) int { - v, err := kgb.Int(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64s returns list of float64s from group-by. -// It is only allowed when executing a group-by query with one field. -func (kgb *KeysGroupBy) Float64s(ctx context.Context) ([]float64, error) { - if len(kgb.fields) > 1 { - return nil, errors.New("db: KeysGroupBy.Float64s is not achievable when grouping more than 1 field") - } - var v []float64 - if err := kgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// Float64sX is like Float64s, but panics if an error occurs. -func (kgb *KeysGroupBy) Float64sX(ctx context.Context) []float64 { - v, err := kgb.Float64s(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64 returns a single float64 from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (kgb *KeysGroupBy) Float64(ctx context.Context) (_ float64, err error) { - var v []float64 - if v, err = kgb.Float64s(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{keys.Label} - default: - err = fmt.Errorf("db: KeysGroupBy.Float64s returned %d results when one was expected", len(v)) - } - return -} - -// Float64X is like Float64, but panics if an error occurs. -func (kgb *KeysGroupBy) Float64X(ctx context.Context) float64 { - v, err := kgb.Float64(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bools returns list of bools from group-by. -// It is only allowed when executing a group-by query with one field. -func (kgb *KeysGroupBy) Bools(ctx context.Context) ([]bool, error) { - if len(kgb.fields) > 1 { - return nil, errors.New("db: KeysGroupBy.Bools is not achievable when grouping more than 1 field") - } - var v []bool - if err := kgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// BoolsX is like Bools, but panics if an error occurs. -func (kgb *KeysGroupBy) BoolsX(ctx context.Context) []bool { - v, err := kgb.Bools(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bool returns a single bool from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (kgb *KeysGroupBy) Bool(ctx context.Context) (_ bool, err error) { - var v []bool - if v, err = kgb.Bools(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{keys.Label} - default: - err = fmt.Errorf("db: KeysGroupBy.Bools returned %d results when one was expected", len(v)) - } - return -} - -// BoolX is like Bool, but panics if an error occurs. -func (kgb *KeysGroupBy) BoolX(ctx context.Context) bool { - v, err := kgb.Bool(ctx) - if err != nil { - panic(err) - } - return v -} - func (kgb *KeysGroupBy) sqlScan(ctx context.Context, v interface{}) error { for _, f := range kgb.fields { if !keys.ValidColumn(f) { @@ -669,18 +482,28 @@ func (kgb *KeysGroupBy) sqlScan(ctx context.Context, v interface{}) error { } func (kgb *KeysGroupBy) sqlQuery() *sql.Selector { - selector := kgb.sql - columns := make([]string, 0, len(kgb.fields)+len(kgb.fns)) - columns = append(columns, kgb.fields...) + selector := kgb.sql.Select() + aggregation := make([]string, 0, len(kgb.fns)) for _, fn := range kgb.fns { - columns = append(columns, fn(selector)) + aggregation = append(aggregation, fn(selector)) + } + // If no columns were selected in a custom aggregation function, the default + // selection is the fields used for "group-by", and the aggregation functions. + if len(selector.SelectedColumns()) == 0 { + columns := make([]string, 0, len(kgb.fields)+len(kgb.fns)) + for _, f := range kgb.fields { + columns = append(columns, selector.C(f)) + } + columns = append(columns, aggregation...) + selector.Select(columns...) } - return selector.Select(columns...).GroupBy(kgb.fields...) + return selector.GroupBy(selector.Columns(kgb.fields...)...) } // KeysSelect is the builder for selecting fields of Keys entities. type KeysSelect struct { *KeysQuery + selector // intermediate query (i.e. traversal path). sql *sql.Selector } @@ -694,213 +517,12 @@ func (ks *KeysSelect) Scan(ctx context.Context, v interface{}) error { return ks.sqlScan(ctx, v) } -// ScanX is like Scan, but panics if an error occurs. -func (ks *KeysSelect) ScanX(ctx context.Context, v interface{}) { - if err := ks.Scan(ctx, v); err != nil { - panic(err) - } -} - -// Strings returns list of strings from a selector. It is only allowed when selecting one field. -func (ks *KeysSelect) Strings(ctx context.Context) ([]string, error) { - if len(ks.fields) > 1 { - return nil, errors.New("db: KeysSelect.Strings is not achievable when selecting more than 1 field") - } - var v []string - if err := ks.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// StringsX is like Strings, but panics if an error occurs. -func (ks *KeysSelect) StringsX(ctx context.Context) []string { - v, err := ks.Strings(ctx) - if err != nil { - panic(err) - } - return v -} - -// String returns a single string from a selector. It is only allowed when selecting one field. -func (ks *KeysSelect) String(ctx context.Context) (_ string, err error) { - var v []string - if v, err = ks.Strings(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{keys.Label} - default: - err = fmt.Errorf("db: KeysSelect.Strings returned %d results when one was expected", len(v)) - } - return -} - -// StringX is like String, but panics if an error occurs. -func (ks *KeysSelect) StringX(ctx context.Context) string { - v, err := ks.String(ctx) - if err != nil { - panic(err) - } - return v -} - -// Ints returns list of ints from a selector. It is only allowed when selecting one field. -func (ks *KeysSelect) Ints(ctx context.Context) ([]int, error) { - if len(ks.fields) > 1 { - return nil, errors.New("db: KeysSelect.Ints is not achievable when selecting more than 1 field") - } - var v []int - if err := ks.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// IntsX is like Ints, but panics if an error occurs. -func (ks *KeysSelect) IntsX(ctx context.Context) []int { - v, err := ks.Ints(ctx) - if err != nil { - panic(err) - } - return v -} - -// Int returns a single int from a selector. It is only allowed when selecting one field. -func (ks *KeysSelect) Int(ctx context.Context) (_ int, err error) { - var v []int - if v, err = ks.Ints(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{keys.Label} - default: - err = fmt.Errorf("db: KeysSelect.Ints returned %d results when one was expected", len(v)) - } - return -} - -// IntX is like Int, but panics if an error occurs. -func (ks *KeysSelect) IntX(ctx context.Context) int { - v, err := ks.Int(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64s returns list of float64s from a selector. It is only allowed when selecting one field. -func (ks *KeysSelect) Float64s(ctx context.Context) ([]float64, error) { - if len(ks.fields) > 1 { - return nil, errors.New("db: KeysSelect.Float64s is not achievable when selecting more than 1 field") - } - var v []float64 - if err := ks.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// Float64sX is like Float64s, but panics if an error occurs. -func (ks *KeysSelect) Float64sX(ctx context.Context) []float64 { - v, err := ks.Float64s(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64 returns a single float64 from a selector. It is only allowed when selecting one field. -func (ks *KeysSelect) Float64(ctx context.Context) (_ float64, err error) { - var v []float64 - if v, err = ks.Float64s(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{keys.Label} - default: - err = fmt.Errorf("db: KeysSelect.Float64s returned %d results when one was expected", len(v)) - } - return -} - -// Float64X is like Float64, but panics if an error occurs. -func (ks *KeysSelect) Float64X(ctx context.Context) float64 { - v, err := ks.Float64(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bools returns list of bools from a selector. It is only allowed when selecting one field. -func (ks *KeysSelect) Bools(ctx context.Context) ([]bool, error) { - if len(ks.fields) > 1 { - return nil, errors.New("db: KeysSelect.Bools is not achievable when selecting more than 1 field") - } - var v []bool - if err := ks.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// BoolsX is like Bools, but panics if an error occurs. -func (ks *KeysSelect) BoolsX(ctx context.Context) []bool { - v, err := ks.Bools(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bool returns a single bool from a selector. It is only allowed when selecting one field. -func (ks *KeysSelect) Bool(ctx context.Context) (_ bool, err error) { - var v []bool - if v, err = ks.Bools(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{keys.Label} - default: - err = fmt.Errorf("db: KeysSelect.Bools returned %d results when one was expected", len(v)) - } - return -} - -// BoolX is like Bool, but panics if an error occurs. -func (ks *KeysSelect) BoolX(ctx context.Context) bool { - v, err := ks.Bool(ctx) - if err != nil { - panic(err) - } - return v -} - func (ks *KeysSelect) sqlScan(ctx context.Context, v interface{}) error { rows := &sql.Rows{} - query, args := ks.sqlQuery().Query() + query, args := ks.sql.Query() if err := ks.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() return sql.ScanSlice(rows, v) } - -func (ks *KeysSelect) sqlQuery() sql.Querier { - selector := ks.sql - selector.Select(selector.Columns(ks.fields...)...) - return selector -} diff --git a/storage/ent/db/keys_update.go b/storage/ent/db/keys_update.go index 8bc0ed3edb..b5fbefff67 100644 --- a/storage/ent/db/keys_update.go +++ b/storage/ent/db/keys_update.go @@ -1,9 +1,10 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package db import ( "context" + "errors" "fmt" "time" @@ -13,7 +14,7 @@ import ( "github.com/dexidp/dex/storage" "github.com/dexidp/dex/storage/ent/db/keys" "github.com/dexidp/dex/storage/ent/db/predicate" - "gopkg.in/square/go-jose.v2" + jose "gopkg.in/square/go-jose.v2" ) // KeysUpdate is the builder for updating Keys entities. @@ -23,9 +24,9 @@ type KeysUpdate struct { mutation *KeysMutation } -// Where adds a new predicate for the KeysUpdate builder. +// Where appends a list predicates to the KeysUpdate builder. func (ku *KeysUpdate) Where(ps ...predicate.Keys) *KeysUpdate { - ku.mutation.predicates = append(ku.mutation.predicates, ps...) + ku.mutation.Where(ps...) return ku } @@ -78,6 +79,9 @@ func (ku *KeysUpdate) Save(ctx context.Context) (int, error) { return affected, err }) for i := len(ku.hooks) - 1; i >= 0; i-- { + if ku.hooks[i] == nil { + return 0, fmt.Errorf("db: uninitialized hook (forgotten import db/runtime?)") + } mut = ku.hooks[i](mut) } if _, err := mut.Mutate(ctx, ku.mutation); err != nil { @@ -158,8 +162,8 @@ func (ku *KeysUpdate) sqlSave(ctx context.Context) (n int, err error) { if n, err = sqlgraph.UpdateNodes(ctx, ku.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{keys.Label} - } else if cerr, ok := isSQLConstraintError(err); ok { - err = cerr + } else if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} } return 0, err } @@ -230,11 +234,20 @@ func (kuo *KeysUpdateOne) Save(ctx context.Context) (*Keys, error) { return node, err }) for i := len(kuo.hooks) - 1; i >= 0; i-- { + if kuo.hooks[i] == nil { + return nil, fmt.Errorf("db: uninitialized hook (forgotten import db/runtime?)") + } mut = kuo.hooks[i](mut) } - if _, err := mut.Mutate(ctx, kuo.mutation); err != nil { + v, err := mut.Mutate(ctx, kuo.mutation) + if err != nil { return nil, err } + nv, ok := v.(*Keys) + if !ok { + return nil, fmt.Errorf("unexpected node type %T returned from KeysMutation", v) + } + node = nv } return node, err } @@ -274,7 +287,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 { @@ -330,8 +343,8 @@ func (kuo *KeysUpdateOne) sqlSave(ctx context.Context) (_node *Keys, err error) if err = sqlgraph.UpdateNode(ctx, kuo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{keys.Label} - } else if cerr, ok := isSQLConstraintError(err); ok { - err = cerr + } else if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } diff --git a/storage/ent/db/migrate/migrate.go b/storage/ent/db/migrate/migrate.go index e4a9a22182..6bccf3918a 100644 --- a/storage/ent/db/migrate/migrate.go +++ b/storage/ent/db/migrate/migrate.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package migrate @@ -28,17 +28,13 @@ var ( // and therefore, it's recommended to enable this option to get more // flexibility in the schema changes. WithDropIndex = schema.WithDropIndex - // WithFixture sets the foreign-key renaming option to the migration when upgrading - // ent from v0.1.0 (issue-#285). Defaults to false. - WithFixture = schema.WithFixture // WithForeignKeys enables creating foreign-key in schema DDL. This defaults to true. WithForeignKeys = schema.WithForeignKeys ) // 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. @@ -46,11 +42,16 @@ func NewSchema(drv dialect.Driver) *Schema { return &Schema{drv: drv} } // Create creates all schema resources. func (s *Schema) Create(ctx context.Context, opts ...schema.MigrateOption) error { + return Create(ctx, s, Tables, opts...) +} + +// Create creates all table resources using the given schema driver. +func Create(ctx context.Context, s *Schema, tables []*schema.Table, opts ...schema.MigrateOption) error { migrate, err := schema.NewMigrate(s.drv, opts...) if err != nil { return fmt.Errorf("ent/migrate: %w", err) } - return migrate.Create(ctx, Tables...) + return migrate.Create(ctx, tables...) } // WriteTo writes the schema changes to w instead of running them against the database. @@ -60,13 +61,5 @@ func (s *Schema) Create(ctx context.Context, opts ...schema.MigrateOption) error // } // func (s *Schema) WriteTo(ctx context.Context, w io.Writer, opts ...schema.MigrateOption) error { - drv := &schema.WriteDriver{ - Writer: w, - Driver: s.drv, - } - migrate, err := schema.NewMigrate(drv, opts...) - if err != nil { - return fmt.Errorf("ent/migrate: %w", err) - } - return migrate.Create(ctx, Tables...) + return Create(ctx, &Schema{drv: &schema.WriteDriver{Writer: w, Driver: s.drv}}, Tables, opts...) } diff --git a/storage/ent/db/migrate/schema.go b/storage/ent/db/migrate/schema.go index ec8a56ae30..4c42c6b3cc 100644 --- a/storage/ent/db/migrate/schema.go +++ b/storage/ent/db/migrate/schema.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package migrate @@ -29,10 +29,9 @@ var ( } // AuthCodesTable holds the schema information for the "auth_codes" table. AuthCodesTable = &schema.Table{ - Name: "auth_codes", - Columns: AuthCodesColumns, - PrimaryKey: []*schema.Column{AuthCodesColumns[0]}, - ForeignKeys: []*schema.ForeignKey{}, + Name: "auth_codes", + Columns: AuthCodesColumns, + PrimaryKey: []*schema.Column{AuthCodesColumns[0]}, } // AuthRequestsColumns holds the columns for the "auth_requests" table. AuthRequestsColumns = []*schema.Column{ @@ -60,10 +59,9 @@ var ( } // AuthRequestsTable holds the schema information for the "auth_requests" table. AuthRequestsTable = &schema.Table{ - Name: "auth_requests", - Columns: AuthRequestsColumns, - PrimaryKey: []*schema.Column{AuthRequestsColumns[0]}, - ForeignKeys: []*schema.ForeignKey{}, + Name: "auth_requests", + Columns: AuthRequestsColumns, + PrimaryKey: []*schema.Column{AuthRequestsColumns[0]}, } // ConnectorsColumns holds the columns for the "connectors" table. ConnectorsColumns = []*schema.Column{ @@ -75,10 +73,9 @@ var ( } // ConnectorsTable holds the schema information for the "connectors" table. ConnectorsTable = &schema.Table{ - Name: "connectors", - Columns: ConnectorsColumns, - PrimaryKey: []*schema.Column{ConnectorsColumns[0]}, - ForeignKeys: []*schema.ForeignKey{}, + Name: "connectors", + Columns: ConnectorsColumns, + PrimaryKey: []*schema.Column{ConnectorsColumns[0]}, } // DeviceRequestsColumns holds the columns for the "device_requests" table. DeviceRequestsColumns = []*schema.Column{ @@ -92,10 +89,9 @@ var ( } // DeviceRequestsTable holds the schema information for the "device_requests" table. DeviceRequestsTable = &schema.Table{ - Name: "device_requests", - Columns: DeviceRequestsColumns, - PrimaryKey: []*schema.Column{DeviceRequestsColumns[0]}, - ForeignKeys: []*schema.ForeignKey{}, + Name: "device_requests", + Columns: DeviceRequestsColumns, + PrimaryKey: []*schema.Column{DeviceRequestsColumns[0]}, } // DeviceTokensColumns holds the columns for the "device_tokens" table. DeviceTokensColumns = []*schema.Column{ @@ -109,10 +105,9 @@ var ( } // DeviceTokensTable holds the schema information for the "device_tokens" table. DeviceTokensTable = &schema.Table{ - Name: "device_tokens", - Columns: DeviceTokensColumns, - PrimaryKey: []*schema.Column{DeviceTokensColumns[0]}, - ForeignKeys: []*schema.ForeignKey{}, + Name: "device_tokens", + Columns: DeviceTokensColumns, + PrimaryKey: []*schema.Column{DeviceTokensColumns[0]}, } // KeysColumns holds the columns for the "keys" table. KeysColumns = []*schema.Column{ @@ -124,10 +119,9 @@ var ( } // KeysTable holds the schema information for the "keys" table. KeysTable = &schema.Table{ - Name: "keys", - Columns: KeysColumns, - PrimaryKey: []*schema.Column{KeysColumns[0]}, - ForeignKeys: []*schema.ForeignKey{}, + Name: "keys", + Columns: KeysColumns, + PrimaryKey: []*schema.Column{KeysColumns[0]}, } // Oauth2clientsColumns holds the columns for the "oauth2clients" table. Oauth2clientsColumns = []*schema.Column{ @@ -141,10 +135,9 @@ var ( } // Oauth2clientsTable holds the schema information for the "oauth2clients" table. Oauth2clientsTable = &schema.Table{ - Name: "oauth2clients", - Columns: Oauth2clientsColumns, - PrimaryKey: []*schema.Column{Oauth2clientsColumns[0]}, - ForeignKeys: []*schema.ForeignKey{}, + Name: "oauth2clients", + Columns: Oauth2clientsColumns, + PrimaryKey: []*schema.Column{Oauth2clientsColumns[0]}, } // OfflineSessionsColumns holds the columns for the "offline_sessions" table. OfflineSessionsColumns = []*schema.Column{ @@ -156,10 +149,9 @@ var ( } // OfflineSessionsTable holds the schema information for the "offline_sessions" table. OfflineSessionsTable = &schema.Table{ - Name: "offline_sessions", - Columns: OfflineSessionsColumns, - PrimaryKey: []*schema.Column{OfflineSessionsColumns[0]}, - ForeignKeys: []*schema.ForeignKey{}, + Name: "offline_sessions", + Columns: OfflineSessionsColumns, + PrimaryKey: []*schema.Column{OfflineSessionsColumns[0]}, } // PasswordsColumns holds the columns for the "passwords" table. PasswordsColumns = []*schema.Column{ @@ -171,10 +163,9 @@ var ( } // PasswordsTable holds the schema information for the "passwords" table. PasswordsTable = &schema.Table{ - Name: "passwords", - Columns: PasswordsColumns, - PrimaryKey: []*schema.Column{PasswordsColumns[0]}, - ForeignKeys: []*schema.ForeignKey{}, + Name: "passwords", + Columns: PasswordsColumns, + PrimaryKey: []*schema.Column{PasswordsColumns[0]}, } // RefreshTokensColumns holds the columns for the "refresh_tokens" table. RefreshTokensColumns = []*schema.Column{ @@ -197,10 +188,9 @@ var ( } // RefreshTokensTable holds the schema information for the "refresh_tokens" table. RefreshTokensTable = &schema.Table{ - Name: "refresh_tokens", - Columns: RefreshTokensColumns, - PrimaryKey: []*schema.Column{RefreshTokensColumns[0]}, - ForeignKeys: []*schema.ForeignKey{}, + Name: "refresh_tokens", + Columns: RefreshTokensColumns, + PrimaryKey: []*schema.Column{RefreshTokensColumns[0]}, } // Tables holds all the tables in the schema. Tables = []*schema.Table{ diff --git a/storage/ent/db/mutation.go b/storage/ent/db/mutation.go index c749d343f4..4bf4469f17 100644 --- a/storage/ent/db/mutation.go +++ b/storage/ent/db/mutation.go @@ -1,9 +1,10 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package db import ( "context" + "errors" "fmt" "sync" "time" @@ -20,7 +21,7 @@ import ( "github.com/dexidp/dex/storage/ent/db/password" "github.com/dexidp/dex/storage/ent/db/predicate" "github.com/dexidp/dex/storage/ent/db/refreshtoken" - "gopkg.in/square/go-jose.v2" + jose "gopkg.in/square/go-jose.v2" "entgo.io/ent" ) @@ -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() @@ -149,8 +150,8 @@ func (m *AuthCodeMutation) SetID(id string) { m.id = &id } -// ID returns the ID value in the mutation. Note that the ID -// is only available if it was provided to the builder. +// ID returns the ID value in the mutation. Note that the ID is only available +// if it was provided to the builder or after it was returned from the database. func (m *AuthCodeMutation) ID() (id string, exists bool) { if m.id == nil { return @@ -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 { @@ -737,6 +757,11 @@ func (m *AuthCodeMutation) ResetCodeChallengeMethod() { m.code_challenge_method = nil } +// Where appends a list predicates to the AuthCodeMutation builder. +func (m *AuthCodeMutation) Where(ps ...predicate.AuthCode) { + m.predicates = append(m.predicates, ps...) +} + // Op returns the operation name. func (m *AuthCodeMutation) Op() Op { return m.op @@ -1217,7 +1242,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) } @@ -1250,7 +1275,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() @@ -1263,8 +1288,8 @@ func (m *AuthRequestMutation) SetID(id string) { m.id = &id } -// ID returns the ID value in the mutation. Note that the ID -// is only available if it was provided to the builder. +// ID returns the ID value in the mutation. Note that the ID is only available +// if it was provided to the builder or after it was returned from the database. func (m *AuthRequestMutation) ID() (id string, exists bool) { if m.id == nil { return @@ -1272,6 +1297,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 @@ -1291,10 +1335,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 { @@ -1327,10 +1371,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 { @@ -1376,10 +1420,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 { @@ -1425,10 +1469,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 { @@ -1461,10 +1505,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 { @@ -1497,10 +1541,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 { @@ -1533,10 +1577,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 { @@ -1569,10 +1613,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 { @@ -1605,10 +1649,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 { @@ -1641,10 +1685,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 { @@ -1677,10 +1721,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 { @@ -1713,10 +1757,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 { @@ -1749,10 +1793,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 { @@ -1798,10 +1842,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 { @@ -1834,10 +1878,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 { @@ -1870,10 +1914,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 { @@ -1919,10 +1963,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 { @@ -1955,10 +1999,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 { @@ -1991,10 +2035,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 { @@ -2027,10 +2071,10 @@ func (m *AuthRequestMutation) LoginHint() (r string, exists bool) { // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *AuthRequestMutation) OldLoginHint(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldLoginHint is only allowed on UpdateOne operations") + return v, errors.New("OldLoginHint is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldLoginHint requires an ID field in the mutation") + return v, errors.New("OldLoginHint requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { @@ -2044,6 +2088,11 @@ func (m *AuthRequestMutation) ResetLoginHint() { m.login_hint = nil } +// Where appends a list predicates to the AuthRequestMutation builder. +func (m *AuthRequestMutation) Where(ps ...predicate.AuthRequest) { + m.predicates = append(m.predicates, ps...) +} + // Op returns the operation name. func (m *AuthRequestMutation) Op() Op { return m.op @@ -2599,7 +2648,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) } @@ -2632,7 +2681,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() @@ -2645,8 +2694,8 @@ func (m *ConnectorMutation) SetID(id string) { m.id = &id } -// ID returns the ID value in the mutation. Note that the ID -// is only available if it was provided to the builder. +// ID returns the ID value in the mutation. Note that the ID is only available +// if it was provided to the builder or after it was returned from the database. func (m *ConnectorMutation) ID() (id string, exists bool) { if m.id == nil { return @@ -2654,6 +2703,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 @@ -2673,10 +2741,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 { @@ -2709,10 +2777,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 { @@ -2745,10 +2813,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 { @@ -2781,10 +2849,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 { @@ -2798,6 +2866,11 @@ func (m *ConnectorMutation) ResetConfig() { m._config = nil } +// Where appends a list predicates to the ConnectorMutation builder. +func (m *ConnectorMutation) Where(ps ...predicate.Connector) { + m.predicates = append(m.predicates, ps...) +} + // Op returns the operation name. func (m *ConnectorMutation) Op() Op { return m.op @@ -3056,7 +3129,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) } @@ -3089,15 +3162,15 @@ 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() return tx, nil } -// ID returns the ID value in the mutation. Note that the ID -// is only available if it was provided to the builder. +// ID returns the ID value in the mutation. Note that the ID is only available +// if it was provided to the builder or after it was returned from the database. func (m *DeviceRequestMutation) ID() (id int, exists bool) { if m.id == nil { return @@ -3105,6 +3178,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 @@ -3124,10 +3216,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 { @@ -3160,10 +3252,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 { @@ -3196,10 +3288,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 { @@ -3232,10 +3324,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 { @@ -3268,10 +3360,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 { @@ -3317,10 +3409,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 { @@ -3334,6 +3426,11 @@ func (m *DeviceRequestMutation) ResetExpiry() { m.expiry = nil } +// Where appends a list predicates to the DeviceRequestMutation builder. +func (m *DeviceRequestMutation) Where(ps ...predicate.DeviceRequest) { + m.predicates = append(m.predicates, ps...) +} + // Op returns the operation name. func (m *DeviceRequestMutation) Op() Op { return m.op @@ -3636,7 +3733,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) } @@ -3669,15 +3766,15 @@ 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() return tx, nil } -// ID returns the ID value in the mutation. Note that the ID -// is only available if it was provided to the builder. +// ID returns the ID value in the mutation. Note that the ID is only available +// if it was provided to the builder or after it was returned from the database. func (m *DeviceTokenMutation) ID() (id int, exists bool) { if m.id == nil { return @@ -3685,6 +3782,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 @@ -3704,10 +3820,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 { @@ -3740,10 +3856,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 { @@ -3776,10 +3892,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 { @@ -3825,10 +3941,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 { @@ -3861,10 +3977,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 { @@ -3898,10 +4014,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 { @@ -3934,6 +4050,11 @@ func (m *DeviceTokenMutation) ResetPollInterval() { m.addpoll_interval = nil } +// Where appends a list predicates to the DeviceTokenMutation builder. +func (m *DeviceTokenMutation) Where(ps ...predicate.DeviceToken) { + m.predicates = append(m.predicates, ps...) +} + // Op returns the operation name. func (m *DeviceTokenMutation) Op() Op { return m.op @@ -4248,7 +4369,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) } @@ -4281,7 +4402,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() @@ -4294,8 +4415,8 @@ func (m *KeysMutation) SetID(id string) { m.id = &id } -// ID returns the ID value in the mutation. Note that the ID -// is only available if it was provided to the builder. +// ID returns the ID value in the mutation. Note that the ID is only available +// if it was provided to the builder or after it was returned from the database. func (m *KeysMutation) ID() (id string, exists bool) { if m.id == nil { return @@ -4303,6 +4424,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 @@ -4322,10 +4462,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 { @@ -4358,10 +4498,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 { @@ -4394,10 +4534,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 { @@ -4430,10 +4570,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 { @@ -4447,6 +4587,11 @@ func (m *KeysMutation) ResetNextRotation() { m.next_rotation = nil } +// Where appends a list predicates to the KeysMutation builder. +func (m *KeysMutation) Where(ps ...predicate.Keys) { + m.predicates = append(m.predicates, ps...) +} + // Op returns the operation name. func (m *KeysMutation) Op() Op { return m.op @@ -4705,7 +4850,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) } @@ -4738,7 +4883,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() @@ -4751,8 +4896,8 @@ func (m *OAuth2ClientMutation) SetID(id string) { m.id = &id } -// ID returns the ID value in the mutation. Note that the ID -// is only available if it was provided to the builder. +// ID returns the ID value in the mutation. Note that the ID is only available +// if it was provided to the builder or after it was returned from the database. func (m *OAuth2ClientMutation) ID() (id string, exists bool) { if m.id == nil { return @@ -4760,6 +4905,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 @@ -4779,10 +4943,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 { @@ -4815,10 +4979,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 { @@ -4864,10 +5028,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 { @@ -4913,10 +5077,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 { @@ -4949,10 +5113,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 { @@ -4985,10 +5149,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 { @@ -5002,6 +5166,11 @@ func (m *OAuth2ClientMutation) ResetLogoURL() { m.logo_url = nil } +// Where appends a list predicates to the OAuth2ClientMutation builder. +func (m *OAuth2ClientMutation) Where(ps ...predicate.OAuth2Client) { + m.predicates = append(m.predicates, ps...) +} + // Op returns the operation name. func (m *OAuth2ClientMutation) Op() Op { return m.op @@ -5307,7 +5476,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) } @@ -5340,7 +5509,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() @@ -5353,8 +5522,8 @@ func (m *OfflineSessionMutation) SetID(id string) { m.id = &id } -// ID returns the ID value in the mutation. Note that the ID -// is only available if it was provided to the builder. +// ID returns the ID value in the mutation. Note that the ID is only available +// if it was provided to the builder or after it was returned from the database. func (m *OfflineSessionMutation) ID() (id string, exists bool) { if m.id == nil { return @@ -5362,6 +5531,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 @@ -5381,10 +5569,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 { @@ -5417,10 +5605,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 { @@ -5453,10 +5641,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 { @@ -5489,10 +5677,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 { @@ -5519,6 +5707,11 @@ func (m *OfflineSessionMutation) ResetConnectorData() { delete(m.clearedFields, offlinesession.FieldConnectorData) } +// Where appends a list predicates to the OfflineSessionMutation builder. +func (m *OfflineSessionMutation) Where(ps ...predicate.OfflineSession) { + m.predicates = append(m.predicates, ps...) +} + // Op returns the operation name. func (m *OfflineSessionMutation) Op() Op { return m.op @@ -5784,7 +5977,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) } @@ -5817,15 +6010,15 @@ 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() return tx, nil } -// ID returns the ID value in the mutation. Note that the ID -// is only available if it was provided to the builder. +// ID returns the ID value in the mutation. Note that the ID is only available +// if it was provided to the builder or after it was returned from the database. func (m *PasswordMutation) ID() (id int, exists bool) { if m.id == nil { return @@ -5833,6 +6026,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 @@ -5852,10 +6064,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 { @@ -5888,10 +6100,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 { @@ -5924,10 +6136,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 { @@ -5960,10 +6172,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 { @@ -5977,6 +6189,11 @@ func (m *PasswordMutation) ResetUserID() { m.user_id = nil } +// Where appends a list predicates to the PasswordMutation builder. +func (m *PasswordMutation) Where(ps ...predicate.Password) { + m.predicates = append(m.predicates, ps...) +} + // Op returns the operation name. func (m *PasswordMutation) Op() Op { return m.op @@ -6244,7 +6461,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) } @@ -6277,7 +6494,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,8 +6507,8 @@ func (m *RefreshTokenMutation) SetID(id string) { m.id = &id } -// ID returns the ID value in the mutation. Note that the ID -// is only available if it was provided to the builder. +// ID returns the ID value in the mutation. Note that the ID is only available +// if it was provided to the builder or after it was returned from the database. func (m *RefreshTokenMutation) ID() (id string, exists bool) { if m.id == nil { return @@ -6299,6 +6516,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 @@ -6318,10 +6554,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 { @@ -6354,10 +6590,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 { @@ -6403,10 +6639,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 { @@ -6439,10 +6675,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 { @@ -6475,10 +6711,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 { @@ -6511,10 +6747,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 { @@ -6547,10 +6783,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 { @@ -6583,10 +6819,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 { @@ -6632,10 +6868,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 { @@ -6668,10 +6904,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 { @@ -6704,10 +6940,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 { @@ -6753,10 +6989,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 { @@ -6789,10 +7025,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 { @@ -6825,10 +7061,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 { @@ -6861,10 +7097,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 { @@ -6878,6 +7114,11 @@ func (m *RefreshTokenMutation) ResetLastUsed() { m.last_used = nil } +// Where appends a list predicates to the RefreshTokenMutation builder. +func (m *RefreshTokenMutation) Where(ps ...predicate.RefreshToken) { + m.predicates = append(m.predicates, ps...) +} + // Op returns the operation name. func (m *RefreshTokenMutation) Op() Op { return m.op diff --git a/storage/ent/db/oauth2client.go b/storage/ent/db/oauth2client.go index 687a6e692d..f96ca218e1 100644 --- a/storage/ent/db/oauth2client.go +++ b/storage/ent/db/oauth2client.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package db @@ -69,7 +69,6 @@ func (o *OAuth2Client) assignValues(columns []string, values []interface{}) erro o.Secret = value.String } case oauth2client.FieldRedirectUris: - if value, ok := values[i].(*[]byte); !ok { return fmt.Errorf("unexpected type %T for field redirect_uris", values[i]) } else if value != nil && len(*value) > 0 { @@ -78,7 +77,6 @@ func (o *OAuth2Client) assignValues(columns []string, values []interface{}) erro } } case oauth2client.FieldTrustedPeers: - if value, ok := values[i].(*[]byte); !ok { return fmt.Errorf("unexpected type %T for field trusted_peers", values[i]) } else if value != nil && len(*value) > 0 { @@ -119,11 +117,11 @@ func (o *OAuth2Client) Update() *OAuth2ClientUpdateOne { // Unwrap unwraps the OAuth2Client entity that was returned from a transaction after it was closed, // so that all future queries will be executed through the driver which created the transaction. func (o *OAuth2Client) Unwrap() *OAuth2Client { - tx, ok := o.config.driver.(*txDriver) + _tx, ok := o.config.driver.(*txDriver) if !ok { panic("db: OAuth2Client is not a transactional entity") } - o.config.driver = tx.drv + o.config.driver = _tx.drv return o } @@ -131,18 +129,23 @@ func (o *OAuth2Client) Unwrap() *OAuth2Client { func (o *OAuth2Client) String() string { var builder strings.Builder builder.WriteString("OAuth2Client(") - builder.WriteString(fmt.Sprintf("id=%v", o.ID)) - builder.WriteString(", secret=") + builder.WriteString(fmt.Sprintf("id=%v, ", o.ID)) + builder.WriteString("secret=") builder.WriteString(o.Secret) - builder.WriteString(", redirect_uris=") + builder.WriteString(", ") + builder.WriteString("redirect_uris=") builder.WriteString(fmt.Sprintf("%v", o.RedirectUris)) - builder.WriteString(", trusted_peers=") + builder.WriteString(", ") + builder.WriteString("trusted_peers=") builder.WriteString(fmt.Sprintf("%v", o.TrustedPeers)) - builder.WriteString(", public=") + builder.WriteString(", ") + builder.WriteString("public=") builder.WriteString(fmt.Sprintf("%v", o.Public)) - builder.WriteString(", name=") + builder.WriteString(", ") + builder.WriteString("name=") builder.WriteString(o.Name) - builder.WriteString(", logo_url=") + builder.WriteString(", ") + builder.WriteString("logo_url=") builder.WriteString(o.LogoURL) builder.WriteByte(')') return builder.String() diff --git a/storage/ent/db/oauth2client/oauth2client.go b/storage/ent/db/oauth2client/oauth2client.go index cbfdad1db5..55b00c166b 100644 --- a/storage/ent/db/oauth2client/oauth2client.go +++ b/storage/ent/db/oauth2client/oauth2client.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package oauth2client diff --git a/storage/ent/db/oauth2client/where.go b/storage/ent/db/oauth2client/where.go index b7dbf7a1ae..3553a5ef91 100644 --- a/storage/ent/db/oauth2client/where.go +++ b/storage/ent/db/oauth2client/where.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package oauth2client @@ -31,12 +31,6 @@ func IDNEQ(id string) predicate.OAuth2Client { // IDIn applies the In predicate on the ID field. func IDIn(ids ...string) predicate.OAuth2Client { return predicate.OAuth2Client(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(ids) == 0 { - s.Where(sql.False()) - return - } v := make([]interface{}, len(ids)) for i := range v { v[i] = ids[i] @@ -48,12 +42,6 @@ func IDIn(ids ...string) predicate.OAuth2Client { // IDNotIn applies the NotIn predicate on the ID field. func IDNotIn(ids ...string) predicate.OAuth2Client { return predicate.OAuth2Client(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(ids) == 0 { - s.Where(sql.False()) - return - } v := make([]interface{}, len(ids)) for i := range v { v[i] = ids[i] diff --git a/storage/ent/db/oauth2client_create.go b/storage/ent/db/oauth2client_create.go index 259b9473dc..02c41a8377 100644 --- a/storage/ent/db/oauth2client_create.go +++ b/storage/ent/db/oauth2client_create.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package db @@ -87,16 +87,28 @@ func (oc *OAuth2ClientCreate) Save(ctx context.Context) (*OAuth2Client, error) { return nil, err } oc.mutation = mutation - node, err = oc.sqlSave(ctx) + if node, err = oc.sqlSave(ctx); err != nil { + return nil, err + } + mutation.id = &node.ID mutation.done = true return node, err }) for i := len(oc.hooks) - 1; i >= 0; i-- { + if oc.hooks[i] == nil { + return nil, fmt.Errorf("db: uninitialized hook (forgotten import db/runtime?)") + } mut = oc.hooks[i](mut) } - if _, err := mut.Mutate(ctx, oc.mutation); err != nil { + v, err := mut.Mutate(ctx, oc.mutation) + if err != nil { return nil, err } + nv, ok := v.(*OAuth2Client) + if !ok { + return nil, fmt.Errorf("unexpected node type %T returned from OAuth2ClientMutation", v) + } + node = nv } return node, err } @@ -110,38 +122,51 @@ func (oc *OAuth2ClientCreate) SaveX(ctx context.Context) *OAuth2Client { return v } +// Exec executes the query. +func (oc *OAuth2ClientCreate) Exec(ctx context.Context) error { + _, err := oc.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (oc *OAuth2ClientCreate) ExecX(ctx context.Context) { + if err := oc.Exec(ctx); err != nil { + panic(err) + } +} + // 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 @@ -150,11 +175,18 @@ func (oc *OAuth2ClientCreate) check() error { func (oc *OAuth2ClientCreate) sqlSave(ctx context.Context) (*OAuth2Client, error) { _node, _spec := oc.createSpec() if err := sqlgraph.CreateNode(ctx, oc.driver, _spec); err != nil { - if cerr, ok := isSQLConstraintError(err); ok { - err = cerr + if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} } 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 } @@ -252,17 +284,19 @@ func (ocb *OAuth2ClientCreateBulk) Save(ctx context.Context) ([]*OAuth2Client, e if i < len(mutators)-1 { _, err = mutators[i+1].Mutate(root, ocb.builders[i+1].mutation) } else { + spec := &sqlgraph.BatchCreateSpec{Nodes: specs} // Invoke the actual operation on the latest mutation in the chain. - if err = sqlgraph.BatchCreate(ctx, ocb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil { - if cerr, ok := isSQLConstraintError(err); ok { - err = cerr + if err = sqlgraph.BatchCreate(ctx, ocb.driver, spec); err != nil { + if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} } } } - mutation.done = true if err != nil { return nil, err } + mutation.id = &nodes[i].ID + mutation.done = true return nodes[i], nil }) for i := len(builder.hooks) - 1; i >= 0; i-- { @@ -287,3 +321,16 @@ func (ocb *OAuth2ClientCreateBulk) SaveX(ctx context.Context) []*OAuth2Client { } return v } + +// Exec executes the query. +func (ocb *OAuth2ClientCreateBulk) Exec(ctx context.Context) error { + _, err := ocb.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (ocb *OAuth2ClientCreateBulk) ExecX(ctx context.Context) { + if err := ocb.Exec(ctx); err != nil { + panic(err) + } +} diff --git a/storage/ent/db/oauth2client_delete.go b/storage/ent/db/oauth2client_delete.go index ab0a45f607..239d904dc2 100644 --- a/storage/ent/db/oauth2client_delete.go +++ b/storage/ent/db/oauth2client_delete.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package db @@ -20,9 +20,9 @@ type OAuth2ClientDelete struct { mutation *OAuth2ClientMutation } -// Where adds a new predicate to the OAuth2ClientDelete builder. +// Where appends a list predicates to the OAuth2ClientDelete builder. func (od *OAuth2ClientDelete) Where(ps ...predicate.OAuth2Client) *OAuth2ClientDelete { - od.mutation.predicates = append(od.mutation.predicates, ps...) + od.mutation.Where(ps...) return od } @@ -46,6 +46,9 @@ func (od *OAuth2ClientDelete) Exec(ctx context.Context) (int, error) { return affected, err }) for i := len(od.hooks) - 1; i >= 0; i-- { + if od.hooks[i] == nil { + return 0, fmt.Errorf("db: uninitialized hook (forgotten import db/runtime?)") + } mut = od.hooks[i](mut) } if _, err := mut.Mutate(ctx, od.mutation); err != nil { @@ -81,7 +84,11 @@ func (od *OAuth2ClientDelete) sqlExec(ctx context.Context) (int, error) { } } } - return sqlgraph.DeleteNodes(ctx, od.driver, _spec) + affected, err := sqlgraph.DeleteNodes(ctx, od.driver, _spec) + if err != nil && sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} + } + return affected, err } // OAuth2ClientDeleteOne is the builder for deleting a single OAuth2Client entity. diff --git a/storage/ent/db/oauth2client_query.go b/storage/ent/db/oauth2client_query.go index 558542f16f..1776c943d2 100644 --- a/storage/ent/db/oauth2client_query.go +++ b/storage/ent/db/oauth2client_query.go @@ -1,10 +1,9 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package db import ( "context" - "errors" "fmt" "math" @@ -106,7 +105,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 +132,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 +241,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, } } @@ -263,15 +263,17 @@ func (oq *OAuth2ClientQuery) Clone() *OAuth2ClientQuery { // Scan(ctx, &v) // func (oq *OAuth2ClientQuery) GroupBy(field string, fields ...string) *OAuth2ClientGroupBy { - group := &OAuth2ClientGroupBy{config: oq.config} - group.fields = append([]string{field}, fields...) - group.path = func(ctx context.Context) (prev *sql.Selector, err error) { + grbuild := &OAuth2ClientGroupBy{config: oq.config} + grbuild.fields = append([]string{field}, fields...) + grbuild.path = func(ctx context.Context) (prev *sql.Selector, err error) { if err := oq.prepareQuery(ctx); err != nil { return nil, err } return oq.sqlQuery(ctx), nil } - return group + grbuild.label = oauth2client.Label + grbuild.flds, grbuild.scan = &grbuild.fields, grbuild.Scan + return grbuild } // Select allows the selection one or more fields/columns for the given query, @@ -287,9 +289,12 @@ func (oq *OAuth2ClientQuery) GroupBy(field string, fields ...string) *OAuth2Clie // Select(oauth2client.FieldSecret). // Scan(ctx, &v) // -func (oq *OAuth2ClientQuery) Select(field string, fields ...string) *OAuth2ClientSelect { - oq.fields = append([]string{field}, fields...) - return &OAuth2ClientSelect{OAuth2ClientQuery: oq} +func (oq *OAuth2ClientQuery) Select(fields ...string) *OAuth2ClientSelect { + oq.fields = append(oq.fields, fields...) + selbuild := &OAuth2ClientSelect{OAuth2ClientQuery: oq} + selbuild.label = oauth2client.Label + selbuild.flds, selbuild.scan = &oq.fields, selbuild.Scan + return selbuild } func (oq *OAuth2ClientQuery) prepareQuery(ctx context.Context) error { @@ -308,23 +313,22 @@ func (oq *OAuth2ClientQuery) prepareQuery(ctx context.Context) error { return nil } -func (oq *OAuth2ClientQuery) sqlAll(ctx context.Context) ([]*OAuth2Client, error) { +func (oq *OAuth2ClientQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*OAuth2Client, error) { var ( nodes = []*OAuth2Client{} _spec = oq.querySpec() ) _spec.ScanValues = func(columns []string) ([]interface{}, error) { - node := &OAuth2Client{config: oq.config} - nodes = append(nodes, node) - return node.scanValues(columns) + return (*OAuth2Client).scanValues(nil, columns) } _spec.Assign = func(columns []string, values []interface{}) error { - if len(nodes) == 0 { - return fmt.Errorf("db: Assign called without calling ScanValues") - } - node := nodes[len(nodes)-1] + node := &OAuth2Client{config: oq.config} + nodes = append(nodes, node) return node.assignValues(columns, values) } + for i := range hooks { + hooks[i](ctx, _spec) + } if err := sqlgraph.QueryNodes(ctx, oq.driver, _spec); err != nil { return nil, err } @@ -336,6 +340,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) } @@ -398,10 +406,17 @@ func (oq *OAuth2ClientQuery) querySpec() *sqlgraph.QuerySpec { func (oq *OAuth2ClientQuery) sqlQuery(ctx context.Context) *sql.Selector { builder := sql.Dialect(oq.driver.Dialect()) t1 := builder.Table(oauth2client.Table) - selector := builder.Select(t1.Columns(oauth2client.Columns...)...).From(t1) + columns := oq.fields + if len(columns) == 0 { + columns = oauth2client.Columns + } + selector := builder.Select(t1.Columns(columns...)...).From(t1) if oq.sql != nil { selector = oq.sql - selector.Select(selector.Columns(oauth2client.Columns...)...) + selector.Select(selector.Columns(columns...)...) + } + if oq.unique != nil && *oq.unique { + selector.Distinct() } for _, p := range oq.predicates { p(selector) @@ -423,6 +438,7 @@ func (oq *OAuth2ClientQuery) sqlQuery(ctx context.Context) *sql.Selector { // OAuth2ClientGroupBy is the group-by builder for OAuth2Client entities. type OAuth2ClientGroupBy struct { config + selector fields []string fns []AggregateFunc // intermediate query (i.e. traversal path). @@ -446,209 +462,6 @@ func (ogb *OAuth2ClientGroupBy) Scan(ctx context.Context, v interface{}) error { return ogb.sqlScan(ctx, v) } -// ScanX is like Scan, but panics if an error occurs. -func (ogb *OAuth2ClientGroupBy) ScanX(ctx context.Context, v interface{}) { - if err := ogb.Scan(ctx, v); err != nil { - panic(err) - } -} - -// Strings returns list of strings from group-by. -// It is only allowed when executing a group-by query with one field. -func (ogb *OAuth2ClientGroupBy) Strings(ctx context.Context) ([]string, error) { - if len(ogb.fields) > 1 { - return nil, errors.New("db: OAuth2ClientGroupBy.Strings is not achievable when grouping more than 1 field") - } - var v []string - if err := ogb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// StringsX is like Strings, but panics if an error occurs. -func (ogb *OAuth2ClientGroupBy) StringsX(ctx context.Context) []string { - v, err := ogb.Strings(ctx) - if err != nil { - panic(err) - } - return v -} - -// String returns a single string from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (ogb *OAuth2ClientGroupBy) String(ctx context.Context) (_ string, err error) { - var v []string - if v, err = ogb.Strings(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{oauth2client.Label} - default: - err = fmt.Errorf("db: OAuth2ClientGroupBy.Strings returned %d results when one was expected", len(v)) - } - return -} - -// StringX is like String, but panics if an error occurs. -func (ogb *OAuth2ClientGroupBy) StringX(ctx context.Context) string { - v, err := ogb.String(ctx) - if err != nil { - panic(err) - } - return v -} - -// Ints returns list of ints from group-by. -// It is only allowed when executing a group-by query with one field. -func (ogb *OAuth2ClientGroupBy) Ints(ctx context.Context) ([]int, error) { - if len(ogb.fields) > 1 { - return nil, errors.New("db: OAuth2ClientGroupBy.Ints is not achievable when grouping more than 1 field") - } - var v []int - if err := ogb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// IntsX is like Ints, but panics if an error occurs. -func (ogb *OAuth2ClientGroupBy) IntsX(ctx context.Context) []int { - v, err := ogb.Ints(ctx) - if err != nil { - panic(err) - } - return v -} - -// Int returns a single int from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (ogb *OAuth2ClientGroupBy) Int(ctx context.Context) (_ int, err error) { - var v []int - if v, err = ogb.Ints(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{oauth2client.Label} - default: - err = fmt.Errorf("db: OAuth2ClientGroupBy.Ints returned %d results when one was expected", len(v)) - } - return -} - -// IntX is like Int, but panics if an error occurs. -func (ogb *OAuth2ClientGroupBy) IntX(ctx context.Context) int { - v, err := ogb.Int(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64s returns list of float64s from group-by. -// It is only allowed when executing a group-by query with one field. -func (ogb *OAuth2ClientGroupBy) Float64s(ctx context.Context) ([]float64, error) { - if len(ogb.fields) > 1 { - return nil, errors.New("db: OAuth2ClientGroupBy.Float64s is not achievable when grouping more than 1 field") - } - var v []float64 - if err := ogb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// Float64sX is like Float64s, but panics if an error occurs. -func (ogb *OAuth2ClientGroupBy) Float64sX(ctx context.Context) []float64 { - v, err := ogb.Float64s(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64 returns a single float64 from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (ogb *OAuth2ClientGroupBy) Float64(ctx context.Context) (_ float64, err error) { - var v []float64 - if v, err = ogb.Float64s(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{oauth2client.Label} - default: - err = fmt.Errorf("db: OAuth2ClientGroupBy.Float64s returned %d results when one was expected", len(v)) - } - return -} - -// Float64X is like Float64, but panics if an error occurs. -func (ogb *OAuth2ClientGroupBy) Float64X(ctx context.Context) float64 { - v, err := ogb.Float64(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bools returns list of bools from group-by. -// It is only allowed when executing a group-by query with one field. -func (ogb *OAuth2ClientGroupBy) Bools(ctx context.Context) ([]bool, error) { - if len(ogb.fields) > 1 { - return nil, errors.New("db: OAuth2ClientGroupBy.Bools is not achievable when grouping more than 1 field") - } - var v []bool - if err := ogb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// BoolsX is like Bools, but panics if an error occurs. -func (ogb *OAuth2ClientGroupBy) BoolsX(ctx context.Context) []bool { - v, err := ogb.Bools(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bool returns a single bool from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (ogb *OAuth2ClientGroupBy) Bool(ctx context.Context) (_ bool, err error) { - var v []bool - if v, err = ogb.Bools(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{oauth2client.Label} - default: - err = fmt.Errorf("db: OAuth2ClientGroupBy.Bools returned %d results when one was expected", len(v)) - } - return -} - -// BoolX is like Bool, but panics if an error occurs. -func (ogb *OAuth2ClientGroupBy) BoolX(ctx context.Context) bool { - v, err := ogb.Bool(ctx) - if err != nil { - panic(err) - } - return v -} - func (ogb *OAuth2ClientGroupBy) sqlScan(ctx context.Context, v interface{}) error { for _, f := range ogb.fields { if !oauth2client.ValidColumn(f) { @@ -669,18 +482,28 @@ func (ogb *OAuth2ClientGroupBy) sqlScan(ctx context.Context, v interface{}) erro } func (ogb *OAuth2ClientGroupBy) sqlQuery() *sql.Selector { - selector := ogb.sql - columns := make([]string, 0, len(ogb.fields)+len(ogb.fns)) - columns = append(columns, ogb.fields...) + selector := ogb.sql.Select() + aggregation := make([]string, 0, len(ogb.fns)) for _, fn := range ogb.fns { - columns = append(columns, fn(selector)) + aggregation = append(aggregation, fn(selector)) + } + // If no columns were selected in a custom aggregation function, the default + // selection is the fields used for "group-by", and the aggregation functions. + if len(selector.SelectedColumns()) == 0 { + columns := make([]string, 0, len(ogb.fields)+len(ogb.fns)) + for _, f := range ogb.fields { + columns = append(columns, selector.C(f)) + } + columns = append(columns, aggregation...) + selector.Select(columns...) } - return selector.Select(columns...).GroupBy(ogb.fields...) + return selector.GroupBy(selector.Columns(ogb.fields...)...) } // OAuth2ClientSelect is the builder for selecting fields of OAuth2Client entities. type OAuth2ClientSelect struct { *OAuth2ClientQuery + selector // intermediate query (i.e. traversal path). sql *sql.Selector } @@ -694,213 +517,12 @@ func (os *OAuth2ClientSelect) Scan(ctx context.Context, v interface{}) error { return os.sqlScan(ctx, v) } -// ScanX is like Scan, but panics if an error occurs. -func (os *OAuth2ClientSelect) ScanX(ctx context.Context, v interface{}) { - if err := os.Scan(ctx, v); err != nil { - panic(err) - } -} - -// Strings returns list of strings from a selector. It is only allowed when selecting one field. -func (os *OAuth2ClientSelect) Strings(ctx context.Context) ([]string, error) { - if len(os.fields) > 1 { - return nil, errors.New("db: OAuth2ClientSelect.Strings is not achievable when selecting more than 1 field") - } - var v []string - if err := os.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// StringsX is like Strings, but panics if an error occurs. -func (os *OAuth2ClientSelect) StringsX(ctx context.Context) []string { - v, err := os.Strings(ctx) - if err != nil { - panic(err) - } - return v -} - -// String returns a single string from a selector. It is only allowed when selecting one field. -func (os *OAuth2ClientSelect) String(ctx context.Context) (_ string, err error) { - var v []string - if v, err = os.Strings(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{oauth2client.Label} - default: - err = fmt.Errorf("db: OAuth2ClientSelect.Strings returned %d results when one was expected", len(v)) - } - return -} - -// StringX is like String, but panics if an error occurs. -func (os *OAuth2ClientSelect) StringX(ctx context.Context) string { - v, err := os.String(ctx) - if err != nil { - panic(err) - } - return v -} - -// Ints returns list of ints from a selector. It is only allowed when selecting one field. -func (os *OAuth2ClientSelect) Ints(ctx context.Context) ([]int, error) { - if len(os.fields) > 1 { - return nil, errors.New("db: OAuth2ClientSelect.Ints is not achievable when selecting more than 1 field") - } - var v []int - if err := os.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// IntsX is like Ints, but panics if an error occurs. -func (os *OAuth2ClientSelect) IntsX(ctx context.Context) []int { - v, err := os.Ints(ctx) - if err != nil { - panic(err) - } - return v -} - -// Int returns a single int from a selector. It is only allowed when selecting one field. -func (os *OAuth2ClientSelect) Int(ctx context.Context) (_ int, err error) { - var v []int - if v, err = os.Ints(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{oauth2client.Label} - default: - err = fmt.Errorf("db: OAuth2ClientSelect.Ints returned %d results when one was expected", len(v)) - } - return -} - -// IntX is like Int, but panics if an error occurs. -func (os *OAuth2ClientSelect) IntX(ctx context.Context) int { - v, err := os.Int(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64s returns list of float64s from a selector. It is only allowed when selecting one field. -func (os *OAuth2ClientSelect) Float64s(ctx context.Context) ([]float64, error) { - if len(os.fields) > 1 { - return nil, errors.New("db: OAuth2ClientSelect.Float64s is not achievable when selecting more than 1 field") - } - var v []float64 - if err := os.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// Float64sX is like Float64s, but panics if an error occurs. -func (os *OAuth2ClientSelect) Float64sX(ctx context.Context) []float64 { - v, err := os.Float64s(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64 returns a single float64 from a selector. It is only allowed when selecting one field. -func (os *OAuth2ClientSelect) Float64(ctx context.Context) (_ float64, err error) { - var v []float64 - if v, err = os.Float64s(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{oauth2client.Label} - default: - err = fmt.Errorf("db: OAuth2ClientSelect.Float64s returned %d results when one was expected", len(v)) - } - return -} - -// Float64X is like Float64, but panics if an error occurs. -func (os *OAuth2ClientSelect) Float64X(ctx context.Context) float64 { - v, err := os.Float64(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bools returns list of bools from a selector. It is only allowed when selecting one field. -func (os *OAuth2ClientSelect) Bools(ctx context.Context) ([]bool, error) { - if len(os.fields) > 1 { - return nil, errors.New("db: OAuth2ClientSelect.Bools is not achievable when selecting more than 1 field") - } - var v []bool - if err := os.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// BoolsX is like Bools, but panics if an error occurs. -func (os *OAuth2ClientSelect) BoolsX(ctx context.Context) []bool { - v, err := os.Bools(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bool returns a single bool from a selector. It is only allowed when selecting one field. -func (os *OAuth2ClientSelect) Bool(ctx context.Context) (_ bool, err error) { - var v []bool - if v, err = os.Bools(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{oauth2client.Label} - default: - err = fmt.Errorf("db: OAuth2ClientSelect.Bools returned %d results when one was expected", len(v)) - } - return -} - -// BoolX is like Bool, but panics if an error occurs. -func (os *OAuth2ClientSelect) BoolX(ctx context.Context) bool { - v, err := os.Bool(ctx) - if err != nil { - panic(err) - } - return v -} - func (os *OAuth2ClientSelect) sqlScan(ctx context.Context, v interface{}) error { rows := &sql.Rows{} - query, args := os.sqlQuery().Query() + query, args := os.sql.Query() if err := os.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() return sql.ScanSlice(rows, v) } - -func (os *OAuth2ClientSelect) sqlQuery() sql.Querier { - selector := os.sql - selector.Select(selector.Columns(os.fields...)...) - return selector -} diff --git a/storage/ent/db/oauth2client_update.go b/storage/ent/db/oauth2client_update.go index 329824183d..aeddbba63c 100644 --- a/storage/ent/db/oauth2client_update.go +++ b/storage/ent/db/oauth2client_update.go @@ -1,9 +1,10 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package db import ( "context" + "errors" "fmt" "entgo.io/ent/dialect/sql" @@ -20,9 +21,9 @@ type OAuth2ClientUpdate struct { mutation *OAuth2ClientMutation } -// Where adds a new predicate for the OAuth2ClientUpdate builder. +// Where appends a list predicates to the OAuth2ClientUpdate builder. func (ou *OAuth2ClientUpdate) Where(ps ...predicate.OAuth2Client) *OAuth2ClientUpdate { - ou.mutation.predicates = append(ou.mutation.predicates, ps...) + ou.mutation.Where(ps...) return ou } @@ -105,6 +106,9 @@ func (ou *OAuth2ClientUpdate) Save(ctx context.Context) (int, error) { return affected, err }) for i := len(ou.hooks) - 1; i >= 0; i-- { + if ou.hooks[i] == nil { + return 0, fmt.Errorf("db: uninitialized hook (forgotten import db/runtime?)") + } mut = ou.hooks[i](mut) } if _, err := mut.Mutate(ctx, ou.mutation); err != nil { @@ -140,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 @@ -231,8 +235,8 @@ func (ou *OAuth2ClientUpdate) sqlSave(ctx context.Context) (n int, err error) { if n, err = sqlgraph.UpdateNodes(ctx, ou.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{oauth2client.Label} - } else if cerr, ok := isSQLConstraintError(err); ok { - err = cerr + } else if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} } return 0, err } @@ -333,11 +337,20 @@ func (ouo *OAuth2ClientUpdateOne) Save(ctx context.Context) (*OAuth2Client, erro return node, err }) for i := len(ouo.hooks) - 1; i >= 0; i-- { + if ouo.hooks[i] == nil { + return nil, fmt.Errorf("db: uninitialized hook (forgotten import db/runtime?)") + } mut = ouo.hooks[i](mut) } - if _, err := mut.Mutate(ctx, ouo.mutation); err != nil { + v, err := mut.Mutate(ctx, ouo.mutation) + if err != nil { return nil, err } + nv, ok := v.(*OAuth2Client) + if !ok { + return nil, fmt.Errorf("unexpected node type %T returned from OAuth2ClientMutation", v) + } + node = nv } return node, err } @@ -368,17 +381,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 @@ -397,7 +410,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 { @@ -479,8 +492,8 @@ func (ouo *OAuth2ClientUpdateOne) sqlSave(ctx context.Context) (_node *OAuth2Cli if err = sqlgraph.UpdateNode(ctx, ouo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{oauth2client.Label} - } else if cerr, ok := isSQLConstraintError(err); ok { - err = cerr + } else if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } diff --git a/storage/ent/db/offlinesession.go b/storage/ent/db/offlinesession.go index 6bfa5d2a7d..4b797e2672 100644 --- a/storage/ent/db/offlinesession.go +++ b/storage/ent/db/offlinesession.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package db @@ -94,11 +94,11 @@ func (os *OfflineSession) Update() *OfflineSessionUpdateOne { // Unwrap unwraps the OfflineSession entity that was returned from a transaction after it was closed, // so that all future queries will be executed through the driver which created the transaction. func (os *OfflineSession) Unwrap() *OfflineSession { - tx, ok := os.config.driver.(*txDriver) + _tx, ok := os.config.driver.(*txDriver) if !ok { panic("db: OfflineSession is not a transactional entity") } - os.config.driver = tx.drv + os.config.driver = _tx.drv return os } @@ -106,15 +106,18 @@ func (os *OfflineSession) Unwrap() *OfflineSession { func (os *OfflineSession) String() string { var builder strings.Builder builder.WriteString("OfflineSession(") - builder.WriteString(fmt.Sprintf("id=%v", os.ID)) - builder.WriteString(", user_id=") + builder.WriteString(fmt.Sprintf("id=%v, ", os.ID)) + builder.WriteString("user_id=") builder.WriteString(os.UserID) - builder.WriteString(", conn_id=") + builder.WriteString(", ") + builder.WriteString("conn_id=") builder.WriteString(os.ConnID) - builder.WriteString(", refresh=") + builder.WriteString(", ") + builder.WriteString("refresh=") builder.WriteString(fmt.Sprintf("%v", os.Refresh)) + builder.WriteString(", ") if v := os.ConnectorData; v != nil { - builder.WriteString(", connector_data=") + builder.WriteString("connector_data=") builder.WriteString(fmt.Sprintf("%v", *v)) } builder.WriteByte(')') diff --git a/storage/ent/db/offlinesession/offlinesession.go b/storage/ent/db/offlinesession/offlinesession.go index df12c7f0bf..f996fe18d7 100644 --- a/storage/ent/db/offlinesession/offlinesession.go +++ b/storage/ent/db/offlinesession/offlinesession.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package offlinesession diff --git a/storage/ent/db/offlinesession/where.go b/storage/ent/db/offlinesession/where.go index e24b903975..541c6b0d32 100644 --- a/storage/ent/db/offlinesession/where.go +++ b/storage/ent/db/offlinesession/where.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package offlinesession @@ -31,12 +31,6 @@ func IDNEQ(id string) predicate.OfflineSession { // IDIn applies the In predicate on the ID field. func IDIn(ids ...string) predicate.OfflineSession { return predicate.OfflineSession(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(ids) == 0 { - s.Where(sql.False()) - return - } v := make([]interface{}, len(ids)) for i := range v { v[i] = ids[i] @@ -48,12 +42,6 @@ func IDIn(ids ...string) predicate.OfflineSession { // IDNotIn applies the NotIn predicate on the ID field. func IDNotIn(ids ...string) predicate.OfflineSession { return predicate.OfflineSession(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(ids) == 0 { - s.Where(sql.False()) - return - } v := make([]interface{}, len(ids)) for i := range v { v[i] = ids[i] diff --git a/storage/ent/db/offlinesession_create.go b/storage/ent/db/offlinesession_create.go index 1103e8eeab..82b8014f1b 100644 --- a/storage/ent/db/offlinesession_create.go +++ b/storage/ent/db/offlinesession_create.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package db @@ -75,16 +75,28 @@ func (osc *OfflineSessionCreate) Save(ctx context.Context) (*OfflineSession, err return nil, err } osc.mutation = mutation - node, err = osc.sqlSave(ctx) + if node, err = osc.sqlSave(ctx); err != nil { + return nil, err + } + mutation.id = &node.ID mutation.done = true return node, err }) for i := len(osc.hooks) - 1; i >= 0; i-- { + if osc.hooks[i] == nil { + return nil, fmt.Errorf("db: uninitialized hook (forgotten import db/runtime?)") + } mut = osc.hooks[i](mut) } - if _, err := mut.Mutate(ctx, osc.mutation); err != nil { + v, err := mut.Mutate(ctx, osc.mutation) + if err != nil { return nil, err } + nv, ok := v.(*OfflineSession) + if !ok { + return nil, fmt.Errorf("unexpected node type %T returned from OfflineSessionMutation", v) + } + node = nv } return node, err } @@ -98,30 +110,43 @@ func (osc *OfflineSessionCreate) SaveX(ctx context.Context) *OfflineSession { return v } +// Exec executes the query. +func (osc *OfflineSessionCreate) Exec(ctx context.Context) error { + _, err := osc.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (osc *OfflineSessionCreate) ExecX(ctx context.Context) { + if err := osc.Exec(ctx); err != nil { + panic(err) + } +} + // 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 @@ -130,11 +155,18 @@ func (osc *OfflineSessionCreate) check() error { func (osc *OfflineSessionCreate) sqlSave(ctx context.Context) (*OfflineSession, error) { _node, _spec := osc.createSpec() if err := sqlgraph.CreateNode(ctx, osc.driver, _spec); err != nil { - if cerr, ok := isSQLConstraintError(err); ok { - err = cerr + if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} } 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 } @@ -216,17 +248,19 @@ func (oscb *OfflineSessionCreateBulk) Save(ctx context.Context) ([]*OfflineSessi if i < len(mutators)-1 { _, err = mutators[i+1].Mutate(root, oscb.builders[i+1].mutation) } else { + spec := &sqlgraph.BatchCreateSpec{Nodes: specs} // Invoke the actual operation on the latest mutation in the chain. - if err = sqlgraph.BatchCreate(ctx, oscb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil { - if cerr, ok := isSQLConstraintError(err); ok { - err = cerr + if err = sqlgraph.BatchCreate(ctx, oscb.driver, spec); err != nil { + if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} } } } - mutation.done = true if err != nil { return nil, err } + mutation.id = &nodes[i].ID + mutation.done = true return nodes[i], nil }) for i := len(builder.hooks) - 1; i >= 0; i-- { @@ -251,3 +285,16 @@ func (oscb *OfflineSessionCreateBulk) SaveX(ctx context.Context) []*OfflineSessi } return v } + +// Exec executes the query. +func (oscb *OfflineSessionCreateBulk) Exec(ctx context.Context) error { + _, err := oscb.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (oscb *OfflineSessionCreateBulk) ExecX(ctx context.Context) { + if err := oscb.Exec(ctx); err != nil { + panic(err) + } +} diff --git a/storage/ent/db/offlinesession_delete.go b/storage/ent/db/offlinesession_delete.go index 8ca8337837..b9c60ba9a3 100644 --- a/storage/ent/db/offlinesession_delete.go +++ b/storage/ent/db/offlinesession_delete.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package db @@ -20,9 +20,9 @@ type OfflineSessionDelete struct { mutation *OfflineSessionMutation } -// Where adds a new predicate to the OfflineSessionDelete builder. +// Where appends a list predicates to the OfflineSessionDelete builder. func (osd *OfflineSessionDelete) Where(ps ...predicate.OfflineSession) *OfflineSessionDelete { - osd.mutation.predicates = append(osd.mutation.predicates, ps...) + osd.mutation.Where(ps...) return osd } @@ -46,6 +46,9 @@ func (osd *OfflineSessionDelete) Exec(ctx context.Context) (int, error) { return affected, err }) for i := len(osd.hooks) - 1; i >= 0; i-- { + if osd.hooks[i] == nil { + return 0, fmt.Errorf("db: uninitialized hook (forgotten import db/runtime?)") + } mut = osd.hooks[i](mut) } if _, err := mut.Mutate(ctx, osd.mutation); err != nil { @@ -81,7 +84,11 @@ func (osd *OfflineSessionDelete) sqlExec(ctx context.Context) (int, error) { } } } - return sqlgraph.DeleteNodes(ctx, osd.driver, _spec) + affected, err := sqlgraph.DeleteNodes(ctx, osd.driver, _spec) + if err != nil && sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} + } + return affected, err } // OfflineSessionDeleteOne is the builder for deleting a single OfflineSession entity. diff --git a/storage/ent/db/offlinesession_query.go b/storage/ent/db/offlinesession_query.go index a4fbe1fda9..e5e09cf16d 100644 --- a/storage/ent/db/offlinesession_query.go +++ b/storage/ent/db/offlinesession_query.go @@ -1,10 +1,9 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package db import ( "context" - "errors" "fmt" "math" @@ -106,7 +105,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 +132,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 +241,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, } } @@ -263,15 +263,17 @@ func (osq *OfflineSessionQuery) Clone() *OfflineSessionQuery { // Scan(ctx, &v) // func (osq *OfflineSessionQuery) GroupBy(field string, fields ...string) *OfflineSessionGroupBy { - group := &OfflineSessionGroupBy{config: osq.config} - group.fields = append([]string{field}, fields...) - group.path = func(ctx context.Context) (prev *sql.Selector, err error) { + grbuild := &OfflineSessionGroupBy{config: osq.config} + grbuild.fields = append([]string{field}, fields...) + grbuild.path = func(ctx context.Context) (prev *sql.Selector, err error) { if err := osq.prepareQuery(ctx); err != nil { return nil, err } return osq.sqlQuery(ctx), nil } - return group + grbuild.label = offlinesession.Label + grbuild.flds, grbuild.scan = &grbuild.fields, grbuild.Scan + return grbuild } // Select allows the selection one or more fields/columns for the given query, @@ -287,9 +289,12 @@ func (osq *OfflineSessionQuery) GroupBy(field string, fields ...string) *Offline // Select(offlinesession.FieldUserID). // Scan(ctx, &v) // -func (osq *OfflineSessionQuery) Select(field string, fields ...string) *OfflineSessionSelect { - osq.fields = append([]string{field}, fields...) - return &OfflineSessionSelect{OfflineSessionQuery: osq} +func (osq *OfflineSessionQuery) Select(fields ...string) *OfflineSessionSelect { + osq.fields = append(osq.fields, fields...) + selbuild := &OfflineSessionSelect{OfflineSessionQuery: osq} + selbuild.label = offlinesession.Label + selbuild.flds, selbuild.scan = &osq.fields, selbuild.Scan + return selbuild } func (osq *OfflineSessionQuery) prepareQuery(ctx context.Context) error { @@ -308,23 +313,22 @@ func (osq *OfflineSessionQuery) prepareQuery(ctx context.Context) error { return nil } -func (osq *OfflineSessionQuery) sqlAll(ctx context.Context) ([]*OfflineSession, error) { +func (osq *OfflineSessionQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*OfflineSession, error) { var ( nodes = []*OfflineSession{} _spec = osq.querySpec() ) _spec.ScanValues = func(columns []string) ([]interface{}, error) { - node := &OfflineSession{config: osq.config} - nodes = append(nodes, node) - return node.scanValues(columns) + return (*OfflineSession).scanValues(nil, columns) } _spec.Assign = func(columns []string, values []interface{}) error { - if len(nodes) == 0 { - return fmt.Errorf("db: Assign called without calling ScanValues") - } - node := nodes[len(nodes)-1] + node := &OfflineSession{config: osq.config} + nodes = append(nodes, node) return node.assignValues(columns, values) } + for i := range hooks { + hooks[i](ctx, _spec) + } if err := sqlgraph.QueryNodes(ctx, osq.driver, _spec); err != nil { return nil, err } @@ -336,6 +340,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) } @@ -398,10 +406,17 @@ func (osq *OfflineSessionQuery) querySpec() *sqlgraph.QuerySpec { func (osq *OfflineSessionQuery) sqlQuery(ctx context.Context) *sql.Selector { builder := sql.Dialect(osq.driver.Dialect()) t1 := builder.Table(offlinesession.Table) - selector := builder.Select(t1.Columns(offlinesession.Columns...)...).From(t1) + columns := osq.fields + if len(columns) == 0 { + columns = offlinesession.Columns + } + selector := builder.Select(t1.Columns(columns...)...).From(t1) if osq.sql != nil { selector = osq.sql - selector.Select(selector.Columns(offlinesession.Columns...)...) + selector.Select(selector.Columns(columns...)...) + } + if osq.unique != nil && *osq.unique { + selector.Distinct() } for _, p := range osq.predicates { p(selector) @@ -423,6 +438,7 @@ func (osq *OfflineSessionQuery) sqlQuery(ctx context.Context) *sql.Selector { // OfflineSessionGroupBy is the group-by builder for OfflineSession entities. type OfflineSessionGroupBy struct { config + selector fields []string fns []AggregateFunc // intermediate query (i.e. traversal path). @@ -446,209 +462,6 @@ func (osgb *OfflineSessionGroupBy) Scan(ctx context.Context, v interface{}) erro return osgb.sqlScan(ctx, v) } -// ScanX is like Scan, but panics if an error occurs. -func (osgb *OfflineSessionGroupBy) ScanX(ctx context.Context, v interface{}) { - if err := osgb.Scan(ctx, v); err != nil { - panic(err) - } -} - -// Strings returns list of strings from group-by. -// It is only allowed when executing a group-by query with one field. -func (osgb *OfflineSessionGroupBy) Strings(ctx context.Context) ([]string, error) { - if len(osgb.fields) > 1 { - return nil, errors.New("db: OfflineSessionGroupBy.Strings is not achievable when grouping more than 1 field") - } - var v []string - if err := osgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// StringsX is like Strings, but panics if an error occurs. -func (osgb *OfflineSessionGroupBy) StringsX(ctx context.Context) []string { - v, err := osgb.Strings(ctx) - if err != nil { - panic(err) - } - return v -} - -// String returns a single string from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (osgb *OfflineSessionGroupBy) String(ctx context.Context) (_ string, err error) { - var v []string - if v, err = osgb.Strings(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{offlinesession.Label} - default: - err = fmt.Errorf("db: OfflineSessionGroupBy.Strings returned %d results when one was expected", len(v)) - } - return -} - -// StringX is like String, but panics if an error occurs. -func (osgb *OfflineSessionGroupBy) StringX(ctx context.Context) string { - v, err := osgb.String(ctx) - if err != nil { - panic(err) - } - return v -} - -// Ints returns list of ints from group-by. -// It is only allowed when executing a group-by query with one field. -func (osgb *OfflineSessionGroupBy) Ints(ctx context.Context) ([]int, error) { - if len(osgb.fields) > 1 { - return nil, errors.New("db: OfflineSessionGroupBy.Ints is not achievable when grouping more than 1 field") - } - var v []int - if err := osgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// IntsX is like Ints, but panics if an error occurs. -func (osgb *OfflineSessionGroupBy) IntsX(ctx context.Context) []int { - v, err := osgb.Ints(ctx) - if err != nil { - panic(err) - } - return v -} - -// Int returns a single int from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (osgb *OfflineSessionGroupBy) Int(ctx context.Context) (_ int, err error) { - var v []int - if v, err = osgb.Ints(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{offlinesession.Label} - default: - err = fmt.Errorf("db: OfflineSessionGroupBy.Ints returned %d results when one was expected", len(v)) - } - return -} - -// IntX is like Int, but panics if an error occurs. -func (osgb *OfflineSessionGroupBy) IntX(ctx context.Context) int { - v, err := osgb.Int(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64s returns list of float64s from group-by. -// It is only allowed when executing a group-by query with one field. -func (osgb *OfflineSessionGroupBy) Float64s(ctx context.Context) ([]float64, error) { - if len(osgb.fields) > 1 { - return nil, errors.New("db: OfflineSessionGroupBy.Float64s is not achievable when grouping more than 1 field") - } - var v []float64 - if err := osgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// Float64sX is like Float64s, but panics if an error occurs. -func (osgb *OfflineSessionGroupBy) Float64sX(ctx context.Context) []float64 { - v, err := osgb.Float64s(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64 returns a single float64 from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (osgb *OfflineSessionGroupBy) Float64(ctx context.Context) (_ float64, err error) { - var v []float64 - if v, err = osgb.Float64s(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{offlinesession.Label} - default: - err = fmt.Errorf("db: OfflineSessionGroupBy.Float64s returned %d results when one was expected", len(v)) - } - return -} - -// Float64X is like Float64, but panics if an error occurs. -func (osgb *OfflineSessionGroupBy) Float64X(ctx context.Context) float64 { - v, err := osgb.Float64(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bools returns list of bools from group-by. -// It is only allowed when executing a group-by query with one field. -func (osgb *OfflineSessionGroupBy) Bools(ctx context.Context) ([]bool, error) { - if len(osgb.fields) > 1 { - return nil, errors.New("db: OfflineSessionGroupBy.Bools is not achievable when grouping more than 1 field") - } - var v []bool - if err := osgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// BoolsX is like Bools, but panics if an error occurs. -func (osgb *OfflineSessionGroupBy) BoolsX(ctx context.Context) []bool { - v, err := osgb.Bools(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bool returns a single bool from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (osgb *OfflineSessionGroupBy) Bool(ctx context.Context) (_ bool, err error) { - var v []bool - if v, err = osgb.Bools(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{offlinesession.Label} - default: - err = fmt.Errorf("db: OfflineSessionGroupBy.Bools returned %d results when one was expected", len(v)) - } - return -} - -// BoolX is like Bool, but panics if an error occurs. -func (osgb *OfflineSessionGroupBy) BoolX(ctx context.Context) bool { - v, err := osgb.Bool(ctx) - if err != nil { - panic(err) - } - return v -} - func (osgb *OfflineSessionGroupBy) sqlScan(ctx context.Context, v interface{}) error { for _, f := range osgb.fields { if !offlinesession.ValidColumn(f) { @@ -669,18 +482,28 @@ func (osgb *OfflineSessionGroupBy) sqlScan(ctx context.Context, v interface{}) e } func (osgb *OfflineSessionGroupBy) sqlQuery() *sql.Selector { - selector := osgb.sql - columns := make([]string, 0, len(osgb.fields)+len(osgb.fns)) - columns = append(columns, osgb.fields...) + selector := osgb.sql.Select() + aggregation := make([]string, 0, len(osgb.fns)) for _, fn := range osgb.fns { - columns = append(columns, fn(selector)) + aggregation = append(aggregation, fn(selector)) + } + // If no columns were selected in a custom aggregation function, the default + // selection is the fields used for "group-by", and the aggregation functions. + if len(selector.SelectedColumns()) == 0 { + columns := make([]string, 0, len(osgb.fields)+len(osgb.fns)) + for _, f := range osgb.fields { + columns = append(columns, selector.C(f)) + } + columns = append(columns, aggregation...) + selector.Select(columns...) } - return selector.Select(columns...).GroupBy(osgb.fields...) + return selector.GroupBy(selector.Columns(osgb.fields...)...) } // OfflineSessionSelect is the builder for selecting fields of OfflineSession entities. type OfflineSessionSelect struct { *OfflineSessionQuery + selector // intermediate query (i.e. traversal path). sql *sql.Selector } @@ -694,213 +517,12 @@ func (oss *OfflineSessionSelect) Scan(ctx context.Context, v interface{}) error return oss.sqlScan(ctx, v) } -// ScanX is like Scan, but panics if an error occurs. -func (oss *OfflineSessionSelect) ScanX(ctx context.Context, v interface{}) { - if err := oss.Scan(ctx, v); err != nil { - panic(err) - } -} - -// Strings returns list of strings from a selector. It is only allowed when selecting one field. -func (oss *OfflineSessionSelect) Strings(ctx context.Context) ([]string, error) { - if len(oss.fields) > 1 { - return nil, errors.New("db: OfflineSessionSelect.Strings is not achievable when selecting more than 1 field") - } - var v []string - if err := oss.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// StringsX is like Strings, but panics if an error occurs. -func (oss *OfflineSessionSelect) StringsX(ctx context.Context) []string { - v, err := oss.Strings(ctx) - if err != nil { - panic(err) - } - return v -} - -// String returns a single string from a selector. It is only allowed when selecting one field. -func (oss *OfflineSessionSelect) String(ctx context.Context) (_ string, err error) { - var v []string - if v, err = oss.Strings(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{offlinesession.Label} - default: - err = fmt.Errorf("db: OfflineSessionSelect.Strings returned %d results when one was expected", len(v)) - } - return -} - -// StringX is like String, but panics if an error occurs. -func (oss *OfflineSessionSelect) StringX(ctx context.Context) string { - v, err := oss.String(ctx) - if err != nil { - panic(err) - } - return v -} - -// Ints returns list of ints from a selector. It is only allowed when selecting one field. -func (oss *OfflineSessionSelect) Ints(ctx context.Context) ([]int, error) { - if len(oss.fields) > 1 { - return nil, errors.New("db: OfflineSessionSelect.Ints is not achievable when selecting more than 1 field") - } - var v []int - if err := oss.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// IntsX is like Ints, but panics if an error occurs. -func (oss *OfflineSessionSelect) IntsX(ctx context.Context) []int { - v, err := oss.Ints(ctx) - if err != nil { - panic(err) - } - return v -} - -// Int returns a single int from a selector. It is only allowed when selecting one field. -func (oss *OfflineSessionSelect) Int(ctx context.Context) (_ int, err error) { - var v []int - if v, err = oss.Ints(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{offlinesession.Label} - default: - err = fmt.Errorf("db: OfflineSessionSelect.Ints returned %d results when one was expected", len(v)) - } - return -} - -// IntX is like Int, but panics if an error occurs. -func (oss *OfflineSessionSelect) IntX(ctx context.Context) int { - v, err := oss.Int(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64s returns list of float64s from a selector. It is only allowed when selecting one field. -func (oss *OfflineSessionSelect) Float64s(ctx context.Context) ([]float64, error) { - if len(oss.fields) > 1 { - return nil, errors.New("db: OfflineSessionSelect.Float64s is not achievable when selecting more than 1 field") - } - var v []float64 - if err := oss.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// Float64sX is like Float64s, but panics if an error occurs. -func (oss *OfflineSessionSelect) Float64sX(ctx context.Context) []float64 { - v, err := oss.Float64s(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64 returns a single float64 from a selector. It is only allowed when selecting one field. -func (oss *OfflineSessionSelect) Float64(ctx context.Context) (_ float64, err error) { - var v []float64 - if v, err = oss.Float64s(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{offlinesession.Label} - default: - err = fmt.Errorf("db: OfflineSessionSelect.Float64s returned %d results when one was expected", len(v)) - } - return -} - -// Float64X is like Float64, but panics if an error occurs. -func (oss *OfflineSessionSelect) Float64X(ctx context.Context) float64 { - v, err := oss.Float64(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bools returns list of bools from a selector. It is only allowed when selecting one field. -func (oss *OfflineSessionSelect) Bools(ctx context.Context) ([]bool, error) { - if len(oss.fields) > 1 { - return nil, errors.New("db: OfflineSessionSelect.Bools is not achievable when selecting more than 1 field") - } - var v []bool - if err := oss.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// BoolsX is like Bools, but panics if an error occurs. -func (oss *OfflineSessionSelect) BoolsX(ctx context.Context) []bool { - v, err := oss.Bools(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bool returns a single bool from a selector. It is only allowed when selecting one field. -func (oss *OfflineSessionSelect) Bool(ctx context.Context) (_ bool, err error) { - var v []bool - if v, err = oss.Bools(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{offlinesession.Label} - default: - err = fmt.Errorf("db: OfflineSessionSelect.Bools returned %d results when one was expected", len(v)) - } - return -} - -// BoolX is like Bool, but panics if an error occurs. -func (oss *OfflineSessionSelect) BoolX(ctx context.Context) bool { - v, err := oss.Bool(ctx) - if err != nil { - panic(err) - } - return v -} - func (oss *OfflineSessionSelect) sqlScan(ctx context.Context, v interface{}) error { rows := &sql.Rows{} - query, args := oss.sqlQuery().Query() + query, args := oss.sql.Query() if err := oss.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() return sql.ScanSlice(rows, v) } - -func (oss *OfflineSessionSelect) sqlQuery() sql.Querier { - selector := oss.sql - selector.Select(selector.Columns(oss.fields...)...) - return selector -} diff --git a/storage/ent/db/offlinesession_update.go b/storage/ent/db/offlinesession_update.go index d6edd52221..f9f1d9cbf1 100644 --- a/storage/ent/db/offlinesession_update.go +++ b/storage/ent/db/offlinesession_update.go @@ -1,9 +1,10 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package db import ( "context" + "errors" "fmt" "entgo.io/ent/dialect/sql" @@ -20,9 +21,9 @@ type OfflineSessionUpdate struct { mutation *OfflineSessionMutation } -// Where adds a new predicate for the OfflineSessionUpdate builder. +// Where appends a list predicates to the OfflineSessionUpdate builder. func (osu *OfflineSessionUpdate) Where(ps ...predicate.OfflineSession) *OfflineSessionUpdate { - osu.mutation.predicates = append(osu.mutation.predicates, ps...) + osu.mutation.Where(ps...) return osu } @@ -87,6 +88,9 @@ func (osu *OfflineSessionUpdate) Save(ctx context.Context) (int, error) { return affected, err }) for i := len(osu.hooks) - 1; i >= 0; i-- { + if osu.hooks[i] == nil { + return 0, fmt.Errorf("db: uninitialized hook (forgotten import db/runtime?)") + } mut = osu.hooks[i](mut) } if _, err := mut.Mutate(ctx, osu.mutation); err != nil { @@ -122,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 @@ -188,8 +192,8 @@ func (osu *OfflineSessionUpdate) sqlSave(ctx context.Context) (n int, err error) if n, err = sqlgraph.UpdateNodes(ctx, osu.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{offlinesession.Label} - } else if cerr, ok := isSQLConstraintError(err); ok { - err = cerr + } else if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} } return 0, err } @@ -272,11 +276,20 @@ func (osuo *OfflineSessionUpdateOne) Save(ctx context.Context) (*OfflineSession, return node, err }) for i := len(osuo.hooks) - 1; i >= 0; i-- { + if osuo.hooks[i] == nil { + return nil, fmt.Errorf("db: uninitialized hook (forgotten import db/runtime?)") + } mut = osuo.hooks[i](mut) } - if _, err := mut.Mutate(ctx, osuo.mutation); err != nil { + v, err := mut.Mutate(ctx, osuo.mutation) + if err != nil { return nil, err } + nv, ok := v.(*OfflineSession) + if !ok { + return nil, fmt.Errorf("unexpected node type %T returned from OfflineSessionMutation", v) + } + node = nv } return node, err } @@ -307,12 +320,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 @@ -331,7 +344,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 { @@ -393,8 +406,8 @@ func (osuo *OfflineSessionUpdateOne) sqlSave(ctx context.Context) (_node *Offlin if err = sqlgraph.UpdateNode(ctx, osuo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{offlinesession.Label} - } else if cerr, ok := isSQLConstraintError(err); ok { - err = cerr + } else if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } diff --git a/storage/ent/db/password.go b/storage/ent/db/password.go index 9a1043d61b..cd30ec54ed 100644 --- a/storage/ent/db/password.go +++ b/storage/ent/db/password.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package db @@ -96,11 +96,11 @@ func (pa *Password) Update() *PasswordUpdateOne { // Unwrap unwraps the Password entity that was returned from a transaction after it was closed, // so that all future queries will be executed through the driver which created the transaction. func (pa *Password) Unwrap() *Password { - tx, ok := pa.config.driver.(*txDriver) + _tx, ok := pa.config.driver.(*txDriver) if !ok { panic("db: Password is not a transactional entity") } - pa.config.driver = tx.drv + pa.config.driver = _tx.drv return pa } @@ -108,14 +108,17 @@ func (pa *Password) Unwrap() *Password { func (pa *Password) String() string { var builder strings.Builder builder.WriteString("Password(") - builder.WriteString(fmt.Sprintf("id=%v", pa.ID)) - builder.WriteString(", email=") + builder.WriteString(fmt.Sprintf("id=%v, ", pa.ID)) + builder.WriteString("email=") builder.WriteString(pa.Email) - builder.WriteString(", hash=") + builder.WriteString(", ") + builder.WriteString("hash=") builder.WriteString(fmt.Sprintf("%v", pa.Hash)) - builder.WriteString(", username=") + builder.WriteString(", ") + builder.WriteString("username=") builder.WriteString(pa.Username) - builder.WriteString(", user_id=") + builder.WriteString(", ") + builder.WriteString("user_id=") builder.WriteString(pa.UserID) builder.WriteByte(')') return builder.String() diff --git a/storage/ent/db/password/password.go b/storage/ent/db/password/password.go index 52061b01dc..34fcac69b8 100644 --- a/storage/ent/db/password/password.go +++ b/storage/ent/db/password/password.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package password diff --git a/storage/ent/db/password/where.go b/storage/ent/db/password/where.go index 979e9aa744..92f1f850b6 100644 --- a/storage/ent/db/password/where.go +++ b/storage/ent/db/password/where.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package password @@ -31,12 +31,6 @@ func IDNEQ(id int) predicate.Password { // IDIn applies the In predicate on the ID field. func IDIn(ids ...int) predicate.Password { return predicate.Password(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(ids) == 0 { - s.Where(sql.False()) - return - } v := make([]interface{}, len(ids)) for i := range v { v[i] = ids[i] @@ -48,12 +42,6 @@ func IDIn(ids ...int) predicate.Password { // IDNotIn applies the NotIn predicate on the ID field. func IDNotIn(ids ...int) predicate.Password { return predicate.Password(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(ids) == 0 { - s.Where(sql.False()) - return - } v := make([]interface{}, len(ids)) for i := range v { v[i] = ids[i] diff --git a/storage/ent/db/password_create.go b/storage/ent/db/password_create.go index 2e01f4a227..277a5c8321 100644 --- a/storage/ent/db/password_create.go +++ b/storage/ent/db/password_create.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package db @@ -69,16 +69,28 @@ func (pc *PasswordCreate) Save(ctx context.Context) (*Password, error) { return nil, err } pc.mutation = mutation - node, err = pc.sqlSave(ctx) + if node, err = pc.sqlSave(ctx); err != nil { + return nil, err + } + mutation.id = &node.ID mutation.done = true return node, err }) for i := len(pc.hooks) - 1; i >= 0; i-- { + if pc.hooks[i] == nil { + return nil, fmt.Errorf("db: uninitialized hook (forgotten import db/runtime?)") + } mut = pc.hooks[i](mut) } - if _, err := mut.Mutate(ctx, pc.mutation); err != nil { + v, err := mut.Mutate(ctx, pc.mutation) + if err != nil { return nil, err } + nv, ok := v.(*Password) + if !ok { + return nil, fmt.Errorf("unexpected node type %T returned from PasswordMutation", v) + } + node = nv } return node, err } @@ -92,33 +104,46 @@ func (pc *PasswordCreate) SaveX(ctx context.Context) *Password { return v } +// Exec executes the query. +func (pc *PasswordCreate) Exec(ctx context.Context) error { + _, err := pc.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (pc *PasswordCreate) ExecX(ctx context.Context) { + if err := pc.Exec(ctx); err != nil { + panic(err) + } +} + // 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 @@ -127,8 +152,8 @@ func (pc *PasswordCreate) check() error { func (pc *PasswordCreate) sqlSave(ctx context.Context) (*Password, error) { _node, _spec := pc.createSpec() if err := sqlgraph.CreateNode(ctx, pc.driver, _spec); err != nil { - if cerr, ok := isSQLConstraintError(err); ok { - err = cerr + if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } @@ -211,19 +236,23 @@ func (pcb *PasswordCreateBulk) Save(ctx context.Context) ([]*Password, error) { if i < len(mutators)-1 { _, err = mutators[i+1].Mutate(root, pcb.builders[i+1].mutation) } else { + spec := &sqlgraph.BatchCreateSpec{Nodes: specs} // Invoke the actual operation on the latest mutation in the chain. - if err = sqlgraph.BatchCreate(ctx, pcb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil { - if cerr, ok := isSQLConstraintError(err); ok { - err = cerr + if err = sqlgraph.BatchCreate(ctx, pcb.driver, spec); err != nil { + if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} } } } - mutation.done = true if err != nil { return nil, err } - id := specs[i].ID.Value.(int64) - nodes[i].ID = int(id) + mutation.id = &nodes[i].ID + if specs[i].ID.Value != nil { + id := specs[i].ID.Value.(int64) + nodes[i].ID = int(id) + } + mutation.done = true return nodes[i], nil }) for i := len(builder.hooks) - 1; i >= 0; i-- { @@ -248,3 +277,16 @@ func (pcb *PasswordCreateBulk) SaveX(ctx context.Context) []*Password { } return v } + +// Exec executes the query. +func (pcb *PasswordCreateBulk) Exec(ctx context.Context) error { + _, err := pcb.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (pcb *PasswordCreateBulk) ExecX(ctx context.Context) { + if err := pcb.Exec(ctx); err != nil { + panic(err) + } +} diff --git a/storage/ent/db/password_delete.go b/storage/ent/db/password_delete.go index 87d018fc16..6bbe5af57b 100644 --- a/storage/ent/db/password_delete.go +++ b/storage/ent/db/password_delete.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package db @@ -20,9 +20,9 @@ type PasswordDelete struct { mutation *PasswordMutation } -// Where adds a new predicate to the PasswordDelete builder. +// Where appends a list predicates to the PasswordDelete builder. func (pd *PasswordDelete) Where(ps ...predicate.Password) *PasswordDelete { - pd.mutation.predicates = append(pd.mutation.predicates, ps...) + pd.mutation.Where(ps...) return pd } @@ -46,6 +46,9 @@ func (pd *PasswordDelete) Exec(ctx context.Context) (int, error) { return affected, err }) for i := len(pd.hooks) - 1; i >= 0; i-- { + if pd.hooks[i] == nil { + return 0, fmt.Errorf("db: uninitialized hook (forgotten import db/runtime?)") + } mut = pd.hooks[i](mut) } if _, err := mut.Mutate(ctx, pd.mutation); err != nil { @@ -81,7 +84,11 @@ func (pd *PasswordDelete) sqlExec(ctx context.Context) (int, error) { } } } - return sqlgraph.DeleteNodes(ctx, pd.driver, _spec) + affected, err := sqlgraph.DeleteNodes(ctx, pd.driver, _spec) + if err != nil && sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} + } + return affected, err } // PasswordDeleteOne is the builder for deleting a single Password entity. diff --git a/storage/ent/db/password_query.go b/storage/ent/db/password_query.go index 8bfe9a83c3..0da4d08aef 100644 --- a/storage/ent/db/password_query.go +++ b/storage/ent/db/password_query.go @@ -1,10 +1,9 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package db import ( "context" - "errors" "fmt" "math" @@ -106,7 +105,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 +132,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 +241,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, } } @@ -263,15 +263,17 @@ func (pq *PasswordQuery) Clone() *PasswordQuery { // Scan(ctx, &v) // func (pq *PasswordQuery) GroupBy(field string, fields ...string) *PasswordGroupBy { - group := &PasswordGroupBy{config: pq.config} - group.fields = append([]string{field}, fields...) - group.path = func(ctx context.Context) (prev *sql.Selector, err error) { + grbuild := &PasswordGroupBy{config: pq.config} + grbuild.fields = append([]string{field}, fields...) + grbuild.path = func(ctx context.Context) (prev *sql.Selector, err error) { if err := pq.prepareQuery(ctx); err != nil { return nil, err } return pq.sqlQuery(ctx), nil } - return group + grbuild.label = password.Label + grbuild.flds, grbuild.scan = &grbuild.fields, grbuild.Scan + return grbuild } // Select allows the selection one or more fields/columns for the given query, @@ -287,9 +289,12 @@ func (pq *PasswordQuery) GroupBy(field string, fields ...string) *PasswordGroupB // Select(password.FieldEmail). // Scan(ctx, &v) // -func (pq *PasswordQuery) Select(field string, fields ...string) *PasswordSelect { - pq.fields = append([]string{field}, fields...) - return &PasswordSelect{PasswordQuery: pq} +func (pq *PasswordQuery) Select(fields ...string) *PasswordSelect { + pq.fields = append(pq.fields, fields...) + selbuild := &PasswordSelect{PasswordQuery: pq} + selbuild.label = password.Label + selbuild.flds, selbuild.scan = &pq.fields, selbuild.Scan + return selbuild } func (pq *PasswordQuery) prepareQuery(ctx context.Context) error { @@ -308,23 +313,22 @@ func (pq *PasswordQuery) prepareQuery(ctx context.Context) error { return nil } -func (pq *PasswordQuery) sqlAll(ctx context.Context) ([]*Password, error) { +func (pq *PasswordQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Password, error) { var ( nodes = []*Password{} _spec = pq.querySpec() ) _spec.ScanValues = func(columns []string) ([]interface{}, error) { - node := &Password{config: pq.config} - nodes = append(nodes, node) - return node.scanValues(columns) + return (*Password).scanValues(nil, columns) } _spec.Assign = func(columns []string, values []interface{}) error { - if len(nodes) == 0 { - return fmt.Errorf("db: Assign called without calling ScanValues") - } - node := nodes[len(nodes)-1] + node := &Password{config: pq.config} + nodes = append(nodes, node) return node.assignValues(columns, values) } + for i := range hooks { + hooks[i](ctx, _spec) + } if err := sqlgraph.QueryNodes(ctx, pq.driver, _spec); err != nil { return nil, err } @@ -336,6 +340,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) } @@ -398,10 +406,17 @@ func (pq *PasswordQuery) querySpec() *sqlgraph.QuerySpec { func (pq *PasswordQuery) sqlQuery(ctx context.Context) *sql.Selector { builder := sql.Dialect(pq.driver.Dialect()) t1 := builder.Table(password.Table) - selector := builder.Select(t1.Columns(password.Columns...)...).From(t1) + columns := pq.fields + if len(columns) == 0 { + columns = password.Columns + } + selector := builder.Select(t1.Columns(columns...)...).From(t1) if pq.sql != nil { selector = pq.sql - selector.Select(selector.Columns(password.Columns...)...) + selector.Select(selector.Columns(columns...)...) + } + if pq.unique != nil && *pq.unique { + selector.Distinct() } for _, p := range pq.predicates { p(selector) @@ -423,6 +438,7 @@ func (pq *PasswordQuery) sqlQuery(ctx context.Context) *sql.Selector { // PasswordGroupBy is the group-by builder for Password entities. type PasswordGroupBy struct { config + selector fields []string fns []AggregateFunc // intermediate query (i.e. traversal path). @@ -446,209 +462,6 @@ func (pgb *PasswordGroupBy) Scan(ctx context.Context, v interface{}) error { return pgb.sqlScan(ctx, v) } -// ScanX is like Scan, but panics if an error occurs. -func (pgb *PasswordGroupBy) ScanX(ctx context.Context, v interface{}) { - if err := pgb.Scan(ctx, v); err != nil { - panic(err) - } -} - -// Strings returns list of strings from group-by. -// It is only allowed when executing a group-by query with one field. -func (pgb *PasswordGroupBy) Strings(ctx context.Context) ([]string, error) { - if len(pgb.fields) > 1 { - return nil, errors.New("db: PasswordGroupBy.Strings is not achievable when grouping more than 1 field") - } - var v []string - if err := pgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// StringsX is like Strings, but panics if an error occurs. -func (pgb *PasswordGroupBy) StringsX(ctx context.Context) []string { - v, err := pgb.Strings(ctx) - if err != nil { - panic(err) - } - return v -} - -// String returns a single string from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (pgb *PasswordGroupBy) String(ctx context.Context) (_ string, err error) { - var v []string - if v, err = pgb.Strings(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{password.Label} - default: - err = fmt.Errorf("db: PasswordGroupBy.Strings returned %d results when one was expected", len(v)) - } - return -} - -// StringX is like String, but panics if an error occurs. -func (pgb *PasswordGroupBy) StringX(ctx context.Context) string { - v, err := pgb.String(ctx) - if err != nil { - panic(err) - } - return v -} - -// Ints returns list of ints from group-by. -// It is only allowed when executing a group-by query with one field. -func (pgb *PasswordGroupBy) Ints(ctx context.Context) ([]int, error) { - if len(pgb.fields) > 1 { - return nil, errors.New("db: PasswordGroupBy.Ints is not achievable when grouping more than 1 field") - } - var v []int - if err := pgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// IntsX is like Ints, but panics if an error occurs. -func (pgb *PasswordGroupBy) IntsX(ctx context.Context) []int { - v, err := pgb.Ints(ctx) - if err != nil { - panic(err) - } - return v -} - -// Int returns a single int from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (pgb *PasswordGroupBy) Int(ctx context.Context) (_ int, err error) { - var v []int - if v, err = pgb.Ints(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{password.Label} - default: - err = fmt.Errorf("db: PasswordGroupBy.Ints returned %d results when one was expected", len(v)) - } - return -} - -// IntX is like Int, but panics if an error occurs. -func (pgb *PasswordGroupBy) IntX(ctx context.Context) int { - v, err := pgb.Int(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64s returns list of float64s from group-by. -// It is only allowed when executing a group-by query with one field. -func (pgb *PasswordGroupBy) Float64s(ctx context.Context) ([]float64, error) { - if len(pgb.fields) > 1 { - return nil, errors.New("db: PasswordGroupBy.Float64s is not achievable when grouping more than 1 field") - } - var v []float64 - if err := pgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// Float64sX is like Float64s, but panics if an error occurs. -func (pgb *PasswordGroupBy) Float64sX(ctx context.Context) []float64 { - v, err := pgb.Float64s(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64 returns a single float64 from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (pgb *PasswordGroupBy) Float64(ctx context.Context) (_ float64, err error) { - var v []float64 - if v, err = pgb.Float64s(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{password.Label} - default: - err = fmt.Errorf("db: PasswordGroupBy.Float64s returned %d results when one was expected", len(v)) - } - return -} - -// Float64X is like Float64, but panics if an error occurs. -func (pgb *PasswordGroupBy) Float64X(ctx context.Context) float64 { - v, err := pgb.Float64(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bools returns list of bools from group-by. -// It is only allowed when executing a group-by query with one field. -func (pgb *PasswordGroupBy) Bools(ctx context.Context) ([]bool, error) { - if len(pgb.fields) > 1 { - return nil, errors.New("db: PasswordGroupBy.Bools is not achievable when grouping more than 1 field") - } - var v []bool - if err := pgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// BoolsX is like Bools, but panics if an error occurs. -func (pgb *PasswordGroupBy) BoolsX(ctx context.Context) []bool { - v, err := pgb.Bools(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bool returns a single bool from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (pgb *PasswordGroupBy) Bool(ctx context.Context) (_ bool, err error) { - var v []bool - if v, err = pgb.Bools(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{password.Label} - default: - err = fmt.Errorf("db: PasswordGroupBy.Bools returned %d results when one was expected", len(v)) - } - return -} - -// BoolX is like Bool, but panics if an error occurs. -func (pgb *PasswordGroupBy) BoolX(ctx context.Context) bool { - v, err := pgb.Bool(ctx) - if err != nil { - panic(err) - } - return v -} - func (pgb *PasswordGroupBy) sqlScan(ctx context.Context, v interface{}) error { for _, f := range pgb.fields { if !password.ValidColumn(f) { @@ -669,18 +482,28 @@ func (pgb *PasswordGroupBy) sqlScan(ctx context.Context, v interface{}) error { } func (pgb *PasswordGroupBy) sqlQuery() *sql.Selector { - selector := pgb.sql - columns := make([]string, 0, len(pgb.fields)+len(pgb.fns)) - columns = append(columns, pgb.fields...) + selector := pgb.sql.Select() + aggregation := make([]string, 0, len(pgb.fns)) for _, fn := range pgb.fns { - columns = append(columns, fn(selector)) + aggregation = append(aggregation, fn(selector)) + } + // If no columns were selected in a custom aggregation function, the default + // selection is the fields used for "group-by", and the aggregation functions. + if len(selector.SelectedColumns()) == 0 { + columns := make([]string, 0, len(pgb.fields)+len(pgb.fns)) + for _, f := range pgb.fields { + columns = append(columns, selector.C(f)) + } + columns = append(columns, aggregation...) + selector.Select(columns...) } - return selector.Select(columns...).GroupBy(pgb.fields...) + return selector.GroupBy(selector.Columns(pgb.fields...)...) } // PasswordSelect is the builder for selecting fields of Password entities. type PasswordSelect struct { *PasswordQuery + selector // intermediate query (i.e. traversal path). sql *sql.Selector } @@ -694,213 +517,12 @@ func (ps *PasswordSelect) Scan(ctx context.Context, v interface{}) error { return ps.sqlScan(ctx, v) } -// ScanX is like Scan, but panics if an error occurs. -func (ps *PasswordSelect) ScanX(ctx context.Context, v interface{}) { - if err := ps.Scan(ctx, v); err != nil { - panic(err) - } -} - -// Strings returns list of strings from a selector. It is only allowed when selecting one field. -func (ps *PasswordSelect) Strings(ctx context.Context) ([]string, error) { - if len(ps.fields) > 1 { - return nil, errors.New("db: PasswordSelect.Strings is not achievable when selecting more than 1 field") - } - var v []string - if err := ps.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// StringsX is like Strings, but panics if an error occurs. -func (ps *PasswordSelect) StringsX(ctx context.Context) []string { - v, err := ps.Strings(ctx) - if err != nil { - panic(err) - } - return v -} - -// String returns a single string from a selector. It is only allowed when selecting one field. -func (ps *PasswordSelect) String(ctx context.Context) (_ string, err error) { - var v []string - if v, err = ps.Strings(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{password.Label} - default: - err = fmt.Errorf("db: PasswordSelect.Strings returned %d results when one was expected", len(v)) - } - return -} - -// StringX is like String, but panics if an error occurs. -func (ps *PasswordSelect) StringX(ctx context.Context) string { - v, err := ps.String(ctx) - if err != nil { - panic(err) - } - return v -} - -// Ints returns list of ints from a selector. It is only allowed when selecting one field. -func (ps *PasswordSelect) Ints(ctx context.Context) ([]int, error) { - if len(ps.fields) > 1 { - return nil, errors.New("db: PasswordSelect.Ints is not achievable when selecting more than 1 field") - } - var v []int - if err := ps.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// IntsX is like Ints, but panics if an error occurs. -func (ps *PasswordSelect) IntsX(ctx context.Context) []int { - v, err := ps.Ints(ctx) - if err != nil { - panic(err) - } - return v -} - -// Int returns a single int from a selector. It is only allowed when selecting one field. -func (ps *PasswordSelect) Int(ctx context.Context) (_ int, err error) { - var v []int - if v, err = ps.Ints(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{password.Label} - default: - err = fmt.Errorf("db: PasswordSelect.Ints returned %d results when one was expected", len(v)) - } - return -} - -// IntX is like Int, but panics if an error occurs. -func (ps *PasswordSelect) IntX(ctx context.Context) int { - v, err := ps.Int(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64s returns list of float64s from a selector. It is only allowed when selecting one field. -func (ps *PasswordSelect) Float64s(ctx context.Context) ([]float64, error) { - if len(ps.fields) > 1 { - return nil, errors.New("db: PasswordSelect.Float64s is not achievable when selecting more than 1 field") - } - var v []float64 - if err := ps.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// Float64sX is like Float64s, but panics if an error occurs. -func (ps *PasswordSelect) Float64sX(ctx context.Context) []float64 { - v, err := ps.Float64s(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64 returns a single float64 from a selector. It is only allowed when selecting one field. -func (ps *PasswordSelect) Float64(ctx context.Context) (_ float64, err error) { - var v []float64 - if v, err = ps.Float64s(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{password.Label} - default: - err = fmt.Errorf("db: PasswordSelect.Float64s returned %d results when one was expected", len(v)) - } - return -} - -// Float64X is like Float64, but panics if an error occurs. -func (ps *PasswordSelect) Float64X(ctx context.Context) float64 { - v, err := ps.Float64(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bools returns list of bools from a selector. It is only allowed when selecting one field. -func (ps *PasswordSelect) Bools(ctx context.Context) ([]bool, error) { - if len(ps.fields) > 1 { - return nil, errors.New("db: PasswordSelect.Bools is not achievable when selecting more than 1 field") - } - var v []bool - if err := ps.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// BoolsX is like Bools, but panics if an error occurs. -func (ps *PasswordSelect) BoolsX(ctx context.Context) []bool { - v, err := ps.Bools(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bool returns a single bool from a selector. It is only allowed when selecting one field. -func (ps *PasswordSelect) Bool(ctx context.Context) (_ bool, err error) { - var v []bool - if v, err = ps.Bools(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{password.Label} - default: - err = fmt.Errorf("db: PasswordSelect.Bools returned %d results when one was expected", len(v)) - } - return -} - -// BoolX is like Bool, but panics if an error occurs. -func (ps *PasswordSelect) BoolX(ctx context.Context) bool { - v, err := ps.Bool(ctx) - if err != nil { - panic(err) - } - return v -} - func (ps *PasswordSelect) sqlScan(ctx context.Context, v interface{}) error { rows := &sql.Rows{} - query, args := ps.sqlQuery().Query() + query, args := ps.sql.Query() if err := ps.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() return sql.ScanSlice(rows, v) } - -func (ps *PasswordSelect) sqlQuery() sql.Querier { - selector := ps.sql - selector.Select(selector.Columns(ps.fields...)...) - return selector -} diff --git a/storage/ent/db/password_update.go b/storage/ent/db/password_update.go index 0eb1cb61c8..8d149991a8 100644 --- a/storage/ent/db/password_update.go +++ b/storage/ent/db/password_update.go @@ -1,9 +1,10 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package db import ( "context" + "errors" "fmt" "entgo.io/ent/dialect/sql" @@ -20,9 +21,9 @@ type PasswordUpdate struct { mutation *PasswordMutation } -// Where adds a new predicate for the PasswordUpdate builder. +// Where appends a list predicates to the PasswordUpdate builder. func (pu *PasswordUpdate) Where(ps ...predicate.Password) *PasswordUpdate { - pu.mutation.predicates = append(pu.mutation.predicates, ps...) + pu.mutation.Where(ps...) return pu } @@ -81,6 +82,9 @@ func (pu *PasswordUpdate) Save(ctx context.Context) (int, error) { return affected, err }) for i := len(pu.hooks) - 1; i >= 0; i-- { + if pu.hooks[i] == nil { + return 0, fmt.Errorf("db: uninitialized hook (forgotten import db/runtime?)") + } mut = pu.hooks[i](mut) } if _, err := mut.Mutate(ctx, pu.mutation); err != nil { @@ -116,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 @@ -181,8 +185,8 @@ func (pu *PasswordUpdate) sqlSave(ctx context.Context) (n int, err error) { if n, err = sqlgraph.UpdateNodes(ctx, pu.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{password.Label} - } else if cerr, ok := isSQLConstraintError(err); ok { - err = cerr + } else if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} } return 0, err } @@ -259,11 +263,20 @@ func (puo *PasswordUpdateOne) Save(ctx context.Context) (*Password, error) { return node, err }) for i := len(puo.hooks) - 1; i >= 0; i-- { + if puo.hooks[i] == nil { + return nil, fmt.Errorf("db: uninitialized hook (forgotten import db/runtime?)") + } mut = puo.hooks[i](mut) } - if _, err := mut.Mutate(ctx, puo.mutation); err != nil { + v, err := mut.Mutate(ctx, puo.mutation) + if err != nil { return nil, err } + nv, ok := v.(*Password) + if !ok { + return nil, fmt.Errorf("unexpected node type %T returned from PasswordMutation", v) + } + node = nv } return node, err } @@ -294,17 +307,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 @@ -323,7 +336,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 { @@ -379,8 +392,8 @@ func (puo *PasswordUpdateOne) sqlSave(ctx context.Context) (_node *Password, err if err = sqlgraph.UpdateNode(ctx, puo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{password.Label} - } else if cerr, ok := isSQLConstraintError(err); ok { - err = cerr + } else if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } diff --git a/storage/ent/db/predicate/predicate.go b/storage/ent/db/predicate/predicate.go index 68270087c2..ed07a0719c 100644 --- a/storage/ent/db/predicate/predicate.go +++ b/storage/ent/db/predicate/predicate.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package predicate diff --git a/storage/ent/db/refreshtoken.go b/storage/ent/db/refreshtoken.go index 7e5270791b..b5c75bb101 100644 --- a/storage/ent/db/refreshtoken.go +++ b/storage/ent/db/refreshtoken.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package db @@ -90,7 +90,6 @@ func (rt *RefreshToken) assignValues(columns []string, values []interface{}) err rt.ClientID = value.String } case refreshtoken.FieldScopes: - if value, ok := values[i].(*[]byte); !ok { return fmt.Errorf("unexpected type %T for field scopes", values[i]) } else if value != nil && len(*value) > 0 { @@ -129,7 +128,6 @@ func (rt *RefreshToken) assignValues(columns []string, values []interface{}) err rt.ClaimsEmailVerified = value.Bool } case refreshtoken.FieldClaimsGroups: - if value, ok := values[i].(*[]byte); !ok { return fmt.Errorf("unexpected type %T for field claims_groups", values[i]) } else if value != nil && len(*value) > 0 { @@ -194,11 +192,11 @@ func (rt *RefreshToken) Update() *RefreshTokenUpdateOne { // Unwrap unwraps the RefreshToken entity that was returned from a transaction after it was closed, // so that all future queries will be executed through the driver which created the transaction. func (rt *RefreshToken) Unwrap() *RefreshToken { - tx, ok := rt.config.driver.(*txDriver) + _tx, ok := rt.config.driver.(*txDriver) if !ok { panic("db: RefreshToken is not a transactional entity") } - rt.config.driver = tx.drv + rt.config.driver = _tx.drv return rt } @@ -206,38 +204,52 @@ func (rt *RefreshToken) Unwrap() *RefreshToken { func (rt *RefreshToken) String() string { var builder strings.Builder builder.WriteString("RefreshToken(") - builder.WriteString(fmt.Sprintf("id=%v", rt.ID)) - builder.WriteString(", client_id=") + builder.WriteString(fmt.Sprintf("id=%v, ", rt.ID)) + builder.WriteString("client_id=") builder.WriteString(rt.ClientID) - builder.WriteString(", scopes=") + builder.WriteString(", ") + builder.WriteString("scopes=") builder.WriteString(fmt.Sprintf("%v", rt.Scopes)) - builder.WriteString(", nonce=") + builder.WriteString(", ") + builder.WriteString("nonce=") builder.WriteString(rt.Nonce) - builder.WriteString(", claims_user_id=") + builder.WriteString(", ") + builder.WriteString("claims_user_id=") builder.WriteString(rt.ClaimsUserID) - builder.WriteString(", claims_username=") + builder.WriteString(", ") + builder.WriteString("claims_username=") builder.WriteString(rt.ClaimsUsername) - builder.WriteString(", claims_email=") + builder.WriteString(", ") + builder.WriteString("claims_email=") builder.WriteString(rt.ClaimsEmail) - builder.WriteString(", claims_email_verified=") + builder.WriteString(", ") + builder.WriteString("claims_email_verified=") builder.WriteString(fmt.Sprintf("%v", rt.ClaimsEmailVerified)) - builder.WriteString(", claims_groups=") + builder.WriteString(", ") + builder.WriteString("claims_groups=") builder.WriteString(fmt.Sprintf("%v", rt.ClaimsGroups)) - builder.WriteString(", claims_preferred_username=") + builder.WriteString(", ") + builder.WriteString("claims_preferred_username=") builder.WriteString(rt.ClaimsPreferredUsername) - builder.WriteString(", connector_id=") + builder.WriteString(", ") + builder.WriteString("connector_id=") builder.WriteString(rt.ConnectorID) + builder.WriteString(", ") if v := rt.ConnectorData; v != nil { - builder.WriteString(", connector_data=") + builder.WriteString("connector_data=") builder.WriteString(fmt.Sprintf("%v", *v)) } - builder.WriteString(", token=") + builder.WriteString(", ") + builder.WriteString("token=") builder.WriteString(rt.Token) - builder.WriteString(", obsolete_token=") + builder.WriteString(", ") + builder.WriteString("obsolete_token=") builder.WriteString(rt.ObsoleteToken) - builder.WriteString(", created_at=") + builder.WriteString(", ") + builder.WriteString("created_at=") builder.WriteString(rt.CreatedAt.Format(time.ANSIC)) - builder.WriteString(", last_used=") + builder.WriteString(", ") + builder.WriteString("last_used=") builder.WriteString(rt.LastUsed.Format(time.ANSIC)) builder.WriteByte(')') return builder.String() diff --git a/storage/ent/db/refreshtoken/refreshtoken.go b/storage/ent/db/refreshtoken/refreshtoken.go index 38efcc227d..d11d84075a 100644 --- a/storage/ent/db/refreshtoken/refreshtoken.go +++ b/storage/ent/db/refreshtoken/refreshtoken.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package refreshtoken diff --git a/storage/ent/db/refreshtoken/where.go b/storage/ent/db/refreshtoken/where.go index 43a4609388..f6158d405a 100644 --- a/storage/ent/db/refreshtoken/where.go +++ b/storage/ent/db/refreshtoken/where.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package refreshtoken @@ -33,12 +33,6 @@ func IDNEQ(id string) predicate.RefreshToken { // IDIn applies the In predicate on the ID field. func IDIn(ids ...string) predicate.RefreshToken { return predicate.RefreshToken(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(ids) == 0 { - s.Where(sql.False()) - return - } v := make([]interface{}, len(ids)) for i := range v { v[i] = ids[i] @@ -50,12 +44,6 @@ func IDIn(ids ...string) predicate.RefreshToken { // IDNotIn applies the NotIn predicate on the ID field. func IDNotIn(ids ...string) predicate.RefreshToken { return predicate.RefreshToken(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(ids) == 0 { - s.Where(sql.False()) - return - } v := make([]interface{}, len(ids)) for i := range v { v[i] = ids[i] diff --git a/storage/ent/db/refreshtoken_create.go b/storage/ent/db/refreshtoken_create.go index e73f276a59..e2bd6c2fad 100644 --- a/storage/ent/db/refreshtoken_create.go +++ b/storage/ent/db/refreshtoken_create.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package db @@ -183,16 +183,28 @@ func (rtc *RefreshTokenCreate) Save(ctx context.Context) (*RefreshToken, error) return nil, err } rtc.mutation = mutation - node, err = rtc.sqlSave(ctx) + if node, err = rtc.sqlSave(ctx); err != nil { + return nil, err + } + mutation.id = &node.ID mutation.done = true return node, err }) for i := len(rtc.hooks) - 1; i >= 0; i-- { + if rtc.hooks[i] == nil { + return nil, fmt.Errorf("db: uninitialized hook (forgotten import db/runtime?)") + } mut = rtc.hooks[i](mut) } - if _, err := mut.Mutate(ctx, rtc.mutation); err != nil { + v, err := mut.Mutate(ctx, rtc.mutation) + if err != nil { return nil, err } + nv, ok := v.(*RefreshToken) + if !ok { + return nil, fmt.Errorf("unexpected node type %T returned from RefreshTokenMutation", v) + } + node = nv } return node, err } @@ -206,6 +218,19 @@ func (rtc *RefreshTokenCreate) SaveX(ctx context.Context) *RefreshToken { return v } +// Exec executes the query. +func (rtc *RefreshTokenCreate) Exec(ctx context.Context) error { + _, err := rtc.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (rtc *RefreshTokenCreate) ExecX(ctx context.Context) { + if err := rtc.Exec(ctx); err != nil { + panic(err) + } +} + // defaults sets the default values of the builder before save. func (rtc *RefreshTokenCreate) defaults() { if _, ok := rtc.mutation.ClaimsPreferredUsername(); !ok { @@ -233,74 +258,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 @@ -309,11 +334,18 @@ func (rtc *RefreshTokenCreate) check() error { func (rtc *RefreshTokenCreate) sqlSave(ctx context.Context) (*RefreshToken, error) { _node, _spec := rtc.createSpec() if err := sqlgraph.CreateNode(ctx, rtc.driver, _spec); err != nil { - if cerr, ok := isSQLConstraintError(err); ok { - err = cerr + if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} } 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 } @@ -484,17 +516,19 @@ func (rtcb *RefreshTokenCreateBulk) Save(ctx context.Context) ([]*RefreshToken, if i < len(mutators)-1 { _, err = mutators[i+1].Mutate(root, rtcb.builders[i+1].mutation) } else { + spec := &sqlgraph.BatchCreateSpec{Nodes: specs} // Invoke the actual operation on the latest mutation in the chain. - if err = sqlgraph.BatchCreate(ctx, rtcb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil { - if cerr, ok := isSQLConstraintError(err); ok { - err = cerr + if err = sqlgraph.BatchCreate(ctx, rtcb.driver, spec); err != nil { + if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} } } } - mutation.done = true if err != nil { return nil, err } + mutation.id = &nodes[i].ID + mutation.done = true return nodes[i], nil }) for i := len(builder.hooks) - 1; i >= 0; i-- { @@ -519,3 +553,16 @@ func (rtcb *RefreshTokenCreateBulk) SaveX(ctx context.Context) []*RefreshToken { } return v } + +// Exec executes the query. +func (rtcb *RefreshTokenCreateBulk) Exec(ctx context.Context) error { + _, err := rtcb.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (rtcb *RefreshTokenCreateBulk) ExecX(ctx context.Context) { + if err := rtcb.Exec(ctx); err != nil { + panic(err) + } +} diff --git a/storage/ent/db/refreshtoken_delete.go b/storage/ent/db/refreshtoken_delete.go index 34671548be..2c8d7c1e80 100644 --- a/storage/ent/db/refreshtoken_delete.go +++ b/storage/ent/db/refreshtoken_delete.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package db @@ -20,9 +20,9 @@ type RefreshTokenDelete struct { mutation *RefreshTokenMutation } -// Where adds a new predicate to the RefreshTokenDelete builder. +// Where appends a list predicates to the RefreshTokenDelete builder. func (rtd *RefreshTokenDelete) Where(ps ...predicate.RefreshToken) *RefreshTokenDelete { - rtd.mutation.predicates = append(rtd.mutation.predicates, ps...) + rtd.mutation.Where(ps...) return rtd } @@ -46,6 +46,9 @@ func (rtd *RefreshTokenDelete) Exec(ctx context.Context) (int, error) { return affected, err }) for i := len(rtd.hooks) - 1; i >= 0; i-- { + if rtd.hooks[i] == nil { + return 0, fmt.Errorf("db: uninitialized hook (forgotten import db/runtime?)") + } mut = rtd.hooks[i](mut) } if _, err := mut.Mutate(ctx, rtd.mutation); err != nil { @@ -81,7 +84,11 @@ func (rtd *RefreshTokenDelete) sqlExec(ctx context.Context) (int, error) { } } } - return sqlgraph.DeleteNodes(ctx, rtd.driver, _spec) + affected, err := sqlgraph.DeleteNodes(ctx, rtd.driver, _spec) + if err != nil && sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} + } + return affected, err } // RefreshTokenDeleteOne is the builder for deleting a single RefreshToken entity. diff --git a/storage/ent/db/refreshtoken_query.go b/storage/ent/db/refreshtoken_query.go index 503e606f3d..a90ac2f912 100644 --- a/storage/ent/db/refreshtoken_query.go +++ b/storage/ent/db/refreshtoken_query.go @@ -1,10 +1,9 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package db import ( "context" - "errors" "fmt" "math" @@ -106,7 +105,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 +132,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 +241,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, } } @@ -263,15 +263,17 @@ func (rtq *RefreshTokenQuery) Clone() *RefreshTokenQuery { // Scan(ctx, &v) // func (rtq *RefreshTokenQuery) GroupBy(field string, fields ...string) *RefreshTokenGroupBy { - group := &RefreshTokenGroupBy{config: rtq.config} - group.fields = append([]string{field}, fields...) - group.path = func(ctx context.Context) (prev *sql.Selector, err error) { + grbuild := &RefreshTokenGroupBy{config: rtq.config} + grbuild.fields = append([]string{field}, fields...) + grbuild.path = func(ctx context.Context) (prev *sql.Selector, err error) { if err := rtq.prepareQuery(ctx); err != nil { return nil, err } return rtq.sqlQuery(ctx), nil } - return group + grbuild.label = refreshtoken.Label + grbuild.flds, grbuild.scan = &grbuild.fields, grbuild.Scan + return grbuild } // Select allows the selection one or more fields/columns for the given query, @@ -287,9 +289,12 @@ func (rtq *RefreshTokenQuery) GroupBy(field string, fields ...string) *RefreshTo // Select(refreshtoken.FieldClientID). // Scan(ctx, &v) // -func (rtq *RefreshTokenQuery) Select(field string, fields ...string) *RefreshTokenSelect { - rtq.fields = append([]string{field}, fields...) - return &RefreshTokenSelect{RefreshTokenQuery: rtq} +func (rtq *RefreshTokenQuery) Select(fields ...string) *RefreshTokenSelect { + rtq.fields = append(rtq.fields, fields...) + selbuild := &RefreshTokenSelect{RefreshTokenQuery: rtq} + selbuild.label = refreshtoken.Label + selbuild.flds, selbuild.scan = &rtq.fields, selbuild.Scan + return selbuild } func (rtq *RefreshTokenQuery) prepareQuery(ctx context.Context) error { @@ -308,23 +313,22 @@ func (rtq *RefreshTokenQuery) prepareQuery(ctx context.Context) error { return nil } -func (rtq *RefreshTokenQuery) sqlAll(ctx context.Context) ([]*RefreshToken, error) { +func (rtq *RefreshTokenQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*RefreshToken, error) { var ( nodes = []*RefreshToken{} _spec = rtq.querySpec() ) _spec.ScanValues = func(columns []string) ([]interface{}, error) { - node := &RefreshToken{config: rtq.config} - nodes = append(nodes, node) - return node.scanValues(columns) + return (*RefreshToken).scanValues(nil, columns) } _spec.Assign = func(columns []string, values []interface{}) error { - if len(nodes) == 0 { - return fmt.Errorf("db: Assign called without calling ScanValues") - } - node := nodes[len(nodes)-1] + node := &RefreshToken{config: rtq.config} + nodes = append(nodes, node) return node.assignValues(columns, values) } + for i := range hooks { + hooks[i](ctx, _spec) + } if err := sqlgraph.QueryNodes(ctx, rtq.driver, _spec); err != nil { return nil, err } @@ -336,6 +340,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) } @@ -398,10 +406,17 @@ func (rtq *RefreshTokenQuery) querySpec() *sqlgraph.QuerySpec { func (rtq *RefreshTokenQuery) sqlQuery(ctx context.Context) *sql.Selector { builder := sql.Dialect(rtq.driver.Dialect()) t1 := builder.Table(refreshtoken.Table) - selector := builder.Select(t1.Columns(refreshtoken.Columns...)...).From(t1) + columns := rtq.fields + if len(columns) == 0 { + columns = refreshtoken.Columns + } + selector := builder.Select(t1.Columns(columns...)...).From(t1) if rtq.sql != nil { selector = rtq.sql - selector.Select(selector.Columns(refreshtoken.Columns...)...) + selector.Select(selector.Columns(columns...)...) + } + if rtq.unique != nil && *rtq.unique { + selector.Distinct() } for _, p := range rtq.predicates { p(selector) @@ -423,6 +438,7 @@ func (rtq *RefreshTokenQuery) sqlQuery(ctx context.Context) *sql.Selector { // RefreshTokenGroupBy is the group-by builder for RefreshToken entities. type RefreshTokenGroupBy struct { config + selector fields []string fns []AggregateFunc // intermediate query (i.e. traversal path). @@ -446,209 +462,6 @@ func (rtgb *RefreshTokenGroupBy) Scan(ctx context.Context, v interface{}) error return rtgb.sqlScan(ctx, v) } -// ScanX is like Scan, but panics if an error occurs. -func (rtgb *RefreshTokenGroupBy) ScanX(ctx context.Context, v interface{}) { - if err := rtgb.Scan(ctx, v); err != nil { - panic(err) - } -} - -// Strings returns list of strings from group-by. -// It is only allowed when executing a group-by query with one field. -func (rtgb *RefreshTokenGroupBy) Strings(ctx context.Context) ([]string, error) { - if len(rtgb.fields) > 1 { - return nil, errors.New("db: RefreshTokenGroupBy.Strings is not achievable when grouping more than 1 field") - } - var v []string - if err := rtgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// StringsX is like Strings, but panics if an error occurs. -func (rtgb *RefreshTokenGroupBy) StringsX(ctx context.Context) []string { - v, err := rtgb.Strings(ctx) - if err != nil { - panic(err) - } - return v -} - -// String returns a single string from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (rtgb *RefreshTokenGroupBy) String(ctx context.Context) (_ string, err error) { - var v []string - if v, err = rtgb.Strings(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{refreshtoken.Label} - default: - err = fmt.Errorf("db: RefreshTokenGroupBy.Strings returned %d results when one was expected", len(v)) - } - return -} - -// StringX is like String, but panics if an error occurs. -func (rtgb *RefreshTokenGroupBy) StringX(ctx context.Context) string { - v, err := rtgb.String(ctx) - if err != nil { - panic(err) - } - return v -} - -// Ints returns list of ints from group-by. -// It is only allowed when executing a group-by query with one field. -func (rtgb *RefreshTokenGroupBy) Ints(ctx context.Context) ([]int, error) { - if len(rtgb.fields) > 1 { - return nil, errors.New("db: RefreshTokenGroupBy.Ints is not achievable when grouping more than 1 field") - } - var v []int - if err := rtgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// IntsX is like Ints, but panics if an error occurs. -func (rtgb *RefreshTokenGroupBy) IntsX(ctx context.Context) []int { - v, err := rtgb.Ints(ctx) - if err != nil { - panic(err) - } - return v -} - -// Int returns a single int from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (rtgb *RefreshTokenGroupBy) Int(ctx context.Context) (_ int, err error) { - var v []int - if v, err = rtgb.Ints(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{refreshtoken.Label} - default: - err = fmt.Errorf("db: RefreshTokenGroupBy.Ints returned %d results when one was expected", len(v)) - } - return -} - -// IntX is like Int, but panics if an error occurs. -func (rtgb *RefreshTokenGroupBy) IntX(ctx context.Context) int { - v, err := rtgb.Int(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64s returns list of float64s from group-by. -// It is only allowed when executing a group-by query with one field. -func (rtgb *RefreshTokenGroupBy) Float64s(ctx context.Context) ([]float64, error) { - if len(rtgb.fields) > 1 { - return nil, errors.New("db: RefreshTokenGroupBy.Float64s is not achievable when grouping more than 1 field") - } - var v []float64 - if err := rtgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// Float64sX is like Float64s, but panics if an error occurs. -func (rtgb *RefreshTokenGroupBy) Float64sX(ctx context.Context) []float64 { - v, err := rtgb.Float64s(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64 returns a single float64 from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (rtgb *RefreshTokenGroupBy) Float64(ctx context.Context) (_ float64, err error) { - var v []float64 - if v, err = rtgb.Float64s(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{refreshtoken.Label} - default: - err = fmt.Errorf("db: RefreshTokenGroupBy.Float64s returned %d results when one was expected", len(v)) - } - return -} - -// Float64X is like Float64, but panics if an error occurs. -func (rtgb *RefreshTokenGroupBy) Float64X(ctx context.Context) float64 { - v, err := rtgb.Float64(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bools returns list of bools from group-by. -// It is only allowed when executing a group-by query with one field. -func (rtgb *RefreshTokenGroupBy) Bools(ctx context.Context) ([]bool, error) { - if len(rtgb.fields) > 1 { - return nil, errors.New("db: RefreshTokenGroupBy.Bools is not achievable when grouping more than 1 field") - } - var v []bool - if err := rtgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// BoolsX is like Bools, but panics if an error occurs. -func (rtgb *RefreshTokenGroupBy) BoolsX(ctx context.Context) []bool { - v, err := rtgb.Bools(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bool returns a single bool from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (rtgb *RefreshTokenGroupBy) Bool(ctx context.Context) (_ bool, err error) { - var v []bool - if v, err = rtgb.Bools(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{refreshtoken.Label} - default: - err = fmt.Errorf("db: RefreshTokenGroupBy.Bools returned %d results when one was expected", len(v)) - } - return -} - -// BoolX is like Bool, but panics if an error occurs. -func (rtgb *RefreshTokenGroupBy) BoolX(ctx context.Context) bool { - v, err := rtgb.Bool(ctx) - if err != nil { - panic(err) - } - return v -} - func (rtgb *RefreshTokenGroupBy) sqlScan(ctx context.Context, v interface{}) error { for _, f := range rtgb.fields { if !refreshtoken.ValidColumn(f) { @@ -669,18 +482,28 @@ func (rtgb *RefreshTokenGroupBy) sqlScan(ctx context.Context, v interface{}) err } func (rtgb *RefreshTokenGroupBy) sqlQuery() *sql.Selector { - selector := rtgb.sql - columns := make([]string, 0, len(rtgb.fields)+len(rtgb.fns)) - columns = append(columns, rtgb.fields...) + selector := rtgb.sql.Select() + aggregation := make([]string, 0, len(rtgb.fns)) for _, fn := range rtgb.fns { - columns = append(columns, fn(selector)) + aggregation = append(aggregation, fn(selector)) + } + // If no columns were selected in a custom aggregation function, the default + // selection is the fields used for "group-by", and the aggregation functions. + if len(selector.SelectedColumns()) == 0 { + columns := make([]string, 0, len(rtgb.fields)+len(rtgb.fns)) + for _, f := range rtgb.fields { + columns = append(columns, selector.C(f)) + } + columns = append(columns, aggregation...) + selector.Select(columns...) } - return selector.Select(columns...).GroupBy(rtgb.fields...) + return selector.GroupBy(selector.Columns(rtgb.fields...)...) } // RefreshTokenSelect is the builder for selecting fields of RefreshToken entities. type RefreshTokenSelect struct { *RefreshTokenQuery + selector // intermediate query (i.e. traversal path). sql *sql.Selector } @@ -694,213 +517,12 @@ func (rts *RefreshTokenSelect) Scan(ctx context.Context, v interface{}) error { return rts.sqlScan(ctx, v) } -// ScanX is like Scan, but panics if an error occurs. -func (rts *RefreshTokenSelect) ScanX(ctx context.Context, v interface{}) { - if err := rts.Scan(ctx, v); err != nil { - panic(err) - } -} - -// Strings returns list of strings from a selector. It is only allowed when selecting one field. -func (rts *RefreshTokenSelect) Strings(ctx context.Context) ([]string, error) { - if len(rts.fields) > 1 { - return nil, errors.New("db: RefreshTokenSelect.Strings is not achievable when selecting more than 1 field") - } - var v []string - if err := rts.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// StringsX is like Strings, but panics if an error occurs. -func (rts *RefreshTokenSelect) StringsX(ctx context.Context) []string { - v, err := rts.Strings(ctx) - if err != nil { - panic(err) - } - return v -} - -// String returns a single string from a selector. It is only allowed when selecting one field. -func (rts *RefreshTokenSelect) String(ctx context.Context) (_ string, err error) { - var v []string - if v, err = rts.Strings(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{refreshtoken.Label} - default: - err = fmt.Errorf("db: RefreshTokenSelect.Strings returned %d results when one was expected", len(v)) - } - return -} - -// StringX is like String, but panics if an error occurs. -func (rts *RefreshTokenSelect) StringX(ctx context.Context) string { - v, err := rts.String(ctx) - if err != nil { - panic(err) - } - return v -} - -// Ints returns list of ints from a selector. It is only allowed when selecting one field. -func (rts *RefreshTokenSelect) Ints(ctx context.Context) ([]int, error) { - if len(rts.fields) > 1 { - return nil, errors.New("db: RefreshTokenSelect.Ints is not achievable when selecting more than 1 field") - } - var v []int - if err := rts.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// IntsX is like Ints, but panics if an error occurs. -func (rts *RefreshTokenSelect) IntsX(ctx context.Context) []int { - v, err := rts.Ints(ctx) - if err != nil { - panic(err) - } - return v -} - -// Int returns a single int from a selector. It is only allowed when selecting one field. -func (rts *RefreshTokenSelect) Int(ctx context.Context) (_ int, err error) { - var v []int - if v, err = rts.Ints(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{refreshtoken.Label} - default: - err = fmt.Errorf("db: RefreshTokenSelect.Ints returned %d results when one was expected", len(v)) - } - return -} - -// IntX is like Int, but panics if an error occurs. -func (rts *RefreshTokenSelect) IntX(ctx context.Context) int { - v, err := rts.Int(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64s returns list of float64s from a selector. It is only allowed when selecting one field. -func (rts *RefreshTokenSelect) Float64s(ctx context.Context) ([]float64, error) { - if len(rts.fields) > 1 { - return nil, errors.New("db: RefreshTokenSelect.Float64s is not achievable when selecting more than 1 field") - } - var v []float64 - if err := rts.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// Float64sX is like Float64s, but panics if an error occurs. -func (rts *RefreshTokenSelect) Float64sX(ctx context.Context) []float64 { - v, err := rts.Float64s(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64 returns a single float64 from a selector. It is only allowed when selecting one field. -func (rts *RefreshTokenSelect) Float64(ctx context.Context) (_ float64, err error) { - var v []float64 - if v, err = rts.Float64s(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{refreshtoken.Label} - default: - err = fmt.Errorf("db: RefreshTokenSelect.Float64s returned %d results when one was expected", len(v)) - } - return -} - -// Float64X is like Float64, but panics if an error occurs. -func (rts *RefreshTokenSelect) Float64X(ctx context.Context) float64 { - v, err := rts.Float64(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bools returns list of bools from a selector. It is only allowed when selecting one field. -func (rts *RefreshTokenSelect) Bools(ctx context.Context) ([]bool, error) { - if len(rts.fields) > 1 { - return nil, errors.New("db: RefreshTokenSelect.Bools is not achievable when selecting more than 1 field") - } - var v []bool - if err := rts.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// BoolsX is like Bools, but panics if an error occurs. -func (rts *RefreshTokenSelect) BoolsX(ctx context.Context) []bool { - v, err := rts.Bools(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bool returns a single bool from a selector. It is only allowed when selecting one field. -func (rts *RefreshTokenSelect) Bool(ctx context.Context) (_ bool, err error) { - var v []bool - if v, err = rts.Bools(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{refreshtoken.Label} - default: - err = fmt.Errorf("db: RefreshTokenSelect.Bools returned %d results when one was expected", len(v)) - } - return -} - -// BoolX is like Bool, but panics if an error occurs. -func (rts *RefreshTokenSelect) BoolX(ctx context.Context) bool { - v, err := rts.Bool(ctx) - if err != nil { - panic(err) - } - return v -} - func (rts *RefreshTokenSelect) sqlScan(ctx context.Context, v interface{}) error { rows := &sql.Rows{} - query, args := rts.sqlQuery().Query() + query, args := rts.sql.Query() if err := rts.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() return sql.ScanSlice(rows, v) } - -func (rts *RefreshTokenSelect) sqlQuery() sql.Querier { - selector := rts.sql - selector.Select(selector.Columns(rts.fields...)...) - return selector -} diff --git a/storage/ent/db/refreshtoken_update.go b/storage/ent/db/refreshtoken_update.go index 87ccfcd059..6c11c7f73c 100644 --- a/storage/ent/db/refreshtoken_update.go +++ b/storage/ent/db/refreshtoken_update.go @@ -1,9 +1,10 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package db import ( "context" + "errors" "fmt" "time" @@ -21,9 +22,9 @@ type RefreshTokenUpdate struct { mutation *RefreshTokenMutation } -// Where adds a new predicate for the RefreshTokenUpdate builder. +// Where appends a list predicates to the RefreshTokenUpdate builder. func (rtu *RefreshTokenUpdate) Where(ps ...predicate.RefreshToken) *RefreshTokenUpdate { - rtu.mutation.predicates = append(rtu.mutation.predicates, ps...) + rtu.mutation.Where(ps...) return rtu } @@ -206,6 +207,9 @@ func (rtu *RefreshTokenUpdate) Save(ctx context.Context) (int, error) { return affected, err }) for i := len(rtu.hooks) - 1; i >= 0; i-- { + if rtu.hooks[i] == nil { + return 0, fmt.Errorf("db: uninitialized hook (forgotten import db/runtime?)") + } mut = rtu.hooks[i](mut) } if _, err := mut.Mutate(ctx, rtu.mutation); err != nil { @@ -241,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 @@ -416,8 +420,8 @@ func (rtu *RefreshTokenUpdate) sqlSave(ctx context.Context) (n int, err error) { if n, err = sqlgraph.UpdateNodes(ctx, rtu.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{refreshtoken.Label} - } else if cerr, ok := isSQLConstraintError(err); ok { - err = cerr + } else if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} } return 0, err } @@ -618,11 +622,20 @@ func (rtuo *RefreshTokenUpdateOne) Save(ctx context.Context) (*RefreshToken, err return node, err }) for i := len(rtuo.hooks) - 1; i >= 0; i-- { + if rtuo.hooks[i] == nil { + return nil, fmt.Errorf("db: uninitialized hook (forgotten import db/runtime?)") + } mut = rtuo.hooks[i](mut) } - if _, err := mut.Mutate(ctx, rtuo.mutation); err != nil { + v, err := mut.Mutate(ctx, rtuo.mutation) + if err != nil { return nil, err } + nv, ok := v.(*RefreshToken) + if !ok { + return nil, fmt.Errorf("unexpected node type %T returned from RefreshTokenMutation", v) + } + node = nv } return node, err } @@ -653,32 +666,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 @@ -697,7 +710,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 { @@ -848,8 +861,8 @@ func (rtuo *RefreshTokenUpdateOne) sqlSave(ctx context.Context) (_node *RefreshT if err = sqlgraph.UpdateNode(ctx, rtuo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{refreshtoken.Label} - } else if cerr, ok := isSQLConstraintError(err); ok { - err = cerr + } else if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } diff --git a/storage/ent/db/runtime.go b/storage/ent/db/runtime.go index 0566e0fef6..2e1d0b82c1 100644 --- a/storage/ent/db/runtime.go +++ b/storage/ent/db/runtime.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package db diff --git a/storage/ent/db/runtime/runtime.go b/storage/ent/db/runtime/runtime.go index 6f056d2df9..ad548b5dca 100644 --- a/storage/ent/db/runtime/runtime.go +++ b/storage/ent/db/runtime/runtime.go @@ -1,10 +1,10 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package runtime // The schema-stitching logic is generated in github.com/dexidp/dex/storage/ent/db/runtime.go const ( - Version = "v0.8.0" // Version of ent codegen. - Sum = "h1:xirrW//1oda7pp0bz+XssSOv4/C3nmgYQOxjIfljFt8=" // Sum of ent codegen. + Version = "v0.11.1" // Version of ent codegen. + Sum = "h1:im67R+2W3Nee2bNS2YnoYz8oAF0Qz4AOlIvKRIAEISY=" // Sum of ent codegen. ) diff --git a/storage/ent/db/tx.go b/storage/ent/db/tx.go index 5b1f7f16a3..73d1944790 100644 --- a/storage/ent/db/tx.go +++ b/storage/ent/db/tx.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package db @@ -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 From fda1bb599550fc50bce161b14cd19a27776841c5 Mon Sep 17 00:00:00 2001 From: "Robert A. Uhl" Date: Fri, 15 Jul 2022 10:52:38 -0400 Subject: [PATCH 26/29] Update & tidy deps --- go.mod | 4 -- go.sum | 133 +++------------------------------------------------------ 2 files changed, 6 insertions(+), 131 deletions(-) diff --git a/go.mod b/go.mod index 866e207220..35dcef23c3 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,6 @@ require ( github.com/dexidp/dex/api/v2 v2.0.0 github.com/felixge/httpsnoop v1.0.2 github.com/ghodss/yaml v1.0.0 - github.com/go-bindata/go-bindata v1.0.1-0.20190711162640-ee3c2418e368 // indirect github.com/go-ldap/ldap/v3 v3.3.0 github.com/go-sql-driver/mysql v1.6.0 github.com/gorilla/handlers v1.5.1 @@ -21,15 +20,12 @@ require ( github.com/lib/pq v1.10.5 github.com/mattermost/xml-roundtrip-validator v0.1.0 github.com/mattn/go-sqlite3 v1.14.13 - github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/oklog/run v1.1.0 github.com/pkg/errors v0.9.1 github.com/prometheus/client_golang v1.11.0 github.com/russellhaering/goxmldsig v1.1.0 - github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect github.com/sirupsen/logrus v1.8.1 github.com/spf13/cobra v1.5.0 - github.com/spf13/viper v1.7.0 // indirect github.com/stretchr/testify v1.7.1-0.20210427113832-6241f9ab9942 go.etcd.io/etcd/client/pkg/v3 v3.5.0 go.etcd.io/etcd/client/v3 v3.5.0 diff --git a/go.sum b/go.sum index 82a698632b..32fb269213 100644 --- a/go.sum +++ b/go.sum @@ -31,7 +31,6 @@ cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4g cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= 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= @@ -42,8 +41,6 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -entgo.io/ent v0.8.0 h1:xirrW//1oda7pp0bz+XssSOv4/C3nmgYQOxjIfljFt8= -entgo.io/ent v0.8.0/go.mod h1:KNjsukat/NJi6zJh1utwRadsbGOZsBbAZNDxkW7tMCc= entgo.io/ent v0.11.1 h1:im67R+2W3Nee2bNS2YnoYz8oAF0Qz4AOlIvKRIAEISY= entgo.io/ent v0.11.1/go.mod h1:X5b1YfMayrRTgKGO//8IqpL7XJx0uqdeReEkxNpXROA= github.com/AppsFlyer/go-sundheit v0.4.0 h1:7ECd0YWaXJQ9LzdCFrpGxJVeAgXvNarN6uwxrJsh69A= @@ -60,7 +57,6 @@ github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030I github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= 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= @@ -74,20 +70,13 @@ github.com/apparentlymart/go-textseg v1.0.0 h1:rRmlIsPEEhUTIKQb7T++Nz/A5Q6C9IuX2 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/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/beevik/etree v1.1.0 h1:T0xke/WvNtMoCqgzPhkX2r4rjY3GDZFi+FjpRZY2Jbs= github.com/beevik/etree v1.1.0/go.mod h1:r8Aw8JqVegEf0w2fDnATrX9VpkMcyFeM0FhwO62wh+A= 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 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= @@ -97,25 +86,17 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -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.0.0 h1:/mAA0XMgYJw2Uqm7WKGCsKnjitE/+A0FFbOmiRJm7LQ= github.com/coreos/go-oidc/v3 v3.0.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.2/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= @@ -124,18 +105,15 @@ github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5y github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= 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-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= @@ -149,22 +127,20 @@ github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V 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 h1:1r7pUrabqp18hOBcwBwiTsbnFeTZHV9eER/QT5JVZxY= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= @@ -229,48 +205,23 @@ github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLe github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.2.0 h1:qJYtXnJRWmpe7m/3XlyhrsLrEURqHRM2kxzoxXqyUDs= -github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5 h1:sjZBwGj9Jlw33ImPtvFviGYvseOtDM7hkSKB7+Tv3SM= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -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/gorilla/websocket v1.5.0/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 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= -github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= 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/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/huandu/xstrings v1.3.1 h1:4jgBlKK6tLKFvO8u5pmYjG91cqytmDCDvGh7ECVFfFs= github.com/huandu/xstrings v1.3.1/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= @@ -280,7 +231,6 @@ github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH 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.0 h1:J2SLSdy7HgElq8ekSl2Mxh6vrRNFxqbXGenYH2I02Vs= github.com/jonboulle/clockwork v0.2.0/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= @@ -290,11 +240,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= @@ -303,44 +250,26 @@ github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFB github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= 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.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/lib/pq v1.10.2 h1:AqzbZs4ZoCBp+GtejcpCpcxM3zlSMx29dXbUSeVtJb8= -github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/lib/pq v1.10.5 h1:J+gdV2cUmX7ZqL2B0lFcW0m+egaHC2V3lpO8nWxyYiQ= github.com/lib/pq v1.10.5/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 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= -github.com/mattn/go-sqlite3 v1.14.7 h1:fxWBnXkxfM6sRiuH3bqJ4CfzZojMOLVc0UTsTglEghA= -github.com/mattn/go-sqlite3 v1.14.7/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= github.com/mattn/go-sqlite3 v1.14.13 h1:1tj15ngiFfcZzii7yd82foL+ks+ouQcj8j/TPq3fk1I= github.com/mattn/go-sqlite3 v1.14.13/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/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/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/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/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/reflectwalk v1.0.0 h1:9D+8oIskB4VJBN5SFlmc27fSlIBZaov1Wpk/IfikLNY= github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= @@ -353,20 +282,15 @@ 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 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= 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/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 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 h1:HNkLOAEQMIDv/K+04rukrLx6ch7msSRwf3/SASFAGtQ= @@ -376,55 +300,36 @@ 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 h1:iMAkS2TDoNWnKM+Kopnx/8tnEStIfpYA0ur0xQzzhMQ= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= 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 h1:mxy4L2jP6qMonqmq+aTtOx1ifVWUgG/TAmntgbh3xv4= github.com/prometheus/procfs v0.6.0/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/russellhaering/goxmldsig v1.1.0 h1:lK/zeJie2sqG52ZAlPNn1oBBqsIsEKypUUBGpYYF6lk= github.com/russellhaering/goxmldsig v1.1.0/go.mod h1:QK8GhXPB3+AfuCrfo0oRISa9NfzeCpWmxeGnqEpDF9o= -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/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/cobra v1.1.3 h1:xghbfqPkxzxP3C/f3n5DdpAbdKLj4ZE4BWQI362l53M= -github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSWzOo= github.com/spf13/cobra v1.5.0 h1:X+jTBEBqF0bHN+9cSMgmfuvv2VHJ9ezmFNf9Y/XstYU= github.com/spf13/cobra v1.5.0/go.mod h1:dWXEIy2H428czQCjInthrTRUg7yKbok+2Qi/yBIJoUM= -github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/pflag v1.0.3/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= @@ -434,15 +339,12 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1-0.20210427113832-6241f9ab9942 h1:t0lM6y/M5IiUZyvbBTcngso8SZEZICH7is9B6g/obVU= github.com/stretchr/testify v1.7.1-0.20210427113832-6241f9ab9942/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/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/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= 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= @@ -453,7 +355,6 @@ github.com/zclconf/go-cty v1.2.0/go.mod h1:hOPWgoHbaTUnI5k4D2ld+GRpFJSCe6bCM7m1q 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/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/etcd/api/v3 v3.5.0 h1:GsV3S+OfZEOCNXdtNkBSR7kgLobAa/SO6tCxRa0GAYw= go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= go.etcd.io/etcd/client/pkg/v3 v3.5.0 h1:2aQv6F436YnN7I4VbI8PPYrBhu+SmrTaADcf8Mi/6PU= @@ -468,17 +369,13 @@ go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= 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.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/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/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= 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= @@ -523,17 +420,13 @@ golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.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 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo= 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= @@ -568,7 +461,6 @@ golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420 h1:a8jGStKg0XqKDlKqjLrXn0ioF5MH36pT7Z0BRTqLhbk= golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f h1:OfiFi4JbukWwe3lzw+xunroH1mnC1e2Gy5cxNJApiSY= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= @@ -597,11 +489,8 @@ 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= @@ -651,7 +540,6 @@ golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210616094352-59db8d763f22 h1:RqytpXGR1iVNX7psjB3ff8y7sNFinVFvkx1c8SjBkio= golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= @@ -664,22 +552,18 @@ golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= 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= @@ -689,7 +573,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= @@ -725,7 +608,6 @@ golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.3 h1:L69ShwSZEyCsLKoAxDKeMvLDZkumEe8gXUZAjab0tX8= golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.9-0.20211216111533-8d383106f7e7 h1:M1gcVrIb2lSn2FIL19DG0+/b8nNVKJ7W7b4WcAGZAYM= golang.org/x/tools v0.1.9-0.20211216111533-8d383106f7e7/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= @@ -857,12 +739,9 @@ gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 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= From 9d57fb571ad136f799af5b0336289861987f25e4 Mon Sep 17 00:00:00 2001 From: "Robert A. Uhl" Date: Fri, 15 Jul 2022 14:02:52 -0400 Subject: [PATCH 27/29] Correct version of go-sqlite3 --- go.mod | 2 +- go.sum | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index be616bef00..35dcef23c3 100644 --- a/go.mod +++ b/go.mod @@ -19,7 +19,7 @@ require ( github.com/kylelemons/godebug v1.1.0 github.com/lib/pq v1.10.5 github.com/mattermost/xml-roundtrip-validator v0.1.0 - github.com/mattn/go-sqlite3 v2.0.3+incompatible + github.com/mattn/go-sqlite3 v1.14.13 github.com/oklog/run v1.1.0 github.com/pkg/errors v0.9.1 github.com/prometheus/client_golang v1.11.0 diff --git a/go.sum b/go.sum index d3d5959325..cfc7a18ee1 100644 --- a/go.sum +++ b/go.sum @@ -260,11 +260,9 @@ github.com/lib/pq v1.10.5 h1:J+gdV2cUmX7ZqL2B0lFcW0m+egaHC2V3lpO8nWxyYiQ= github.com/lib/pq v1.10.5/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= 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-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= +github.com/mattn/go-sqlite3 v1.14.13 h1:1tj15ngiFfcZzii7yd82foL+ks+ouQcj8j/TPq3fk1I= github.com/mattn/go-sqlite3 v1.14.13/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= -github.com/mattn/go-sqlite3 v2.0.3+incompatible h1:gXHsfypPkaMZrKbD5209QV9jbUTJKjyR5WD3HYQSd+U= -github.com/mattn/go-sqlite3 v2.0.3+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= 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/mitchellh/copystructure v1.0.0 h1:Laisrj+bAB6b/yJwB5Bt3ITZhGJdqmxquMKeZ+mmkFQ= @@ -283,7 +281,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/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -610,7 +607,6 @@ golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.9-0.20211216111533-8d383106f7e7 h1:M1gcVrIb2lSn2FIL19DG0+/b8nNVKJ7W7b4WcAGZAYM= golang.org/x/tools v0.1.9-0.20211216111533-8d383106f7e7/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= From a26b9fd07892eb272c7bf982df1ab1b1d254567f Mon Sep 17 00:00:00 2001 From: "Robert A. Uhl" Date: Sat, 16 Jul 2022 05:32:07 -0400 Subject: [PATCH 28/29] Delint --- server/api_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/api_test.go b/server/api_test.go index 020613402c..01c59cf875 100644 --- a/server/api_test.go +++ b/server/api_test.go @@ -9,6 +9,7 @@ import ( "github.com/sirupsen/logrus" "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" "github.com/dexidp/dex/api/v2" "github.com/dexidp/dex/pkg/log" @@ -41,7 +42,7 @@ func newAPI(s storage.Storage, logger log.Logger, t *testing.T) *apiClient { // Dial will retry automatically if the serv.Serve() goroutine // hasn't started yet. - conn, err := grpc.Dial(l.Addr().String(), grpc.WithInsecure()) + conn, err := grpc.Dial(l.Addr().String(), grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { t.Fatal(err) } From 6e4586ad05b10167d3228af6518e3f1dcee36f0a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 4 Jan 2023 10:04:58 +0000 Subject: [PATCH 29/29] build(deps): bump github.com/coreos/go-oidc/v3 from 3.0.0 to 3.5.0 Bumps [github.com/coreos/go-oidc/v3](https://github.com/coreos/go-oidc) from 3.0.0 to 3.5.0. - [Release notes](https://github.com/coreos/go-oidc/releases) - [Commits](https://github.com/coreos/go-oidc/compare/v3.0.0...v3.5.0) --- updated-dependencies: - dependency-name: github.com/coreos/go-oidc/v3 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 8 ++++---- go.sum | 37 ++++++++++++++++++++++++++----------- 2 files changed, 30 insertions(+), 15 deletions(-) diff --git a/go.mod b/go.mod index 2976942480..85ed7d0988 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/AppsFlyer/go-sundheit v0.4.0 github.com/Masterminds/sprig/v3 v3.2.2 github.com/beevik/etree v1.1.0 - github.com/coreos/go-oidc/v3 v3.0.0 + github.com/coreos/go-oidc/v3 v3.5.0 github.com/dexidp/dex/api/v2 v2.0.0 github.com/felixge/httpsnoop v1.0.2 github.com/ghodss/yaml v1.0.0 @@ -29,9 +29,9 @@ require ( github.com/stretchr/testify v1.7.1-0.20210427113832-6241f9ab9942 go.etcd.io/etcd/client/pkg/v3 v3.5.0 go.etcd.io/etcd/client/v3 v3.5.0 - golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2 - golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e - golang.org/x/oauth2 v0.0.0-20220622183110-fd043fe589d2 + golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 + golang.org/x/net v0.4.0 + golang.org/x/oauth2 v0.3.0 google.golang.org/api v0.87.0 google.golang.org/grpc v1.48.0 google.golang.org/protobuf v1.28.0 diff --git a/go.sum b/go.sum index c3897bdb5c..065c7ba5c6 100644 --- a/go.sum +++ b/go.sum @@ -44,6 +44,8 @@ cloud.google.com/go/compute v1.6.0/go.mod h1:T29tfhtVbq1wvAPo0E3+7vhgmkOYeXjhFvz cloud.google.com/go/compute v1.6.1/go.mod h1:g85FgpzFvNULZ+S8AYq87axRKuf2Kh7deLqV/jJ3thU= cloud.google.com/go/compute v1.7.0 h1:v/k9Eueb8aAJ0vZuxKMrgm6kPhCLZU9HxFU+AFDs9Uk= cloud.google.com/go/compute v1.7.0/go.mod h1:435lt8av5oL9P3fv1OEzSbSUe+ybHXGMPQHHZWZxy9U= +cloud.google.com/go/compute/metadata v0.2.0 h1:nBbNSZyDpkNlo3DepaaLKVuO7ClyifSAmNloSCZrHnQ= +cloud.google.com/go/compute/metadata v0.2.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1hT1fIilQDwofLpJ20k= 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/iam v0.3.0/go.mod h1:XzJPvDayI+9zsASAFO68Hk07u3z+f+JrT2xXNdp4bnY= @@ -112,8 +114,8 @@ github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/coreos/go-oidc/v3 v3.0.0 h1:/mAA0XMgYJw2Uqm7WKGCsKnjitE/+A0FFbOmiRJm7LQ= -github.com/coreos/go-oidc/v3 v3.0.0/go.mod h1:rEJ/idjfUyfkBit1eI1fvyr+64/g9dcKpAm8MJMesvo= +github.com/coreos/go-oidc/v3 v3.5.0 h1:VxKtbccHZxs8juq7RdJntSqtXFtde9YpNpGn0yqgEHw= +github.com/coreos/go-oidc/v3 v3.5.0/go.mod h1:ecXRtV4romGPeO6ieExAsUK9cb/3fp9hXNz1tlv8PIM= 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/v22 v22.3.2 h1:D9/bQk5vlXQFZ6Kwuu6zaiXJ9oTPe68++AzAJc1DzSI= @@ -146,6 +148,8 @@ github.com/go-asn1-ber/asn1-ber v1.5.1/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkPro 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= +github.com/go-jose/go-jose/v3 v3.0.0 h1:s6rrhirfEP/CGIoc6p+PZAeogN2SxKav6Wp7+dyMWVo= +github.com/go-jose/go-jose/v3 v3.0.0/go.mod h1:RNkWWRld676jZEYoV3+XK8L2ZnNSvIsxFMht0mSX+u8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= @@ -393,6 +397,7 @@ github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= 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= @@ -423,12 +428,13 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk 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-20190911031432-227b76d455e7/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200414173820-0848c9571904/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2 h1:It14KIkyBFYkHkwZ7k45minvA9aorojkyjGk9KJ5B/w= -golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 h1:7I4JAnoQBe7ZtJcBaYHi5UtiO8tQHbUSXxL+pnGRANg= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -464,8 +470,9 @@ 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/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= 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= @@ -489,7 +496,6 @@ golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200505041828-1ed23360d12c/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= @@ -512,8 +518,11 @@ golang.org/x/net v0.0.0-20220325170049-de3da57026de/go.mod h1:CfG3xpIq0wQ8r1q4Su golang.org/x/net v0.0.0-20220412020605-290c469a71a5/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e h1:TsQ7F31D3bUCLeqPT0u+yjp1guoArKaNKmCr22PYgTQ= golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= +golang.org/x/net v0.4.0 h1:Q5QPcMlvfxFTAPV0+07Xz/MpK9NTXu2VDUuy0FeMfaU= +golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -534,8 +543,9 @@ golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= golang.org/x/oauth2 v0.0.0-20220608161450-d0670ef3b1eb/go.mod h1:jaDAt6Dkxork7LmZnYtzbRWj0W47D86a3TGe0YHBvmE= -golang.org/x/oauth2 v0.0.0-20220622183110-fd043fe589d2 h1:+jnHzr9VPj32ykQVai5DNahi9+NSp7yYuCsl5eAQtL0= golang.org/x/oauth2 v0.0.0-20220622183110-fd043fe589d2/go.mod h1:jaDAt6Dkxork7LmZnYtzbRWj0W47D86a3TGe0YHBvmE= +golang.org/x/oauth2 v0.3.0 h1:6l90koy8/LaBLmLu8jpHeHexzMwEita0zFfYlggy2F8= +golang.org/x/oauth2 v0.3.0/go.mod h1:rQrIauxkUhJ6CuwEXwymO2/eh4xz2ZWF1nBkcxS+tGk= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -548,6 +558,7 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ 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/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -618,10 +629,13 @@ golang.org/x/sys v0.0.0-20220502124256-b6088ccd6cba/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220610221304-9f5ed59c137d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220624220833-87e55d714810 h1:rHZQSjJdAI4Xf5Qzeh2bBc5YJIkPFVM6oDtMFYmgws0= golang.org/x/sys v0.0.0-20220624220833-87e55d714810/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ= +golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -630,8 +644,9 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.5.0 h1:OLmvp0KP+FVG99Ct/qFiL/Fhk4zp4QQnZ7b2U+5piUM= +golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= 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= @@ -689,6 +704,7 @@ golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.9-0.20211216111533-8d383106f7e7/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -881,7 +897,6 @@ gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -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.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=