Skip to content

A continuation of HomeBox the inventory and organization system built for the Home User

Add support for SSO / OpenID Connect (OIDC) (#996)

Jeff Rescignanof36756d98eeb
diff --git a/backend/app/api/handlers/v1/controller.go b/backend/app/api/handlers/v1/controller.go
index c77cff3b..844ed8e4 100644
--- a/backend/app/api/handlers/v1/controller.go
+++ b/backend/app/api/handlers/v1/controller.go
@@ -10,6 +10,7 @@ import (
"github.com/hay-kot/httpkit/errchain"
"github.com/hay-kot/httpkit/server"
"github.com/rs/zerolog/log"
+ "github.com/sysadminsmedia/homebox/backend/app/api/providers"
"github.com/sysadminsmedia/homebox/backend/internal/core/services"
"github.com/sysadminsmedia/homebox/backend/internal/core/services/reporting/eventbus"
"github.com/sysadminsmedia/homebox/backend/internal/data/repo"
@@ -74,6 +75,7 @@ type V1Controller struct {
bus *eventbus.EventBus
url string
config *config.Config
+ oidcProvider *providers.OIDCProvider
}
type (
@@ -95,6 +97,14 @@ type (
Demo bool `json:"demo"`
AllowRegistration bool `json:"allowRegistration"`
LabelPrinting bool `json:"labelPrinting"`
+ OIDC OIDCStatus `json:"oidc"`
+ }
+
+ OIDCStatus struct {
+ Enabled bool `json:"enabled"`
+ ButtonText string `json:"buttonText,omitempty"`
+ AutoRedirect bool `json:"autoRedirect,omitempty"`
+ AllowLocal bool `json:"allowLocal"`
}
)
@@ -111,9 +121,23 @@ func NewControllerV1(svc *services.AllServices, repos *repo.AllRepos, bus *event
opt(ctrl)
}
+ ctrl.initOIDCProvider()
+
return ctrl
}
+func (ctrl *V1Controller) initOIDCProvider() {
+ if ctrl.config.OIDC.Enabled {
+ oidcProvider, err := providers.NewOIDCProvider(ctrl.svc.User, &ctrl.config.OIDC, &ctrl.config.Options, ctrl.cookieSecure)
+ if err != nil {
+ log.Err(err).Msg("failed to initialize OIDC provider at startup")
+ } else {
+ ctrl.oidcProvider = oidcProvider
+ log.Info().Msg("OIDC provider initialized successfully at startup")
+ }
+ }
+}
+
// HandleBase godoc
//
// @Summary Application Info
@@ -132,6 +156,12 @@ func (ctrl *V1Controller) HandleBase(ready ReadyFunc, build Build) errchain.Hand
Demo: ctrl.isDemo,
AllowRegistration: ctrl.allowRegistration,
LabelPrinting: ctrl.config.LabelMaker.PrintCommand != nil,
+ OIDC: OIDCStatus{
+ Enabled: ctrl.config.OIDC.Enabled,
+ ButtonText: ctrl.config.OIDC.ButtonText,
+ AutoRedirect: ctrl.config.OIDC.AutoRedirect,
+ AllowLocal: ctrl.config.Options.AllowLocalLogin,
+ },
})
}
}
diff --git a/backend/app/api/handlers/v1/v1_ctrl_auth.go b/backend/app/api/handlers/v1/v1_ctrl_auth.go
index 64d556fe..defc8175 100644
--- a/backend/app/api/handlers/v1/v1_ctrl_auth.go
+++ b/backend/app/api/handlers/v1/v1_ctrl_auth.go
@@ -2,6 +2,7 @@ package v1
import (
"errors"
+ "fmt"
"net/http"
"strconv"
"strings"
@@ -106,6 +107,11 @@ func (ctrl *V1Controller) HandleAuthLogin(ps ...AuthProvider) errchain.HandlerFu
provider = "local"
}
+ // Block local only when disabled
+ if provider == "local" && !ctrl.config.Options.AllowLocalLogin {
+ return validate.NewRequestError(fmt.Errorf("local login is not enabled"), http.StatusForbidden)
+ }
+
// Get the provider
p, ok := providers[provider]
if !ok {
@@ -114,8 +120,8 @@ func (ctrl *V1Controller) HandleAuthLogin(ps ...AuthProvider) errchain.HandlerFu
newToken, err := p.Authenticate(w, r)
if err != nil {
- log.Err(err).Msg("failed to authenticate")
- return server.JSON(w, http.StatusInternalServerError, err.Error())
+ log.Warn().Err(err).Msg("authentication failed")
+ return validate.NewUnauthorizedError()
}
ctrl.setCookies(w, noPort(r.Host), newToken.Raw, newToken.ExpiresAt, true)
@@ -247,3 +253,65 @@ func (ctrl *V1Controller) unsetCookies(w http.ResponseWriter, domain string) {
Path: "/",
})
}
+
+// HandleOIDCLogin godoc
+//
+// @Summary OIDC Login Initiation
+// @Tags Authentication
+// @Produce json
+// @Success 302
+// @Router /v1/users/login/oidc [GET]
+func (ctrl *V1Controller) HandleOIDCLogin() errchain.HandlerFunc {
+ return func(w http.ResponseWriter, r *http.Request) error {
+ // Forbidden if OIDC is not enabled
+ if !ctrl.config.OIDC.Enabled {
+ return validate.NewRequestError(fmt.Errorf("OIDC is not enabled"), http.StatusForbidden)
+ }
+
+ // Check if OIDC provider is available
+ if ctrl.oidcProvider == nil {
+ log.Error().Msg("OIDC provider not initialized")
+ return validate.NewRequestError(errors.New("OIDC provider not available"), http.StatusInternalServerError)
+ }
+
+ // Initiate OIDC flow
+ _, err := ctrl.oidcProvider.InitiateOIDCFlow(w, r)
+ return err
+ }
+}
+
+// HandleOIDCCallback godoc
+//
+// @Summary OIDC Callback Handler
+// @Tags Authentication
+// @Param code query string true "Authorization code"
+// @Param state query string true "State parameter"
+// @Success 302
+// @Router /v1/users/login/oidc/callback [GET]
+func (ctrl *V1Controller) HandleOIDCCallback() errchain.HandlerFunc {
+ return func(w http.ResponseWriter, r *http.Request) error {
+ // Forbidden if OIDC is not enabled
+ if !ctrl.config.OIDC.Enabled {
+ return validate.NewRequestError(fmt.Errorf("OIDC is not enabled"), http.StatusForbidden)
+ }
+
+ // Check if OIDC provider is available
+ if ctrl.oidcProvider == nil {
+ log.Error().Msg("OIDC provider not initialized")
+ return validate.NewRequestError(errors.New("OIDC provider not available"), http.StatusInternalServerError)
+ }
+
+ // Handle callback
+ newToken, err := ctrl.oidcProvider.HandleCallback(w, r)
+ if err != nil {
+ log.Err(err).Msg("OIDC callback failed")
+ http.Redirect(w, r, "/?oidc_error=oidc_auth_failed", http.StatusFound)
+ return nil
+ }
+
+ // Set cookies and redirect to home
+ ctrl.setCookies(w, noPort(r.Host), newToken.Raw, newToken.ExpiresAt, true)
+ http.Redirect(w, r, "/home", http.StatusFound)
+ return nil
+ }
+}
diff --git a/backend/app/api/handlers/v1/v1_ctrl_user.go b/backend/app/api/handlers/v1/v1_ctrl_user.go
index a99c7b86..f1dbefa2 100644
--- a/backend/app/api/handlers/v1/v1_ctrl_user.go
+++ b/backend/app/api/handlers/v1/v1_ctrl_user.go
@@ -20,9 +20,15 @@ import (
// @Produce json
// @Param payload body services.UserRegistration true "User Data"
// @Success 204
+// @Failure 403 {string} string "Local login is not enabled"
// @Router /v1/users/register [Post]
func (ctrl *V1Controller) HandleUserRegistration() errchain.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) error {
+ // Forbidden if local login is not enabled
+ if !ctrl.config.Options.AllowLocalLogin {
+ return validate.NewRequestError(fmt.Errorf("local login is not enabled"), http.StatusForbidden)
+ }
+
regData := services.UserRegistration{}
if err := server.Decode(r, &regData); err != nil {
diff --git a/backend/app/api/providers/oidc.go b/backend/app/api/providers/oidc.go
new file mode 100644
index 00000000..7120baea
--- /dev/null
+++ b/backend/app/api/providers/oidc.go
@@ -0,0 +1,626 @@
+package providers
+
+import (
+ "context"
+ "crypto/rand"
+ "crypto/sha256"
+ "encoding/base64"
+ "fmt"
+ "net/http"
+ "net/url"
+ "strconv"
+ "strings"
+ "time"
+
+ "github.com/coreos/go-oidc/v3/oidc"
+ "github.com/rs/zerolog/log"
+ "github.com/sysadminsmedia/homebox/backend/internal/core/services"
+ "github.com/sysadminsmedia/homebox/backend/internal/sys/config"
+ "golang.org/x/oauth2"
+)
+
+type OIDCProvider struct {
+ service *services.UserService
+ config *config.OIDCConf
+ options *config.Options
+ cookieSecure bool
+ provider *oidc.Provider
+ verifier *oidc.IDTokenVerifier
+ endpoint oauth2.Endpoint
+}
+
+type OIDCClaims struct {
+ Email string
+ Groups []string
+ Name string
+ Subject string
+ Issuer string
+ EmailVerified *bool
+}
+
+func NewOIDCProvider(service *services.UserService, config *config.OIDCConf, options *config.Options, cookieSecure bool) (*OIDCProvider, error) {
+ if !config.Enabled {
+ return nil, fmt.Errorf("OIDC is not enabled")
+ }
+
+ // Validate required configuration
+ if config.ClientID == "" {
+ return nil, fmt.Errorf("OIDC client ID is required when OIDC is enabled (set HBOX_OIDC_CLIENT_ID)")
+ }
+ if config.ClientSecret == "" {
+ return nil, fmt.Errorf("OIDC client secret is required when OIDC is enabled (set HBOX_OIDC_CLIENT_SECRET)")
+ }
+ if config.IssuerURL == "" {
+ return nil, fmt.Errorf("OIDC issuer URL is required when OIDC is enabled (set HBOX_OIDC_ISSUER_URL)")
+ }
+
+ ctx, cancel := context.WithTimeout(context.Background(), config.RequestTimeout)
+ defer cancel()
+
+ provider, err := oidc.NewProvider(ctx, config.IssuerURL)
+ if err != nil {
+ return nil, fmt.Errorf("failed to create OIDC provider from issuer URL: %w", err)
+ }
+
+ // Create ID token verifier
+ verifier := provider.Verifier(&oidc.Config{
+ ClientID: config.ClientID,
+ })
+
+ log.Info().
+ Str("issuer", config.IssuerURL).
+ Str("client_id", config.ClientID).
+ Str("scope", config.Scope).
+ Msg("OIDC provider initialized successfully with discovery")
+
+ return &OIDCProvider{
+ service: service,
+ config: config,
+ options: options,
+ cookieSecure: cookieSecure,
+ provider: provider,
+ verifier: verifier,
+ endpoint: provider.Endpoint(),
+ }, nil
+}
+
+func (p *OIDCProvider) Name() string {
+ return "oidc"
+}
+
+// Authenticate implements the AuthProvider interface but is not used for OIDC
+// OIDC uses dedicated endpoints: GET /api/v1/users/login/oidc and GET /api/v1/users/login/oidc/callback
+func (p *OIDCProvider) Authenticate(w http.ResponseWriter, r *http.Request) (services.UserAuthTokenDetail, error) {
+ _ = w
+ _ = r
+ return services.UserAuthTokenDetail{}, fmt.Errorf("OIDC authentication uses dedicated endpoints: /api/v1/users/login/oidc")
+}
+
+// AuthenticateWithBaseURL is the main authentication method that requires baseURL
+// Called from handleCallback after state, nonce, and PKCE verification
+func (p *OIDCProvider) AuthenticateWithBaseURL(baseURL, expectedNonce, pkceVerifier string, _ http.ResponseWriter, r *http.Request) (services.UserAuthTokenDetail, error) {
+ code := r.URL.Query().Get("code")
+ if code == "" {
+ return services.UserAuthTokenDetail{}, fmt.Errorf("missing authorization code")
+ }
+
+ // Get OAuth2 config for this request
+ oauth2Config := p.getOAuth2Config(baseURL)
+
+ // Exchange code for token with timeout and PKCE verifier
+ ctx, cancel := context.WithTimeout(r.Context(), p.config.RequestTimeout)
+ defer cancel()
+
+ token, err := oauth2Config.Exchange(ctx, code, oauth2.SetAuthURLParam("code_verifier", pkceVerifier))
+ if err != nil {
+ log.Err(err).Msg("failed to exchange OIDC code for token")
+ return services.UserAuthTokenDetail{}, fmt.Errorf("failed to exchange code for token")
+ }
+
+ // Extract ID token
+ idToken, ok := token.Extra("id_token").(string)
+ if !ok {
+ return services.UserAuthTokenDetail{}, fmt.Errorf("no id_token in response")
+ }
+
+ // Parse and validate the ID token using the library's verifier with timeout
+ verifyCtx, verifyCancel := context.WithTimeout(r.Context(), p.config.RequestTimeout)
+ defer verifyCancel()
+
+ idTokenStruct, err := p.verifier.Verify(verifyCtx, idToken)
+ if err != nil {
+ log.Err(err).Msg("failed to verify ID token")
+ return services.UserAuthTokenDetail{}, fmt.Errorf("failed to verify ID token")
+ }
+
+ // Extract claims from the verified token using dynamic parsing
+ var rawClaims map[string]interface{}
+ if err := idTokenStruct.Claims(&rawClaims); err != nil {
+ log.Err(err).Msg("failed to extract claims from ID token")
+ return services.UserAuthTokenDetail{}, fmt.Errorf("failed to extract claims from ID token")
+ }
+
+ // Attempt to retrieve UserInfo claims; use them as primary, fallback to ID token claims.
+ finalClaims := rawClaims
+ userInfoCtx, uiCancel := context.WithTimeout(r.Context(), p.config.RequestTimeout)
+ defer uiCancel()
+
+ userInfo, uiErr := p.provider.UserInfo(userInfoCtx, oauth2.StaticTokenSource(token))
+ if uiErr != nil {
+ log.Debug().Err(uiErr).Msg("OIDC UserInfo fetch failed; falling back to ID token claims")
+ } else {
+ var uiClaims map[string]interface{}
+ if err := userInfo.Claims(&uiClaims); err != nil {
+ log.Debug().Err(err).Msg("failed to decode UserInfo claims; falling back to ID token claims")
+ } else {
+ finalClaims = mergeOIDCClaims(uiClaims, rawClaims) // UserInfo first, then fill gaps from ID token
+ log.Debug().Int("userinfo_claims", len(uiClaims)).Int("id_token_claims", len(rawClaims)).Int("merged_claims", len(finalClaims)).Msg("merged UserInfo and ID token claims")
+ }
+ }
+
+ // Parse claims using configurable claim names (after merge)
+ claims, err := p.parseOIDCClaims(finalClaims)
+ if err != nil {
+ log.Err(err).Msg("failed to parse OIDC claims")
+ return services.UserAuthTokenDetail{}, fmt.Errorf("failed to parse OIDC claims: %w", err)
+ }
+
+ // Verify nonce claim matches expected value (nonce only from ID token; ensure preserved in merged map)
+ tokenNonce, exists := finalClaims["nonce"]
+ if !exists {
+ log.Warn().Msg("nonce claim missing from ID token - possible replay attack")
+ return services.UserAuthTokenDetail{}, fmt.Errorf("nonce claim missing from token")
+ }
+
+ tokenNonceStr, ok := tokenNonce.(string)
+ if !ok {
+ log.Warn().Msg("nonce claim is not a string in ID token")
+ return services.UserAuthTokenDetail{}, fmt.Errorf("invalid nonce claim format")
+ }
+
+ if tokenNonceStr != expectedNonce {
+ log.Warn().Str("received", tokenNonceStr).Str("expected", expectedNonce).Msg("OIDC nonce mismatch - possible replay attack")
+ return services.UserAuthTokenDetail{}, fmt.Errorf("nonce parameter mismatch")
+ }
+
+ // Check if email is verified
+ if p.config.VerifyEmail {
+ if claims.EmailVerified == nil {
+ return services.UserAuthTokenDetail{}, fmt.Errorf("email verification status not found in token claims")
+ }
+
+ if !*claims.EmailVerified {
+ return services.UserAuthTokenDetail{}, fmt.Errorf("email not verified")
+ }
+ }
+
+ // Check group authorization if configured
+ if p.config.AllowedGroups != "" {
+ allowedGroups := strings.Split(p.config.AllowedGroups, ",")
+ if !p.hasAllowedGroup(claims.Groups, allowedGroups) {
+ log.Warn().
+ Strs("user_groups", claims.Groups).
+ Strs("allowed_groups", allowedGroups).
+ Str("user", claims.Email).
+ Msg("user not in allowed groups")
+ return services.UserAuthTokenDetail{}, fmt.Errorf("user not in allowed groups")
+ }
+ }
+
+ // Determine username from claims
+ email := claims.Email
+ if email == "" {
+ return services.UserAuthTokenDetail{}, fmt.Errorf("no email found in token claims")
+ }
+ if claims.Subject == "" {
+ return services.UserAuthTokenDetail{}, fmt.Errorf("no subject (sub) claim present")
+ }
+ if claims.Issuer == "" {
+ claims.Issuer = p.config.IssuerURL // fallback to configured issuer, though spec requires 'iss'
+ }
+
+ // Use the dedicated OIDC login method (issuer + subject identity)
+ sessionToken, err := p.service.LoginOIDC(r.Context(), claims.Issuer, claims.Subject, email, claims.Name)
+ if err != nil {
+ log.Err(err).Str("email", email).Str("issuer", claims.Issuer).Str("subject", claims.Subject).Msg("OIDC login failed")
+ return services.UserAuthTokenDetail{}, fmt.Errorf("OIDC login failed: %w", err)
+ }
+
+ return sessionToken, nil
+}
+
+func (p *OIDCProvider) parseOIDCClaims(rawClaims map[string]interface{}) (OIDCClaims, error) {
+ var claims OIDCClaims
+
+ // Parse email claim
+ key := p.config.EmailClaim
+ if key == "" {
+ key = "email"
+ }
+ if emailValue, exists := rawClaims[key]; exists {
+ if email, ok := emailValue.(string); ok {
+ claims.Email = email
+ }
+ }
+
+ // Parse email_verified claim
+ if p.config.VerifyEmail {
+ key = p.config.EmailVerifiedClaim
+ if key == "" {
+ key = "email_verified"
+ }
+ if emailVerifiedValue, exists := rawClaims[key]; exists {
+ switch v := emailVerifiedValue.(type) {
+ case bool:
+ claims.EmailVerified = &v
+ case string:
+ if b, err := strconv.ParseBool(v); err == nil {
+ claims.EmailVerified = &b
+ }
+ }
+ }
+ }
+
+ // Parse name claim
+ key = p.config.NameClaim
+ if key == "" {
+ key = "name"
+ }
+ if nameValue, exists := rawClaims[key]; exists {
+ if name, ok := nameValue.(string); ok {
+ claims.Name = name
+ }
+ }
+
+ // Parse groups claim
+ key = p.config.GroupClaim
+ if key == "" {
+ key = "groups"
+ }
+ if groupsValue, exists := rawClaims[key]; exists {
+ switch groups := groupsValue.(type) {
+ case []interface{}:
+ for _, group := range groups {
+ if groupStr, ok := group.(string); ok {
+ claims.Groups = append(claims.Groups, groupStr)
+ }
+ }
+ case []string:
+ claims.Groups = groups
+ case string:
+ // Single group as string
+ claims.Groups = []string{groups}
+ }
+ }
+
+ // Parse subject claim (always "sub")
+ if subValue, exists := rawClaims["sub"]; exists {
+ if subject, ok := subValue.(string); ok {
+ claims.Subject = subject
+ }
+ }
+ // Parse issuer claim ("iss")
+ if issValue, exists := rawClaims["iss"]; exists {
+ if iss, ok := issValue.(string); ok {
+ claims.Issuer = iss
+ }
+ }
+
+ return claims, nil
+}
+
+func (p *OIDCProvider) hasAllowedGroup(userGroups, allowedGroups []string) bool {
+ if len(allowedGroups) == 0 {
+ return true
+ }
+
+ allowedGroupsMap := make(map[string]bool)
+ for _, group := range allowedGroups {
+ allowedGroupsMap[strings.TrimSpace(group)] = true
+ }
+
+ for _, userGroup := range userGroups {
+ if allowedGroupsMap[userGroup] {
+ return true
+ }
+ }
+
+ return false
+}
+
+func (p *OIDCProvider) GetAuthURL(baseURL, state, nonce, pkceVerifier string) string {
+ oauth2Config := p.getOAuth2Config(baseURL)
+ pkceChallenge := generatePKCEChallenge(pkceVerifier)
+ return oauth2Config.AuthCodeURL(state,
+ oidc.Nonce(nonce),
+ oauth2.SetAuthURLParam("code_challenge", pkceChallenge),
+ oauth2.SetAuthURLParam("code_challenge_method", "S256"))
+}
+
+func (p *OIDCProvider) getOAuth2Config(baseURL string) oauth2.Config {
+ // Construct full redirect URL with dedicated callback endpoint
+ redirectURL, err := url.JoinPath(baseURL, "/api/v1/users/login/oidc/callback")
+ if err != nil {
+ log.Err(err).Msg("failed to construct redirect URL")
+ return oauth2.Config{}
+ }
+
+ return oauth2.Config{
+ ClientID: p.config.ClientID,
+ ClientSecret: p.config.ClientSecret,
+ RedirectURL: redirectURL,
+ Endpoint: p.endpoint,
+ Scopes: strings.Fields(p.config.Scope),
+ }
+}
+
+// initiateOIDCFlow handles the initial OIDC authentication request by redirecting to the provider
+func (p *OIDCProvider) initiateOIDCFlow(w http.ResponseWriter, r *http.Request) (services.UserAuthTokenDetail, error) {
+ // Generate state parameter for CSRF protection
+ state, err := generateSecureToken()
+ if err != nil {
+ log.Err(err).Msg("failed to generate OIDC state parameter")
+ return services.UserAuthTokenDetail{}, fmt.Errorf("internal server error")
+ }
+
+ // Generate nonce parameter for replay attack protection
+ nonce, err := generateSecureToken()
+ if err != nil {
+ log.Err(err).Msg("failed to generate OIDC nonce parameter")
+ return services.UserAuthTokenDetail{}, fmt.Errorf("internal server error")
+ }
+
+ // Generate PKCE verifier for code interception protection
+ pkceVerifier, err := generatePKCEVerifier()
+ if err != nil {
+ log.Err(err).Msg("failed to generate OIDC PKCE verifier")
+ return services.UserAuthTokenDetail{}, fmt.Errorf("internal server error")
+ }
+
+ // Get base URL from request
+ baseURL := p.getBaseURL(r)
+ u, _ := url.Parse(baseURL)
+ domain := u.Hostname()
+ if domain == "" {
+ domain = noPort(r.Host)
+ }
+
+ // Store state in session cookie for validation
+ http.SetCookie(w, &http.Cookie{
+ Name: "oidc_state",
+ Value: state,
+ Expires: time.Now().Add(p.config.StateExpiry),
+ Domain: domain,
+ Secure: p.isSecure(r),
+ HttpOnly: true,
+ Path: "/",
+ SameSite: http.SameSiteLaxMode,
+ })
+
+ // Store nonce in session cookie for validation
+ http.SetCookie(w, &http.Cookie{
+ Name: "oidc_nonce",
+ Value: nonce,
+ Expires: time.Now().Add(p.config.StateExpiry),
+ Domain: domain,
+ Secure: p.isSecure(r),
+ HttpOnly: true,
+ Path: "/",
+ SameSite: http.SameSiteLaxMode,
+ })
+
+ // Store PKCE verifier in session cookie for token exchange
+ http.SetCookie(w, &http.Cookie{
+ Name: "oidc_pkce_verifier",
+ Value: pkceVerifier,
+ Expires: time.Now().Add(p.config.StateExpiry),
+ Domain: domain,
+ Secure: p.isSecure(r),
+ HttpOnly: true,
+ Path: "/",
+ SameSite: http.SameSiteLaxMode,
+ })
+
+ // Generate auth URL and redirect
+ authURL := p.GetAuthURL(baseURL, state, nonce, pkceVerifier)
+ http.Redirect(w, r, authURL, http.StatusFound)
+
+ // Return empty token since this is a redirect response
+ return services.UserAuthTokenDetail{}, nil
+}
+
+// handleCallback processes the OAuth2 callback from the OIDC provider
+func (p *OIDCProvider) handleCallback(w http.ResponseWriter, r *http.Request) (services.UserAuthTokenDetail, error) {
+ // Helper to clear state cookie using computed domain
+ baseURL := p.getBaseURL(r)
+ u, _ := url.Parse(baseURL)
+ domain := u.Hostname()
+ if domain == "" {
+ domain = noPort(r.Host)
+ }
+ clearCookies := func() {
+ http.SetCookie(w, &http.Cookie{
+ Name: "oidc_state",
+ Value: "",
+ Expires: time.Unix(0, 0),
+ Domain: domain,
+ MaxAge: -1,
+ Secure: p.isSecure(r),
+ HttpOnly: true,
+ Path: "/",
+ SameSite: http.SameSiteLaxMode,
+ })
+ http.SetCookie(w, &http.Cookie{
+ Name: "oidc_nonce",
+ Value: "",
+ Expires: time.Unix(0, 0),
+ Domain: domain,
+ MaxAge: -1,
+ Secure: p.isSecure(r),
+ HttpOnly: true,
+ Path: "/",
+ SameSite: http.SameSiteLaxMode,
+ })
+ http.SetCookie(w, &http.Cookie{
+ Name: "oidc_pkce_verifier",
+ Value: "",
+ Expires: time.Unix(0, 0),
+ Domain: domain,
+ MaxAge: -1,
+ Secure: p.isSecure(r),
+ HttpOnly: true,
+ Path: "/",
+ SameSite: http.SameSiteLaxMode,
+ })
+ }
+
+ // Check for OAuth error responses first
+ if errCode := r.URL.Query().Get("error"); errCode != "" {
+ errDesc := r.URL.Query().Get("error_description")
+ log.Warn().Str("error", errCode).Str("description", errDesc).Msg("OIDC provider returned error")
+ clearCookies()
+ return services.UserAuthTokenDetail{}, fmt.Errorf("OIDC provider error: %s - %s", errCode, errDesc)
+ }
+
+ // Verify state parameter
+ stateCookie, err := r.Cookie("oidc_state")
+ if err != nil {
+ log.Warn().Err(err).Msg("OIDC state cookie not found - possible CSRF attack or expired session")
+ clearCookies()
+ return services.UserAuthTokenDetail{}, fmt.Errorf("state cookie not found")
+ }
+
+ stateParam := r.URL.Query().Get("state")
+ if stateParam == "" {
+ log.Warn().Msg("OIDC state parameter missing from callback")
+ clearCookies()
+ return services.UserAuthTokenDetail{}, fmt.Errorf("state parameter missing")
+ }
+
+ if stateParam != stateCookie.Value {
+ log.Warn().Str("received", stateParam).Str("expected", stateCookie.Value).Msg("OIDC state mismatch - possible CSRF attack")
+ clearCookies()
+ return services.UserAuthTokenDetail{}, fmt.Errorf("state parameter mismatch")
+ }
+
+ // Verify nonce parameter
+ nonceCookie, err := r.Cookie("oidc_nonce")
+ if err != nil {
+ log.Warn().Err(err).Msg("OIDC nonce cookie not found - possible replay attack or expired session")
+ clearCookies()
+ return services.UserAuthTokenDetail{}, fmt.Errorf("nonce cookie not found")
+ }
+
+ // Verify PKCE verifier parameter
+ pkceCookie, err := r.Cookie("oidc_pkce_verifier")
+ if err != nil {
+ log.Warn().Err(err).Msg("OIDC PKCE verifier cookie not found - possible code interception attack or expired session")
+ clearCookies()
+ return services.UserAuthTokenDetail{}, fmt.Errorf("PKCE verifier cookie not found")
+ }
+
+ // Clear cookies before proceeding to token verification
+ clearCookies()
+
+ // Use the existing callback logic but return the token instead of redirecting
+ return p.AuthenticateWithBaseURL(baseURL, nonceCookie.Value, pkceCookie.Value, w, r)
+}
+
+// Helper functions
+func generateSecureToken() (string, error) {
+ // Generate 32 bytes of cryptographically secure random data
+ bytes := make([]byte, 32)
+ _, err := rand.Read(bytes)
+ if err != nil {
+ return "", fmt.Errorf("failed to generate secure random token: %w", err)
+ }
+ // Use URL-safe base64 encoding without padding for clean URLs
+ return base64.RawURLEncoding.EncodeToString(bytes), nil
+}
+
+// generatePKCEVerifier generates a cryptographically secure code verifier for PKCE
+func generatePKCEVerifier() (string, error) {
+ // PKCE verifier must be 43-128 characters, we'll use 43 for efficiency
+ // 32 bytes = 43 characters when base64url encoded without padding
+ bytes := make([]byte, 32)
+ _, err := rand.Read(bytes)
+ if err != nil {
+ return "", fmt.Errorf("failed to generate PKCE verifier: %w", err)
+ }
+ return base64.RawURLEncoding.EncodeToString(bytes), nil
+}
+
+// generatePKCEChallenge generates a code challenge from a verifier using S256 method
+func generatePKCEChallenge(verifier string) string {
+ hash := sha256.Sum256([]byte(verifier))
+ return base64.RawURLEncoding.EncodeToString(hash[:])
+}
+
+func noPort(host string) string {
+ return strings.Split(host, ":")[0]
+}
+
+func (p *OIDCProvider) getBaseURL(r *http.Request) string {
+ scheme := "http"
+ if r.TLS != nil {
+ scheme = "https"
+ } else if p.options.TrustProxy && r.Header.Get("X-Forwarded-Proto") == "https" {
+ scheme = "https"
+ }
+
+ host := r.Host
+ if p.options.Hostname != "" {
+ host = p.options.Hostname
+ } else if p.options.TrustProxy {
+ if xfHost := r.Header.Get("X-Forwarded-Host"); xfHost != "" {
+ host = xfHost
+ }
+ }
+
+ return scheme + "://" + host
+}
+
+func (p *OIDCProvider) isSecure(r *http.Request) bool {
+ _ = r
+ return p.cookieSecure
+}
+
+// InitiateOIDCFlow starts the OIDC authentication flow by redirecting to the provider
+func (p *OIDCProvider) InitiateOIDCFlow(w http.ResponseWriter, r *http.Request) (services.UserAuthTokenDetail, error) {
+ return p.initiateOIDCFlow(w, r)
+}
+
+// HandleCallback processes the OIDC callback and returns the authenticated user token
+func (p *OIDCProvider) HandleCallback(w http.ResponseWriter, r *http.Request) (services.UserAuthTokenDetail, error) {
+ return p.handleCallback(w, r)
+}
+
+func mergeOIDCClaims(primary, secondary map[string]interface{}) map[string]interface{} {
+ // primary has precedence; fill missing/empty values from secondary.
+ merged := make(map[string]interface{}, len(primary)+len(secondary))
+ for k, v := range primary {
+ merged[k] = v
+ }
+ for k, v := range secondary {
+ if existing, ok := merged[k]; !ok || isEmptyClaim(existing) {
+ merged[k] = v
+ }
+ }
+ return merged
+}
+
+func isEmptyClaim(v interface{}) bool {
+ if v == nil {
+ return true
+ }
+ switch val := v.(type) {
+ case string:
+ return val == ""
+ case []interface{}:
+ return len(val) == 0
+ case []string:
+ return len(val) == 0
+ default:
+ return false
+ }
+}
diff --git a/backend/app/api/routes.go b/backend/app/api/routes.go
index 5f6a5ca6..f3a796f6 100644
--- a/backend/app/api/routes.go
+++ b/backend/app/api/routes.go
@@ -75,6 +75,11 @@ func (a *app) mountRoutes(r *chi.Mux, chain *errchain.ErrChain, repos *repo.AllR
r.Post("/users/register", chain.ToHandlerFunc(v1Ctrl.HandleUserRegistration()))
r.Post("/users/login", chain.ToHandlerFunc(v1Ctrl.HandleAuthLogin(providers...)))
+ if a.conf.OIDC.Enabled {
+ r.Get("/users/login/oidc", chain.ToHandlerFunc(v1Ctrl.HandleOIDCLogin()))
+ r.Get("/users/login/oidc/callback", chain.ToHandlerFunc(v1Ctrl.HandleOIDCCallback()))
+ }
+
userMW := []errchain.Middleware{
a.mwAuthToken,
a.mwRoles(RoleModeOr, authroles.RoleUser.String()),
diff --git a/backend/go.mod b/backend/go.mod
index ec6b963a..ec1220c0 100644
--- a/backend/go.mod
+++ b/backend/go.mod
@@ -8,6 +8,7 @@ require (
entgo.io/ent v0.14.5
github.com/ardanlabs/conf/v3 v3.9.0
github.com/containrrr/shoutrrr v0.8.0
+ github.com/coreos/go-oidc/v3 v3.17.0
github.com/evanoberholster/imagemeta v0.3.1
github.com/gen2brain/avif v0.4.4
github.com/gen2brain/heic v0.4.5
@@ -41,6 +42,7 @@ require (
gocloud.dev/pubsub/rabbitpubsub v0.43.0
golang.org/x/crypto v0.45.0
golang.org/x/image v0.33.0
+ golang.org/x/oauth2 v0.33.0
golang.org/x/text v0.31.0
modernc.org/sqlite v1.40.0
)
@@ -110,7 +112,7 @@ require (
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fogleman/gg v1.3.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.11 // indirect
- github.com/go-jose/go-jose/v4 v4.1.2 // indirect
+ github.com/go-jose/go-jose/v4 v4.1.3 // indirect
github.com/go-logr/logr v1.4.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
@@ -191,7 +193,6 @@ require (
golang.org/x/exp v0.0.0-20251113190631-e25ba8c21ef6 // indirect
golang.org/x/mod v0.30.0 // indirect
golang.org/x/net v0.47.0 // indirect
- golang.org/x/oauth2 v0.33.0 // indirect
golang.org/x/sync v0.18.0 // indirect
golang.org/x/sys v0.38.0 // indirect
golang.org/x/time v0.14.0 // indirect
diff --git a/backend/go.sum b/backend/go.sum
index fb65fd5e..289633b4 100644
--- a/backend/go.sum
+++ b/backend/go.sum
@@ -133,6 +133,8 @@ github.com/coder/websocket v1.8.13 h1:f3QZdXy7uGVz+4uCJy2nTZyM0yTBj8yANEHhqlXZ9F
github.com/coder/websocket v1.8.13/go.mod h1:LNVeNrXQZfe5qhS9ALED3uA+l5pPqvwXg3CKoDBB2gs=
github.com/containrrr/shoutrrr v0.8.0 h1:mfG2ATzIS7NR2Ec6XL+xyoHzN97H8WPjir8aYzJUSec=
github.com/containrrr/shoutrrr v0.8.0/go.mod h1:ioyQAyu1LJY6sILuNyKaQaw+9Ttik5QePU8atnAdO2o=
+github.com/coreos/go-oidc/v3 v3.17.0 h1:hWBGaQfbi0iVviX4ibC7bk8OKT5qNr4klBaCHVNvehc=
+github.com/coreos/go-oidc/v3 v3.17.0/go.mod h1:wqPbKFrVnE90vty060SB40FCJ8fTHTxSwyXJqZH+sI8=
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -182,8 +184,8 @@ github.com/gen2brain/webp v0.5.5 h1:MvQR75yIPU/9nSqYT5h13k4URaJK3gf9tgz/ksRbyEg=
github.com/gen2brain/webp v0.5.5/go.mod h1:xOSMzp4aROt2KFW++9qcK/RBTOVC2S9tJG66ip/9Oc0=
github.com/go-chi/chi/v5 v5.2.3 h1:WQIt9uxdsAbgIYgid+BpYc+liqQZGMHRaUwp0JUcvdE=
github.com/go-chi/chi/v5 v5.2.3/go.mod h1:L2yAIGWB3H+phAw1NxKwWM+7eUH/lU8pOMm5hHcoops=
-github.com/go-jose/go-jose/v4 v4.1.2 h1:TK/7NqRQZfgAh+Td8AlsrvtPoUyiHh0LqVvokh+1vHI=
-github.com/go-jose/go-jose/v4 v4.1.2/go.mod h1:22cg9HWM1pOlnRiY+9cQYJ9XHmya1bYW8OeDM6Ku6Oo=
+github.com/go-jose/go-jose/v4 v4.1.3 h1:CVLmWDhDVRa6Mi/IgCgaopNosCaHz7zrMeF9MlZRkrs=
+github.com/go-jose/go-jose/v4 v4.1.3/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08=
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
@@ -327,6 +329,8 @@ github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
+github.com/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.32 h1:JD12Ag3oLy1zQA+BNn74xRgaBbdhbNIDYvQUEuuErjs=
github.com/mattn/go-sqlite3 v1.14.32/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
github.com/mfridman/interpolate v0.0.2 h1:pnuTK7MQIxxFz1Gr+rjSIx9u7qVjf5VOoM/u6BbAxPY=
@@ -349,6 +353,8 @@ github.com/ncruces/go-strftime v1.0.0 h1:HMFp8mLCTPp341M/ZnA4qaf7ZlsbTc+miZjCLOF
github.com/ncruces/go-strftime v1.0.0/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls=
github.com/olahol/melody v1.4.0 h1:Pa5SdeZL/zXPi1tJuMAPDbl4n3gQOThSL6G1p4qZ4SI=
github.com/olahol/melody v1.4.0/go.mod h1:GgkTl6Y7yWj/HtfD48Q5vLKPVoZOH+Qqgfa7CvJgJM4=
+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/onsi/ginkgo/v2 v2.9.2 h1:BA2GMJOtfGAfagzYtrAlufIP0lq6QERkFmHLMLPwFSU=
github.com/onsi/ginkgo/v2 v2.9.2/go.mod h1:WHcJJG2dIlcCqVfBAwUCrJxSPFb6v4azBwgxeMeDuts=
github.com/onsi/gomega v1.27.6 h1:ENqfyGeS5AX/rlXDd/ETokDz93u0YufY1Pgxuy/PvWE=
@@ -391,6 +397,10 @@ github.com/shirou/gopsutil/v4 v4.25.10 h1:at8lk/5T1OgtuCp+AwrDofFRjnvosn0nkN2OLQ
github.com/shirou/gopsutil/v4 v4.25.10/go.mod h1:+kSwyC8DRUD9XXEHCAFjK+0nuArFJM0lva+StQAcskM=
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e h1:MRM5ITcdelLK2j1vwZ3Je0FKVCfqOLp5zO6trqMLYs0=
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e/go.mod h1:XV66xRDqSt+GTGFMVlhk3ULuV0y9ZmzeVGR4mloJI3M=
+github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I=
+github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0=
+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/spiffe/go-spiffe/v2 v2.5.0 h1:N2I01KCUkv1FAjZXJMwh95KK1ZIQLYbPfhaxw8WS0hE=
github.com/spiffe/go-spiffe/v2 v2.5.0/go.mod h1:P+NxobPc6wXhVtINNtFjNWGBTreew1GBUCwT2wPmb7g=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
diff --git a/backend/internal/core/services/main_test.go b/backend/internal/core/services/main_test.go
index b792ab37..43d5921a 100644
--- a/backend/internal/core/services/main_test.go
+++ b/backend/internal/core/services/main_test.go
@@ -38,10 +38,11 @@ func bootstrap() {
log.Fatal(err)
}
+ password := fk.Str(10)
tUser, err = tRepos.Users.Create(ctx, repo.UserCreate{
Name: fk.Str(10),
Email: fk.Email(),
- Password: fk.Str(10),
+ Password: &password,
IsSuperuser: fk.Bool(),
GroupID: tGroup.ID,
})
diff --git a/backend/internal/core/services/service_user.go b/backend/internal/core/services/service_user.go
index b3397527..8b13a653 100644
--- a/backend/internal/core/services/service_user.go
+++ b/backend/internal/core/services/service_user.go
@@ -3,20 +3,21 @@ package services
import (
"context"
"errors"
+ "strings"
"time"
"github.com/google/uuid"
"github.com/rs/zerolog/log"
+ "github.com/sysadminsmedia/homebox/backend/internal/data/ent"
"github.com/sysadminsmedia/homebox/backend/internal/data/ent/authroles"
"github.com/sysadminsmedia/homebox/backend/internal/data/repo"
"github.com/sysadminsmedia/homebox/backend/pkgs/hasher"
)
var (
- oneWeek = time.Hour * 24 * 7
- ErrorInvalidLogin = errors.New("invalid username or password")
- ErrorInvalidToken = errors.New("invalid token")
- ErrorTokenIDMismatch = errors.New("token id mismatch")
+ oneWeek = time.Hour * 24 * 7
+ ErrorInvalidLogin = errors.New("invalid username or password")
+ ErrorInvalidToken = errors.New("invalid token")
)
type UserService struct {
@@ -82,7 +83,7 @@ func (svc *UserService) RegisterUser(ctx context.Context, data UserRegistration)
usrCreate := repo.UserCreate{
Name: data.Name,
Email: data.Email,
- Password: hashed,
+ Password: &hashed,
IsSuperuser: false,
GroupID: group.ID,
IsOwner: creatingGroup,
@@ -190,6 +191,14 @@ func (svc *UserService) Login(ctx context.Context, username, password string, ex
return UserAuthTokenDetail{}, ErrorInvalidLogin
}
+ // SECURITY: Deny login for users with null or empty password (OIDC users)
+ if usr.PasswordHash == "" {
+ log.Warn().Str("email", username).Msg("Login attempt blocked for user with null password (likely OIDC user)")
+ // SECURITY: Perform hash to ensure response times are the same
+ hasher.CheckPasswordHash("not-a-real-password", "not-a-real-password")
+ return UserAuthTokenDetail{}, ErrorInvalidLogin
+ }
+
check, rehash := hasher.CheckPasswordHash(password, usr.PasswordHash)
if !check {
@@ -210,6 +219,106 @@ func (svc *UserService) Login(ctx context.Context, username, password string, ex
return svc.createSessionToken(ctx, usr.ID, extendedSession)
}
+// LoginOIDC creates a session token for a user authenticated via OIDC.
+// It now uses issuer + subject for identity association (OIDC spec compliance).
+// If the user doesn't exist, it will create one.
+func (svc *UserService) LoginOIDC(ctx context.Context, issuer, subject, email, name string) (UserAuthTokenDetail, error) {
+ issuer = strings.TrimSpace(issuer)
+ subject = strings.TrimSpace(subject)
+ email = strings.ToLower(strings.TrimSpace(email))
+ name = strings.TrimSpace(name)
+
+ if issuer == "" || subject == "" {
+ log.Warn().Str("issuer", issuer).Str("subject", subject).Msg("OIDC login missing issuer or subject")
+ return UserAuthTokenDetail{}, ErrorInvalidLogin
+ }
+
+ // Try to get existing user by OIDC identity
+ usr, err := svc.repos.Users.GetOneOIDC(ctx, issuer, subject)
+ if err != nil {
+ if !ent.IsNotFound(err) {
+ log.Err(err).Str("issuer", issuer).Str("subject", subject).Msg("failed to lookup user by OIDC identity")
+ return UserAuthTokenDetail{}, err
+ }
+ // Not found: attempt migration path by email (legacy) if email provided
+ if email != "" {
+ legacyUsr, lerr := svc.repos.Users.GetOneEmail(ctx, email)
+ if lerr == nil {
+ log.Info().Str("email", email).Str("issuer", issuer).Str("subject", subject).Msg("migrating legacy email-based OIDC user to issuer+subject")
+ // Update user with OIDC identity fields
+ if uerr := svc.repos.Users.SetOIDCIdentity(ctx, legacyUsr.ID, issuer, subject); uerr == nil {
+ usr = legacyUsr
+ } else {
+ log.Err(uerr).Str("email", email).Msg("failed to set OIDC identity on legacy user")
+ }
+ }
+ }
+ }
+
+ // Create user if still not resolved
+ if usr.ID == uuid.Nil {
+ log.Debug().Str("issuer", issuer).Str("subject", subject).Msg("OIDC user not found, creating new user")
+ usr, err = svc.registerOIDCUser(ctx, issuer, subject, email, name)
+ if err != nil {
+ if ent.IsConstraintError(err) {
+ if usr2, gerr := svc.repos.Users.GetOneOIDC(ctx, issuer, subject); gerr == nil {
+ log.Info().Str("issuer", issuer).Str("subject", subject).Msg("OIDC user created concurrently; proceeding")
+ usr = usr2
+ } else {
+ log.Err(gerr).Str("issuer", issuer).Str("subject", subject).Msg("failed to fetch user after constraint error")
+ return UserAuthTokenDetail{}, gerr
+ }
+ } else {
+ log.Err(err).Str("issuer", issuer).Str("subject", subject).Msg("failed to create OIDC user")
+ return UserAuthTokenDetail{}, err
+ }
+ }
+ }
+
+ return svc.createSessionToken(ctx, usr.ID, true)
+}
+
+// registerOIDCUser creates a new user for OIDC authentication with issuer+subject identity.
+func (svc *UserService) registerOIDCUser(ctx context.Context, issuer, subject, email, name string) (repo.UserOut, error) {
+ group, err := svc.repos.Groups.GroupCreate(ctx, "Home")
+ if err != nil {
+ log.Err(err).Msg("Failed to create group for OIDC user")
+ return repo.UserOut{}, err
+ }
+
+ usrCreate := repo.UserCreate{
+ Name: name,
+ Email: email,
+ Password: nil,
+ IsSuperuser: false,
+ GroupID: group.ID,
+ IsOwner: true,
+ }
+
+ entUser, err := svc.repos.Users.CreateWithOIDC(ctx, usrCreate, issuer, subject)
+ if err != nil {
+ return repo.UserOut{}, err
+ }
+
+ log.Debug().Str("issuer", issuer).Str("subject", subject).Msg("creating default labels for OIDC user")
+ for _, label := range defaultLabels() {
+ _, err := svc.repos.Labels.Create(ctx, group.ID, label)
+ if err != nil {
+ log.Err(err).Msg("Failed to create default label")
+ }
+ }
+
+ log.Debug().Str("issuer", issuer).Str("subject", subject).Msg("creating default locations for OIDC user")
+ for _, location := range defaultLocations() {
+ _, err := svc.repos.Locations.Create(ctx, group.ID, location)
+ if err != nil {
+ log.Err(err).Msg("Failed to create default location")
+ }
+ }
+
+ return entUser, nil
+}
+
func (svc *UserService) Logout(ctx context.Context, token string) error {
hash := hasher.HashToken(token)
err := svc.repos.AuthTokens.DeleteToken(ctx, hash)
diff --git a/backend/internal/data/ent/attachment.go b/backend/internal/data/ent/attachment.go
index d947086f..c7fbdf3b 100644
--- a/backend/internal/data/ent/attachment.go
+++ b/backend/internal/data/ent/attachment.go
@@ -100,7 +100,7 @@ func (*Attachment) scanValues(columns []string) ([]any, error) {
// assignValues assigns the values that were returned from sql.Rows (after scanning)
// to the Attachment fields.
-func (a *Attachment) assignValues(columns []string, values []any) error {
+func (_m *Attachment) assignValues(columns []string, values []any) error {
if m, n := len(values), len(columns); m < n {
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
}
@@ -110,66 +110,66 @@ func (a *Attachment) assignValues(columns []string, values []any) error {
if value, ok := values[i].(*uuid.UUID); !ok {
return fmt.Errorf("unexpected type %T for field id", values[i])
} else if value != nil {
- a.ID = *value
+ _m.ID = *value
}
case attachment.FieldCreatedAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field created_at", values[i])
} else if value.Valid {
- a.CreatedAt = value.Time
+ _m.CreatedAt = value.Time
}
case attachment.FieldUpdatedAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field updated_at", values[i])
} else if value.Valid {
- a.UpdatedAt = value.Time
+ _m.UpdatedAt = value.Time
}
case attachment.FieldType:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field type", values[i])
} else if value.Valid {
- a.Type = attachment.Type(value.String)
+ _m.Type = attachment.Type(value.String)
}
case attachment.FieldPrimary:
if value, ok := values[i].(*sql.NullBool); !ok {
return fmt.Errorf("unexpected type %T for field primary", values[i])
} else if value.Valid {
- a.Primary = value.Bool
+ _m.Primary = value.Bool
}
case attachment.FieldTitle:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field title", values[i])
} else if value.Valid {
- a.Title = value.String
+ _m.Title = value.String
}
case attachment.FieldPath:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field path", values[i])
} else if value.Valid {
- a.Path = value.String
+ _m.Path = value.String
}
case attachment.FieldMimeType:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field mime_type", values[i])
} else if value.Valid {
- a.MimeType = value.String
+ _m.MimeType = value.String
}
case attachment.ForeignKeys[0]:
if value, ok := values[i].(*sql.NullScanner); !ok {
return fmt.Errorf("unexpected type %T for field attachment_thumbnail", values[i])
} else if value.Valid {
- a.attachment_thumbnail = new(uuid.UUID)
- *a.attachment_thumbnail = *value.S.(*uuid.UUID)
+ _m.attachment_thumbnail = new(uuid.UUID)
+ *_m.attachment_thumbnail = *value.S.(*uuid.UUID)
}
case attachment.ForeignKeys[1]:
if value, ok := values[i].(*sql.NullScanner); !ok {
return fmt.Errorf("unexpected type %T for field item_attachments", values[i])
} else if value.Valid {
- a.item_attachments = new(uuid.UUID)
- *a.item_attachments = *value.S.(*uuid.UUID)
+ _m.item_attachments = new(uuid.UUID)
+ *_m.item_attachments = *value.S.(*uuid.UUID)
}
default:
- a.selectValues.Set(columns[i], values[i])
+ _m.selectValues.Set(columns[i], values[i])
}
}
return nil
@@ -177,63 +177,63 @@ func (a *Attachment) assignValues(columns []string, values []any) error {
// Value returns the ent.Value that was dynamically selected and assigned to the Attachment.
// This includes values selected through modifiers, order, etc.
-func (a *Attachment) Value(name string) (ent.Value, error) {
- return a.selectValues.Get(name)
+func (_m *Attachment) Value(name string) (ent.Value, error) {
+ return _m.selectValues.Get(name)
}
// QueryItem queries the "item" edge of the Attachment entity.
-func (a *Attachment) QueryItem() *ItemQuery {
- return NewAttachmentClient(a.config).QueryItem(a)
+func (_m *Attachment) QueryItem() *ItemQuery {
+ return NewAttachmentClient(_m.config).QueryItem(_m)
}
// QueryThumbnail queries the "thumbnail" edge of the Attachment entity.
-func (a *Attachment) QueryThumbnail() *AttachmentQuery {
- return NewAttachmentClient(a.config).QueryThumbnail(a)
+func (_m *Attachment) QueryThumbnail() *AttachmentQuery {
+ return NewAttachmentClient(_m.config).QueryThumbnail(_m)
}
// Update returns a builder for updating this Attachment.
// Note that you need to call Attachment.Unwrap() before calling this method if this Attachment
// was returned from a transaction, and the transaction was committed or rolled back.
-func (a *Attachment) Update() *AttachmentUpdateOne {
- return NewAttachmentClient(a.config).UpdateOne(a)
+func (_m *Attachment) Update() *AttachmentUpdateOne {
+ return NewAttachmentClient(_m.config).UpdateOne(_m)
}
// Unwrap unwraps the Attachment 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 (a *Attachment) Unwrap() *Attachment {
- _tx, ok := a.config.driver.(*txDriver)
+func (_m *Attachment) Unwrap() *Attachment {
+ _tx, ok := _m.config.driver.(*txDriver)
if !ok {
panic("ent: Attachment is not a transactional entity")
}
- a.config.driver = _tx.drv
- return a
+ _m.config.driver = _tx.drv
+ return _m
}
// String implements the fmt.Stringer.
-func (a *Attachment) String() string {
+func (_m *Attachment) String() string {
var builder strings.Builder
builder.WriteString("Attachment(")
- builder.WriteString(fmt.Sprintf("id=%v, ", a.ID))
+ builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
builder.WriteString("created_at=")
- builder.WriteString(a.CreatedAt.Format(time.ANSIC))
+ builder.WriteString(_m.CreatedAt.Format(time.ANSIC))
builder.WriteString(", ")
builder.WriteString("updated_at=")
- builder.WriteString(a.UpdatedAt.Format(time.ANSIC))
+ builder.WriteString(_m.UpdatedAt.Format(time.ANSIC))
builder.WriteString(", ")
builder.WriteString("type=")
- builder.WriteString(fmt.Sprintf("%v", a.Type))
+ builder.WriteString(fmt.Sprintf("%v", _m.Type))
builder.WriteString(", ")
builder.WriteString("primary=")
- builder.WriteString(fmt.Sprintf("%v", a.Primary))
+ builder.WriteString(fmt.Sprintf("%v", _m.Primary))
builder.WriteString(", ")
builder.WriteString("title=")
- builder.WriteString(a.Title)
+ builder.WriteString(_m.Title)
builder.WriteString(", ")
builder.WriteString("path=")
- builder.WriteString(a.Path)
+ builder.WriteString(_m.Path)
builder.WriteString(", ")
builder.WriteString("mime_type=")
- builder.WriteString(a.MimeType)
+ builder.WriteString(_m.MimeType)
builder.WriteByte(')')
return builder.String()
}
diff --git a/backend/internal/data/ent/attachment_create.go b/backend/internal/data/ent/attachment_create.go
index 019c8363..d46a71f9 100644
--- a/backend/internal/data/ent/attachment_create.go
+++ b/backend/internal/data/ent/attachment_create.go
@@ -23,169 +23,169 @@ type AttachmentCreate struct {
}
// SetCreatedAt sets the "created_at" field.
-func (ac *AttachmentCreate) SetCreatedAt(t time.Time) *AttachmentCreate {
- ac.mutation.SetCreatedAt(t)
- return ac
+func (_c *AttachmentCreate) SetCreatedAt(v time.Time) *AttachmentCreate {
+ _c.mutation.SetCreatedAt(v)
+ return _c
}
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
-func (ac *AttachmentCreate) SetNillableCreatedAt(t *time.Time) *AttachmentCreate {
- if t != nil {
- ac.SetCreatedAt(*t)
+func (_c *AttachmentCreate) SetNillableCreatedAt(v *time.Time) *AttachmentCreate {
+ if v != nil {
+ _c.SetCreatedAt(*v)
}
- return ac
+ return _c
}
// SetUpdatedAt sets the "updated_at" field.
-func (ac *AttachmentCreate) SetUpdatedAt(t time.Time) *AttachmentCreate {
- ac.mutation.SetUpdatedAt(t)
- return ac
+func (_c *AttachmentCreate) SetUpdatedAt(v time.Time) *AttachmentCreate {
+ _c.mutation.SetUpdatedAt(v)
+ return _c
}
// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
-func (ac *AttachmentCreate) SetNillableUpdatedAt(t *time.Time) *AttachmentCreate {
- if t != nil {
- ac.SetUpdatedAt(*t)
+func (_c *AttachmentCreate) SetNillableUpdatedAt(v *time.Time) *AttachmentCreate {
+ if v != nil {
+ _c.SetUpdatedAt(*v)
}
- return ac
+ return _c
}
// SetType sets the "type" field.
-func (ac *AttachmentCreate) SetType(a attachment.Type) *AttachmentCreate {
- ac.mutation.SetType(a)
- return ac
+func (_c *AttachmentCreate) SetType(v attachment.Type) *AttachmentCreate {
+ _c.mutation.SetType(v)
+ return _c
}
// SetNillableType sets the "type" field if the given value is not nil.
-func (ac *AttachmentCreate) SetNillableType(a *attachment.Type) *AttachmentCreate {
- if a != nil {
- ac.SetType(*a)
+func (_c *AttachmentCreate) SetNillableType(v *attachment.Type) *AttachmentCreate {
+ if v != nil {
+ _c.SetType(*v)
}
- return ac
+ return _c
}
// SetPrimary sets the "primary" field.
-func (ac *AttachmentCreate) SetPrimary(b bool) *AttachmentCreate {
- ac.mutation.SetPrimary(b)
- return ac
+func (_c *AttachmentCreate) SetPrimary(v bool) *AttachmentCreate {
+ _c.mutation.SetPrimary(v)
+ return _c
}
// SetNillablePrimary sets the "primary" field if the given value is not nil.
-func (ac *AttachmentCreate) SetNillablePrimary(b *bool) *AttachmentCreate {
- if b != nil {
- ac.SetPrimary(*b)
+func (_c *AttachmentCreate) SetNillablePrimary(v *bool) *AttachmentCreate {
+ if v != nil {
+ _c.SetPrimary(*v)
}
- return ac
+ return _c
}
// SetTitle sets the "title" field.
-func (ac *AttachmentCreate) SetTitle(s string) *AttachmentCreate {
- ac.mutation.SetTitle(s)
- return ac
+func (_c *AttachmentCreate) SetTitle(v string) *AttachmentCreate {
+ _c.mutation.SetTitle(v)
+ return _c
}
// SetNillableTitle sets the "title" field if the given value is not nil.
-func (ac *AttachmentCreate) SetNillableTitle(s *string) *AttachmentCreate {
- if s != nil {
- ac.SetTitle(*s)
+func (_c *AttachmentCreate) SetNillableTitle(v *string) *AttachmentCreate {
+ if v != nil {
+ _c.SetTitle(*v)
}
- return ac
+ return _c
}
// SetPath sets the "path" field.
-func (ac *AttachmentCreate) SetPath(s string) *AttachmentCreate {
- ac.mutation.SetPath(s)
- return ac
+func (_c *AttachmentCreate) SetPath(v string) *AttachmentCreate {
+ _c.mutation.SetPath(v)
+ return _c
}
// SetNillablePath sets the "path" field if the given value is not nil.
-func (ac *AttachmentCreate) SetNillablePath(s *string) *AttachmentCreate {
- if s != nil {
- ac.SetPath(*s)
+func (_c *AttachmentCreate) SetNillablePath(v *string) *AttachmentCreate {
+ if v != nil {
+ _c.SetPath(*v)
}
- return ac
+ return _c
}
// SetMimeType sets the "mime_type" field.
-func (ac *AttachmentCreate) SetMimeType(s string) *AttachmentCreate {
- ac.mutation.SetMimeType(s)
- return ac
+func (_c *AttachmentCreate) SetMimeType(v string) *AttachmentCreate {
+ _c.mutation.SetMimeType(v)
+ return _c
}
// SetNillableMimeType sets the "mime_type" field if the given value is not nil.
-func (ac *AttachmentCreate) SetNillableMimeType(s *string) *AttachmentCreate {
- if s != nil {
- ac.SetMimeType(*s)
+func (_c *AttachmentCreate) SetNillableMimeType(v *string) *AttachmentCreate {
+ if v != nil {
+ _c.SetMimeType(*v)
}
- return ac
+ return _c
}
// SetID sets the "id" field.
-func (ac *AttachmentCreate) SetID(u uuid.UUID) *AttachmentCreate {
- ac.mutation.SetID(u)
- return ac
+func (_c *AttachmentCreate) SetID(v uuid.UUID) *AttachmentCreate {
+ _c.mutation.SetID(v)
+ return _c
}
// SetNillableID sets the "id" field if the given value is not nil.
-func (ac *AttachmentCreate) SetNillableID(u *uuid.UUID) *AttachmentCreate {
- if u != nil {
- ac.SetID(*u)
+func (_c *AttachmentCreate) SetNillableID(v *uuid.UUID) *AttachmentCreate {
+ if v != nil {
+ _c.SetID(*v)
}
- return ac
+ return _c
}
// SetItemID sets the "item" edge to the Item entity by ID.
-func (ac *AttachmentCreate) SetItemID(id uuid.UUID) *AttachmentCreate {
- ac.mutation.SetItemID(id)
- return ac
+func (_c *AttachmentCreate) SetItemID(id uuid.UUID) *AttachmentCreate {
+ _c.mutation.SetItemID(id)
+ return _c
}
// SetNillableItemID sets the "item" edge to the Item entity by ID if the given value is not nil.
-func (ac *AttachmentCreate) SetNillableItemID(id *uuid.UUID) *AttachmentCreate {
+func (_c *AttachmentCreate) SetNillableItemID(id *uuid.UUID) *AttachmentCreate {
if id != nil {
- ac = ac.SetItemID(*id)
+ _c = _c.SetItemID(*id)
}
- return ac
+ return _c
}
// SetItem sets the "item" edge to the Item entity.
-func (ac *AttachmentCreate) SetItem(i *Item) *AttachmentCreate {
- return ac.SetItemID(i.ID)
+func (_c *AttachmentCreate) SetItem(v *Item) *AttachmentCreate {
+ return _c.SetItemID(v.ID)
}
// SetThumbnailID sets the "thumbnail" edge to the Attachment entity by ID.
-func (ac *AttachmentCreate) SetThumbnailID(id uuid.UUID) *AttachmentCreate {
- ac.mutation.SetThumbnailID(id)
- return ac
+func (_c *AttachmentCreate) SetThumbnailID(id uuid.UUID) *AttachmentCreate {
+ _c.mutation.SetThumbnailID(id)
+ return _c
}
// SetNillableThumbnailID sets the "thumbnail" edge to the Attachment entity by ID if the given value is not nil.
-func (ac *AttachmentCreate) SetNillableThumbnailID(id *uuid.UUID) *AttachmentCreate {
+func (_c *AttachmentCreate) SetNillableThumbnailID(id *uuid.UUID) *AttachmentCreate {
if id != nil {
- ac = ac.SetThumbnailID(*id)
+ _c = _c.SetThumbnailID(*id)
}
- return ac
+ return _c
}
// SetThumbnail sets the "thumbnail" edge to the Attachment entity.
-func (ac *AttachmentCreate) SetThumbnail(a *Attachment) *AttachmentCreate {
- return ac.SetThumbnailID(a.ID)
+func (_c *AttachmentCreate) SetThumbnail(v *Attachment) *AttachmentCreate {
+ return _c.SetThumbnailID(v.ID)
}
// Mutation returns the AttachmentMutation object of the builder.
-func (ac *AttachmentCreate) Mutation() *AttachmentMutation {
- return ac.mutation
+func (_c *AttachmentCreate) Mutation() *AttachmentMutation {
+ return _c.mutation
}
// Save creates the Attachment in the database.
-func (ac *AttachmentCreate) Save(ctx context.Context) (*Attachment, error) {
- ac.defaults()
- return withHooks(ctx, ac.sqlSave, ac.mutation, ac.hooks)
+func (_c *AttachmentCreate) Save(ctx context.Context) (*Attachment, error) {
+ _c.defaults()
+ return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
}
// SaveX calls Save and panics if Save returns an error.
-func (ac *AttachmentCreate) SaveX(ctx context.Context) *Attachment {
- v, err := ac.Save(ctx)
+func (_c *AttachmentCreate) SaveX(ctx context.Context) *Attachment {
+ v, err := _c.Save(ctx)
if err != nil {
panic(err)
}
@@ -193,91 +193,91 @@ func (ac *AttachmentCreate) SaveX(ctx context.Context) *Attachment {
}
// Exec executes the query.
-func (ac *AttachmentCreate) Exec(ctx context.Context) error {
- _, err := ac.Save(ctx)
+func (_c *AttachmentCreate) Exec(ctx context.Context) error {
+ _, err := _c.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
-func (ac *AttachmentCreate) ExecX(ctx context.Context) {
- if err := ac.Exec(ctx); err != nil {
+func (_c *AttachmentCreate) ExecX(ctx context.Context) {
+ if err := _c.Exec(ctx); err != nil {
panic(err)
}
}
// defaults sets the default values of the builder before save.
-func (ac *AttachmentCreate) defaults() {
- if _, ok := ac.mutation.CreatedAt(); !ok {
+func (_c *AttachmentCreate) defaults() {
+ if _, ok := _c.mutation.CreatedAt(); !ok {
v := attachment.DefaultCreatedAt()
- ac.mutation.SetCreatedAt(v)
+ _c.mutation.SetCreatedAt(v)
}
- if _, ok := ac.mutation.UpdatedAt(); !ok {
+ if _, ok := _c.mutation.UpdatedAt(); !ok {
v := attachment.DefaultUpdatedAt()
- ac.mutation.SetUpdatedAt(v)
+ _c.mutation.SetUpdatedAt(v)
}
- if _, ok := ac.mutation.GetType(); !ok {
+ if _, ok := _c.mutation.GetType(); !ok {
v := attachment.DefaultType
- ac.mutation.SetType(v)
+ _c.mutation.SetType(v)
}
- if _, ok := ac.mutation.Primary(); !ok {
+ if _, ok := _c.mutation.Primary(); !ok {
v := attachment.DefaultPrimary
- ac.mutation.SetPrimary(v)
+ _c.mutation.SetPrimary(v)
}
- if _, ok := ac.mutation.Title(); !ok {
+ if _, ok := _c.mutation.Title(); !ok {
v := attachment.DefaultTitle
- ac.mutation.SetTitle(v)
+ _c.mutation.SetTitle(v)
}
- if _, ok := ac.mutation.Path(); !ok {
+ if _, ok := _c.mutation.Path(); !ok {
v := attachment.DefaultPath
- ac.mutation.SetPath(v)
+ _c.mutation.SetPath(v)
}
- if _, ok := ac.mutation.MimeType(); !ok {
+ if _, ok := _c.mutation.MimeType(); !ok {
v := attachment.DefaultMimeType
- ac.mutation.SetMimeType(v)
+ _c.mutation.SetMimeType(v)
}
- if _, ok := ac.mutation.ID(); !ok {
+ if _, ok := _c.mutation.ID(); !ok {
v := attachment.DefaultID()
- ac.mutation.SetID(v)
+ _c.mutation.SetID(v)
}
}
// check runs all checks and user-defined validators on the builder.
-func (ac *AttachmentCreate) check() error {
- if _, ok := ac.mutation.CreatedAt(); !ok {
+func (_c *AttachmentCreate) check() error {
+ if _, ok := _c.mutation.CreatedAt(); !ok {
return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "Attachment.created_at"`)}
}
- if _, ok := ac.mutation.UpdatedAt(); !ok {
+ if _, ok := _c.mutation.UpdatedAt(); !ok {
return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "Attachment.updated_at"`)}
}
- if _, ok := ac.mutation.GetType(); !ok {
+ if _, ok := _c.mutation.GetType(); !ok {
return &ValidationError{Name: "type", err: errors.New(`ent: missing required field "Attachment.type"`)}
}
- if v, ok := ac.mutation.GetType(); ok {
+ if v, ok := _c.mutation.GetType(); ok {
if err := attachment.TypeValidator(v); err != nil {
return &ValidationError{Name: "type", err: fmt.Errorf(`ent: validator failed for field "Attachment.type": %w`, err)}
}
}
- if _, ok := ac.mutation.Primary(); !ok {
+ if _, ok := _c.mutation.Primary(); !ok {
return &ValidationError{Name: "primary", err: errors.New(`ent: missing required field "Attachment.primary"`)}
}
- if _, ok := ac.mutation.Title(); !ok {
+ if _, ok := _c.mutation.Title(); !ok {
return &ValidationError{Name: "title", err: errors.New(`ent: missing required field "Attachment.title"`)}
}
- if _, ok := ac.mutation.Path(); !ok {
+ if _, ok := _c.mutation.Path(); !ok {
return &ValidationError{Name: "path", err: errors.New(`ent: missing required field "Attachment.path"`)}
}
- if _, ok := ac.mutation.MimeType(); !ok {
+ if _, ok := _c.mutation.MimeType(); !ok {
return &ValidationError{Name: "mime_type", err: errors.New(`ent: missing required field "Attachment.mime_type"`)}
}
return nil
}
-func (ac *AttachmentCreate) sqlSave(ctx context.Context) (*Attachment, error) {
- if err := ac.check(); err != nil {
+func (_c *AttachmentCreate) sqlSave(ctx context.Context) (*Attachment, error) {
+ if err := _c.check(); err != nil {
return nil, err
}
- _node, _spec := ac.createSpec()
- if err := sqlgraph.CreateNode(ctx, ac.driver, _spec); err != nil {
+ _node, _spec := _c.createSpec()
+ if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil {
if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
@@ -290,49 +290,49 @@ func (ac *AttachmentCreate) sqlSave(ctx context.Context) (*Attachment, error) {
return nil, err
}
}
- ac.mutation.id = &_node.ID
- ac.mutation.done = true
+ _c.mutation.id = &_node.ID
+ _c.mutation.done = true
return _node, nil
}
-func (ac *AttachmentCreate) createSpec() (*Attachment, *sqlgraph.CreateSpec) {
+func (_c *AttachmentCreate) createSpec() (*Attachment, *sqlgraph.CreateSpec) {
var (
- _node = &Attachment{config: ac.config}
+ _node = &Attachment{config: _c.config}
_spec = sqlgraph.NewCreateSpec(attachment.Table, sqlgraph.NewFieldSpec(attachment.FieldID, field.TypeUUID))
)
- if id, ok := ac.mutation.ID(); ok {
+ if id, ok := _c.mutation.ID(); ok {
_node.ID = id
_spec.ID.Value = &id
}
- if value, ok := ac.mutation.CreatedAt(); ok {
+ if value, ok := _c.mutation.CreatedAt(); ok {
_spec.SetField(attachment.FieldCreatedAt, field.TypeTime, value)
_node.CreatedAt = value
}
- if value, ok := ac.mutation.UpdatedAt(); ok {
+ if value, ok := _c.mutation.UpdatedAt(); ok {
_spec.SetField(attachment.FieldUpdatedAt, field.TypeTime, value)
_node.UpdatedAt = value
}
- if value, ok := ac.mutation.GetType(); ok {
+ if value, ok := _c.mutation.GetType(); ok {
_spec.SetField(attachment.FieldType, field.TypeEnum, value)
_node.Type = value
}
- if value, ok := ac.mutation.Primary(); ok {
+ if value, ok := _c.mutation.Primary(); ok {
_spec.SetField(attachment.FieldPrimary, field.TypeBool, value)
_node.Primary = value
}
- if value, ok := ac.mutation.Title(); ok {
+ if value, ok := _c.mutation.Title(); ok {
_spec.SetField(attachment.FieldTitle, field.TypeString, value)
_node.Title = value
}
- if value, ok := ac.mutation.Path(); ok {
+ if value, ok := _c.mutation.Path(); ok {
_spec.SetField(attachment.FieldPath, field.TypeString, value)
_node.Path = value
}
- if value, ok := ac.mutation.MimeType(); ok {
+ if value, ok := _c.mutation.MimeType(); ok {
_spec.SetField(attachment.FieldMimeType, field.TypeString, value)
_node.MimeType = value
}
- if nodes := ac.mutation.ItemIDs(); len(nodes) > 0 {
+ if nodes := _c.mutation.ItemIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -349,7 +349,7 @@ func (ac *AttachmentCreate) createSpec() (*Attachment, *sqlgraph.CreateSpec) {
_node.item_attachments = &nodes[0]
_spec.Edges = append(_spec.Edges, edge)
}
- if nodes := ac.mutation.ThumbnailIDs(); len(nodes) > 0 {
+ if nodes := _c.mutation.ThumbnailIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2O,
Inverse: false,
@@ -377,16 +377,16 @@ type AttachmentCreateBulk struct {
}
// Save creates the Attachment entities in the database.
-func (acb *AttachmentCreateBulk) Save(ctx context.Context) ([]*Attachment, error) {
- if acb.err != nil {
- return nil, acb.err
- }
- specs := make([]*sqlgraph.CreateSpec, len(acb.builders))
- nodes := make([]*Attachment, len(acb.builders))
- mutators := make([]Mutator, len(acb.builders))
- for i := range acb.builders {
+func (_c *AttachmentCreateBulk) Save(ctx context.Context) ([]*Attachment, error) {
+ if _c.err != nil {
+ return nil, _c.err
+ }
+ specs := make([]*sqlgraph.CreateSpec, len(_c.builders))
+ nodes := make([]*Attachment, len(_c.builders))
+ mutators := make([]Mutator, len(_c.builders))
+ for i := range _c.builders {
func(i int, root context.Context) {
- builder := acb.builders[i]
+ builder := _c.builders[i]
builder.defaults()
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
mutation, ok := m.(*AttachmentMutation)
@@ -400,11 +400,11 @@ func (acb *AttachmentCreateBulk) Save(ctx context.Context) ([]*Attachment, error
var err error
nodes[i], specs[i] = builder.createSpec()
if i < len(mutators)-1 {
- _, err = mutators[i+1].Mutate(root, acb.builders[i+1].mutation)
+ _, err = mutators[i+1].Mutate(root, _c.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, acb.driver, spec); err != nil {
+ if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil {
if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
@@ -424,7 +424,7 @@ func (acb *AttachmentCreateBulk) Save(ctx context.Context) ([]*Attachment, error
}(i, ctx)
}
if len(mutators) > 0 {
- if _, err := mutators[0].Mutate(ctx, acb.builders[0].mutation); err != nil {
+ if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil {
return nil, err
}
}
@@ -432,8 +432,8 @@ func (acb *AttachmentCreateBulk) Save(ctx context.Context) ([]*Attachment, error
}
// SaveX is like Save, but panics if an error occurs.
-func (acb *AttachmentCreateBulk) SaveX(ctx context.Context) []*Attachment {
- v, err := acb.Save(ctx)
+func (_c *AttachmentCreateBulk) SaveX(ctx context.Context) []*Attachment {
+ v, err := _c.Save(ctx)
if err != nil {
panic(err)
}
@@ -441,14 +441,14 @@ func (acb *AttachmentCreateBulk) SaveX(ctx context.Context) []*Attachment {
}
// Exec executes the query.
-func (acb *AttachmentCreateBulk) Exec(ctx context.Context) error {
- _, err := acb.Save(ctx)
+func (_c *AttachmentCreateBulk) Exec(ctx context.Context) error {
+ _, err := _c.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
-func (acb *AttachmentCreateBulk) ExecX(ctx context.Context) {
- if err := acb.Exec(ctx); err != nil {
+func (_c *AttachmentCreateBulk) ExecX(ctx context.Context) {
+ if err := _c.Exec(ctx); err != nil {
panic(err)
}
}
diff --git a/backend/internal/data/ent/attachment_delete.go b/backend/internal/data/ent/attachment_delete.go
index 63a9356a..bc7a6a92 100644
--- a/backend/internal/data/ent/attachment_delete.go
+++ b/backend/internal/data/ent/attachment_delete.go
@@ -20,56 +20,56 @@ type AttachmentDelete struct {
}
// Where appends a list predicates to the AttachmentDelete builder.
-func (ad *AttachmentDelete) Where(ps ...predicate.Attachment) *AttachmentDelete {
- ad.mutation.Where(ps...)
- return ad
+func (_d *AttachmentDelete) Where(ps ...predicate.Attachment) *AttachmentDelete {
+ _d.mutation.Where(ps...)
+ return _d
}
// Exec executes the deletion query and returns how many vertices were deleted.
-func (ad *AttachmentDelete) Exec(ctx context.Context) (int, error) {
- return withHooks(ctx, ad.sqlExec, ad.mutation, ad.hooks)
+func (_d *AttachmentDelete) Exec(ctx context.Context) (int, error) {
+ return withHooks(ctx, _d.sqlExec, _d.mutation, _d.hooks)
}
// ExecX is like Exec, but panics if an error occurs.
-func (ad *AttachmentDelete) ExecX(ctx context.Context) int {
- n, err := ad.Exec(ctx)
+func (_d *AttachmentDelete) ExecX(ctx context.Context) int {
+ n, err := _d.Exec(ctx)
if err != nil {
panic(err)
}
return n
}
-func (ad *AttachmentDelete) sqlExec(ctx context.Context) (int, error) {
+func (_d *AttachmentDelete) sqlExec(ctx context.Context) (int, error) {
_spec := sqlgraph.NewDeleteSpec(attachment.Table, sqlgraph.NewFieldSpec(attachment.FieldID, field.TypeUUID))
- if ps := ad.mutation.predicates; len(ps) > 0 {
+ if ps := _d.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
- affected, err := sqlgraph.DeleteNodes(ctx, ad.driver, _spec)
+ affected, err := sqlgraph.DeleteNodes(ctx, _d.driver, _spec)
if err != nil && sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
- ad.mutation.done = true
+ _d.mutation.done = true
return affected, err
}
// AttachmentDeleteOne is the builder for deleting a single Attachment entity.
type AttachmentDeleteOne struct {
- ad *AttachmentDelete
+ _d *AttachmentDelete
}
// Where appends a list predicates to the AttachmentDelete builder.
-func (ado *AttachmentDeleteOne) Where(ps ...predicate.Attachment) *AttachmentDeleteOne {
- ado.ad.mutation.Where(ps...)
- return ado
+func (_d *AttachmentDeleteOne) Where(ps ...predicate.Attachment) *AttachmentDeleteOne {
+ _d._d.mutation.Where(ps...)
+ return _d
}
// Exec executes the deletion query.
-func (ado *AttachmentDeleteOne) Exec(ctx context.Context) error {
- n, err := ado.ad.Exec(ctx)
+func (_d *AttachmentDeleteOne) Exec(ctx context.Context) error {
+ n, err := _d._d.Exec(ctx)
switch {
case err != nil:
return err
@@ -81,8 +81,8 @@ func (ado *AttachmentDeleteOne) Exec(ctx context.Context) error {
}
// ExecX is like Exec, but panics if an error occurs.
-func (ado *AttachmentDeleteOne) ExecX(ctx context.Context) {
- if err := ado.Exec(ctx); err != nil {
+func (_d *AttachmentDeleteOne) ExecX(ctx context.Context) {
+ if err := _d.Exec(ctx); err != nil {
panic(err)
}
}
diff --git a/backend/internal/data/ent/attachment_query.go b/backend/internal/data/ent/attachment_query.go
index 5f264dd1..8eea544c 100644
--- a/backend/internal/data/ent/attachment_query.go
+++ b/backend/internal/data/ent/attachment_query.go
@@ -33,44 +33,44 @@ type AttachmentQuery struct {
}
// Where adds a new predicate for the AttachmentQuery builder.
-func (aq *AttachmentQuery) Where(ps ...predicate.Attachment) *AttachmentQuery {
- aq.predicates = append(aq.predicates, ps...)
- return aq
+func (_q *AttachmentQuery) Where(ps ...predicate.Attachment) *AttachmentQuery {
+ _q.predicates = append(_q.predicates, ps...)
+ return _q
}
// Limit the number of records to be returned by this query.
-func (aq *AttachmentQuery) Limit(limit int) *AttachmentQuery {
- aq.ctx.Limit = &limit
- return aq
+func (_q *AttachmentQuery) Limit(limit int) *AttachmentQuery {
+ _q.ctx.Limit = &limit
+ return _q
}
// Offset to start from.
-func (aq *AttachmentQuery) Offset(offset int) *AttachmentQuery {
- aq.ctx.Offset = &offset
- return aq
+func (_q *AttachmentQuery) Offset(offset int) *AttachmentQuery {
+ _q.ctx.Offset = &offset
+ return _q
}
// Unique configures the query builder to filter duplicate records on query.
// By default, unique is set to true, and can be disabled using this method.
-func (aq *AttachmentQuery) Unique(unique bool) *AttachmentQuery {
- aq.ctx.Unique = &unique
- return aq
+func (_q *AttachmentQuery) Unique(unique bool) *AttachmentQuery {
+ _q.ctx.Unique = &unique
+ return _q
}
// Order specifies how the records should be ordered.
-func (aq *AttachmentQuery) Order(o ...attachment.OrderOption) *AttachmentQuery {
- aq.order = append(aq.order, o...)
- return aq
+func (_q *AttachmentQuery) Order(o ...attachment.OrderOption) *AttachmentQuery {
+ _q.order = append(_q.order, o...)
+ return _q
}
// QueryItem chains the current query on the "item" edge.
-func (aq *AttachmentQuery) QueryItem() *ItemQuery {
- query := (&ItemClient{config: aq.config}).Query()
+func (_q *AttachmentQuery) QueryItem() *ItemQuery {
+ query := (&ItemClient{config: _q.config}).Query()
query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
- if err := aq.prepareQuery(ctx); err != nil {
+ if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
- selector := aq.sqlQuery(ctx)
+ selector := _q.sqlQuery(ctx)
if err := selector.Err(); err != nil {
return nil, err
}
@@ -79,20 +79,20 @@ func (aq *AttachmentQuery) QueryItem() *ItemQuery {
sqlgraph.To(item.Table, item.FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, attachment.ItemTable, attachment.ItemColumn),
)
- fromU = sqlgraph.SetNeighbors(aq.driver.Dialect(), step)
+ fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step)
return fromU, nil
}
return query
}
// QueryThumbnail chains the current query on the "thumbnail" edge.
-func (aq *AttachmentQuery) QueryThumbnail() *AttachmentQuery {
- query := (&AttachmentClient{config: aq.config}).Query()
+func (_q *AttachmentQuery) QueryThumbnail() *AttachmentQuery {
+ query := (&AttachmentClient{config: _q.config}).Query()
query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
- if err := aq.prepareQuery(ctx); err != nil {
+ if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
- selector := aq.sqlQuery(ctx)
+ selector := _q.sqlQuery(ctx)
if err := selector.Err(); err != nil {
return nil, err
}
@@ -101,7 +101,7 @@ func (aq *AttachmentQuery) QueryThumbnail() *AttachmentQuery {
sqlgraph.To(attachment.Table, attachment.FieldID),
sqlgraph.Edge(sqlgraph.O2O, false, attachment.ThumbnailTable, attachment.ThumbnailColumn),
)
- fromU = sqlgraph.SetNeighbors(aq.driver.Dialect(), step)
+ fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step)
return fromU, nil
}
return query
@@ -109,8 +109,8 @@ func (aq *AttachmentQuery) QueryThumbnail() *AttachmentQuery {
// First returns the first Attachment entity from the query.
// Returns a *NotFoundError when no Attachment was found.
-func (aq *AttachmentQuery) First(ctx context.Context) (*Attachment, error) {
- nodes, err := aq.Limit(1).All(setContextOp(ctx, aq.ctx, ent.OpQueryFirst))
+func (_q *AttachmentQuery) First(ctx context.Context) (*Attachment, error) {
+ nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst))
if err != nil {
return nil, err
}
@@ -121,8 +121,8 @@ func (aq *AttachmentQuery) First(ctx context.Context) (*Attachment, error) {
}
// FirstX is like First, but panics if an error occurs.
-func (aq *AttachmentQuery) FirstX(ctx context.Context) *Attachment {
- node, err := aq.First(ctx)
+func (_q *AttachmentQuery) FirstX(ctx context.Context) *Attachment {
+ node, err := _q.First(ctx)
if err != nil && !IsNotFound(err) {
panic(err)
}
@@ -131,9 +131,9 @@ func (aq *AttachmentQuery) FirstX(ctx context.Context) *Attachment {
// FirstID returns the first Attachment ID from the query.
// Returns a *NotFoundError when no Attachment ID was found.
-func (aq *AttachmentQuery) FirstID(ctx context.Context) (id uuid.UUID, err error) {
+func (_q *AttachmentQuery) FirstID(ctx context.Context) (id uuid.UUID, err error) {
var ids []uuid.UUID
- if ids, err = aq.Limit(1).IDs(setContextOp(ctx, aq.ctx, ent.OpQueryFirstID)); err != nil {
+ if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil {
return
}
if len(ids) == 0 {
@@ -144,8 +144,8 @@ func (aq *AttachmentQuery) FirstID(ctx context.Context) (id uuid.UUID, err error
}
// FirstIDX is like FirstID, but panics if an error occurs.
-func (aq *AttachmentQuery) FirstIDX(ctx context.Context) uuid.UUID {
- id, err := aq.FirstID(ctx)
+func (_q *AttachmentQuery) FirstIDX(ctx context.Context) uuid.UUID {
+ id, err := _q.FirstID(ctx)
if err != nil && !IsNotFound(err) {
panic(err)
}
@@ -155,8 +155,8 @@ func (aq *AttachmentQuery) FirstIDX(ctx context.Context) uuid.UUID {
// Only returns a single Attachment entity found by the query, ensuring it only returns one.
// Returns a *NotSingularError when more than one Attachment entity is found.
// Returns a *NotFoundError when no Attachment entities are found.
-func (aq *AttachmentQuery) Only(ctx context.Context) (*Attachment, error) {
- nodes, err := aq.Limit(2).All(setContextOp(ctx, aq.ctx, ent.OpQueryOnly))
+func (_q *AttachmentQuery) Only(ctx context.Context) (*Attachment, error) {
+ nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly))
if err != nil {
return nil, err
}
@@ -171,8 +171,8 @@ func (aq *AttachmentQuery) Only(ctx context.Context) (*Attachment, error) {
}
// OnlyX is like Only, but panics if an error occurs.
-func (aq *AttachmentQuery) OnlyX(ctx context.Context) *Attachment {
- node, err := aq.Only(ctx)
+func (_q *AttachmentQuery) OnlyX(ctx context.Context) *Attachment {
+ node, err := _q.Only(ctx)
if err != nil {
panic(err)
}
@@ -182,9 +182,9 @@ func (aq *AttachmentQuery) OnlyX(ctx context.Context) *Attachment {
// OnlyID is like Only, but returns the only Attachment ID in the query.
// Returns a *NotSingularError when more than one Attachment ID is found.
// Returns a *NotFoundError when no entities are found.
-func (aq *AttachmentQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error) {
+func (_q *AttachmentQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error) {
var ids []uuid.UUID
- if ids, err = aq.Limit(2).IDs(setContextOp(ctx, aq.ctx, ent.OpQueryOnlyID)); err != nil {
+ if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil {
return
}
switch len(ids) {
@@ -199,8 +199,8 @@ func (aq *AttachmentQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)
}
// OnlyIDX is like OnlyID, but panics if an error occurs.
-func (aq *AttachmentQuery) OnlyIDX(ctx context.Context) uuid.UUID {
- id, err := aq.OnlyID(ctx)
+func (_q *AttachmentQuery) OnlyIDX(ctx context.Context) uuid.UUID {
+ id, err := _q.OnlyID(ctx)
if err != nil {
panic(err)
}
@@ -208,18 +208,18 @@ func (aq *AttachmentQuery) OnlyIDX(ctx context.Context) uuid.UUID {
}
// All executes the query and returns a list of Attachments.
-func (aq *AttachmentQuery) All(ctx context.Context) ([]*Attachment, error) {
- ctx = setContextOp(ctx, aq.ctx, ent.OpQueryAll)
- if err := aq.prepareQuery(ctx); err != nil {
+func (_q *AttachmentQuery) All(ctx context.Context) ([]*Attachment, error) {
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll)
+ if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
qr := querierAll[[]*Attachment, *AttachmentQuery]()
- return withInterceptors[[]*Attachment](ctx, aq, qr, aq.inters)
+ return withInterceptors[[]*Attachment](ctx, _q, qr, _q.inters)
}
// AllX is like All, but panics if an error occurs.
-func (aq *AttachmentQuery) AllX(ctx context.Context) []*Attachment {
- nodes, err := aq.All(ctx)
+func (_q *AttachmentQuery) AllX(ctx context.Context) []*Attachment {
+ nodes, err := _q.All(ctx)
if err != nil {
panic(err)
}
@@ -227,20 +227,20 @@ func (aq *AttachmentQuery) AllX(ctx context.Context) []*Attachment {
}
// IDs executes the query and returns a list of Attachment IDs.
-func (aq *AttachmentQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error) {
- if aq.ctx.Unique == nil && aq.path != nil {
- aq.Unique(true)
+func (_q *AttachmentQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error) {
+ if _q.ctx.Unique == nil && _q.path != nil {
+ _q.Unique(true)
}
- ctx = setContextOp(ctx, aq.ctx, ent.OpQueryIDs)
- if err = aq.Select(attachment.FieldID).Scan(ctx, &ids); err != nil {
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs)
+ if err = _q.Select(attachment.FieldID).Scan(ctx, &ids); err != nil {
return nil, err
}
return ids, nil
}
// IDsX is like IDs, but panics if an error occurs.
-func (aq *AttachmentQuery) IDsX(ctx context.Context) []uuid.UUID {
- ids, err := aq.IDs(ctx)
+func (_q *AttachmentQuery) IDsX(ctx context.Context) []uuid.UUID {
+ ids, err := _q.IDs(ctx)
if err != nil {
panic(err)
}
@@ -248,17 +248,17 @@ func (aq *AttachmentQuery) IDsX(ctx context.Context) []uuid.UUID {
}
// Count returns the count of the given query.
-func (aq *AttachmentQuery) Count(ctx context.Context) (int, error) {
- ctx = setContextOp(ctx, aq.ctx, ent.OpQueryCount)
- if err := aq.prepareQuery(ctx); err != nil {
+func (_q *AttachmentQuery) Count(ctx context.Context) (int, error) {
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryCount)
+ if err := _q.prepareQuery(ctx); err != nil {
return 0, err
}
- return withInterceptors[int](ctx, aq, querierCount[*AttachmentQuery](), aq.inters)
+ return withInterceptors[int](ctx, _q, querierCount[*AttachmentQuery](), _q.inters)
}
// CountX is like Count, but panics if an error occurs.
-func (aq *AttachmentQuery) CountX(ctx context.Context) int {
- count, err := aq.Count(ctx)
+func (_q *AttachmentQuery) CountX(ctx context.Context) int {
+ count, err := _q.Count(ctx)
if err != nil {
panic(err)
}
@@ -266,9 +266,9 @@ func (aq *AttachmentQuery) CountX(ctx context.Context) int {
}
// Exist returns true if the query has elements in the graph.
-func (aq *AttachmentQuery) Exist(ctx context.Context) (bool, error) {
- ctx = setContextOp(ctx, aq.ctx, ent.OpQueryExist)
- switch _, err := aq.FirstID(ctx); {
+func (_q *AttachmentQuery) Exist(ctx context.Context) (bool, error) {
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryExist)
+ switch _, err := _q.FirstID(ctx); {
case IsNotFound(err):
return false, nil
case err != nil:
@@ -279,8 +279,8 @@ func (aq *AttachmentQuery) Exist(ctx context.Context) (bool, error) {
}
// ExistX is like Exist, but panics if an error occurs.
-func (aq *AttachmentQuery) ExistX(ctx context.Context) bool {
- exist, err := aq.Exist(ctx)
+func (_q *AttachmentQuery) ExistX(ctx context.Context) bool {
+ exist, err := _q.Exist(ctx)
if err != nil {
panic(err)
}
@@ -289,44 +289,44 @@ func (aq *AttachmentQuery) ExistX(ctx context.Context) bool {
// Clone returns a duplicate of the AttachmentQuery builder, including all associated steps. It can be
// used to prepare common query builders and use them differently after the clone is made.
-func (aq *AttachmentQuery) Clone() *AttachmentQuery {
- if aq == nil {
+func (_q *AttachmentQuery) Clone() *AttachmentQuery {
+ if _q == nil {
return nil
}
return &AttachmentQuery{
- config: aq.config,
- ctx: aq.ctx.Clone(),
- order: append([]attachment.OrderOption{}, aq.order...),
- inters: append([]Interceptor{}, aq.inters...),
- predicates: append([]predicate.Attachment{}, aq.predicates...),
- withItem: aq.withItem.Clone(),
- withThumbnail: aq.withThumbnail.Clone(),
+ config: _q.config,
+ ctx: _q.ctx.Clone(),
+ order: append([]attachment.OrderOption{}, _q.order...),
+ inters: append([]Interceptor{}, _q.inters...),
+ predicates: append([]predicate.Attachment{}, _q.predicates...),
+ withItem: _q.withItem.Clone(),
+ withThumbnail: _q.withThumbnail.Clone(),
// clone intermediate query.
- sql: aq.sql.Clone(),
- path: aq.path,
+ sql: _q.sql.Clone(),
+ path: _q.path,
}
}
// WithItem tells the query-builder to eager-load the nodes that are connected to
// the "item" edge. The optional arguments are used to configure the query builder of the edge.
-func (aq *AttachmentQuery) WithItem(opts ...func(*ItemQuery)) *AttachmentQuery {
- query := (&ItemClient{config: aq.config}).Query()
+func (_q *AttachmentQuery) WithItem(opts ...func(*ItemQuery)) *AttachmentQuery {
+ query := (&ItemClient{config: _q.config}).Query()
for _, opt := range opts {
opt(query)
}
- aq.withItem = query
- return aq
+ _q.withItem = query
+ return _q
}
// WithThumbnail tells the query-builder to eager-load the nodes that are connected to
// the "thumbnail" edge. The optional arguments are used to configure the query builder of the edge.
-func (aq *AttachmentQuery) WithThumbnail(opts ...func(*AttachmentQuery)) *AttachmentQuery {
- query := (&AttachmentClient{config: aq.config}).Query()
+func (_q *AttachmentQuery) WithThumbnail(opts ...func(*AttachmentQuery)) *AttachmentQuery {
+ query := (&AttachmentClient{config: _q.config}).Query()
for _, opt := range opts {
opt(query)
}
- aq.withThumbnail = query
- return aq
+ _q.withThumbnail = query
+ return _q
}
// GroupBy is used to group vertices by one or more fields/columns.
@@ -343,10 +343,10 @@ func (aq *AttachmentQuery) WithThumbnail(opts ...func(*AttachmentQuery)) *Attach
// GroupBy(attachment.FieldCreatedAt).
// Aggregate(ent.Count()).
// Scan(ctx, &v)
-func (aq *AttachmentQuery) GroupBy(field string, fields ...string) *AttachmentGroupBy {
- aq.ctx.Fields = append([]string{field}, fields...)
- grbuild := &AttachmentGroupBy{build: aq}
- grbuild.flds = &aq.ctx.Fields
+func (_q *AttachmentQuery) GroupBy(field string, fields ...string) *AttachmentGroupBy {
+ _q.ctx.Fields = append([]string{field}, fields...)
+ grbuild := &AttachmentGroupBy{build: _q}
+ grbuild.flds = &_q.ctx.Fields
grbuild.label = attachment.Label
grbuild.scan = grbuild.Scan
return grbuild
@@ -364,56 +364,56 @@ func (aq *AttachmentQuery) GroupBy(field string, fields ...string) *AttachmentGr
// client.Attachment.Query().
// Select(attachment.FieldCreatedAt).
// Scan(ctx, &v)
-func (aq *AttachmentQuery) Select(fields ...string) *AttachmentSelect {
- aq.ctx.Fields = append(aq.ctx.Fields, fields...)
- sbuild := &AttachmentSelect{AttachmentQuery: aq}
+func (_q *AttachmentQuery) Select(fields ...string) *AttachmentSelect {
+ _q.ctx.Fields = append(_q.ctx.Fields, fields...)
+ sbuild := &AttachmentSelect{AttachmentQuery: _q}
sbuild.label = attachment.Label
- sbuild.flds, sbuild.scan = &aq.ctx.Fields, sbuild.Scan
+ sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan
return sbuild
}
// Aggregate returns a AttachmentSelect configured with the given aggregations.
-func (aq *AttachmentQuery) Aggregate(fns ...AggregateFunc) *AttachmentSelect {
- return aq.Select().Aggregate(fns...)
+func (_q *AttachmentQuery) Aggregate(fns ...AggregateFunc) *AttachmentSelect {
+ return _q.Select().Aggregate(fns...)
}
-func (aq *AttachmentQuery) prepareQuery(ctx context.Context) error {
- for _, inter := range aq.inters {
+func (_q *AttachmentQuery) prepareQuery(ctx context.Context) error {
+ for _, inter := range _q.inters {
if inter == nil {
return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)")
}
if trv, ok := inter.(Traverser); ok {
- if err := trv.Traverse(ctx, aq); err != nil {
+ if err := trv.Traverse(ctx, _q); err != nil {
return err
}
}
}
- for _, f := range aq.ctx.Fields {
+ for _, f := range _q.ctx.Fields {
if !attachment.ValidColumn(f) {
return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
}
}
- if aq.path != nil {
- prev, err := aq.path(ctx)
+ if _q.path != nil {
+ prev, err := _q.path(ctx)
if err != nil {
return err
}
- aq.sql = prev
+ _q.sql = prev
}
return nil
}
-func (aq *AttachmentQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Attachment, error) {
+func (_q *AttachmentQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Attachment, error) {
var (
nodes = []*Attachment{}
- withFKs = aq.withFKs
- _spec = aq.querySpec()
+ withFKs = _q.withFKs
+ _spec = _q.querySpec()
loadedTypes = [2]bool{
- aq.withItem != nil,
- aq.withThumbnail != nil,
+ _q.withItem != nil,
+ _q.withThumbnail != nil,
}
)
- if aq.withItem != nil || aq.withThumbnail != nil {
+ if _q.withItem != nil || _q.withThumbnail != nil {
withFKs = true
}
if withFKs {
@@ -423,7 +423,7 @@ func (aq *AttachmentQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*A
return (*Attachment).scanValues(nil, columns)
}
_spec.Assign = func(columns []string, values []any) error {
- node := &Attachment{config: aq.config}
+ node := &Attachment{config: _q.config}
nodes = append(nodes, node)
node.Edges.loadedTypes = loadedTypes
return node.assignValues(columns, values)
@@ -431,20 +431,20 @@ func (aq *AttachmentQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*A
for i := range hooks {
hooks[i](ctx, _spec)
}
- if err := sqlgraph.QueryNodes(ctx, aq.driver, _spec); err != nil {
+ if err := sqlgraph.QueryNodes(ctx, _q.driver, _spec); err != nil {
return nil, err
}
if len(nodes) == 0 {
return nodes, nil
}
- if query := aq.withItem; query != nil {
- if err := aq.loadItem(ctx, query, nodes, nil,
+ if query := _q.withItem; query != nil {
+ if err := _q.loadItem(ctx, query, nodes, nil,
func(n *Attachment, e *Item) { n.Edges.Item = e }); err != nil {
return nil, err
}
}
- if query := aq.withThumbnail; query != nil {
- if err := aq.loadThumbnail(ctx, query, nodes, nil,
+ if query := _q.withThumbnail; query != nil {
+ if err := _q.loadThumbnail(ctx, query, nodes, nil,
func(n *Attachment, e *Attachment) { n.Edges.Thumbnail = e }); err != nil {
return nil, err
}
@@ -452,7 +452,7 @@ func (aq *AttachmentQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*A
return nodes, nil
}
-func (aq *AttachmentQuery) loadItem(ctx context.Context, query *ItemQuery, nodes []*Attachment, init func(*Attachment), assign func(*Attachment, *Item)) error {
+func (_q *AttachmentQuery) loadItem(ctx context.Context, query *ItemQuery, nodes []*Attachment, init func(*Attachment), assign func(*Attachment, *Item)) error {
ids := make([]uuid.UUID, 0, len(nodes))
nodeids := make(map[uuid.UUID][]*Attachment)
for i := range nodes {
@@ -484,7 +484,7 @@ func (aq *AttachmentQuery) loadItem(ctx context.Context, query *ItemQuery, nodes
}
return nil
}
-func (aq *AttachmentQuery) loadThumbnail(ctx context.Context, query *AttachmentQuery, nodes []*Attachment, init func(*Attachment), assign func(*Attachment, *Attachment)) error {
+func (_q *AttachmentQuery) loadThumbnail(ctx context.Context, query *AttachmentQuery, nodes []*Attachment, init func(*Attachment), assign func(*Attachment, *Attachment)) error {
ids := make([]uuid.UUID, 0, len(nodes))
nodeids := make(map[uuid.UUID][]*Attachment)
for i := range nodes {
@@ -517,24 +517,24 @@ func (aq *AttachmentQuery) loadThumbnail(ctx context.Context, query *AttachmentQ
return nil
}
-func (aq *AttachmentQuery) sqlCount(ctx context.Context) (int, error) {
- _spec := aq.querySpec()
- _spec.Node.Columns = aq.ctx.Fields
- if len(aq.ctx.Fields) > 0 {
- _spec.Unique = aq.ctx.Unique != nil && *aq.ctx.Unique
+func (_q *AttachmentQuery) sqlCount(ctx context.Context) (int, error) {
+ _spec := _q.querySpec()
+ _spec.Node.Columns = _q.ctx.Fields
+ if len(_q.ctx.Fields) > 0 {
+ _spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique
}
- return sqlgraph.CountNodes(ctx, aq.driver, _spec)
+ return sqlgraph.CountNodes(ctx, _q.driver, _spec)
}
-func (aq *AttachmentQuery) querySpec() *sqlgraph.QuerySpec {
+func (_q *AttachmentQuery) querySpec() *sqlgraph.QuerySpec {
_spec := sqlgraph.NewQuerySpec(attachment.Table, attachment.Columns, sqlgraph.NewFieldSpec(attachment.FieldID, field.TypeUUID))
- _spec.From = aq.sql
- if unique := aq.ctx.Unique; unique != nil {
+ _spec.From = _q.sql
+ if unique := _q.ctx.Unique; unique != nil {
_spec.Unique = *unique
- } else if aq.path != nil {
+ } else if _q.path != nil {
_spec.Unique = true
}
- if fields := aq.ctx.Fields; len(fields) > 0 {
+ if fields := _q.ctx.Fields; len(fields) > 0 {
_spec.Node.Columns = make([]string, 0, len(fields))
_spec.Node.Columns = append(_spec.Node.Columns, attachment.FieldID)
for i := range fields {
@@ -543,20 +543,20 @@ func (aq *AttachmentQuery) querySpec() *sqlgraph.QuerySpec {
}
}
}
- if ps := aq.predicates; len(ps) > 0 {
+ if ps := _q.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
- if limit := aq.ctx.Limit; limit != nil {
+ if limit := _q.ctx.Limit; limit != nil {
_spec.Limit = *limit
}
- if offset := aq.ctx.Offset; offset != nil {
+ if offset := _q.ctx.Offset; offset != nil {
_spec.Offset = *offset
}
- if ps := aq.order; len(ps) > 0 {
+ if ps := _q.order; len(ps) > 0 {
_spec.Order = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
@@ -566,33 +566,33 @@ func (aq *AttachmentQuery) querySpec() *sqlgraph.QuerySpec {
return _spec
}
-func (aq *AttachmentQuery) sqlQuery(ctx context.Context) *sql.Selector {
- builder := sql.Dialect(aq.driver.Dialect())
+func (_q *AttachmentQuery) sqlQuery(ctx context.Context) *sql.Selector {
+ builder := sql.Dialect(_q.driver.Dialect())
t1 := builder.Table(attachment.Table)
- columns := aq.ctx.Fields
+ columns := _q.ctx.Fields
if len(columns) == 0 {
columns = attachment.Columns
}
selector := builder.Select(t1.Columns(columns...)...).From(t1)
- if aq.sql != nil {
- selector = aq.sql
+ if _q.sql != nil {
+ selector = _q.sql
selector.Select(selector.Columns(columns...)...)
}
- if aq.ctx.Unique != nil && *aq.ctx.Unique {
+ if _q.ctx.Unique != nil && *_q.ctx.Unique {
selector.Distinct()
}
- for _, p := range aq.predicates {
+ for _, p := range _q.predicates {
p(selector)
}
- for _, p := range aq.order {
+ for _, p := range _q.order {
p(selector)
}
- if offset := aq.ctx.Offset; offset != nil {
+ if offset := _q.ctx.Offset; offset != nil {
// limit is mandatory for offset clause. We start
// with default value, and override it below if needed.
selector.Offset(*offset).Limit(math.MaxInt32)
}
- if limit := aq.ctx.Limit; limit != nil {
+ if limit := _q.ctx.Limit; limit != nil {
selector.Limit(*limit)
}
return selector
@@ -605,41 +605,41 @@ type AttachmentGroupBy struct {
}
// Aggregate adds the given aggregation functions to the group-by query.
-func (agb *AttachmentGroupBy) Aggregate(fns ...AggregateFunc) *AttachmentGroupBy {
- agb.fns = append(agb.fns, fns...)
- return agb
+func (_g *AttachmentGroupBy) Aggregate(fns ...AggregateFunc) *AttachmentGroupBy {
+ _g.fns = append(_g.fns, fns...)
+ return _g
}
// Scan applies the selector query and scans the result into the given value.
-func (agb *AttachmentGroupBy) Scan(ctx context.Context, v any) error {
- ctx = setContextOp(ctx, agb.build.ctx, ent.OpQueryGroupBy)
- if err := agb.build.prepareQuery(ctx); err != nil {
+func (_g *AttachmentGroupBy) Scan(ctx context.Context, v any) error {
+ ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy)
+ if err := _g.build.prepareQuery(ctx); err != nil {
return err
}
- return scanWithInterceptors[*AttachmentQuery, *AttachmentGroupBy](ctx, agb.build, agb, agb.build.inters, v)
+ return scanWithInterceptors[*AttachmentQuery, *AttachmentGroupBy](ctx, _g.build, _g, _g.build.inters, v)
}
-func (agb *AttachmentGroupBy) sqlScan(ctx context.Context, root *AttachmentQuery, v any) error {
+func (_g *AttachmentGroupBy) sqlScan(ctx context.Context, root *AttachmentQuery, v any) error {
selector := root.sqlQuery(ctx).Select()
- aggregation := make([]string, 0, len(agb.fns))
- for _, fn := range agb.fns {
+ aggregation := make([]string, 0, len(_g.fns))
+ for _, fn := range _g.fns {
aggregation = append(aggregation, fn(selector))
}
if len(selector.SelectedColumns()) == 0 {
- columns := make([]string, 0, len(*agb.flds)+len(agb.fns))
- for _, f := range *agb.flds {
+ columns := make([]string, 0, len(*_g.flds)+len(_g.fns))
+ for _, f := range *_g.flds {
columns = append(columns, selector.C(f))
}
columns = append(columns, aggregation...)
selector.Select(columns...)
}
- selector.GroupBy(selector.Columns(*agb.flds...)...)
+ selector.GroupBy(selector.Columns(*_g.flds...)...)
if err := selector.Err(); err != nil {
return err
}
rows := &sql.Rows{}
query, args := selector.Query()
- if err := agb.build.driver.Query(ctx, query, args, rows); err != nil {
+ if err := _g.build.driver.Query(ctx, query, args, rows); err != nil {
return err
}
defer rows.Close()
@@ -653,27 +653,27 @@ type AttachmentSelect struct {
}
// Aggregate adds the given aggregation functions to the selector query.
-func (as *AttachmentSelect) Aggregate(fns ...AggregateFunc) *AttachmentSelect {
- as.fns = append(as.fns, fns...)
- return as
+func (_s *AttachmentSelect) Aggregate(fns ...AggregateFunc) *AttachmentSelect {
+ _s.fns = append(_s.fns, fns...)
+ return _s
}
// Scan applies the selector query and scans the result into the given value.
-func (as *AttachmentSelect) Scan(ctx context.Context, v any) error {
- ctx = setContextOp(ctx, as.ctx, ent.OpQuerySelect)
- if err := as.prepareQuery(ctx); err != nil {
+func (_s *AttachmentSelect) Scan(ctx context.Context, v any) error {
+ ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect)
+ if err := _s.prepareQuery(ctx); err != nil {
return err
}
- return scanWithInterceptors[*AttachmentQuery, *AttachmentSelect](ctx, as.AttachmentQuery, as, as.inters, v)
+ return scanWithInterceptors[*AttachmentQuery, *AttachmentSelect](ctx, _s.AttachmentQuery, _s, _s.inters, v)
}
-func (as *AttachmentSelect) sqlScan(ctx context.Context, root *AttachmentQuery, v any) error {
+func (_s *AttachmentSelect) sqlScan(ctx context.Context, root *AttachmentQuery, v any) error {
selector := root.sqlQuery(ctx)
- aggregation := make([]string, 0, len(as.fns))
- for _, fn := range as.fns {
+ aggregation := make([]string, 0, len(_s.fns))
+ for _, fn := range _s.fns {
aggregation = append(aggregation, fn(selector))
}
- switch n := len(*as.selector.flds); {
+ switch n := len(*_s.selector.flds); {
case n == 0 && len(aggregation) > 0:
selector.Select(aggregation...)
case n != 0 && len(aggregation) > 0:
@@ -681,7 +681,7 @@ func (as *AttachmentSelect) sqlScan(ctx context.Context, root *AttachmentQuery,
}
rows := &sql.Rows{}
query, args := selector.Query()
- if err := as.driver.Query(ctx, query, args, rows); err != nil {
+ if err := _s.driver.Query(ctx, query, args, rows); err != nil {
return err
}
defer rows.Close()
diff --git a/backend/internal/data/ent/attachment_update.go b/backend/internal/data/ent/attachment_update.go
index 15eb4be7..6b2cdd35 100644
--- a/backend/internal/data/ent/attachment_update.go
+++ b/backend/internal/data/ent/attachment_update.go
@@ -25,151 +25,151 @@ type AttachmentUpdate struct {
}
// Where appends a list predicates to the AttachmentUpdate builder.
-func (au *AttachmentUpdate) Where(ps ...predicate.Attachment) *AttachmentUpdate {
- au.mutation.Where(ps...)
- return au
+func (_u *AttachmentUpdate) Where(ps ...predicate.Attachment) *AttachmentUpdate {
+ _u.mutation.Where(ps...)
+ return _u
}
// SetUpdatedAt sets the "updated_at" field.
-func (au *AttachmentUpdate) SetUpdatedAt(t time.Time) *AttachmentUpdate {
- au.mutation.SetUpdatedAt(t)
- return au
+func (_u *AttachmentUpdate) SetUpdatedAt(v time.Time) *AttachmentUpdate {
+ _u.mutation.SetUpdatedAt(v)
+ return _u
}
// SetType sets the "type" field.
-func (au *AttachmentUpdate) SetType(a attachment.Type) *AttachmentUpdate {
- au.mutation.SetType(a)
- return au
+func (_u *AttachmentUpdate) SetType(v attachment.Type) *AttachmentUpdate {
+ _u.mutation.SetType(v)
+ return _u
}
// SetNillableType sets the "type" field if the given value is not nil.
-func (au *AttachmentUpdate) SetNillableType(a *attachment.Type) *AttachmentUpdate {
- if a != nil {
- au.SetType(*a)
+func (_u *AttachmentUpdate) SetNillableType(v *attachment.Type) *AttachmentUpdate {
+ if v != nil {
+ _u.SetType(*v)
}
- return au
+ return _u
}
// SetPrimary sets the "primary" field.
-func (au *AttachmentUpdate) SetPrimary(b bool) *AttachmentUpdate {
- au.mutation.SetPrimary(b)
- return au
+func (_u *AttachmentUpdate) SetPrimary(v bool) *AttachmentUpdate {
+ _u.mutation.SetPrimary(v)
+ return _u
}
// SetNillablePrimary sets the "primary" field if the given value is not nil.
-func (au *AttachmentUpdate) SetNillablePrimary(b *bool) *AttachmentUpdate {
- if b != nil {
- au.SetPrimary(*b)
+func (_u *AttachmentUpdate) SetNillablePrimary(v *bool) *AttachmentUpdate {
+ if v != nil {
+ _u.SetPrimary(*v)
}
- return au
+ return _u
}
// SetTitle sets the "title" field.
-func (au *AttachmentUpdate) SetTitle(s string) *AttachmentUpdate {
- au.mutation.SetTitle(s)
- return au
+func (_u *AttachmentUpdate) SetTitle(v string) *AttachmentUpdate {
+ _u.mutation.SetTitle(v)
+ return _u
}
// SetNillableTitle sets the "title" field if the given value is not nil.
-func (au *AttachmentUpdate) SetNillableTitle(s *string) *AttachmentUpdate {
- if s != nil {
- au.SetTitle(*s)
+func (_u *AttachmentUpdate) SetNillableTitle(v *string) *AttachmentUpdate {
+ if v != nil {
+ _u.SetTitle(*v)
}
- return au
+ return _u
}
// SetPath sets the "path" field.
-func (au *AttachmentUpdate) SetPath(s string) *AttachmentUpdate {
- au.mutation.SetPath(s)
- return au
+func (_u *AttachmentUpdate) SetPath(v string) *AttachmentUpdate {
+ _u.mutation.SetPath(v)
+ return _u
}
// SetNillablePath sets the "path" field if the given value is not nil.
-func (au *AttachmentUpdate) SetNillablePath(s *string) *AttachmentUpdate {
- if s != nil {
- au.SetPath(*s)
+func (_u *AttachmentUpdate) SetNillablePath(v *string) *AttachmentUpdate {
+ if v != nil {
+ _u.SetPath(*v)
}
- return au
+ return _u
}
// SetMimeType sets the "mime_type" field.
-func (au *AttachmentUpdate) SetMimeType(s string) *AttachmentUpdate {
- au.mutation.SetMimeType(s)
- return au
+func (_u *AttachmentUpdate) SetMimeType(v string) *AttachmentUpdate {
+ _u.mutation.SetMimeType(v)
+ return _u
}
// SetNillableMimeType sets the "mime_type" field if the given value is not nil.
-func (au *AttachmentUpdate) SetNillableMimeType(s *string) *AttachmentUpdate {
- if s != nil {
- au.SetMimeType(*s)
+func (_u *AttachmentUpdate) SetNillableMimeType(v *string) *AttachmentUpdate {
+ if v != nil {
+ _u.SetMimeType(*v)
}
- return au
+ return _u
}
// SetItemID sets the "item" edge to the Item entity by ID.
-func (au *AttachmentUpdate) SetItemID(id uuid.UUID) *AttachmentUpdate {
- au.mutation.SetItemID(id)
- return au
+func (_u *AttachmentUpdate) SetItemID(id uuid.UUID) *AttachmentUpdate {
+ _u.mutation.SetItemID(id)
+ return _u
}
// SetNillableItemID sets the "item" edge to the Item entity by ID if the given value is not nil.
-func (au *AttachmentUpdate) SetNillableItemID(id *uuid.UUID) *AttachmentUpdate {
+func (_u *AttachmentUpdate) SetNillableItemID(id *uuid.UUID) *AttachmentUpdate {
if id != nil {
- au = au.SetItemID(*id)
+ _u = _u.SetItemID(*id)
}
- return au
+ return _u
}
// SetItem sets the "item" edge to the Item entity.
-func (au *AttachmentUpdate) SetItem(i *Item) *AttachmentUpdate {
- return au.SetItemID(i.ID)
+func (_u *AttachmentUpdate) SetItem(v *Item) *AttachmentUpdate {
+ return _u.SetItemID(v.ID)
}
// SetThumbnailID sets the "thumbnail" edge to the Attachment entity by ID.
-func (au *AttachmentUpdate) SetThumbnailID(id uuid.UUID) *AttachmentUpdate {
- au.mutation.SetThumbnailID(id)
- return au
+func (_u *AttachmentUpdate) SetThumbnailID(id uuid.UUID) *AttachmentUpdate {
+ _u.mutation.SetThumbnailID(id)
+ return _u
}
// SetNillableThumbnailID sets the "thumbnail" edge to the Attachment entity by ID if the given value is not nil.
-func (au *AttachmentUpdate) SetNillableThumbnailID(id *uuid.UUID) *AttachmentUpdate {
+func (_u *AttachmentUpdate) SetNillableThumbnailID(id *uuid.UUID) *AttachmentUpdate {
if id != nil {
- au = au.SetThumbnailID(*id)
+ _u = _u.SetThumbnailID(*id)
}
- return au
+ return _u
}
// SetThumbnail sets the "thumbnail" edge to the Attachment entity.
-func (au *AttachmentUpdate) SetThumbnail(a *Attachment) *AttachmentUpdate {
- return au.SetThumbnailID(a.ID)
+func (_u *AttachmentUpdate) SetThumbnail(v *Attachment) *AttachmentUpdate {
+ return _u.SetThumbnailID(v.ID)
}
// Mutation returns the AttachmentMutation object of the builder.
-func (au *AttachmentUpdate) Mutation() *AttachmentMutation {
- return au.mutation
+func (_u *AttachmentUpdate) Mutation() *AttachmentMutation {
+ return _u.mutation
}
// ClearItem clears the "item" edge to the Item entity.
-func (au *AttachmentUpdate) ClearItem() *AttachmentUpdate {
- au.mutation.ClearItem()
- return au
+func (_u *AttachmentUpdate) ClearItem() *AttachmentUpdate {
+ _u.mutation.ClearItem()
+ return _u
}
// ClearThumbnail clears the "thumbnail" edge to the Attachment entity.
-func (au *AttachmentUpdate) ClearThumbnail() *AttachmentUpdate {
- au.mutation.ClearThumbnail()
- return au
+func (_u *AttachmentUpdate) ClearThumbnail() *AttachmentUpdate {
+ _u.mutation.ClearThumbnail()
+ return _u
}
// Save executes the query and returns the number of nodes affected by the update operation.
-func (au *AttachmentUpdate) Save(ctx context.Context) (int, error) {
- au.defaults()
- return withHooks(ctx, au.sqlSave, au.mutation, au.hooks)
+func (_u *AttachmentUpdate) Save(ctx context.Context) (int, error) {
+ _u.defaults()
+ return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
}
// SaveX is like Save, but panics if an error occurs.
-func (au *AttachmentUpdate) SaveX(ctx context.Context) int {
- affected, err := au.Save(ctx)
+func (_u *AttachmentUpdate) SaveX(ctx context.Context) int {
+ affected, err := _u.Save(ctx)
if err != nil {
panic(err)
}
@@ -177,29 +177,29 @@ func (au *AttachmentUpdate) SaveX(ctx context.Context) int {
}
// Exec executes the query.
-func (au *AttachmentUpdate) Exec(ctx context.Context) error {
- _, err := au.Save(ctx)
+func (_u *AttachmentUpdate) Exec(ctx context.Context) error {
+ _, err := _u.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
-func (au *AttachmentUpdate) ExecX(ctx context.Context) {
- if err := au.Exec(ctx); err != nil {
+func (_u *AttachmentUpdate) ExecX(ctx context.Context) {
+ if err := _u.Exec(ctx); err != nil {
panic(err)
}
}
// defaults sets the default values of the builder before save.
-func (au *AttachmentUpdate) defaults() {
- if _, ok := au.mutation.UpdatedAt(); !ok {
+func (_u *AttachmentUpdate) defaults() {
+ if _, ok := _u.mutation.UpdatedAt(); !ok {
v := attachment.UpdateDefaultUpdatedAt()
- au.mutation.SetUpdatedAt(v)
+ _u.mutation.SetUpdatedAt(v)
}
}
// check runs all checks and user-defined validators on the builder.
-func (au *AttachmentUpdate) check() error {
- if v, ok := au.mutation.GetType(); ok {
+func (_u *AttachmentUpdate) check() error {
+ if v, ok := _u.mutation.GetType(); ok {
if err := attachment.TypeValidator(v); err != nil {
return &ValidationError{Name: "type", err: fmt.Errorf(`ent: validator failed for field "Attachment.type": %w`, err)}
}
@@ -207,37 +207,37 @@ func (au *AttachmentUpdate) check() error {
return nil
}
-func (au *AttachmentUpdate) sqlSave(ctx context.Context) (n int, err error) {
- if err := au.check(); err != nil {
- return n, err
+func (_u *AttachmentUpdate) sqlSave(ctx context.Context) (_node int, err error) {
+ if err := _u.check(); err != nil {
+ return _node, err
}
_spec := sqlgraph.NewUpdateSpec(attachment.Table, attachment.Columns, sqlgraph.NewFieldSpec(attachment.FieldID, field.TypeUUID))
- if ps := au.mutation.predicates; len(ps) > 0 {
+ if ps := _u.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
- if value, ok := au.mutation.UpdatedAt(); ok {
+ if value, ok := _u.mutation.UpdatedAt(); ok {
_spec.SetField(attachment.FieldUpdatedAt, field.TypeTime, value)
}
- if value, ok := au.mutation.GetType(); ok {
+ if value, ok := _u.mutation.GetType(); ok {
_spec.SetField(attachment.FieldType, field.TypeEnum, value)
}
- if value, ok := au.mutation.Primary(); ok {
+ if value, ok := _u.mutation.Primary(); ok {
_spec.SetField(attachment.FieldPrimary, field.TypeBool, value)
}
- if value, ok := au.mutation.Title(); ok {
+ if value, ok := _u.mutation.Title(); ok {
_spec.SetField(attachment.FieldTitle, field.TypeString, value)
}
- if value, ok := au.mutation.Path(); ok {
+ if value, ok := _u.mutation.Path(); ok {
_spec.SetField(attachment.FieldPath, field.TypeString, value)
}
- if value, ok := au.mutation.MimeType(); ok {
+ if value, ok := _u.mutation.MimeType(); ok {
_spec.SetField(attachment.FieldMimeType, field.TypeString, value)
}
- if au.mutation.ItemCleared() {
+ if _u.mutation.ItemCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -250,7 +250,7 @@ func (au *AttachmentUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := au.mutation.ItemIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.ItemIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -266,7 +266,7 @@ func (au *AttachmentUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- if au.mutation.ThumbnailCleared() {
+ if _u.mutation.ThumbnailCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2O,
Inverse: false,
@@ -279,7 +279,7 @@ func (au *AttachmentUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := au.mutation.ThumbnailIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.ThumbnailIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2O,
Inverse: false,
@@ -295,7 +295,7 @@ func (au *AttachmentUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- if n, err = sqlgraph.UpdateNodes(ctx, au.driver, _spec); err != nil {
+ if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil {
if _, ok := err.(*sqlgraph.NotFoundError); ok {
err = &NotFoundError{attachment.Label}
} else if sqlgraph.IsConstraintError(err) {
@@ -303,8 +303,8 @@ func (au *AttachmentUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
return 0, err
}
- au.mutation.done = true
- return n, nil
+ _u.mutation.done = true
+ return _node, nil
}
// AttachmentUpdateOne is the builder for updating a single Attachment entity.
@@ -316,158 +316,158 @@ type AttachmentUpdateOne struct {
}
// SetUpdatedAt sets the "updated_at" field.
-func (auo *AttachmentUpdateOne) SetUpdatedAt(t time.Time) *AttachmentUpdateOne {
- auo.mutation.SetUpdatedAt(t)
- return auo
+func (_u *AttachmentUpdateOne) SetUpdatedAt(v time.Time) *AttachmentUpdateOne {
+ _u.mutation.SetUpdatedAt(v)
+ return _u
}
// SetType sets the "type" field.
-func (auo *AttachmentUpdateOne) SetType(a attachment.Type) *AttachmentUpdateOne {
- auo.mutation.SetType(a)
- return auo
+func (_u *AttachmentUpdateOne) SetType(v attachment.Type) *AttachmentUpdateOne {
+ _u.mutation.SetType(v)
+ return _u
}
// SetNillableType sets the "type" field if the given value is not nil.
-func (auo *AttachmentUpdateOne) SetNillableType(a *attachment.Type) *AttachmentUpdateOne {
- if a != nil {
- auo.SetType(*a)
+func (_u *AttachmentUpdateOne) SetNillableType(v *attachment.Type) *AttachmentUpdateOne {
+ if v != nil {
+ _u.SetType(*v)
}
- return auo
+ return _u
}
// SetPrimary sets the "primary" field.
-func (auo *AttachmentUpdateOne) SetPrimary(b bool) *AttachmentUpdateOne {
- auo.mutation.SetPrimary(b)
- return auo
+func (_u *AttachmentUpdateOne) SetPrimary(v bool) *AttachmentUpdateOne {
+ _u.mutation.SetPrimary(v)
+ return _u
}
// SetNillablePrimary sets the "primary" field if the given value is not nil.
-func (auo *AttachmentUpdateOne) SetNillablePrimary(b *bool) *AttachmentUpdateOne {
- if b != nil {
- auo.SetPrimary(*b)
+func (_u *AttachmentUpdateOne) SetNillablePrimary(v *bool) *AttachmentUpdateOne {
+ if v != nil {
+ _u.SetPrimary(*v)
}
- return auo
+ return _u
}
// SetTitle sets the "title" field.
-func (auo *AttachmentUpdateOne) SetTitle(s string) *AttachmentUpdateOne {
- auo.mutation.SetTitle(s)
- return auo
+func (_u *AttachmentUpdateOne) SetTitle(v string) *AttachmentUpdateOne {
+ _u.mutation.SetTitle(v)
+ return _u
}
// SetNillableTitle sets the "title" field if the given value is not nil.
-func (auo *AttachmentUpdateOne) SetNillableTitle(s *string) *AttachmentUpdateOne {
- if s != nil {
- auo.SetTitle(*s)
+func (_u *AttachmentUpdateOne) SetNillableTitle(v *string) *AttachmentUpdateOne {
+ if v != nil {
+ _u.SetTitle(*v)
}
- return auo
+ return _u
}
// SetPath sets the "path" field.
-func (auo *AttachmentUpdateOne) SetPath(s string) *AttachmentUpdateOne {
- auo.mutation.SetPath(s)
- return auo
+func (_u *AttachmentUpdateOne) SetPath(v string) *AttachmentUpdateOne {
+ _u.mutation.SetPath(v)
+ return _u
}
// SetNillablePath sets the "path" field if the given value is not nil.
-func (auo *AttachmentUpdateOne) SetNillablePath(s *string) *AttachmentUpdateOne {
- if s != nil {
- auo.SetPath(*s)
+func (_u *AttachmentUpdateOne) SetNillablePath(v *string) *AttachmentUpdateOne {
+ if v != nil {
+ _u.SetPath(*v)
}
- return auo
+ return _u
}
// SetMimeType sets the "mime_type" field.
-func (auo *AttachmentUpdateOne) SetMimeType(s string) *AttachmentUpdateOne {
- auo.mutation.SetMimeType(s)
- return auo
+func (_u *AttachmentUpdateOne) SetMimeType(v string) *AttachmentUpdateOne {
+ _u.mutation.SetMimeType(v)
+ return _u
}
// SetNillableMimeType sets the "mime_type" field if the given value is not nil.
-func (auo *AttachmentUpdateOne) SetNillableMimeType(s *string) *AttachmentUpdateOne {
- if s != nil {
- auo.SetMimeType(*s)
+func (_u *AttachmentUpdateOne) SetNillableMimeType(v *string) *AttachmentUpdateOne {
+ if v != nil {
+ _u.SetMimeType(*v)
}
- return auo
+ return _u
}
// SetItemID sets the "item" edge to the Item entity by ID.
-func (auo *AttachmentUpdateOne) SetItemID(id uuid.UUID) *AttachmentUpdateOne {
- auo.mutation.SetItemID(id)
- return auo
+func (_u *AttachmentUpdateOne) SetItemID(id uuid.UUID) *AttachmentUpdateOne {
+ _u.mutation.SetItemID(id)
+ return _u
}
// SetNillableItemID sets the "item" edge to the Item entity by ID if the given value is not nil.
-func (auo *AttachmentUpdateOne) SetNillableItemID(id *uuid.UUID) *AttachmentUpdateOne {
+func (_u *AttachmentUpdateOne) SetNillableItemID(id *uuid.UUID) *AttachmentUpdateOne {
if id != nil {
- auo = auo.SetItemID(*id)
+ _u = _u.SetItemID(*id)
}
- return auo
+ return _u
}
// SetItem sets the "item" edge to the Item entity.
-func (auo *AttachmentUpdateOne) SetItem(i *Item) *AttachmentUpdateOne {
- return auo.SetItemID(i.ID)
+func (_u *AttachmentUpdateOne) SetItem(v *Item) *AttachmentUpdateOne {
+ return _u.SetItemID(v.ID)
}
// SetThumbnailID sets the "thumbnail" edge to the Attachment entity by ID.
-func (auo *AttachmentUpdateOne) SetThumbnailID(id uuid.UUID) *AttachmentUpdateOne {
- auo.mutation.SetThumbnailID(id)
- return auo
+func (_u *AttachmentUpdateOne) SetThumbnailID(id uuid.UUID) *AttachmentUpdateOne {
+ _u.mutation.SetThumbnailID(id)
+ return _u
}
// SetNillableThumbnailID sets the "thumbnail" edge to the Attachment entity by ID if the given value is not nil.
-func (auo *AttachmentUpdateOne) SetNillableThumbnailID(id *uuid.UUID) *AttachmentUpdateOne {
+func (_u *AttachmentUpdateOne) SetNillableThumbnailID(id *uuid.UUID) *AttachmentUpdateOne {
if id != nil {
- auo = auo.SetThumbnailID(*id)
+ _u = _u.SetThumbnailID(*id)
}
- return auo
+ return _u
}
// SetThumbnail sets the "thumbnail" edge to the Attachment entity.
-func (auo *AttachmentUpdateOne) SetThumbnail(a *Attachment) *AttachmentUpdateOne {
- return auo.SetThumbnailID(a.ID)
+func (_u *AttachmentUpdateOne) SetThumbnail(v *Attachment) *AttachmentUpdateOne {
+ return _u.SetThumbnailID(v.ID)
}
// Mutation returns the AttachmentMutation object of the builder.
-func (auo *AttachmentUpdateOne) Mutation() *AttachmentMutation {
- return auo.mutation
+func (_u *AttachmentUpdateOne) Mutation() *AttachmentMutation {
+ return _u.mutation
}
// ClearItem clears the "item" edge to the Item entity.
-func (auo *AttachmentUpdateOne) ClearItem() *AttachmentUpdateOne {
- auo.mutation.ClearItem()
- return auo
+func (_u *AttachmentUpdateOne) ClearItem() *AttachmentUpdateOne {
+ _u.mutation.ClearItem()
+ return _u
}
// ClearThumbnail clears the "thumbnail" edge to the Attachment entity.
-func (auo *AttachmentUpdateOne) ClearThumbnail() *AttachmentUpdateOne {
- auo.mutation.ClearThumbnail()
- return auo
+func (_u *AttachmentUpdateOne) ClearThumbnail() *AttachmentUpdateOne {
+ _u.mutation.ClearThumbnail()
+ return _u
}
// Where appends a list predicates to the AttachmentUpdate builder.
-func (auo *AttachmentUpdateOne) Where(ps ...predicate.Attachment) *AttachmentUpdateOne {
- auo.mutation.Where(ps...)
- return auo
+func (_u *AttachmentUpdateOne) Where(ps ...predicate.Attachment) *AttachmentUpdateOne {
+ _u.mutation.Where(ps...)
+ return _u
}
// Select allows selecting one or more fields (columns) of the returned entity.
// The default is selecting all fields defined in the entity schema.
-func (auo *AttachmentUpdateOne) Select(field string, fields ...string) *AttachmentUpdateOne {
- auo.fields = append([]string{field}, fields...)
- return auo
+func (_u *AttachmentUpdateOne) Select(field string, fields ...string) *AttachmentUpdateOne {
+ _u.fields = append([]string{field}, fields...)
+ return _u
}
// Save executes the query and returns the updated Attachment entity.
-func (auo *AttachmentUpdateOne) Save(ctx context.Context) (*Attachment, error) {
- auo.defaults()
- return withHooks(ctx, auo.sqlSave, auo.mutation, auo.hooks)
+func (_u *AttachmentUpdateOne) Save(ctx context.Context) (*Attachment, error) {
+ _u.defaults()
+ return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
}
// SaveX is like Save, but panics if an error occurs.
-func (auo *AttachmentUpdateOne) SaveX(ctx context.Context) *Attachment {
- node, err := auo.Save(ctx)
+func (_u *AttachmentUpdateOne) SaveX(ctx context.Context) *Attachment {
+ node, err := _u.Save(ctx)
if err != nil {
panic(err)
}
@@ -475,29 +475,29 @@ func (auo *AttachmentUpdateOne) SaveX(ctx context.Context) *Attachment {
}
// Exec executes the query on the entity.
-func (auo *AttachmentUpdateOne) Exec(ctx context.Context) error {
- _, err := auo.Save(ctx)
+func (_u *AttachmentUpdateOne) Exec(ctx context.Context) error {
+ _, err := _u.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
-func (auo *AttachmentUpdateOne) ExecX(ctx context.Context) {
- if err := auo.Exec(ctx); err != nil {
+func (_u *AttachmentUpdateOne) ExecX(ctx context.Context) {
+ if err := _u.Exec(ctx); err != nil {
panic(err)
}
}
// defaults sets the default values of the builder before save.
-func (auo *AttachmentUpdateOne) defaults() {
- if _, ok := auo.mutation.UpdatedAt(); !ok {
+func (_u *AttachmentUpdateOne) defaults() {
+ if _, ok := _u.mutation.UpdatedAt(); !ok {
v := attachment.UpdateDefaultUpdatedAt()
- auo.mutation.SetUpdatedAt(v)
+ _u.mutation.SetUpdatedAt(v)
}
}
// check runs all checks and user-defined validators on the builder.
-func (auo *AttachmentUpdateOne) check() error {
- if v, ok := auo.mutation.GetType(); ok {
+func (_u *AttachmentUpdateOne) check() error {
+ if v, ok := _u.mutation.GetType(); ok {
if err := attachment.TypeValidator(v); err != nil {
return &ValidationError{Name: "type", err: fmt.Errorf(`ent: validator failed for field "Attachment.type": %w`, err)}
}
@@ -505,17 +505,17 @@ func (auo *AttachmentUpdateOne) check() error {
return nil
}
-func (auo *AttachmentUpdateOne) sqlSave(ctx context.Context) (_node *Attachment, err error) {
- if err := auo.check(); err != nil {
+func (_u *AttachmentUpdateOne) sqlSave(ctx context.Context) (_node *Attachment, err error) {
+ if err := _u.check(); err != nil {
return _node, err
}
_spec := sqlgraph.NewUpdateSpec(attachment.Table, attachment.Columns, sqlgraph.NewFieldSpec(attachment.FieldID, field.TypeUUID))
- id, ok := auo.mutation.ID()
+ id, ok := _u.mutation.ID()
if !ok {
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Attachment.id" for update`)}
}
_spec.Node.ID.Value = id
- if fields := auo.fields; len(fields) > 0 {
+ if fields := _u.fields; len(fields) > 0 {
_spec.Node.Columns = make([]string, 0, len(fields))
_spec.Node.Columns = append(_spec.Node.Columns, attachment.FieldID)
for _, f := range fields {
@@ -527,32 +527,32 @@ func (auo *AttachmentUpdateOne) sqlSave(ctx context.Context) (_node *Attachment,
}
}
}
- if ps := auo.mutation.predicates; len(ps) > 0 {
+ if ps := _u.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
- if value, ok := auo.mutation.UpdatedAt(); ok {
+ if value, ok := _u.mutation.UpdatedAt(); ok {
_spec.SetField(attachment.FieldUpdatedAt, field.TypeTime, value)
}
- if value, ok := auo.mutation.GetType(); ok {
+ if value, ok := _u.mutation.GetType(); ok {
_spec.SetField(attachment.FieldType, field.TypeEnum, value)
}
- if value, ok := auo.mutation.Primary(); ok {
+ if value, ok := _u.mutation.Primary(); ok {
_spec.SetField(attachment.FieldPrimary, field.TypeBool, value)
}
- if value, ok := auo.mutation.Title(); ok {
+ if value, ok := _u.mutation.Title(); ok {
_spec.SetField(attachment.FieldTitle, field.TypeString, value)
}
- if value, ok := auo.mutation.Path(); ok {
+ if value, ok := _u.mutation.Path(); ok {
_spec.SetField(attachment.FieldPath, field.TypeString, value)
}
- if value, ok := auo.mutation.MimeType(); ok {
+ if value, ok := _u.mutation.MimeType(); ok {
_spec.SetField(attachment.FieldMimeType, field.TypeString, value)
}
- if auo.mutation.ItemCleared() {
+ if _u.mutation.ItemCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -565,7 +565,7 @@ func (auo *AttachmentUpdateOne) sqlSave(ctx context.Context) (_node *Attachment,
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := auo.mutation.ItemIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.ItemIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -581,7 +581,7 @@ func (auo *AttachmentUpdateOne) sqlSave(ctx context.Context) (_node *Attachment,
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- if auo.mutation.ThumbnailCleared() {
+ if _u.mutation.ThumbnailCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2O,
Inverse: false,
@@ -594,7 +594,7 @@ func (auo *AttachmentUpdateOne) sqlSave(ctx context.Context) (_node *Attachment,
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := auo.mutation.ThumbnailIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.ThumbnailIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2O,
Inverse: false,
@@ -610,10 +610,10 @@ func (auo *AttachmentUpdateOne) sqlSave(ctx context.Context) (_node *Attachment,
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- _node = &Attachment{config: auo.config}
+ _node = &Attachment{config: _u.config}
_spec.Assign = _node.assignValues
_spec.ScanValues = _node.scanValues
- if err = sqlgraph.UpdateNode(ctx, auo.driver, _spec); err != nil {
+ if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil {
if _, ok := err.(*sqlgraph.NotFoundError); ok {
err = &NotFoundError{attachment.Label}
} else if sqlgraph.IsConstraintError(err) {
@@ -621,6 +621,6 @@ func (auo *AttachmentUpdateOne) sqlSave(ctx context.Context) (_node *Attachment,
}
return nil, err
}
- auo.mutation.done = true
+ _u.mutation.done = true
return _node, nil
}
diff --git a/backend/internal/data/ent/authroles.go b/backend/internal/data/ent/authroles.go
index 2192ef93..2b36e8cf 100644
--- a/backend/internal/data/ent/authroles.go
+++ b/backend/internal/data/ent/authroles.go
@@ -67,7 +67,7 @@ func (*AuthRoles) scanValues(columns []string) ([]any, error) {
// assignValues assigns the values that were returned from sql.Rows (after scanning)
// to the AuthRoles fields.
-func (ar *AuthRoles) assignValues(columns []string, values []any) error {
+func (_m *AuthRoles) assignValues(columns []string, values []any) error {
if m, n := len(values), len(columns); m < n {
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
}
@@ -78,22 +78,22 @@ func (ar *AuthRoles) assignValues(columns []string, values []any) error {
if !ok {
return fmt.Errorf("unexpected type %T for field id", value)
}
- ar.ID = int(value.Int64)
+ _m.ID = int(value.Int64)
case authroles.FieldRole:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field role", values[i])
} else if value.Valid {
- ar.Role = authroles.Role(value.String)
+ _m.Role = authroles.Role(value.String)
}
case authroles.ForeignKeys[0]:
if value, ok := values[i].(*sql.NullScanner); !ok {
return fmt.Errorf("unexpected type %T for field auth_tokens_roles", values[i])
} else if value.Valid {
- ar.auth_tokens_roles = new(uuid.UUID)
- *ar.auth_tokens_roles = *value.S.(*uuid.UUID)
+ _m.auth_tokens_roles = new(uuid.UUID)
+ *_m.auth_tokens_roles = *value.S.(*uuid.UUID)
}
default:
- ar.selectValues.Set(columns[i], values[i])
+ _m.selectValues.Set(columns[i], values[i])
}
}
return nil
@@ -101,40 +101,40 @@ func (ar *AuthRoles) assignValues(columns []string, values []any) error {
// Value returns the ent.Value that was dynamically selected and assigned to the AuthRoles.
// This includes values selected through modifiers, order, etc.
-func (ar *AuthRoles) Value(name string) (ent.Value, error) {
- return ar.selectValues.Get(name)
+func (_m *AuthRoles) Value(name string) (ent.Value, error) {
+ return _m.selectValues.Get(name)
}
// QueryToken queries the "token" edge of the AuthRoles entity.
-func (ar *AuthRoles) QueryToken() *AuthTokensQuery {
- return NewAuthRolesClient(ar.config).QueryToken(ar)
+func (_m *AuthRoles) QueryToken() *AuthTokensQuery {
+ return NewAuthRolesClient(_m.config).QueryToken(_m)
}
// Update returns a builder for updating this AuthRoles.
// Note that you need to call AuthRoles.Unwrap() before calling this method if this AuthRoles
// was returned from a transaction, and the transaction was committed or rolled back.
-func (ar *AuthRoles) Update() *AuthRolesUpdateOne {
- return NewAuthRolesClient(ar.config).UpdateOne(ar)
+func (_m *AuthRoles) Update() *AuthRolesUpdateOne {
+ return NewAuthRolesClient(_m.config).UpdateOne(_m)
}
// Unwrap unwraps the AuthRoles 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 *AuthRoles) Unwrap() *AuthRoles {
- _tx, ok := ar.config.driver.(*txDriver)
+func (_m *AuthRoles) Unwrap() *AuthRoles {
+ _tx, ok := _m.config.driver.(*txDriver)
if !ok {
panic("ent: AuthRoles is not a transactional entity")
}
- ar.config.driver = _tx.drv
- return ar
+ _m.config.driver = _tx.drv
+ return _m
}
// String implements the fmt.Stringer.
-func (ar *AuthRoles) String() string {
+func (_m *AuthRoles) String() string {
var builder strings.Builder
builder.WriteString("AuthRoles(")
- builder.WriteString(fmt.Sprintf("id=%v, ", ar.ID))
+ builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
builder.WriteString("role=")
- builder.WriteString(fmt.Sprintf("%v", ar.Role))
+ builder.WriteString(fmt.Sprintf("%v", _m.Role))
builder.WriteByte(')')
return builder.String()
}
diff --git a/backend/internal/data/ent/authroles_create.go b/backend/internal/data/ent/authroles_create.go
index 1d2fbe6c..e1815469 100644
--- a/backend/internal/data/ent/authroles_create.go
+++ b/backend/internal/data/ent/authroles_create.go
@@ -22,52 +22,52 @@ type AuthRolesCreate struct {
}
// SetRole sets the "role" field.
-func (arc *AuthRolesCreate) SetRole(a authroles.Role) *AuthRolesCreate {
- arc.mutation.SetRole(a)
- return arc
+func (_c *AuthRolesCreate) SetRole(v authroles.Role) *AuthRolesCreate {
+ _c.mutation.SetRole(v)
+ return _c
}
// SetNillableRole sets the "role" field if the given value is not nil.
-func (arc *AuthRolesCreate) SetNillableRole(a *authroles.Role) *AuthRolesCreate {
- if a != nil {
- arc.SetRole(*a)
+func (_c *AuthRolesCreate) SetNillableRole(v *authroles.Role) *AuthRolesCreate {
+ if v != nil {
+ _c.SetRole(*v)
}
- return arc
+ return _c
}
// SetTokenID sets the "token" edge to the AuthTokens entity by ID.
-func (arc *AuthRolesCreate) SetTokenID(id uuid.UUID) *AuthRolesCreate {
- arc.mutation.SetTokenID(id)
- return arc
+func (_c *AuthRolesCreate) SetTokenID(id uuid.UUID) *AuthRolesCreate {
+ _c.mutation.SetTokenID(id)
+ return _c
}
// SetNillableTokenID sets the "token" edge to the AuthTokens entity by ID if the given value is not nil.
-func (arc *AuthRolesCreate) SetNillableTokenID(id *uuid.UUID) *AuthRolesCreate {
+func (_c *AuthRolesCreate) SetNillableTokenID(id *uuid.UUID) *AuthRolesCreate {
if id != nil {
- arc = arc.SetTokenID(*id)
+ _c = _c.SetTokenID(*id)
}
- return arc
+ return _c
}
// SetToken sets the "token" edge to the AuthTokens entity.
-func (arc *AuthRolesCreate) SetToken(a *AuthTokens) *AuthRolesCreate {
- return arc.SetTokenID(a.ID)
+func (_c *AuthRolesCreate) SetToken(v *AuthTokens) *AuthRolesCreate {
+ return _c.SetTokenID(v.ID)
}
// Mutation returns the AuthRolesMutation object of the builder.
-func (arc *AuthRolesCreate) Mutation() *AuthRolesMutation {
- return arc.mutation
+func (_c *AuthRolesCreate) Mutation() *AuthRolesMutation {
+ return _c.mutation
}
// Save creates the AuthRoles in the database.
-func (arc *AuthRolesCreate) Save(ctx context.Context) (*AuthRoles, error) {
- arc.defaults()
- return withHooks(ctx, arc.sqlSave, arc.mutation, arc.hooks)
+func (_c *AuthRolesCreate) Save(ctx context.Context) (*AuthRoles, error) {
+ _c.defaults()
+ return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
}
// SaveX calls Save and panics if Save returns an error.
-func (arc *AuthRolesCreate) SaveX(ctx context.Context) *AuthRoles {
- v, err := arc.Save(ctx)
+func (_c *AuthRolesCreate) SaveX(ctx context.Context) *AuthRoles {
+ v, err := _c.Save(ctx)
if err != nil {
panic(err)
}
@@ -75,32 +75,32 @@ func (arc *AuthRolesCreate) SaveX(ctx context.Context) *AuthRoles {
}
// Exec executes the query.
-func (arc *AuthRolesCreate) Exec(ctx context.Context) error {
- _, err := arc.Save(ctx)
+func (_c *AuthRolesCreate) Exec(ctx context.Context) error {
+ _, err := _c.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
-func (arc *AuthRolesCreate) ExecX(ctx context.Context) {
- if err := arc.Exec(ctx); err != nil {
+func (_c *AuthRolesCreate) ExecX(ctx context.Context) {
+ if err := _c.Exec(ctx); err != nil {
panic(err)
}
}
// defaults sets the default values of the builder before save.
-func (arc *AuthRolesCreate) defaults() {
- if _, ok := arc.mutation.Role(); !ok {
+func (_c *AuthRolesCreate) defaults() {
+ if _, ok := _c.mutation.Role(); !ok {
v := authroles.DefaultRole
- arc.mutation.SetRole(v)
+ _c.mutation.SetRole(v)
}
}
// check runs all checks and user-defined validators on the builder.
-func (arc *AuthRolesCreate) check() error {
- if _, ok := arc.mutation.Role(); !ok {
+func (_c *AuthRolesCreate) check() error {
+ if _, ok := _c.mutation.Role(); !ok {
return &ValidationError{Name: "role", err: errors.New(`ent: missing required field "AuthRoles.role"`)}
}
- if v, ok := arc.mutation.Role(); ok {
+ if v, ok := _c.mutation.Role(); ok {
if err := authroles.RoleValidator(v); err != nil {
return &ValidationError{Name: "role", err: fmt.Errorf(`ent: validator failed for field "AuthRoles.role": %w`, err)}
}
@@ -108,12 +108,12 @@ func (arc *AuthRolesCreate) check() error {
return nil
}
-func (arc *AuthRolesCreate) sqlSave(ctx context.Context) (*AuthRoles, error) {
- if err := arc.check(); err != nil {
+func (_c *AuthRolesCreate) sqlSave(ctx context.Context) (*AuthRoles, error) {
+ if err := _c.check(); err != nil {
return nil, err
}
- _node, _spec := arc.createSpec()
- if err := sqlgraph.CreateNode(ctx, arc.driver, _spec); err != nil {
+ _node, _spec := _c.createSpec()
+ if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil {
if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
@@ -121,21 +121,21 @@ func (arc *AuthRolesCreate) sqlSave(ctx context.Context) (*AuthRoles, error) {
}
id := _spec.ID.Value.(int64)
_node.ID = int(id)
- arc.mutation.id = &_node.ID
- arc.mutation.done = true
+ _c.mutation.id = &_node.ID
+ _c.mutation.done = true
return _node, nil
}
-func (arc *AuthRolesCreate) createSpec() (*AuthRoles, *sqlgraph.CreateSpec) {
+func (_c *AuthRolesCreate) createSpec() (*AuthRoles, *sqlgraph.CreateSpec) {
var (
- _node = &AuthRoles{config: arc.config}
+ _node = &AuthRoles{config: _c.config}
_spec = sqlgraph.NewCreateSpec(authroles.Table, sqlgraph.NewFieldSpec(authroles.FieldID, field.TypeInt))
)
- if value, ok := arc.mutation.Role(); ok {
+ if value, ok := _c.mutation.Role(); ok {
_spec.SetField(authroles.FieldRole, field.TypeEnum, value)
_node.Role = value
}
- if nodes := arc.mutation.TokenIDs(); len(nodes) > 0 {
+ if nodes := _c.mutation.TokenIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2O,
Inverse: true,
@@ -163,16 +163,16 @@ type AuthRolesCreateBulk struct {
}
// Save creates the AuthRoles entities in the database.
-func (arcb *AuthRolesCreateBulk) Save(ctx context.Context) ([]*AuthRoles, error) {
- if arcb.err != nil {
- return nil, arcb.err
- }
- specs := make([]*sqlgraph.CreateSpec, len(arcb.builders))
- nodes := make([]*AuthRoles, len(arcb.builders))
- mutators := make([]Mutator, len(arcb.builders))
- for i := range arcb.builders {
+func (_c *AuthRolesCreateBulk) Save(ctx context.Context) ([]*AuthRoles, error) {
+ if _c.err != nil {
+ return nil, _c.err
+ }
+ specs := make([]*sqlgraph.CreateSpec, len(_c.builders))
+ nodes := make([]*AuthRoles, len(_c.builders))
+ mutators := make([]Mutator, len(_c.builders))
+ for i := range _c.builders {
func(i int, root context.Context) {
- builder := arcb.builders[i]
+ builder := _c.builders[i]
builder.defaults()
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
mutation, ok := m.(*AuthRolesMutation)
@@ -186,11 +186,11 @@ func (arcb *AuthRolesCreateBulk) Save(ctx context.Context) ([]*AuthRoles, error)
var err error
nodes[i], specs[i] = builder.createSpec()
if i < len(mutators)-1 {
- _, err = mutators[i+1].Mutate(root, arcb.builders[i+1].mutation)
+ _, err = mutators[i+1].Mutate(root, _c.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, spec); err != nil {
+ if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil {
if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
@@ -214,7 +214,7 @@ func (arcb *AuthRolesCreateBulk) Save(ctx context.Context) ([]*AuthRoles, error)
}(i, ctx)
}
if len(mutators) > 0 {
- if _, err := mutators[0].Mutate(ctx, arcb.builders[0].mutation); err != nil {
+ if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil {
return nil, err
}
}
@@ -222,8 +222,8 @@ func (arcb *AuthRolesCreateBulk) Save(ctx context.Context) ([]*AuthRoles, error)
}
// SaveX is like Save, but panics if an error occurs.
-func (arcb *AuthRolesCreateBulk) SaveX(ctx context.Context) []*AuthRoles {
- v, err := arcb.Save(ctx)
+func (_c *AuthRolesCreateBulk) SaveX(ctx context.Context) []*AuthRoles {
+ v, err := _c.Save(ctx)
if err != nil {
panic(err)
}
@@ -231,14 +231,14 @@ func (arcb *AuthRolesCreateBulk) SaveX(ctx context.Context) []*AuthRoles {
}
// Exec executes the query.
-func (arcb *AuthRolesCreateBulk) Exec(ctx context.Context) error {
- _, err := arcb.Save(ctx)
+func (_c *AuthRolesCreateBulk) Exec(ctx context.Context) error {
+ _, err := _c.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
-func (arcb *AuthRolesCreateBulk) ExecX(ctx context.Context) {
- if err := arcb.Exec(ctx); err != nil {
+func (_c *AuthRolesCreateBulk) ExecX(ctx context.Context) {
+ if err := _c.Exec(ctx); err != nil {
panic(err)
}
}
diff --git a/backend/internal/data/ent/authroles_delete.go b/backend/internal/data/ent/authroles_delete.go
index 5bb902c2..5a00ffc9 100644
--- a/backend/internal/data/ent/authroles_delete.go
+++ b/backend/internal/data/ent/authroles_delete.go
@@ -20,56 +20,56 @@ type AuthRolesDelete struct {
}
// Where appends a list predicates to the AuthRolesDelete builder.
-func (ard *AuthRolesDelete) Where(ps ...predicate.AuthRoles) *AuthRolesDelete {
- ard.mutation.Where(ps...)
- return ard
+func (_d *AuthRolesDelete) Where(ps ...predicate.AuthRoles) *AuthRolesDelete {
+ _d.mutation.Where(ps...)
+ return _d
}
// Exec executes the deletion query and returns how many vertices were deleted.
-func (ard *AuthRolesDelete) Exec(ctx context.Context) (int, error) {
- return withHooks(ctx, ard.sqlExec, ard.mutation, ard.hooks)
+func (_d *AuthRolesDelete) Exec(ctx context.Context) (int, error) {
+ return withHooks(ctx, _d.sqlExec, _d.mutation, _d.hooks)
}
// ExecX is like Exec, but panics if an error occurs.
-func (ard *AuthRolesDelete) ExecX(ctx context.Context) int {
- n, err := ard.Exec(ctx)
+func (_d *AuthRolesDelete) ExecX(ctx context.Context) int {
+ n, err := _d.Exec(ctx)
if err != nil {
panic(err)
}
return n
}
-func (ard *AuthRolesDelete) sqlExec(ctx context.Context) (int, error) {
+func (_d *AuthRolesDelete) sqlExec(ctx context.Context) (int, error) {
_spec := sqlgraph.NewDeleteSpec(authroles.Table, sqlgraph.NewFieldSpec(authroles.FieldID, field.TypeInt))
- if ps := ard.mutation.predicates; len(ps) > 0 {
+ if ps := _d.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
- affected, err := sqlgraph.DeleteNodes(ctx, ard.driver, _spec)
+ affected, err := sqlgraph.DeleteNodes(ctx, _d.driver, _spec)
if err != nil && sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
- ard.mutation.done = true
+ _d.mutation.done = true
return affected, err
}
// AuthRolesDeleteOne is the builder for deleting a single AuthRoles entity.
type AuthRolesDeleteOne struct {
- ard *AuthRolesDelete
+ _d *AuthRolesDelete
}
// Where appends a list predicates to the AuthRolesDelete builder.
-func (ardo *AuthRolesDeleteOne) Where(ps ...predicate.AuthRoles) *AuthRolesDeleteOne {
- ardo.ard.mutation.Where(ps...)
- return ardo
+func (_d *AuthRolesDeleteOne) Where(ps ...predicate.AuthRoles) *AuthRolesDeleteOne {
+ _d._d.mutation.Where(ps...)
+ return _d
}
// Exec executes the deletion query.
-func (ardo *AuthRolesDeleteOne) Exec(ctx context.Context) error {
- n, err := ardo.ard.Exec(ctx)
+func (_d *AuthRolesDeleteOne) Exec(ctx context.Context) error {
+ n, err := _d._d.Exec(ctx)
switch {
case err != nil:
return err
@@ -81,8 +81,8 @@ func (ardo *AuthRolesDeleteOne) Exec(ctx context.Context) error {
}
// ExecX is like Exec, but panics if an error occurs.
-func (ardo *AuthRolesDeleteOne) ExecX(ctx context.Context) {
- if err := ardo.Exec(ctx); err != nil {
+func (_d *AuthRolesDeleteOne) ExecX(ctx context.Context) {
+ if err := _d.Exec(ctx); err != nil {
panic(err)
}
}
diff --git a/backend/internal/data/ent/authroles_query.go b/backend/internal/data/ent/authroles_query.go
index ef361228..aa378c37 100644
--- a/backend/internal/data/ent/authroles_query.go
+++ b/backend/internal/data/ent/authroles_query.go
@@ -32,44 +32,44 @@ type AuthRolesQuery struct {
}
// Where adds a new predicate for the AuthRolesQuery builder.
-func (arq *AuthRolesQuery) Where(ps ...predicate.AuthRoles) *AuthRolesQuery {
- arq.predicates = append(arq.predicates, ps...)
- return arq
+func (_q *AuthRolesQuery) Where(ps ...predicate.AuthRoles) *AuthRolesQuery {
+ _q.predicates = append(_q.predicates, ps...)
+ return _q
}
// Limit the number of records to be returned by this query.
-func (arq *AuthRolesQuery) Limit(limit int) *AuthRolesQuery {
- arq.ctx.Limit = &limit
- return arq
+func (_q *AuthRolesQuery) Limit(limit int) *AuthRolesQuery {
+ _q.ctx.Limit = &limit
+ return _q
}
// Offset to start from.
-func (arq *AuthRolesQuery) Offset(offset int) *AuthRolesQuery {
- arq.ctx.Offset = &offset
- return arq
+func (_q *AuthRolesQuery) Offset(offset int) *AuthRolesQuery {
+ _q.ctx.Offset = &offset
+ return _q
}
// Unique configures the query builder to filter duplicate records on query.
// By default, unique is set to true, and can be disabled using this method.
-func (arq *AuthRolesQuery) Unique(unique bool) *AuthRolesQuery {
- arq.ctx.Unique = &unique
- return arq
+func (_q *AuthRolesQuery) Unique(unique bool) *AuthRolesQuery {
+ _q.ctx.Unique = &unique
+ return _q
}
// Order specifies how the records should be ordered.
-func (arq *AuthRolesQuery) Order(o ...authroles.OrderOption) *AuthRolesQuery {
- arq.order = append(arq.order, o...)
- return arq
+func (_q *AuthRolesQuery) Order(o ...authroles.OrderOption) *AuthRolesQuery {
+ _q.order = append(_q.order, o...)
+ return _q
}
// QueryToken chains the current query on the "token" edge.
-func (arq *AuthRolesQuery) QueryToken() *AuthTokensQuery {
- query := (&AuthTokensClient{config: arq.config}).Query()
+func (_q *AuthRolesQuery) QueryToken() *AuthTokensQuery {
+ query := (&AuthTokensClient{config: _q.config}).Query()
query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
- if err := arq.prepareQuery(ctx); err != nil {
+ if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
- selector := arq.sqlQuery(ctx)
+ selector := _q.sqlQuery(ctx)
if err := selector.Err(); err != nil {
return nil, err
}
@@ -78,7 +78,7 @@ func (arq *AuthRolesQuery) QueryToken() *AuthTokensQuery {
sqlgraph.To(authtokens.Table, authtokens.FieldID),
sqlgraph.Edge(sqlgraph.O2O, true, authroles.TokenTable, authroles.TokenColumn),
)
- fromU = sqlgraph.SetNeighbors(arq.driver.Dialect(), step)
+ fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step)
return fromU, nil
}
return query
@@ -86,8 +86,8 @@ func (arq *AuthRolesQuery) QueryToken() *AuthTokensQuery {
// First returns the first AuthRoles entity from the query.
// Returns a *NotFoundError when no AuthRoles was found.
-func (arq *AuthRolesQuery) First(ctx context.Context) (*AuthRoles, error) {
- nodes, err := arq.Limit(1).All(setContextOp(ctx, arq.ctx, ent.OpQueryFirst))
+func (_q *AuthRolesQuery) First(ctx context.Context) (*AuthRoles, error) {
+ nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst))
if err != nil {
return nil, err
}
@@ -98,8 +98,8 @@ func (arq *AuthRolesQuery) First(ctx context.Context) (*AuthRoles, error) {
}
// FirstX is like First, but panics if an error occurs.
-func (arq *AuthRolesQuery) FirstX(ctx context.Context) *AuthRoles {
- node, err := arq.First(ctx)
+func (_q *AuthRolesQuery) FirstX(ctx context.Context) *AuthRoles {
+ node, err := _q.First(ctx)
if err != nil && !IsNotFound(err) {
panic(err)
}
@@ -108,9 +108,9 @@ func (arq *AuthRolesQuery) FirstX(ctx context.Context) *AuthRoles {
// FirstID returns the first AuthRoles ID from the query.
// Returns a *NotFoundError when no AuthRoles ID was found.
-func (arq *AuthRolesQuery) FirstID(ctx context.Context) (id int, err error) {
+func (_q *AuthRolesQuery) FirstID(ctx context.Context) (id int, err error) {
var ids []int
- if ids, err = arq.Limit(1).IDs(setContextOp(ctx, arq.ctx, ent.OpQueryFirstID)); err != nil {
+ if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil {
return
}
if len(ids) == 0 {
@@ -121,8 +121,8 @@ func (arq *AuthRolesQuery) FirstID(ctx context.Context) (id int, err error) {
}
// FirstIDX is like FirstID, but panics if an error occurs.
-func (arq *AuthRolesQuery) FirstIDX(ctx context.Context) int {
- id, err := arq.FirstID(ctx)
+func (_q *AuthRolesQuery) FirstIDX(ctx context.Context) int {
+ id, err := _q.FirstID(ctx)
if err != nil && !IsNotFound(err) {
panic(err)
}
@@ -132,8 +132,8 @@ func (arq *AuthRolesQuery) FirstIDX(ctx context.Context) int {
// Only returns a single AuthRoles entity found by the query, ensuring it only returns one.
// Returns a *NotSingularError when more than one AuthRoles entity is found.
// Returns a *NotFoundError when no AuthRoles entities are found.
-func (arq *AuthRolesQuery) Only(ctx context.Context) (*AuthRoles, error) {
- nodes, err := arq.Limit(2).All(setContextOp(ctx, arq.ctx, ent.OpQueryOnly))
+func (_q *AuthRolesQuery) Only(ctx context.Context) (*AuthRoles, error) {
+ nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly))
if err != nil {
return nil, err
}
@@ -148,8 +148,8 @@ func (arq *AuthRolesQuery) Only(ctx context.Context) (*AuthRoles, error) {
}
// OnlyX is like Only, but panics if an error occurs.
-func (arq *AuthRolesQuery) OnlyX(ctx context.Context) *AuthRoles {
- node, err := arq.Only(ctx)
+func (_q *AuthRolesQuery) OnlyX(ctx context.Context) *AuthRoles {
+ node, err := _q.Only(ctx)
if err != nil {
panic(err)
}
@@ -159,9 +159,9 @@ func (arq *AuthRolesQuery) OnlyX(ctx context.Context) *AuthRoles {
// OnlyID is like Only, but returns the only AuthRoles ID in the query.
// Returns a *NotSingularError when more than one AuthRoles ID is found.
// Returns a *NotFoundError when no entities are found.
-func (arq *AuthRolesQuery) OnlyID(ctx context.Context) (id int, err error) {
+func (_q *AuthRolesQuery) OnlyID(ctx context.Context) (id int, err error) {
var ids []int
- if ids, err = arq.Limit(2).IDs(setContextOp(ctx, arq.ctx, ent.OpQueryOnlyID)); err != nil {
+ if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil {
return
}
switch len(ids) {
@@ -176,8 +176,8 @@ func (arq *AuthRolesQuery) OnlyID(ctx context.Context) (id int, err error) {
}
// OnlyIDX is like OnlyID, but panics if an error occurs.
-func (arq *AuthRolesQuery) OnlyIDX(ctx context.Context) int {
- id, err := arq.OnlyID(ctx)
+func (_q *AuthRolesQuery) OnlyIDX(ctx context.Context) int {
+ id, err := _q.OnlyID(ctx)
if err != nil {
panic(err)
}
@@ -185,18 +185,18 @@ func (arq *AuthRolesQuery) OnlyIDX(ctx context.Context) int {
}
// All executes the query and returns a list of AuthRolesSlice.
-func (arq *AuthRolesQuery) All(ctx context.Context) ([]*AuthRoles, error) {
- ctx = setContextOp(ctx, arq.ctx, ent.OpQueryAll)
- if err := arq.prepareQuery(ctx); err != nil {
+func (_q *AuthRolesQuery) All(ctx context.Context) ([]*AuthRoles, error) {
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll)
+ if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
qr := querierAll[[]*AuthRoles, *AuthRolesQuery]()
- return withInterceptors[[]*AuthRoles](ctx, arq, qr, arq.inters)
+ return withInterceptors[[]*AuthRoles](ctx, _q, qr, _q.inters)
}
// AllX is like All, but panics if an error occurs.
-func (arq *AuthRolesQuery) AllX(ctx context.Context) []*AuthRoles {
- nodes, err := arq.All(ctx)
+func (_q *AuthRolesQuery) AllX(ctx context.Context) []*AuthRoles {
+ nodes, err := _q.All(ctx)
if err != nil {
panic(err)
}
@@ -204,20 +204,20 @@ func (arq *AuthRolesQuery) AllX(ctx context.Context) []*AuthRoles {
}
// IDs executes the query and returns a list of AuthRoles IDs.
-func (arq *AuthRolesQuery) IDs(ctx context.Context) (ids []int, err error) {
- if arq.ctx.Unique == nil && arq.path != nil {
- arq.Unique(true)
+func (_q *AuthRolesQuery) IDs(ctx context.Context) (ids []int, err error) {
+ if _q.ctx.Unique == nil && _q.path != nil {
+ _q.Unique(true)
}
- ctx = setContextOp(ctx, arq.ctx, ent.OpQueryIDs)
- if err = arq.Select(authroles.FieldID).Scan(ctx, &ids); err != nil {
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs)
+ if err = _q.Select(authroles.FieldID).Scan(ctx, &ids); err != nil {
return nil, err
}
return ids, nil
}
// IDsX is like IDs, but panics if an error occurs.
-func (arq *AuthRolesQuery) IDsX(ctx context.Context) []int {
- ids, err := arq.IDs(ctx)
+func (_q *AuthRolesQuery) IDsX(ctx context.Context) []int {
+ ids, err := _q.IDs(ctx)
if err != nil {
panic(err)
}
@@ -225,17 +225,17 @@ func (arq *AuthRolesQuery) IDsX(ctx context.Context) []int {
}
// Count returns the count of the given query.
-func (arq *AuthRolesQuery) Count(ctx context.Context) (int, error) {
- ctx = setContextOp(ctx, arq.ctx, ent.OpQueryCount)
- if err := arq.prepareQuery(ctx); err != nil {
+func (_q *AuthRolesQuery) Count(ctx context.Context) (int, error) {
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryCount)
+ if err := _q.prepareQuery(ctx); err != nil {
return 0, err
}
- return withInterceptors[int](ctx, arq, querierCount[*AuthRolesQuery](), arq.inters)
+ return withInterceptors[int](ctx, _q, querierCount[*AuthRolesQuery](), _q.inters)
}
// CountX is like Count, but panics if an error occurs.
-func (arq *AuthRolesQuery) CountX(ctx context.Context) int {
- count, err := arq.Count(ctx)
+func (_q *AuthRolesQuery) CountX(ctx context.Context) int {
+ count, err := _q.Count(ctx)
if err != nil {
panic(err)
}
@@ -243,9 +243,9 @@ func (arq *AuthRolesQuery) CountX(ctx context.Context) int {
}
// Exist returns true if the query has elements in the graph.
-func (arq *AuthRolesQuery) Exist(ctx context.Context) (bool, error) {
- ctx = setContextOp(ctx, arq.ctx, ent.OpQueryExist)
- switch _, err := arq.FirstID(ctx); {
+func (_q *AuthRolesQuery) Exist(ctx context.Context) (bool, error) {
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryExist)
+ switch _, err := _q.FirstID(ctx); {
case IsNotFound(err):
return false, nil
case err != nil:
@@ -256,8 +256,8 @@ func (arq *AuthRolesQuery) Exist(ctx context.Context) (bool, error) {
}
// ExistX is like Exist, but panics if an error occurs.
-func (arq *AuthRolesQuery) ExistX(ctx context.Context) bool {
- exist, err := arq.Exist(ctx)
+func (_q *AuthRolesQuery) ExistX(ctx context.Context) bool {
+ exist, err := _q.Exist(ctx)
if err != nil {
panic(err)
}
@@ -266,32 +266,32 @@ func (arq *AuthRolesQuery) ExistX(ctx context.Context) bool {
// Clone returns a duplicate of the AuthRolesQuery builder, including all associated steps. It can be
// used to prepare common query builders and use them differently after the clone is made.
-func (arq *AuthRolesQuery) Clone() *AuthRolesQuery {
- if arq == nil {
+func (_q *AuthRolesQuery) Clone() *AuthRolesQuery {
+ if _q == nil {
return nil
}
return &AuthRolesQuery{
- config: arq.config,
- ctx: arq.ctx.Clone(),
- order: append([]authroles.OrderOption{}, arq.order...),
- inters: append([]Interceptor{}, arq.inters...),
- predicates: append([]predicate.AuthRoles{}, arq.predicates...),
- withToken: arq.withToken.Clone(),
+ config: _q.config,
+ ctx: _q.ctx.Clone(),
+ order: append([]authroles.OrderOption{}, _q.order...),
+ inters: append([]Interceptor{}, _q.inters...),
+ predicates: append([]predicate.AuthRoles{}, _q.predicates...),
+ withToken: _q.withToken.Clone(),
// clone intermediate query.
- sql: arq.sql.Clone(),
- path: arq.path,
+ sql: _q.sql.Clone(),
+ path: _q.path,
}
}
// WithToken tells the query-builder to eager-load the nodes that are connected to
// the "token" edge. The optional arguments are used to configure the query builder of the edge.
-func (arq *AuthRolesQuery) WithToken(opts ...func(*AuthTokensQuery)) *AuthRolesQuery {
- query := (&AuthTokensClient{config: arq.config}).Query()
+func (_q *AuthRolesQuery) WithToken(opts ...func(*AuthTokensQuery)) *AuthRolesQuery {
+ query := (&AuthTokensClient{config: _q.config}).Query()
for _, opt := range opts {
opt(query)
}
- arq.withToken = query
- return arq
+ _q.withToken = query
+ return _q
}
// GroupBy is used to group vertices by one or more fields/columns.
@@ -308,10 +308,10 @@ func (arq *AuthRolesQuery) WithToken(opts ...func(*AuthTokensQuery)) *AuthRolesQ
// GroupBy(authroles.FieldRole).
// Aggregate(ent.Count()).
// Scan(ctx, &v)
-func (arq *AuthRolesQuery) GroupBy(field string, fields ...string) *AuthRolesGroupBy {
- arq.ctx.Fields = append([]string{field}, fields...)
- grbuild := &AuthRolesGroupBy{build: arq}
- grbuild.flds = &arq.ctx.Fields
+func (_q *AuthRolesQuery) GroupBy(field string, fields ...string) *AuthRolesGroupBy {
+ _q.ctx.Fields = append([]string{field}, fields...)
+ grbuild := &AuthRolesGroupBy{build: _q}
+ grbuild.flds = &_q.ctx.Fields
grbuild.label = authroles.Label
grbuild.scan = grbuild.Scan
return grbuild
@@ -329,55 +329,55 @@ func (arq *AuthRolesQuery) GroupBy(field string, fields ...string) *AuthRolesGro
// client.AuthRoles.Query().
// Select(authroles.FieldRole).
// Scan(ctx, &v)
-func (arq *AuthRolesQuery) Select(fields ...string) *AuthRolesSelect {
- arq.ctx.Fields = append(arq.ctx.Fields, fields...)
- sbuild := &AuthRolesSelect{AuthRolesQuery: arq}
+func (_q *AuthRolesQuery) Select(fields ...string) *AuthRolesSelect {
+ _q.ctx.Fields = append(_q.ctx.Fields, fields...)
+ sbuild := &AuthRolesSelect{AuthRolesQuery: _q}
sbuild.label = authroles.Label
- sbuild.flds, sbuild.scan = &arq.ctx.Fields, sbuild.Scan
+ sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan
return sbuild
}
// Aggregate returns a AuthRolesSelect configured with the given aggregations.
-func (arq *AuthRolesQuery) Aggregate(fns ...AggregateFunc) *AuthRolesSelect {
- return arq.Select().Aggregate(fns...)
+func (_q *AuthRolesQuery) Aggregate(fns ...AggregateFunc) *AuthRolesSelect {
+ return _q.Select().Aggregate(fns...)
}
-func (arq *AuthRolesQuery) prepareQuery(ctx context.Context) error {
- for _, inter := range arq.inters {
+func (_q *AuthRolesQuery) prepareQuery(ctx context.Context) error {
+ for _, inter := range _q.inters {
if inter == nil {
return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)")
}
if trv, ok := inter.(Traverser); ok {
- if err := trv.Traverse(ctx, arq); err != nil {
+ if err := trv.Traverse(ctx, _q); err != nil {
return err
}
}
}
- for _, f := range arq.ctx.Fields {
+ for _, f := range _q.ctx.Fields {
if !authroles.ValidColumn(f) {
return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
}
}
- if arq.path != nil {
- prev, err := arq.path(ctx)
+ if _q.path != nil {
+ prev, err := _q.path(ctx)
if err != nil {
return err
}
- arq.sql = prev
+ _q.sql = prev
}
return nil
}
-func (arq *AuthRolesQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*AuthRoles, error) {
+func (_q *AuthRolesQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*AuthRoles, error) {
var (
nodes = []*AuthRoles{}
- withFKs = arq.withFKs
- _spec = arq.querySpec()
+ withFKs = _q.withFKs
+ _spec = _q.querySpec()
loadedTypes = [1]bool{
- arq.withToken != nil,
+ _q.withToken != nil,
}
)
- if arq.withToken != nil {
+ if _q.withToken != nil {
withFKs = true
}
if withFKs {
@@ -387,7 +387,7 @@ func (arq *AuthRolesQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*A
return (*AuthRoles).scanValues(nil, columns)
}
_spec.Assign = func(columns []string, values []any) error {
- node := &AuthRoles{config: arq.config}
+ node := &AuthRoles{config: _q.config}
nodes = append(nodes, node)
node.Edges.loadedTypes = loadedTypes
return node.assignValues(columns, values)
@@ -395,14 +395,14 @@ func (arq *AuthRolesQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*A
for i := range hooks {
hooks[i](ctx, _spec)
}
- if err := sqlgraph.QueryNodes(ctx, arq.driver, _spec); err != nil {
+ if err := sqlgraph.QueryNodes(ctx, _q.driver, _spec); err != nil {
return nil, err
}
if len(nodes) == 0 {
return nodes, nil
}
- if query := arq.withToken; query != nil {
- if err := arq.loadToken(ctx, query, nodes, nil,
+ if query := _q.withToken; query != nil {
+ if err := _q.loadToken(ctx, query, nodes, nil,
func(n *AuthRoles, e *AuthTokens) { n.Edges.Token = e }); err != nil {
return nil, err
}
@@ -410,7 +410,7 @@ func (arq *AuthRolesQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*A
return nodes, nil
}
-func (arq *AuthRolesQuery) loadToken(ctx context.Context, query *AuthTokensQuery, nodes []*AuthRoles, init func(*AuthRoles), assign func(*AuthRoles, *AuthTokens)) error {
+func (_q *AuthRolesQuery) loadToken(ctx context.Context, query *AuthTokensQuery, nodes []*AuthRoles, init func(*AuthRoles), assign func(*AuthRoles, *AuthTokens)) error {
ids := make([]uuid.UUID, 0, len(nodes))
nodeids := make(map[uuid.UUID][]*AuthRoles)
for i := range nodes {
@@ -443,24 +443,24 @@ func (arq *AuthRolesQuery) loadToken(ctx context.Context, query *AuthTokensQuery
return nil
}
-func (arq *AuthRolesQuery) sqlCount(ctx context.Context) (int, error) {
- _spec := arq.querySpec()
- _spec.Node.Columns = arq.ctx.Fields
- if len(arq.ctx.Fields) > 0 {
- _spec.Unique = arq.ctx.Unique != nil && *arq.ctx.Unique
+func (_q *AuthRolesQuery) sqlCount(ctx context.Context) (int, error) {
+ _spec := _q.querySpec()
+ _spec.Node.Columns = _q.ctx.Fields
+ if len(_q.ctx.Fields) > 0 {
+ _spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique
}
- return sqlgraph.CountNodes(ctx, arq.driver, _spec)
+ return sqlgraph.CountNodes(ctx, _q.driver, _spec)
}
-func (arq *AuthRolesQuery) querySpec() *sqlgraph.QuerySpec {
+func (_q *AuthRolesQuery) querySpec() *sqlgraph.QuerySpec {
_spec := sqlgraph.NewQuerySpec(authroles.Table, authroles.Columns, sqlgraph.NewFieldSpec(authroles.FieldID, field.TypeInt))
- _spec.From = arq.sql
- if unique := arq.ctx.Unique; unique != nil {
+ _spec.From = _q.sql
+ if unique := _q.ctx.Unique; unique != nil {
_spec.Unique = *unique
- } else if arq.path != nil {
+ } else if _q.path != nil {
_spec.Unique = true
}
- if fields := arq.ctx.Fields; len(fields) > 0 {
+ if fields := _q.ctx.Fields; len(fields) > 0 {
_spec.Node.Columns = make([]string, 0, len(fields))
_spec.Node.Columns = append(_spec.Node.Columns, authroles.FieldID)
for i := range fields {
@@ -469,20 +469,20 @@ func (arq *AuthRolesQuery) querySpec() *sqlgraph.QuerySpec {
}
}
}
- if ps := arq.predicates; len(ps) > 0 {
+ if ps := _q.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
- if limit := arq.ctx.Limit; limit != nil {
+ if limit := _q.ctx.Limit; limit != nil {
_spec.Limit = *limit
}
- if offset := arq.ctx.Offset; offset != nil {
+ if offset := _q.ctx.Offset; offset != nil {
_spec.Offset = *offset
}
- if ps := arq.order; len(ps) > 0 {
+ if ps := _q.order; len(ps) > 0 {
_spec.Order = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
@@ -492,33 +492,33 @@ func (arq *AuthRolesQuery) querySpec() *sqlgraph.QuerySpec {
return _spec
}
-func (arq *AuthRolesQuery) sqlQuery(ctx context.Context) *sql.Selector {
- builder := sql.Dialect(arq.driver.Dialect())
+func (_q *AuthRolesQuery) sqlQuery(ctx context.Context) *sql.Selector {
+ builder := sql.Dialect(_q.driver.Dialect())
t1 := builder.Table(authroles.Table)
- columns := arq.ctx.Fields
+ columns := _q.ctx.Fields
if len(columns) == 0 {
columns = authroles.Columns
}
selector := builder.Select(t1.Columns(columns...)...).From(t1)
- if arq.sql != nil {
- selector = arq.sql
+ if _q.sql != nil {
+ selector = _q.sql
selector.Select(selector.Columns(columns...)...)
}
- if arq.ctx.Unique != nil && *arq.ctx.Unique {
+ if _q.ctx.Unique != nil && *_q.ctx.Unique {
selector.Distinct()
}
- for _, p := range arq.predicates {
+ for _, p := range _q.predicates {
p(selector)
}
- for _, p := range arq.order {
+ for _, p := range _q.order {
p(selector)
}
- if offset := arq.ctx.Offset; offset != nil {
+ if offset := _q.ctx.Offset; offset != nil {
// limit is mandatory for offset clause. We start
// with default value, and override it below if needed.
selector.Offset(*offset).Limit(math.MaxInt32)
}
- if limit := arq.ctx.Limit; limit != nil {
+ if limit := _q.ctx.Limit; limit != nil {
selector.Limit(*limit)
}
return selector
@@ -531,41 +531,41 @@ type AuthRolesGroupBy struct {
}
// Aggregate adds the given aggregation functions to the group-by query.
-func (argb *AuthRolesGroupBy) Aggregate(fns ...AggregateFunc) *AuthRolesGroupBy {
- argb.fns = append(argb.fns, fns...)
- return argb
+func (_g *AuthRolesGroupBy) Aggregate(fns ...AggregateFunc) *AuthRolesGroupBy {
+ _g.fns = append(_g.fns, fns...)
+ return _g
}
// Scan applies the selector query and scans the result into the given value.
-func (argb *AuthRolesGroupBy) Scan(ctx context.Context, v any) error {
- ctx = setContextOp(ctx, argb.build.ctx, ent.OpQueryGroupBy)
- if err := argb.build.prepareQuery(ctx); err != nil {
+func (_g *AuthRolesGroupBy) Scan(ctx context.Context, v any) error {
+ ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy)
+ if err := _g.build.prepareQuery(ctx); err != nil {
return err
}
- return scanWithInterceptors[*AuthRolesQuery, *AuthRolesGroupBy](ctx, argb.build, argb, argb.build.inters, v)
+ return scanWithInterceptors[*AuthRolesQuery, *AuthRolesGroupBy](ctx, _g.build, _g, _g.build.inters, v)
}
-func (argb *AuthRolesGroupBy) sqlScan(ctx context.Context, root *AuthRolesQuery, v any) error {
+func (_g *AuthRolesGroupBy) sqlScan(ctx context.Context, root *AuthRolesQuery, v any) error {
selector := root.sqlQuery(ctx).Select()
- aggregation := make([]string, 0, len(argb.fns))
- for _, fn := range argb.fns {
+ aggregation := make([]string, 0, len(_g.fns))
+ for _, fn := range _g.fns {
aggregation = append(aggregation, fn(selector))
}
if len(selector.SelectedColumns()) == 0 {
- columns := make([]string, 0, len(*argb.flds)+len(argb.fns))
- for _, f := range *argb.flds {
+ columns := make([]string, 0, len(*_g.flds)+len(_g.fns))
+ for _, f := range *_g.flds {
columns = append(columns, selector.C(f))
}
columns = append(columns, aggregation...)
selector.Select(columns...)
}
- selector.GroupBy(selector.Columns(*argb.flds...)...)
+ selector.GroupBy(selector.Columns(*_g.flds...)...)
if err := selector.Err(); err != nil {
return err
}
rows := &sql.Rows{}
query, args := selector.Query()
- if err := argb.build.driver.Query(ctx, query, args, rows); err != nil {
+ if err := _g.build.driver.Query(ctx, query, args, rows); err != nil {
return err
}
defer rows.Close()
@@ -579,27 +579,27 @@ type AuthRolesSelect struct {
}
// Aggregate adds the given aggregation functions to the selector query.
-func (ars *AuthRolesSelect) Aggregate(fns ...AggregateFunc) *AuthRolesSelect {
- ars.fns = append(ars.fns, fns...)
- return ars
+func (_s *AuthRolesSelect) Aggregate(fns ...AggregateFunc) *AuthRolesSelect {
+ _s.fns = append(_s.fns, fns...)
+ return _s
}
// Scan applies the selector query and scans the result into the given value.
-func (ars *AuthRolesSelect) Scan(ctx context.Context, v any) error {
- ctx = setContextOp(ctx, ars.ctx, ent.OpQuerySelect)
- if err := ars.prepareQuery(ctx); err != nil {
+func (_s *AuthRolesSelect) Scan(ctx context.Context, v any) error {
+ ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect)
+ if err := _s.prepareQuery(ctx); err != nil {
return err
}
- return scanWithInterceptors[*AuthRolesQuery, *AuthRolesSelect](ctx, ars.AuthRolesQuery, ars, ars.inters, v)
+ return scanWithInterceptors[*AuthRolesQuery, *AuthRolesSelect](ctx, _s.AuthRolesQuery, _s, _s.inters, v)
}
-func (ars *AuthRolesSelect) sqlScan(ctx context.Context, root *AuthRolesQuery, v any) error {
+func (_s *AuthRolesSelect) sqlScan(ctx context.Context, root *AuthRolesQuery, v any) error {
selector := root.sqlQuery(ctx)
- aggregation := make([]string, 0, len(ars.fns))
- for _, fn := range ars.fns {
+ aggregation := make([]string, 0, len(_s.fns))
+ for _, fn := range _s.fns {
aggregation = append(aggregation, fn(selector))
}
- switch n := len(*ars.selector.flds); {
+ switch n := len(*_s.selector.flds); {
case n == 0 && len(aggregation) > 0:
selector.Select(aggregation...)
case n != 0 && len(aggregation) > 0:
@@ -607,7 +607,7 @@ func (ars *AuthRolesSelect) sqlScan(ctx context.Context, root *AuthRolesQuery, v
}
rows := &sql.Rows{}
query, args := selector.Query()
- if err := ars.driver.Query(ctx, query, args, rows); err != nil {
+ if err := _s.driver.Query(ctx, query, args, rows); err != nil {
return err
}
defer rows.Close()
diff --git a/backend/internal/data/ent/authroles_update.go b/backend/internal/data/ent/authroles_update.go
index 554f989a..c348914d 100644
--- a/backend/internal/data/ent/authroles_update.go
+++ b/backend/internal/data/ent/authroles_update.go
@@ -24,63 +24,63 @@ type AuthRolesUpdate struct {
}
// Where appends a list predicates to the AuthRolesUpdate builder.
-func (aru *AuthRolesUpdate) Where(ps ...predicate.AuthRoles) *AuthRolesUpdate {
- aru.mutation.Where(ps...)
- return aru
+func (_u *AuthRolesUpdate) Where(ps ...predicate.AuthRoles) *AuthRolesUpdate {
+ _u.mutation.Where(ps...)
+ return _u
}
// SetRole sets the "role" field.
-func (aru *AuthRolesUpdate) SetRole(a authroles.Role) *AuthRolesUpdate {
- aru.mutation.SetRole(a)
- return aru
+func (_u *AuthRolesUpdate) SetRole(v authroles.Role) *AuthRolesUpdate {
+ _u.mutation.SetRole(v)
+ return _u
}
// SetNillableRole sets the "role" field if the given value is not nil.
-func (aru *AuthRolesUpdate) SetNillableRole(a *authroles.Role) *AuthRolesUpdate {
- if a != nil {
- aru.SetRole(*a)
+func (_u *AuthRolesUpdate) SetNillableRole(v *authroles.Role) *AuthRolesUpdate {
+ if v != nil {
+ _u.SetRole(*v)
}
- return aru
+ return _u
}
// SetTokenID sets the "token" edge to the AuthTokens entity by ID.
-func (aru *AuthRolesUpdate) SetTokenID(id uuid.UUID) *AuthRolesUpdate {
- aru.mutation.SetTokenID(id)
- return aru
+func (_u *AuthRolesUpdate) SetTokenID(id uuid.UUID) *AuthRolesUpdate {
+ _u.mutation.SetTokenID(id)
+ return _u
}
// SetNillableTokenID sets the "token" edge to the AuthTokens entity by ID if the given value is not nil.
-func (aru *AuthRolesUpdate) SetNillableTokenID(id *uuid.UUID) *AuthRolesUpdate {
+func (_u *AuthRolesUpdate) SetNillableTokenID(id *uuid.UUID) *AuthRolesUpdate {
if id != nil {
- aru = aru.SetTokenID(*id)
+ _u = _u.SetTokenID(*id)
}
- return aru
+ return _u
}
// SetToken sets the "token" edge to the AuthTokens entity.
-func (aru *AuthRolesUpdate) SetToken(a *AuthTokens) *AuthRolesUpdate {
- return aru.SetTokenID(a.ID)
+func (_u *AuthRolesUpdate) SetToken(v *AuthTokens) *AuthRolesUpdate {
+ return _u.SetTokenID(v.ID)
}
// Mutation returns the AuthRolesMutation object of the builder.
-func (aru *AuthRolesUpdate) Mutation() *AuthRolesMutation {
- return aru.mutation
+func (_u *AuthRolesUpdate) Mutation() *AuthRolesMutation {
+ return _u.mutation
}
// ClearToken clears the "token" edge to the AuthTokens entity.
-func (aru *AuthRolesUpdate) ClearToken() *AuthRolesUpdate {
- aru.mutation.ClearToken()
- return aru
+func (_u *AuthRolesUpdate) ClearToken() *AuthRolesUpdate {
+ _u.mutation.ClearToken()
+ return _u
}
// Save executes the query and returns the number of nodes affected by the update operation.
-func (aru *AuthRolesUpdate) Save(ctx context.Context) (int, error) {
- return withHooks(ctx, aru.sqlSave, aru.mutation, aru.hooks)
+func (_u *AuthRolesUpdate) Save(ctx context.Context) (int, error) {
+ return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
}
// SaveX is like Save, but panics if an error occurs.
-func (aru *AuthRolesUpdate) SaveX(ctx context.Context) int {
- affected, err := aru.Save(ctx)
+func (_u *AuthRolesUpdate) SaveX(ctx context.Context) int {
+ affected, err := _u.Save(ctx)
if err != nil {
panic(err)
}
@@ -88,21 +88,21 @@ func (aru *AuthRolesUpdate) SaveX(ctx context.Context) int {
}
// Exec executes the query.
-func (aru *AuthRolesUpdate) Exec(ctx context.Context) error {
- _, err := aru.Save(ctx)
+func (_u *AuthRolesUpdate) Exec(ctx context.Context) error {
+ _, err := _u.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
-func (aru *AuthRolesUpdate) ExecX(ctx context.Context) {
- if err := aru.Exec(ctx); err != nil {
+func (_u *AuthRolesUpdate) ExecX(ctx context.Context) {
+ if err := _u.Exec(ctx); err != nil {
panic(err)
}
}
// check runs all checks and user-defined validators on the builder.
-func (aru *AuthRolesUpdate) check() error {
- if v, ok := aru.mutation.Role(); ok {
+func (_u *AuthRolesUpdate) check() error {
+ if v, ok := _u.mutation.Role(); ok {
if err := authroles.RoleValidator(v); err != nil {
return &ValidationError{Name: "role", err: fmt.Errorf(`ent: validator failed for field "AuthRoles.role": %w`, err)}
}
@@ -110,22 +110,22 @@ func (aru *AuthRolesUpdate) check() error {
return nil
}
-func (aru *AuthRolesUpdate) sqlSave(ctx context.Context) (n int, err error) {
- if err := aru.check(); err != nil {
- return n, err
+func (_u *AuthRolesUpdate) sqlSave(ctx context.Context) (_node int, err error) {
+ if err := _u.check(); err != nil {
+ return _node, err
}
_spec := sqlgraph.NewUpdateSpec(authroles.Table, authroles.Columns, sqlgraph.NewFieldSpec(authroles.FieldID, field.TypeInt))
- if ps := aru.mutation.predicates; len(ps) > 0 {
+ if ps := _u.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
- if value, ok := aru.mutation.Role(); ok {
+ if value, ok := _u.mutation.Role(); ok {
_spec.SetField(authroles.FieldRole, field.TypeEnum, value)
}
- if aru.mutation.TokenCleared() {
+ if _u.mutation.TokenCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2O,
Inverse: true,
@@ -138,7 +138,7 @@ func (aru *AuthRolesUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := aru.mutation.TokenIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.TokenIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2O,
Inverse: true,
@@ -154,7 +154,7 @@ func (aru *AuthRolesUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- if n, err = sqlgraph.UpdateNodes(ctx, aru.driver, _spec); err != nil {
+ if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil {
if _, ok := err.(*sqlgraph.NotFoundError); ok {
err = &NotFoundError{authroles.Label}
} else if sqlgraph.IsConstraintError(err) {
@@ -162,8 +162,8 @@ func (aru *AuthRolesUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
return 0, err
}
- aru.mutation.done = true
- return n, nil
+ _u.mutation.done = true
+ return _node, nil
}
// AuthRolesUpdateOne is the builder for updating a single AuthRoles entity.
@@ -175,70 +175,70 @@ type AuthRolesUpdateOne struct {
}
// SetRole sets the "role" field.
-func (aruo *AuthRolesUpdateOne) SetRole(a authroles.Role) *AuthRolesUpdateOne {
- aruo.mutation.SetRole(a)
- return aruo
+func (_u *AuthRolesUpdateOne) SetRole(v authroles.Role) *AuthRolesUpdateOne {
+ _u.mutation.SetRole(v)
+ return _u
}
// SetNillableRole sets the "role" field if the given value is not nil.
-func (aruo *AuthRolesUpdateOne) SetNillableRole(a *authroles.Role) *AuthRolesUpdateOne {
- if a != nil {
- aruo.SetRole(*a)
+func (_u *AuthRolesUpdateOne) SetNillableRole(v *authroles.Role) *AuthRolesUpdateOne {
+ if v != nil {
+ _u.SetRole(*v)
}
- return aruo
+ return _u
}
// SetTokenID sets the "token" edge to the AuthTokens entity by ID.
-func (aruo *AuthRolesUpdateOne) SetTokenID(id uuid.UUID) *AuthRolesUpdateOne {
- aruo.mutation.SetTokenID(id)
- return aruo
+func (_u *AuthRolesUpdateOne) SetTokenID(id uuid.UUID) *AuthRolesUpdateOne {
+ _u.mutation.SetTokenID(id)
+ return _u
}
// SetNillableTokenID sets the "token" edge to the AuthTokens entity by ID if the given value is not nil.
-func (aruo *AuthRolesUpdateOne) SetNillableTokenID(id *uuid.UUID) *AuthRolesUpdateOne {
+func (_u *AuthRolesUpdateOne) SetNillableTokenID(id *uuid.UUID) *AuthRolesUpdateOne {
if id != nil {
- aruo = aruo.SetTokenID(*id)
+ _u = _u.SetTokenID(*id)
}
- return aruo
+ return _u
}
// SetToken sets the "token" edge to the AuthTokens entity.
-func (aruo *AuthRolesUpdateOne) SetToken(a *AuthTokens) *AuthRolesUpdateOne {
- return aruo.SetTokenID(a.ID)
+func (_u *AuthRolesUpdateOne) SetToken(v *AuthTokens) *AuthRolesUpdateOne {
+ return _u.SetTokenID(v.ID)
}
// Mutation returns the AuthRolesMutation object of the builder.
-func (aruo *AuthRolesUpdateOne) Mutation() *AuthRolesMutation {
- return aruo.mutation
+func (_u *AuthRolesUpdateOne) Mutation() *AuthRolesMutation {
+ return _u.mutation
}
// ClearToken clears the "token" edge to the AuthTokens entity.
-func (aruo *AuthRolesUpdateOne) ClearToken() *AuthRolesUpdateOne {
- aruo.mutation.ClearToken()
- return aruo
+func (_u *AuthRolesUpdateOne) ClearToken() *AuthRolesUpdateOne {
+ _u.mutation.ClearToken()
+ return _u
}
// Where appends a list predicates to the AuthRolesUpdate builder.
-func (aruo *AuthRolesUpdateOne) Where(ps ...predicate.AuthRoles) *AuthRolesUpdateOne {
- aruo.mutation.Where(ps...)
- return aruo
+func (_u *AuthRolesUpdateOne) Where(ps ...predicate.AuthRoles) *AuthRolesUpdateOne {
+ _u.mutation.Where(ps...)
+ return _u
}
// Select allows selecting one or more fields (columns) of the returned entity.
// The default is selecting all fields defined in the entity schema.
-func (aruo *AuthRolesUpdateOne) Select(field string, fields ...string) *AuthRolesUpdateOne {
- aruo.fields = append([]string{field}, fields...)
- return aruo
+func (_u *AuthRolesUpdateOne) Select(field string, fields ...string) *AuthRolesUpdateOne {
+ _u.fields = append([]string{field}, fields...)
+ return _u
}
// Save executes the query and returns the updated AuthRoles entity.
-func (aruo *AuthRolesUpdateOne) Save(ctx context.Context) (*AuthRoles, error) {
- return withHooks(ctx, aruo.sqlSave, aruo.mutation, aruo.hooks)
+func (_u *AuthRolesUpdateOne) Save(ctx context.Context) (*AuthRoles, error) {
+ return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
}
// SaveX is like Save, but panics if an error occurs.
-func (aruo *AuthRolesUpdateOne) SaveX(ctx context.Context) *AuthRoles {
- node, err := aruo.Save(ctx)
+func (_u *AuthRolesUpdateOne) SaveX(ctx context.Context) *AuthRoles {
+ node, err := _u.Save(ctx)
if err != nil {
panic(err)
}
@@ -246,21 +246,21 @@ func (aruo *AuthRolesUpdateOne) SaveX(ctx context.Context) *AuthRoles {
}
// Exec executes the query on the entity.
-func (aruo *AuthRolesUpdateOne) Exec(ctx context.Context) error {
- _, err := aruo.Save(ctx)
+func (_u *AuthRolesUpdateOne) Exec(ctx context.Context) error {
+ _, err := _u.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
-func (aruo *AuthRolesUpdateOne) ExecX(ctx context.Context) {
- if err := aruo.Exec(ctx); err != nil {
+func (_u *AuthRolesUpdateOne) ExecX(ctx context.Context) {
+ if err := _u.Exec(ctx); err != nil {
panic(err)
}
}
// check runs all checks and user-defined validators on the builder.
-func (aruo *AuthRolesUpdateOne) check() error {
- if v, ok := aruo.mutation.Role(); ok {
+func (_u *AuthRolesUpdateOne) check() error {
+ if v, ok := _u.mutation.Role(); ok {
if err := authroles.RoleValidator(v); err != nil {
return &ValidationError{Name: "role", err: fmt.Errorf(`ent: validator failed for field "AuthRoles.role": %w`, err)}
}
@@ -268,17 +268,17 @@ func (aruo *AuthRolesUpdateOne) check() error {
return nil
}
-func (aruo *AuthRolesUpdateOne) sqlSave(ctx context.Context) (_node *AuthRoles, err error) {
- if err := aruo.check(); err != nil {
+func (_u *AuthRolesUpdateOne) sqlSave(ctx context.Context) (_node *AuthRoles, err error) {
+ if err := _u.check(); err != nil {
return _node, err
}
_spec := sqlgraph.NewUpdateSpec(authroles.Table, authroles.Columns, sqlgraph.NewFieldSpec(authroles.FieldID, field.TypeInt))
- id, ok := aruo.mutation.ID()
+ id, ok := _u.mutation.ID()
if !ok {
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "AuthRoles.id" for update`)}
}
_spec.Node.ID.Value = id
- if fields := aruo.fields; len(fields) > 0 {
+ if fields := _u.fields; len(fields) > 0 {
_spec.Node.Columns = make([]string, 0, len(fields))
_spec.Node.Columns = append(_spec.Node.Columns, authroles.FieldID)
for _, f := range fields {
@@ -290,17 +290,17 @@ func (aruo *AuthRolesUpdateOne) sqlSave(ctx context.Context) (_node *AuthRoles,
}
}
}
- if ps := aruo.mutation.predicates; len(ps) > 0 {
+ if ps := _u.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
- if value, ok := aruo.mutation.Role(); ok {
+ if value, ok := _u.mutation.Role(); ok {
_spec.SetField(authroles.FieldRole, field.TypeEnum, value)
}
- if aruo.mutation.TokenCleared() {
+ if _u.mutation.TokenCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2O,
Inverse: true,
@@ -313,7 +313,7 @@ func (aruo *AuthRolesUpdateOne) sqlSave(ctx context.Context) (_node *AuthRoles,
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := aruo.mutation.TokenIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.TokenIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2O,
Inverse: true,
@@ -329,10 +329,10 @@ func (aruo *AuthRolesUpdateOne) sqlSave(ctx context.Context) (_node *AuthRoles,
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- _node = &AuthRoles{config: aruo.config}
+ _node = &AuthRoles{config: _u.config}
_spec.Assign = _node.assignValues
_spec.ScanValues = _node.scanValues
- if err = sqlgraph.UpdateNode(ctx, aruo.driver, _spec); err != nil {
+ if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil {
if _, ok := err.(*sqlgraph.NotFoundError); ok {
err = &NotFoundError{authroles.Label}
} else if sqlgraph.IsConstraintError(err) {
@@ -340,6 +340,6 @@ func (aruo *AuthRolesUpdateOne) sqlSave(ctx context.Context) (_node *AuthRoles,
}
return nil, err
}
- aruo.mutation.done = true
+ _u.mutation.done = true
return _node, nil
}
diff --git a/backend/internal/data/ent/authtokens.go b/backend/internal/data/ent/authtokens.go
index 03845acd..6660241d 100644
--- a/backend/internal/data/ent/authtokens.go
+++ b/backend/internal/data/ent/authtokens.go
@@ -90,7 +90,7 @@ func (*AuthTokens) scanValues(columns []string) ([]any, error) {
// assignValues assigns the values that were returned from sql.Rows (after scanning)
// to the AuthTokens fields.
-func (at *AuthTokens) assignValues(columns []string, values []any) error {
+func (_m *AuthTokens) assignValues(columns []string, values []any) error {
if m, n := len(values), len(columns); m < n {
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
}
@@ -100,41 +100,41 @@ func (at *AuthTokens) assignValues(columns []string, values []any) error {
if value, ok := values[i].(*uuid.UUID); !ok {
return fmt.Errorf("unexpected type %T for field id", values[i])
} else if value != nil {
- at.ID = *value
+ _m.ID = *value
}
case authtokens.FieldCreatedAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field created_at", values[i])
} else if value.Valid {
- at.CreatedAt = value.Time
+ _m.CreatedAt = value.Time
}
case authtokens.FieldUpdatedAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field updated_at", values[i])
} else if value.Valid {
- at.UpdatedAt = value.Time
+ _m.UpdatedAt = value.Time
}
case authtokens.FieldToken:
if value, ok := values[i].(*[]byte); !ok {
return fmt.Errorf("unexpected type %T for field token", values[i])
} else if value != nil {
- at.Token = *value
+ _m.Token = *value
}
case authtokens.FieldExpiresAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field expires_at", values[i])
} else if value.Valid {
- at.ExpiresAt = value.Time
+ _m.ExpiresAt = value.Time
}
case authtokens.ForeignKeys[0]:
if value, ok := values[i].(*sql.NullScanner); !ok {
return fmt.Errorf("unexpected type %T for field user_auth_tokens", values[i])
} else if value.Valid {
- at.user_auth_tokens = new(uuid.UUID)
- *at.user_auth_tokens = *value.S.(*uuid.UUID)
+ _m.user_auth_tokens = new(uuid.UUID)
+ *_m.user_auth_tokens = *value.S.(*uuid.UUID)
}
default:
- at.selectValues.Set(columns[i], values[i])
+ _m.selectValues.Set(columns[i], values[i])
}
}
return nil
@@ -142,54 +142,54 @@ func (at *AuthTokens) assignValues(columns []string, values []any) error {
// Value returns the ent.Value that was dynamically selected and assigned to the AuthTokens.
// This includes values selected through modifiers, order, etc.
-func (at *AuthTokens) Value(name string) (ent.Value, error) {
- return at.selectValues.Get(name)
+func (_m *AuthTokens) Value(name string) (ent.Value, error) {
+ return _m.selectValues.Get(name)
}
// QueryUser queries the "user" edge of the AuthTokens entity.
-func (at *AuthTokens) QueryUser() *UserQuery {
- return NewAuthTokensClient(at.config).QueryUser(at)
+func (_m *AuthTokens) QueryUser() *UserQuery {
+ return NewAuthTokensClient(_m.config).QueryUser(_m)
}
// QueryRoles queries the "roles" edge of the AuthTokens entity.
-func (at *AuthTokens) QueryRoles() *AuthRolesQuery {
- return NewAuthTokensClient(at.config).QueryRoles(at)
+func (_m *AuthTokens) QueryRoles() *AuthRolesQuery {
+ return NewAuthTokensClient(_m.config).QueryRoles(_m)
}
// Update returns a builder for updating this AuthTokens.
// Note that you need to call AuthTokens.Unwrap() before calling this method if this AuthTokens
// was returned from a transaction, and the transaction was committed or rolled back.
-func (at *AuthTokens) Update() *AuthTokensUpdateOne {
- return NewAuthTokensClient(at.config).UpdateOne(at)
+func (_m *AuthTokens) Update() *AuthTokensUpdateOne {
+ return NewAuthTokensClient(_m.config).UpdateOne(_m)
}
// Unwrap unwraps the AuthTokens 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 (at *AuthTokens) Unwrap() *AuthTokens {
- _tx, ok := at.config.driver.(*txDriver)
+func (_m *AuthTokens) Unwrap() *AuthTokens {
+ _tx, ok := _m.config.driver.(*txDriver)
if !ok {
panic("ent: AuthTokens is not a transactional entity")
}
- at.config.driver = _tx.drv
- return at
+ _m.config.driver = _tx.drv
+ return _m
}
// String implements the fmt.Stringer.
-func (at *AuthTokens) String() string {
+func (_m *AuthTokens) String() string {
var builder strings.Builder
builder.WriteString("AuthTokens(")
- builder.WriteString(fmt.Sprintf("id=%v, ", at.ID))
+ builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
builder.WriteString("created_at=")
- builder.WriteString(at.CreatedAt.Format(time.ANSIC))
+ builder.WriteString(_m.CreatedAt.Format(time.ANSIC))
builder.WriteString(", ")
builder.WriteString("updated_at=")
- builder.WriteString(at.UpdatedAt.Format(time.ANSIC))
+ builder.WriteString(_m.UpdatedAt.Format(time.ANSIC))
builder.WriteString(", ")
builder.WriteString("token=")
- builder.WriteString(fmt.Sprintf("%v", at.Token))
+ builder.WriteString(fmt.Sprintf("%v", _m.Token))
builder.WriteString(", ")
builder.WriteString("expires_at=")
- builder.WriteString(at.ExpiresAt.Format(time.ANSIC))
+ builder.WriteString(_m.ExpiresAt.Format(time.ANSIC))
builder.WriteByte(')')
return builder.String()
}
diff --git a/backend/internal/data/ent/authtokens_create.go b/backend/internal/data/ent/authtokens_create.go
index 4cc0048e..35ebce9e 100644
--- a/backend/internal/data/ent/authtokens_create.go
+++ b/backend/internal/data/ent/authtokens_create.go
@@ -24,119 +24,119 @@ type AuthTokensCreate struct {
}
// SetCreatedAt sets the "created_at" field.
-func (atc *AuthTokensCreate) SetCreatedAt(t time.Time) *AuthTokensCreate {
- atc.mutation.SetCreatedAt(t)
- return atc
+func (_c *AuthTokensCreate) SetCreatedAt(v time.Time) *AuthTokensCreate {
+ _c.mutation.SetCreatedAt(v)
+ return _c
}
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
-func (atc *AuthTokensCreate) SetNillableCreatedAt(t *time.Time) *AuthTokensCreate {
- if t != nil {
- atc.SetCreatedAt(*t)
+func (_c *AuthTokensCreate) SetNillableCreatedAt(v *time.Time) *AuthTokensCreate {
+ if v != nil {
+ _c.SetCreatedAt(*v)
}
- return atc
+ return _c
}
// SetUpdatedAt sets the "updated_at" field.
-func (atc *AuthTokensCreate) SetUpdatedAt(t time.Time) *AuthTokensCreate {
- atc.mutation.SetUpdatedAt(t)
- return atc
+func (_c *AuthTokensCreate) SetUpdatedAt(v time.Time) *AuthTokensCreate {
+ _c.mutation.SetUpdatedAt(v)
+ return _c
}
// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
-func (atc *AuthTokensCreate) SetNillableUpdatedAt(t *time.Time) *AuthTokensCreate {
- if t != nil {
- atc.SetUpdatedAt(*t)
+func (_c *AuthTokensCreate) SetNillableUpdatedAt(v *time.Time) *AuthTokensCreate {
+ if v != nil {
+ _c.SetUpdatedAt(*v)
}
- return atc
+ return _c
}
// SetToken sets the "token" field.
-func (atc *AuthTokensCreate) SetToken(b []byte) *AuthTokensCreate {
- atc.mutation.SetToken(b)
- return atc
+func (_c *AuthTokensCreate) SetToken(v []byte) *AuthTokensCreate {
+ _c.mutation.SetToken(v)
+ return _c
}
// SetExpiresAt sets the "expires_at" field.
-func (atc *AuthTokensCreate) SetExpiresAt(t time.Time) *AuthTokensCreate {
- atc.mutation.SetExpiresAt(t)
- return atc
+func (_c *AuthTokensCreate) SetExpiresAt(v time.Time) *AuthTokensCreate {
+ _c.mutation.SetExpiresAt(v)
+ return _c
}
// SetNillableExpiresAt sets the "expires_at" field if the given value is not nil.
-func (atc *AuthTokensCreate) SetNillableExpiresAt(t *time.Time) *AuthTokensCreate {
- if t != nil {
- atc.SetExpiresAt(*t)
+func (_c *AuthTokensCreate) SetNillableExpiresAt(v *time.Time) *AuthTokensCreate {
+ if v != nil {
+ _c.SetExpiresAt(*v)
}
- return atc
+ return _c
}
// SetID sets the "id" field.
-func (atc *AuthTokensCreate) SetID(u uuid.UUID) *AuthTokensCreate {
- atc.mutation.SetID(u)
- return atc
+func (_c *AuthTokensCreate) SetID(v uuid.UUID) *AuthTokensCreate {
+ _c.mutation.SetID(v)
+ return _c
}
// SetNillableID sets the "id" field if the given value is not nil.
-func (atc *AuthTokensCreate) SetNillableID(u *uuid.UUID) *AuthTokensCreate {
- if u != nil {
- atc.SetID(*u)
+func (_c *AuthTokensCreate) SetNillableID(v *uuid.UUID) *AuthTokensCreate {
+ if v != nil {
+ _c.SetID(*v)
}
- return atc
+ return _c
}
// SetUserID sets the "user" edge to the User entity by ID.
-func (atc *AuthTokensCreate) SetUserID(id uuid.UUID) *AuthTokensCreate {
- atc.mutation.SetUserID(id)
- return atc
+func (_c *AuthTokensCreate) SetUserID(id uuid.UUID) *AuthTokensCreate {
+ _c.mutation.SetUserID(id)
+ return _c
}
// SetNillableUserID sets the "user" edge to the User entity by ID if the given value is not nil.
-func (atc *AuthTokensCreate) SetNillableUserID(id *uuid.UUID) *AuthTokensCreate {
+func (_c *AuthTokensCreate) SetNillableUserID(id *uuid.UUID) *AuthTokensCreate {
if id != nil {
- atc = atc.SetUserID(*id)
+ _c = _c.SetUserID(*id)
}
- return atc
+ return _c
}
// SetUser sets the "user" edge to the User entity.
-func (atc *AuthTokensCreate) SetUser(u *User) *AuthTokensCreate {
- return atc.SetUserID(u.ID)
+func (_c *AuthTokensCreate) SetUser(v *User) *AuthTokensCreate {
+ return _c.SetUserID(v.ID)
}
// SetRolesID sets the "roles" edge to the AuthRoles entity by ID.
-func (atc *AuthTokensCreate) SetRolesID(id int) *AuthTokensCreate {
- atc.mutation.SetRolesID(id)
- return atc
+func (_c *AuthTokensCreate) SetRolesID(id int) *AuthTokensCreate {
+ _c.mutation.SetRolesID(id)
+ return _c
}
// SetNillableRolesID sets the "roles" edge to the AuthRoles entity by ID if the given value is not nil.
-func (atc *AuthTokensCreate) SetNillableRolesID(id *int) *AuthTokensCreate {
+func (_c *AuthTokensCreate) SetNillableRolesID(id *int) *AuthTokensCreate {
if id != nil {
- atc = atc.SetRolesID(*id)
+ _c = _c.SetRolesID(*id)
}
- return atc
+ return _c
}
// SetRoles sets the "roles" edge to the AuthRoles entity.
-func (atc *AuthTokensCreate) SetRoles(a *AuthRoles) *AuthTokensCreate {
- return atc.SetRolesID(a.ID)
+func (_c *AuthTokensCreate) SetRoles(v *AuthRoles) *AuthTokensCreate {
+ return _c.SetRolesID(v.ID)
}
// Mutation returns the AuthTokensMutation object of the builder.
-func (atc *AuthTokensCreate) Mutation() *AuthTokensMutation {
- return atc.mutation
+func (_c *AuthTokensCreate) Mutation() *AuthTokensMutation {
+ return _c.mutation
}
// Save creates the AuthTokens in the database.
-func (atc *AuthTokensCreate) Save(ctx context.Context) (*AuthTokens, error) {
- atc.defaults()
- return withHooks(ctx, atc.sqlSave, atc.mutation, atc.hooks)
+func (_c *AuthTokensCreate) Save(ctx context.Context) (*AuthTokens, error) {
+ _c.defaults()
+ return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
}
// SaveX calls Save and panics if Save returns an error.
-func (atc *AuthTokensCreate) SaveX(ctx context.Context) *AuthTokens {
- v, err := atc.Save(ctx)
+func (_c *AuthTokensCreate) SaveX(ctx context.Context) *AuthTokens {
+ v, err := _c.Save(ctx)
if err != nil {
panic(err)
}
@@ -144,61 +144,61 @@ func (atc *AuthTokensCreate) SaveX(ctx context.Context) *AuthTokens {
}
// Exec executes the query.
-func (atc *AuthTokensCreate) Exec(ctx context.Context) error {
- _, err := atc.Save(ctx)
+func (_c *AuthTokensCreate) Exec(ctx context.Context) error {
+ _, err := _c.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
-func (atc *AuthTokensCreate) ExecX(ctx context.Context) {
- if err := atc.Exec(ctx); err != nil {
+func (_c *AuthTokensCreate) ExecX(ctx context.Context) {
+ if err := _c.Exec(ctx); err != nil {
panic(err)
}
}
// defaults sets the default values of the builder before save.
-func (atc *AuthTokensCreate) defaults() {
- if _, ok := atc.mutation.CreatedAt(); !ok {
+func (_c *AuthTokensCreate) defaults() {
+ if _, ok := _c.mutation.CreatedAt(); !ok {
v := authtokens.DefaultCreatedAt()
- atc.mutation.SetCreatedAt(v)
+ _c.mutation.SetCreatedAt(v)
}
- if _, ok := atc.mutation.UpdatedAt(); !ok {
+ if _, ok := _c.mutation.UpdatedAt(); !ok {
v := authtokens.DefaultUpdatedAt()
- atc.mutation.SetUpdatedAt(v)
+ _c.mutation.SetUpdatedAt(v)
}
- if _, ok := atc.mutation.ExpiresAt(); !ok {
+ if _, ok := _c.mutation.ExpiresAt(); !ok {
v := authtokens.DefaultExpiresAt()
- atc.mutation.SetExpiresAt(v)
+ _c.mutation.SetExpiresAt(v)
}
- if _, ok := atc.mutation.ID(); !ok {
+ if _, ok := _c.mutation.ID(); !ok {
v := authtokens.DefaultID()
- atc.mutation.SetID(v)
+ _c.mutation.SetID(v)
}
}
// check runs all checks and user-defined validators on the builder.
-func (atc *AuthTokensCreate) check() error {
- if _, ok := atc.mutation.CreatedAt(); !ok {
+func (_c *AuthTokensCreate) check() error {
+ if _, ok := _c.mutation.CreatedAt(); !ok {
return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "AuthTokens.created_at"`)}
}
- if _, ok := atc.mutation.UpdatedAt(); !ok {
+ if _, ok := _c.mutation.UpdatedAt(); !ok {
return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "AuthTokens.updated_at"`)}
}
- if _, ok := atc.mutation.Token(); !ok {
+ if _, ok := _c.mutation.Token(); !ok {
return &ValidationError{Name: "token", err: errors.New(`ent: missing required field "AuthTokens.token"`)}
}
- if _, ok := atc.mutation.ExpiresAt(); !ok {
+ if _, ok := _c.mutation.ExpiresAt(); !ok {
return &ValidationError{Name: "expires_at", err: errors.New(`ent: missing required field "AuthTokens.expires_at"`)}
}
return nil
}
-func (atc *AuthTokensCreate) sqlSave(ctx context.Context) (*AuthTokens, error) {
- if err := atc.check(); err != nil {
+func (_c *AuthTokensCreate) sqlSave(ctx context.Context) (*AuthTokens, error) {
+ if err := _c.check(); err != nil {
return nil, err
}
- _node, _spec := atc.createSpec()
- if err := sqlgraph.CreateNode(ctx, atc.driver, _spec); err != nil {
+ _node, _spec := _c.createSpec()
+ if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil {
if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
@@ -211,37 +211,37 @@ func (atc *AuthTokensCreate) sqlSave(ctx context.Context) (*AuthTokens, error) {
return nil, err
}
}
- atc.mutation.id = &_node.ID
- atc.mutation.done = true
+ _c.mutation.id = &_node.ID
+ _c.mutation.done = true
return _node, nil
}
-func (atc *AuthTokensCreate) createSpec() (*AuthTokens, *sqlgraph.CreateSpec) {
+func (_c *AuthTokensCreate) createSpec() (*AuthTokens, *sqlgraph.CreateSpec) {
var (
- _node = &AuthTokens{config: atc.config}
+ _node = &AuthTokens{config: _c.config}
_spec = sqlgraph.NewCreateSpec(authtokens.Table, sqlgraph.NewFieldSpec(authtokens.FieldID, field.TypeUUID))
)
- if id, ok := atc.mutation.ID(); ok {
+ if id, ok := _c.mutation.ID(); ok {
_node.ID = id
_spec.ID.Value = &id
}
- if value, ok := atc.mutation.CreatedAt(); ok {
+ if value, ok := _c.mutation.CreatedAt(); ok {
_spec.SetField(authtokens.FieldCreatedAt, field.TypeTime, value)
_node.CreatedAt = value
}
- if value, ok := atc.mutation.UpdatedAt(); ok {
+ if value, ok := _c.mutation.UpdatedAt(); ok {
_spec.SetField(authtokens.FieldUpdatedAt, field.TypeTime, value)
_node.UpdatedAt = value
}
- if value, ok := atc.mutation.Token(); ok {
+ if value, ok := _c.mutation.Token(); ok {
_spec.SetField(authtokens.FieldToken, field.TypeBytes, value)
_node.Token = value
}
- if value, ok := atc.mutation.ExpiresAt(); ok {
+ if value, ok := _c.mutation.ExpiresAt(); ok {
_spec.SetField(authtokens.FieldExpiresAt, field.TypeTime, value)
_node.ExpiresAt = value
}
- if nodes := atc.mutation.UserIDs(); len(nodes) > 0 {
+ if nodes := _c.mutation.UserIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -258,7 +258,7 @@ func (atc *AuthTokensCreate) createSpec() (*AuthTokens, *sqlgraph.CreateSpec) {
_node.user_auth_tokens = &nodes[0]
_spec.Edges = append(_spec.Edges, edge)
}
- if nodes := atc.mutation.RolesIDs(); len(nodes) > 0 {
+ if nodes := _c.mutation.RolesIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2O,
Inverse: false,
@@ -285,16 +285,16 @@ type AuthTokensCreateBulk struct {
}
// Save creates the AuthTokens entities in the database.
-func (atcb *AuthTokensCreateBulk) Save(ctx context.Context) ([]*AuthTokens, error) {
- if atcb.err != nil {
- return nil, atcb.err
+func (_c *AuthTokensCreateBulk) Save(ctx context.Context) ([]*AuthTokens, error) {
+ if _c.err != nil {
+ return nil, _c.err
}
- specs := make([]*sqlgraph.CreateSpec, len(atcb.builders))
- nodes := make([]*AuthTokens, len(atcb.builders))
- mutators := make([]Mutator, len(atcb.builders))
- for i := range atcb.builders {
+ specs := make([]*sqlgraph.CreateSpec, len(_c.builders))
+ nodes := make([]*AuthTokens, len(_c.builders))
+ mutators := make([]Mutator, len(_c.builders))
+ for i := range _c.builders {
func(i int, root context.Context) {
- builder := atcb.builders[i]
+ builder := _c.builders[i]
builder.defaults()
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
mutation, ok := m.(*AuthTokensMutation)
@@ -308,11 +308,11 @@ func (atcb *AuthTokensCreateBulk) Save(ctx context.Context) ([]*AuthTokens, erro
var err error
nodes[i], specs[i] = builder.createSpec()
if i < len(mutators)-1 {
- _, err = mutators[i+1].Mutate(root, atcb.builders[i+1].mutation)
+ _, err = mutators[i+1].Mutate(root, _c.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, atcb.driver, spec); err != nil {
+ if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil {
if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
@@ -332,7 +332,7 @@ func (atcb *AuthTokensCreateBulk) Save(ctx context.Context) ([]*AuthTokens, erro
}(i, ctx)
}
if len(mutators) > 0 {
- if _, err := mutators[0].Mutate(ctx, atcb.builders[0].mutation); err != nil {
+ if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil {
return nil, err
}
}
@@ -340,8 +340,8 @@ func (atcb *AuthTokensCreateBulk) Save(ctx context.Context) ([]*AuthTokens, erro
}
// SaveX is like Save, but panics if an error occurs.
-func (atcb *AuthTokensCreateBulk) SaveX(ctx context.Context) []*AuthTokens {
- v, err := atcb.Save(ctx)
+func (_c *AuthTokensCreateBulk) SaveX(ctx context.Context) []*AuthTokens {
+ v, err := _c.Save(ctx)
if err != nil {
panic(err)
}
@@ -349,14 +349,14 @@ func (atcb *AuthTokensCreateBulk) SaveX(ctx context.Context) []*AuthTokens {
}
// Exec executes the query.
-func (atcb *AuthTokensCreateBulk) Exec(ctx context.Context) error {
- _, err := atcb.Save(ctx)
+func (_c *AuthTokensCreateBulk) Exec(ctx context.Context) error {
+ _, err := _c.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
-func (atcb *AuthTokensCreateBulk) ExecX(ctx context.Context) {
- if err := atcb.Exec(ctx); err != nil {
+func (_c *AuthTokensCreateBulk) ExecX(ctx context.Context) {
+ if err := _c.Exec(ctx); err != nil {
panic(err)
}
}
diff --git a/backend/internal/data/ent/authtokens_delete.go b/backend/internal/data/ent/authtokens_delete.go
index cc9dbec5..8aa16337 100644
--- a/backend/internal/data/ent/authtokens_delete.go
+++ b/backend/internal/data/ent/authtokens_delete.go
@@ -20,56 +20,56 @@ type AuthTokensDelete struct {
}
// Where appends a list predicates to the AuthTokensDelete builder.
-func (atd *AuthTokensDelete) Where(ps ...predicate.AuthTokens) *AuthTokensDelete {
- atd.mutation.Where(ps...)
- return atd
+func (_d *AuthTokensDelete) Where(ps ...predicate.AuthTokens) *AuthTokensDelete {
+ _d.mutation.Where(ps...)
+ return _d
}
// Exec executes the deletion query and returns how many vertices were deleted.
-func (atd *AuthTokensDelete) Exec(ctx context.Context) (int, error) {
- return withHooks(ctx, atd.sqlExec, atd.mutation, atd.hooks)
+func (_d *AuthTokensDelete) Exec(ctx context.Context) (int, error) {
+ return withHooks(ctx, _d.sqlExec, _d.mutation, _d.hooks)
}
// ExecX is like Exec, but panics if an error occurs.
-func (atd *AuthTokensDelete) ExecX(ctx context.Context) int {
- n, err := atd.Exec(ctx)
+func (_d *AuthTokensDelete) ExecX(ctx context.Context) int {
+ n, err := _d.Exec(ctx)
if err != nil {
panic(err)
}
return n
}
-func (atd *AuthTokensDelete) sqlExec(ctx context.Context) (int, error) {
+func (_d *AuthTokensDelete) sqlExec(ctx context.Context) (int, error) {
_spec := sqlgraph.NewDeleteSpec(authtokens.Table, sqlgraph.NewFieldSpec(authtokens.FieldID, field.TypeUUID))
- if ps := atd.mutation.predicates; len(ps) > 0 {
+ if ps := _d.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
- affected, err := sqlgraph.DeleteNodes(ctx, atd.driver, _spec)
+ affected, err := sqlgraph.DeleteNodes(ctx, _d.driver, _spec)
if err != nil && sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
- atd.mutation.done = true
+ _d.mutation.done = true
return affected, err
}
// AuthTokensDeleteOne is the builder for deleting a single AuthTokens entity.
type AuthTokensDeleteOne struct {
- atd *AuthTokensDelete
+ _d *AuthTokensDelete
}
// Where appends a list predicates to the AuthTokensDelete builder.
-func (atdo *AuthTokensDeleteOne) Where(ps ...predicate.AuthTokens) *AuthTokensDeleteOne {
- atdo.atd.mutation.Where(ps...)
- return atdo
+func (_d *AuthTokensDeleteOne) Where(ps ...predicate.AuthTokens) *AuthTokensDeleteOne {
+ _d._d.mutation.Where(ps...)
+ return _d
}
// Exec executes the deletion query.
-func (atdo *AuthTokensDeleteOne) Exec(ctx context.Context) error {
- n, err := atdo.atd.Exec(ctx)
+func (_d *AuthTokensDeleteOne) Exec(ctx context.Context) error {
+ n, err := _d._d.Exec(ctx)
switch {
case err != nil:
return err
@@ -81,8 +81,8 @@ func (atdo *AuthTokensDeleteOne) Exec(ctx context.Context) error {
}
// ExecX is like Exec, but panics if an error occurs.
-func (atdo *AuthTokensDeleteOne) ExecX(ctx context.Context) {
- if err := atdo.Exec(ctx); err != nil {
+func (_d *AuthTokensDeleteOne) ExecX(ctx context.Context) {
+ if err := _d.Exec(ctx); err != nil {
panic(err)
}
}
diff --git a/backend/internal/data/ent/authtokens_query.go b/backend/internal/data/ent/authtokens_query.go
index e645e412..8c0ef8d7 100644
--- a/backend/internal/data/ent/authtokens_query.go
+++ b/backend/internal/data/ent/authtokens_query.go
@@ -35,44 +35,44 @@ type AuthTokensQuery struct {
}
// Where adds a new predicate for the AuthTokensQuery builder.
-func (atq *AuthTokensQuery) Where(ps ...predicate.AuthTokens) *AuthTokensQuery {
- atq.predicates = append(atq.predicates, ps...)
- return atq
+func (_q *AuthTokensQuery) Where(ps ...predicate.AuthTokens) *AuthTokensQuery {
+ _q.predicates = append(_q.predicates, ps...)
+ return _q
}
// Limit the number of records to be returned by this query.
-func (atq *AuthTokensQuery) Limit(limit int) *AuthTokensQuery {
- atq.ctx.Limit = &limit
- return atq
+func (_q *AuthTokensQuery) Limit(limit int) *AuthTokensQuery {
+ _q.ctx.Limit = &limit
+ return _q
}
// Offset to start from.
-func (atq *AuthTokensQuery) Offset(offset int) *AuthTokensQuery {
- atq.ctx.Offset = &offset
- return atq
+func (_q *AuthTokensQuery) Offset(offset int) *AuthTokensQuery {
+ _q.ctx.Offset = &offset
+ return _q
}
// Unique configures the query builder to filter duplicate records on query.
// By default, unique is set to true, and can be disabled using this method.
-func (atq *AuthTokensQuery) Unique(unique bool) *AuthTokensQuery {
- atq.ctx.Unique = &unique
- return atq
+func (_q *AuthTokensQuery) Unique(unique bool) *AuthTokensQuery {
+ _q.ctx.Unique = &unique
+ return _q
}
// Order specifies how the records should be ordered.
-func (atq *AuthTokensQuery) Order(o ...authtokens.OrderOption) *AuthTokensQuery {
- atq.order = append(atq.order, o...)
- return atq
+func (_q *AuthTokensQuery) Order(o ...authtokens.OrderOption) *AuthTokensQuery {
+ _q.order = append(_q.order, o...)
+ return _q
}
// QueryUser chains the current query on the "user" edge.
-func (atq *AuthTokensQuery) QueryUser() *UserQuery {
- query := (&UserClient{config: atq.config}).Query()
+func (_q *AuthTokensQuery) QueryUser() *UserQuery {
+ query := (&UserClient{config: _q.config}).Query()
query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
- if err := atq.prepareQuery(ctx); err != nil {
+ if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
- selector := atq.sqlQuery(ctx)
+ selector := _q.sqlQuery(ctx)
if err := selector.Err(); err != nil {
return nil, err
}
@@ -81,20 +81,20 @@ func (atq *AuthTokensQuery) QueryUser() *UserQuery {
sqlgraph.To(user.Table, user.FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, authtokens.UserTable, authtokens.UserColumn),
)
- fromU = sqlgraph.SetNeighbors(atq.driver.Dialect(), step)
+ fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step)
return fromU, nil
}
return query
}
// QueryRoles chains the current query on the "roles" edge.
-func (atq *AuthTokensQuery) QueryRoles() *AuthRolesQuery {
- query := (&AuthRolesClient{config: atq.config}).Query()
+func (_q *AuthTokensQuery) QueryRoles() *AuthRolesQuery {
+ query := (&AuthRolesClient{config: _q.config}).Query()
query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
- if err := atq.prepareQuery(ctx); err != nil {
+ if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
- selector := atq.sqlQuery(ctx)
+ selector := _q.sqlQuery(ctx)
if err := selector.Err(); err != nil {
return nil, err
}
@@ -103,7 +103,7 @@ func (atq *AuthTokensQuery) QueryRoles() *AuthRolesQuery {
sqlgraph.To(authroles.Table, authroles.FieldID),
sqlgraph.Edge(sqlgraph.O2O, false, authtokens.RolesTable, authtokens.RolesColumn),
)
- fromU = sqlgraph.SetNeighbors(atq.driver.Dialect(), step)
+ fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step)
return fromU, nil
}
return query
@@ -111,8 +111,8 @@ func (atq *AuthTokensQuery) QueryRoles() *AuthRolesQuery {
// First returns the first AuthTokens entity from the query.
// Returns a *NotFoundError when no AuthTokens was found.
-func (atq *AuthTokensQuery) First(ctx context.Context) (*AuthTokens, error) {
- nodes, err := atq.Limit(1).All(setContextOp(ctx, atq.ctx, ent.OpQueryFirst))
+func (_q *AuthTokensQuery) First(ctx context.Context) (*AuthTokens, error) {
+ nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst))
if err != nil {
return nil, err
}
@@ -123,8 +123,8 @@ func (atq *AuthTokensQuery) First(ctx context.Context) (*AuthTokens, error) {
}
// FirstX is like First, but panics if an error occurs.
-func (atq *AuthTokensQuery) FirstX(ctx context.Context) *AuthTokens {
- node, err := atq.First(ctx)
+func (_q *AuthTokensQuery) FirstX(ctx context.Context) *AuthTokens {
+ node, err := _q.First(ctx)
if err != nil && !IsNotFound(err) {
panic(err)
}
@@ -133,9 +133,9 @@ func (atq *AuthTokensQuery) FirstX(ctx context.Context) *AuthTokens {
// FirstID returns the first AuthTokens ID from the query.
// Returns a *NotFoundError when no AuthTokens ID was found.
-func (atq *AuthTokensQuery) FirstID(ctx context.Context) (id uuid.UUID, err error) {
+func (_q *AuthTokensQuery) FirstID(ctx context.Context) (id uuid.UUID, err error) {
var ids []uuid.UUID
- if ids, err = atq.Limit(1).IDs(setContextOp(ctx, atq.ctx, ent.OpQueryFirstID)); err != nil {
+ if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil {
return
}
if len(ids) == 0 {
@@ -146,8 +146,8 @@ func (atq *AuthTokensQuery) FirstID(ctx context.Context) (id uuid.UUID, err erro
}
// FirstIDX is like FirstID, but panics if an error occurs.
-func (atq *AuthTokensQuery) FirstIDX(ctx context.Context) uuid.UUID {
- id, err := atq.FirstID(ctx)
+func (_q *AuthTokensQuery) FirstIDX(ctx context.Context) uuid.UUID {
+ id, err := _q.FirstID(ctx)
if err != nil && !IsNotFound(err) {
panic(err)
}
@@ -157,8 +157,8 @@ func (atq *AuthTokensQuery) FirstIDX(ctx context.Context) uuid.UUID {
// Only returns a single AuthTokens entity found by the query, ensuring it only returns one.
// Returns a *NotSingularError when more than one AuthTokens entity is found.
// Returns a *NotFoundError when no AuthTokens entities are found.
-func (atq *AuthTokensQuery) Only(ctx context.Context) (*AuthTokens, error) {
- nodes, err := atq.Limit(2).All(setContextOp(ctx, atq.ctx, ent.OpQueryOnly))
+func (_q *AuthTokensQuery) Only(ctx context.Context) (*AuthTokens, error) {
+ nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly))
if err != nil {
return nil, err
}
@@ -173,8 +173,8 @@ func (atq *AuthTokensQuery) Only(ctx context.Context) (*AuthTokens, error) {
}
// OnlyX is like Only, but panics if an error occurs.
-func (atq *AuthTokensQuery) OnlyX(ctx context.Context) *AuthTokens {
- node, err := atq.Only(ctx)
+func (_q *AuthTokensQuery) OnlyX(ctx context.Context) *AuthTokens {
+ node, err := _q.Only(ctx)
if err != nil {
panic(err)
}
@@ -184,9 +184,9 @@ func (atq *AuthTokensQuery) OnlyX(ctx context.Context) *AuthTokens {
// OnlyID is like Only, but returns the only AuthTokens ID in the query.
// Returns a *NotSingularError when more than one AuthTokens ID is found.
// Returns a *NotFoundError when no entities are found.
-func (atq *AuthTokensQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error) {
+func (_q *AuthTokensQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error) {
var ids []uuid.UUID
- if ids, err = atq.Limit(2).IDs(setContextOp(ctx, atq.ctx, ent.OpQueryOnlyID)); err != nil {
+ if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil {
return
}
switch len(ids) {
@@ -201,8 +201,8 @@ func (atq *AuthTokensQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error
}
// OnlyIDX is like OnlyID, but panics if an error occurs.
-func (atq *AuthTokensQuery) OnlyIDX(ctx context.Context) uuid.UUID {
- id, err := atq.OnlyID(ctx)
+func (_q *AuthTokensQuery) OnlyIDX(ctx context.Context) uuid.UUID {
+ id, err := _q.OnlyID(ctx)
if err != nil {
panic(err)
}
@@ -210,18 +210,18 @@ func (atq *AuthTokensQuery) OnlyIDX(ctx context.Context) uuid.UUID {
}
// All executes the query and returns a list of AuthTokensSlice.
-func (atq *AuthTokensQuery) All(ctx context.Context) ([]*AuthTokens, error) {
- ctx = setContextOp(ctx, atq.ctx, ent.OpQueryAll)
- if err := atq.prepareQuery(ctx); err != nil {
+func (_q *AuthTokensQuery) All(ctx context.Context) ([]*AuthTokens, error) {
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll)
+ if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
qr := querierAll[[]*AuthTokens, *AuthTokensQuery]()
- return withInterceptors[[]*AuthTokens](ctx, atq, qr, atq.inters)
+ return withInterceptors[[]*AuthTokens](ctx, _q, qr, _q.inters)
}
// AllX is like All, but panics if an error occurs.
-func (atq *AuthTokensQuery) AllX(ctx context.Context) []*AuthTokens {
- nodes, err := atq.All(ctx)
+func (_q *AuthTokensQuery) AllX(ctx context.Context) []*AuthTokens {
+ nodes, err := _q.All(ctx)
if err != nil {
panic(err)
}
@@ -229,20 +229,20 @@ func (atq *AuthTokensQuery) AllX(ctx context.Context) []*AuthTokens {
}
// IDs executes the query and returns a list of AuthTokens IDs.
-func (atq *AuthTokensQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error) {
- if atq.ctx.Unique == nil && atq.path != nil {
- atq.Unique(true)
+func (_q *AuthTokensQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error) {
+ if _q.ctx.Unique == nil && _q.path != nil {
+ _q.Unique(true)
}
- ctx = setContextOp(ctx, atq.ctx, ent.OpQueryIDs)
- if err = atq.Select(authtokens.FieldID).Scan(ctx, &ids); err != nil {
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs)
+ if err = _q.Select(authtokens.FieldID).Scan(ctx, &ids); err != nil {
return nil, err
}
return ids, nil
}
// IDsX is like IDs, but panics if an error occurs.
-func (atq *AuthTokensQuery) IDsX(ctx context.Context) []uuid.UUID {
- ids, err := atq.IDs(ctx)
+func (_q *AuthTokensQuery) IDsX(ctx context.Context) []uuid.UUID {
+ ids, err := _q.IDs(ctx)
if err != nil {
panic(err)
}
@@ -250,17 +250,17 @@ func (atq *AuthTokensQuery) IDsX(ctx context.Context) []uuid.UUID {
}
// Count returns the count of the given query.
-func (atq *AuthTokensQuery) Count(ctx context.Context) (int, error) {
- ctx = setContextOp(ctx, atq.ctx, ent.OpQueryCount)
- if err := atq.prepareQuery(ctx); err != nil {
+func (_q *AuthTokensQuery) Count(ctx context.Context) (int, error) {
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryCount)
+ if err := _q.prepareQuery(ctx); err != nil {
return 0, err
}
- return withInterceptors[int](ctx, atq, querierCount[*AuthTokensQuery](), atq.inters)
+ return withInterceptors[int](ctx, _q, querierCount[*AuthTokensQuery](), _q.inters)
}
// CountX is like Count, but panics if an error occurs.
-func (atq *AuthTokensQuery) CountX(ctx context.Context) int {
- count, err := atq.Count(ctx)
+func (_q *AuthTokensQuery) CountX(ctx context.Context) int {
+ count, err := _q.Count(ctx)
if err != nil {
panic(err)
}
@@ -268,9 +268,9 @@ func (atq *AuthTokensQuery) CountX(ctx context.Context) int {
}
// Exist returns true if the query has elements in the graph.
-func (atq *AuthTokensQuery) Exist(ctx context.Context) (bool, error) {
- ctx = setContextOp(ctx, atq.ctx, ent.OpQueryExist)
- switch _, err := atq.FirstID(ctx); {
+func (_q *AuthTokensQuery) Exist(ctx context.Context) (bool, error) {
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryExist)
+ switch _, err := _q.FirstID(ctx); {
case IsNotFound(err):
return false, nil
case err != nil:
@@ -281,8 +281,8 @@ func (atq *AuthTokensQuery) Exist(ctx context.Context) (bool, error) {
}
// ExistX is like Exist, but panics if an error occurs.
-func (atq *AuthTokensQuery) ExistX(ctx context.Context) bool {
- exist, err := atq.Exist(ctx)
+func (_q *AuthTokensQuery) ExistX(ctx context.Context) bool {
+ exist, err := _q.Exist(ctx)
if err != nil {
panic(err)
}
@@ -291,44 +291,44 @@ func (atq *AuthTokensQuery) ExistX(ctx context.Context) bool {
// Clone returns a duplicate of the AuthTokensQuery builder, including all associated steps. It can be
// used to prepare common query builders and use them differently after the clone is made.
-func (atq *AuthTokensQuery) Clone() *AuthTokensQuery {
- if atq == nil {
+func (_q *AuthTokensQuery) Clone() *AuthTokensQuery {
+ if _q == nil {
return nil
}
return &AuthTokensQuery{
- config: atq.config,
- ctx: atq.ctx.Clone(),
- order: append([]authtokens.OrderOption{}, atq.order...),
- inters: append([]Interceptor{}, atq.inters...),
- predicates: append([]predicate.AuthTokens{}, atq.predicates...),
- withUser: atq.withUser.Clone(),
- withRoles: atq.withRoles.Clone(),
+ config: _q.config,
+ ctx: _q.ctx.Clone(),
+ order: append([]authtokens.OrderOption{}, _q.order...),
+ inters: append([]Interceptor{}, _q.inters...),
+ predicates: append([]predicate.AuthTokens{}, _q.predicates...),
+ withUser: _q.withUser.Clone(),
+ withRoles: _q.withRoles.Clone(),
// clone intermediate query.
- sql: atq.sql.Clone(),
- path: atq.path,
+ sql: _q.sql.Clone(),
+ path: _q.path,
}
}
// WithUser tells the query-builder to eager-load the nodes that are connected to
// the "user" edge. The optional arguments are used to configure the query builder of the edge.
-func (atq *AuthTokensQuery) WithUser(opts ...func(*UserQuery)) *AuthTokensQuery {
- query := (&UserClient{config: atq.config}).Query()
+func (_q *AuthTokensQuery) WithUser(opts ...func(*UserQuery)) *AuthTokensQuery {
+ query := (&UserClient{config: _q.config}).Query()
for _, opt := range opts {
opt(query)
}
- atq.withUser = query
- return atq
+ _q.withUser = query
+ return _q
}
// WithRoles tells the query-builder to eager-load the nodes that are connected to
// the "roles" edge. The optional arguments are used to configure the query builder of the edge.
-func (atq *AuthTokensQuery) WithRoles(opts ...func(*AuthRolesQuery)) *AuthTokensQuery {
- query := (&AuthRolesClient{config: atq.config}).Query()
+func (_q *AuthTokensQuery) WithRoles(opts ...func(*AuthRolesQuery)) *AuthTokensQuery {
+ query := (&AuthRolesClient{config: _q.config}).Query()
for _, opt := range opts {
opt(query)
}
- atq.withRoles = query
- return atq
+ _q.withRoles = query
+ return _q
}
// GroupBy is used to group vertices by one or more fields/columns.
@@ -345,10 +345,10 @@ func (atq *AuthTokensQuery) WithRoles(opts ...func(*AuthRolesQuery)) *AuthTokens
// GroupBy(authtokens.FieldCreatedAt).
// Aggregate(ent.Count()).
// Scan(ctx, &v)
-func (atq *AuthTokensQuery) GroupBy(field string, fields ...string) *AuthTokensGroupBy {
- atq.ctx.Fields = append([]string{field}, fields...)
- grbuild := &AuthTokensGroupBy{build: atq}
- grbuild.flds = &atq.ctx.Fields
+func (_q *AuthTokensQuery) GroupBy(field string, fields ...string) *AuthTokensGroupBy {
+ _q.ctx.Fields = append([]string{field}, fields...)
+ grbuild := &AuthTokensGroupBy{build: _q}
+ grbuild.flds = &_q.ctx.Fields
grbuild.label = authtokens.Label
grbuild.scan = grbuild.Scan
return grbuild
@@ -366,56 +366,56 @@ func (atq *AuthTokensQuery) GroupBy(field string, fields ...string) *AuthTokensG
// client.AuthTokens.Query().
// Select(authtokens.FieldCreatedAt).
// Scan(ctx, &v)
-func (atq *AuthTokensQuery) Select(fields ...string) *AuthTokensSelect {
- atq.ctx.Fields = append(atq.ctx.Fields, fields...)
- sbuild := &AuthTokensSelect{AuthTokensQuery: atq}
+func (_q *AuthTokensQuery) Select(fields ...string) *AuthTokensSelect {
+ _q.ctx.Fields = append(_q.ctx.Fields, fields...)
+ sbuild := &AuthTokensSelect{AuthTokensQuery: _q}
sbuild.label = authtokens.Label
- sbuild.flds, sbuild.scan = &atq.ctx.Fields, sbuild.Scan
+ sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan
return sbuild
}
// Aggregate returns a AuthTokensSelect configured with the given aggregations.
-func (atq *AuthTokensQuery) Aggregate(fns ...AggregateFunc) *AuthTokensSelect {
- return atq.Select().Aggregate(fns...)
+func (_q *AuthTokensQuery) Aggregate(fns ...AggregateFunc) *AuthTokensSelect {
+ return _q.Select().Aggregate(fns...)
}
-func (atq *AuthTokensQuery) prepareQuery(ctx context.Context) error {
- for _, inter := range atq.inters {
+func (_q *AuthTokensQuery) prepareQuery(ctx context.Context) error {
+ for _, inter := range _q.inters {
if inter == nil {
return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)")
}
if trv, ok := inter.(Traverser); ok {
- if err := trv.Traverse(ctx, atq); err != nil {
+ if err := trv.Traverse(ctx, _q); err != nil {
return err
}
}
}
- for _, f := range atq.ctx.Fields {
+ for _, f := range _q.ctx.Fields {
if !authtokens.ValidColumn(f) {
return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
}
}
- if atq.path != nil {
- prev, err := atq.path(ctx)
+ if _q.path != nil {
+ prev, err := _q.path(ctx)
if err != nil {
return err
}
- atq.sql = prev
+ _q.sql = prev
}
return nil
}
-func (atq *AuthTokensQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*AuthTokens, error) {
+func (_q *AuthTokensQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*AuthTokens, error) {
var (
nodes = []*AuthTokens{}
- withFKs = atq.withFKs
- _spec = atq.querySpec()
+ withFKs = _q.withFKs
+ _spec = _q.querySpec()
loadedTypes = [2]bool{
- atq.withUser != nil,
- atq.withRoles != nil,
+ _q.withUser != nil,
+ _q.withRoles != nil,
}
)
- if atq.withUser != nil {
+ if _q.withUser != nil {
withFKs = true
}
if withFKs {
@@ -425,7 +425,7 @@ func (atq *AuthTokensQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*
return (*AuthTokens).scanValues(nil, columns)
}
_spec.Assign = func(columns []string, values []any) error {
- node := &AuthTokens{config: atq.config}
+ node := &AuthTokens{config: _q.config}
nodes = append(nodes, node)
node.Edges.loadedTypes = loadedTypes
return node.assignValues(columns, values)
@@ -433,20 +433,20 @@ func (atq *AuthTokensQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*
for i := range hooks {
hooks[i](ctx, _spec)
}
- if err := sqlgraph.QueryNodes(ctx, atq.driver, _spec); err != nil {
+ if err := sqlgraph.QueryNodes(ctx, _q.driver, _spec); err != nil {
return nil, err
}
if len(nodes) == 0 {
return nodes, nil
}
- if query := atq.withUser; query != nil {
- if err := atq.loadUser(ctx, query, nodes, nil,
+ if query := _q.withUser; query != nil {
+ if err := _q.loadUser(ctx, query, nodes, nil,
func(n *AuthTokens, e *User) { n.Edges.User = e }); err != nil {
return nil, err
}
}
- if query := atq.withRoles; query != nil {
- if err := atq.loadRoles(ctx, query, nodes, nil,
+ if query := _q.withRoles; query != nil {
+ if err := _q.loadRoles(ctx, query, nodes, nil,
func(n *AuthTokens, e *AuthRoles) { n.Edges.Roles = e }); err != nil {
return nil, err
}
@@ -454,7 +454,7 @@ func (atq *AuthTokensQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*
return nodes, nil
}
-func (atq *AuthTokensQuery) loadUser(ctx context.Context, query *UserQuery, nodes []*AuthTokens, init func(*AuthTokens), assign func(*AuthTokens, *User)) error {
+func (_q *AuthTokensQuery) loadUser(ctx context.Context, query *UserQuery, nodes []*AuthTokens, init func(*AuthTokens), assign func(*AuthTokens, *User)) error {
ids := make([]uuid.UUID, 0, len(nodes))
nodeids := make(map[uuid.UUID][]*AuthTokens)
for i := range nodes {
@@ -486,7 +486,7 @@ func (atq *AuthTokensQuery) loadUser(ctx context.Context, query *UserQuery, node
}
return nil
}
-func (atq *AuthTokensQuery) loadRoles(ctx context.Context, query *AuthRolesQuery, nodes []*AuthTokens, init func(*AuthTokens), assign func(*AuthTokens, *AuthRoles)) error {
+func (_q *AuthTokensQuery) loadRoles(ctx context.Context, query *AuthRolesQuery, nodes []*AuthTokens, init func(*AuthTokens), assign func(*AuthTokens, *AuthRoles)) error {
fks := make([]driver.Value, 0, len(nodes))
nodeids := make(map[uuid.UUID]*AuthTokens)
for i := range nodes {
@@ -515,24 +515,24 @@ func (atq *AuthTokensQuery) loadRoles(ctx context.Context, query *AuthRolesQuery
return nil
}
-func (atq *AuthTokensQuery) sqlCount(ctx context.Context) (int, error) {
- _spec := atq.querySpec()
- _spec.Node.Columns = atq.ctx.Fields
- if len(atq.ctx.Fields) > 0 {
- _spec.Unique = atq.ctx.Unique != nil && *atq.ctx.Unique
+func (_q *AuthTokensQuery) sqlCount(ctx context.Context) (int, error) {
+ _spec := _q.querySpec()
+ _spec.Node.Columns = _q.ctx.Fields
+ if len(_q.ctx.Fields) > 0 {
+ _spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique
}
- return sqlgraph.CountNodes(ctx, atq.driver, _spec)
+ return sqlgraph.CountNodes(ctx, _q.driver, _spec)
}
-func (atq *AuthTokensQuery) querySpec() *sqlgraph.QuerySpec {
+func (_q *AuthTokensQuery) querySpec() *sqlgraph.QuerySpec {
_spec := sqlgraph.NewQuerySpec(authtokens.Table, authtokens.Columns, sqlgraph.NewFieldSpec(authtokens.FieldID, field.TypeUUID))
- _spec.From = atq.sql
- if unique := atq.ctx.Unique; unique != nil {
+ _spec.From = _q.sql
+ if unique := _q.ctx.Unique; unique != nil {
_spec.Unique = *unique
- } else if atq.path != nil {
+ } else if _q.path != nil {
_spec.Unique = true
}
- if fields := atq.ctx.Fields; len(fields) > 0 {
+ if fields := _q.ctx.Fields; len(fields) > 0 {
_spec.Node.Columns = make([]string, 0, len(fields))
_spec.Node.Columns = append(_spec.Node.Columns, authtokens.FieldID)
for i := range fields {
@@ -541,20 +541,20 @@ func (atq *AuthTokensQuery) querySpec() *sqlgraph.QuerySpec {
}
}
}
- if ps := atq.predicates; len(ps) > 0 {
+ if ps := _q.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
- if limit := atq.ctx.Limit; limit != nil {
+ if limit := _q.ctx.Limit; limit != nil {
_spec.Limit = *limit
}
- if offset := atq.ctx.Offset; offset != nil {
+ if offset := _q.ctx.Offset; offset != nil {
_spec.Offset = *offset
}
- if ps := atq.order; len(ps) > 0 {
+ if ps := _q.order; len(ps) > 0 {
_spec.Order = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
@@ -564,33 +564,33 @@ func (atq *AuthTokensQuery) querySpec() *sqlgraph.QuerySpec {
return _spec
}
-func (atq *AuthTokensQuery) sqlQuery(ctx context.Context) *sql.Selector {
- builder := sql.Dialect(atq.driver.Dialect())
+func (_q *AuthTokensQuery) sqlQuery(ctx context.Context) *sql.Selector {
+ builder := sql.Dialect(_q.driver.Dialect())
t1 := builder.Table(authtokens.Table)
- columns := atq.ctx.Fields
+ columns := _q.ctx.Fields
if len(columns) == 0 {
columns = authtokens.Columns
}
selector := builder.Select(t1.Columns(columns...)...).From(t1)
- if atq.sql != nil {
- selector = atq.sql
+ if _q.sql != nil {
+ selector = _q.sql
selector.Select(selector.Columns(columns...)...)
}
- if atq.ctx.Unique != nil && *atq.ctx.Unique {
+ if _q.ctx.Unique != nil && *_q.ctx.Unique {
selector.Distinct()
}
- for _, p := range atq.predicates {
+ for _, p := range _q.predicates {
p(selector)
}
- for _, p := range atq.order {
+ for _, p := range _q.order {
p(selector)
}
- if offset := atq.ctx.Offset; offset != nil {
+ if offset := _q.ctx.Offset; offset != nil {
// limit is mandatory for offset clause. We start
// with default value, and override it below if needed.
selector.Offset(*offset).Limit(math.MaxInt32)
}
- if limit := atq.ctx.Limit; limit != nil {
+ if limit := _q.ctx.Limit; limit != nil {
selector.Limit(*limit)
}
return selector
@@ -603,41 +603,41 @@ type AuthTokensGroupBy struct {
}
// Aggregate adds the given aggregation functions to the group-by query.
-func (atgb *AuthTokensGroupBy) Aggregate(fns ...AggregateFunc) *AuthTokensGroupBy {
- atgb.fns = append(atgb.fns, fns...)
- return atgb
+func (_g *AuthTokensGroupBy) Aggregate(fns ...AggregateFunc) *AuthTokensGroupBy {
+ _g.fns = append(_g.fns, fns...)
+ return _g
}
// Scan applies the selector query and scans the result into the given value.
-func (atgb *AuthTokensGroupBy) Scan(ctx context.Context, v any) error {
- ctx = setContextOp(ctx, atgb.build.ctx, ent.OpQueryGroupBy)
- if err := atgb.build.prepareQuery(ctx); err != nil {
+func (_g *AuthTokensGroupBy) Scan(ctx context.Context, v any) error {
+ ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy)
+ if err := _g.build.prepareQuery(ctx); err != nil {
return err
}
- return scanWithInterceptors[*AuthTokensQuery, *AuthTokensGroupBy](ctx, atgb.build, atgb, atgb.build.inters, v)
+ return scanWithInterceptors[*AuthTokensQuery, *AuthTokensGroupBy](ctx, _g.build, _g, _g.build.inters, v)
}
-func (atgb *AuthTokensGroupBy) sqlScan(ctx context.Context, root *AuthTokensQuery, v any) error {
+func (_g *AuthTokensGroupBy) sqlScan(ctx context.Context, root *AuthTokensQuery, v any) error {
selector := root.sqlQuery(ctx).Select()
- aggregation := make([]string, 0, len(atgb.fns))
- for _, fn := range atgb.fns {
+ aggregation := make([]string, 0, len(_g.fns))
+ for _, fn := range _g.fns {
aggregation = append(aggregation, fn(selector))
}
if len(selector.SelectedColumns()) == 0 {
- columns := make([]string, 0, len(*atgb.flds)+len(atgb.fns))
- for _, f := range *atgb.flds {
+ columns := make([]string, 0, len(*_g.flds)+len(_g.fns))
+ for _, f := range *_g.flds {
columns = append(columns, selector.C(f))
}
columns = append(columns, aggregation...)
selector.Select(columns...)
}
- selector.GroupBy(selector.Columns(*atgb.flds...)...)
+ selector.GroupBy(selector.Columns(*_g.flds...)...)
if err := selector.Err(); err != nil {
return err
}
rows := &sql.Rows{}
query, args := selector.Query()
- if err := atgb.build.driver.Query(ctx, query, args, rows); err != nil {
+ if err := _g.build.driver.Query(ctx, query, args, rows); err != nil {
return err
}
defer rows.Close()
@@ -651,27 +651,27 @@ type AuthTokensSelect struct {
}
// Aggregate adds the given aggregation functions to the selector query.
-func (ats *AuthTokensSelect) Aggregate(fns ...AggregateFunc) *AuthTokensSelect {
- ats.fns = append(ats.fns, fns...)
- return ats
+func (_s *AuthTokensSelect) Aggregate(fns ...AggregateFunc) *AuthTokensSelect {
+ _s.fns = append(_s.fns, fns...)
+ return _s
}
// Scan applies the selector query and scans the result into the given value.
-func (ats *AuthTokensSelect) Scan(ctx context.Context, v any) error {
- ctx = setContextOp(ctx, ats.ctx, ent.OpQuerySelect)
- if err := ats.prepareQuery(ctx); err != nil {
+func (_s *AuthTokensSelect) Scan(ctx context.Context, v any) error {
+ ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect)
+ if err := _s.prepareQuery(ctx); err != nil {
return err
}
- return scanWithInterceptors[*AuthTokensQuery, *AuthTokensSelect](ctx, ats.AuthTokensQuery, ats, ats.inters, v)
+ return scanWithInterceptors[*AuthTokensQuery, *AuthTokensSelect](ctx, _s.AuthTokensQuery, _s, _s.inters, v)
}
-func (ats *AuthTokensSelect) sqlScan(ctx context.Context, root *AuthTokensQuery, v any) error {
+func (_s *AuthTokensSelect) sqlScan(ctx context.Context, root *AuthTokensQuery, v any) error {
selector := root.sqlQuery(ctx)
- aggregation := make([]string, 0, len(ats.fns))
- for _, fn := range ats.fns {
+ aggregation := make([]string, 0, len(_s.fns))
+ for _, fn := range _s.fns {
aggregation = append(aggregation, fn(selector))
}
- switch n := len(*ats.selector.flds); {
+ switch n := len(*_s.selector.flds); {
case n == 0 && len(aggregation) > 0:
selector.Select(aggregation...)
case n != 0 && len(aggregation) > 0:
@@ -679,7 +679,7 @@ func (ats *AuthTokensSelect) sqlScan(ctx context.Context, root *AuthTokensQuery,
}
rows := &sql.Rows{}
query, args := selector.Query()
- if err := ats.driver.Query(ctx, query, args, rows); err != nil {
+ if err := _s.driver.Query(ctx, query, args, rows); err != nil {
return err
}
defer rows.Close()
diff --git a/backend/internal/data/ent/authtokens_update.go b/backend/internal/data/ent/authtokens_update.go
index 380f9fb6..260a1fe9 100644
--- a/backend/internal/data/ent/authtokens_update.go
+++ b/backend/internal/data/ent/authtokens_update.go
@@ -26,101 +26,101 @@ type AuthTokensUpdate struct {
}
// Where appends a list predicates to the AuthTokensUpdate builder.
-func (atu *AuthTokensUpdate) Where(ps ...predicate.AuthTokens) *AuthTokensUpdate {
- atu.mutation.Where(ps...)
- return atu
+func (_u *AuthTokensUpdate) Where(ps ...predicate.AuthTokens) *AuthTokensUpdate {
+ _u.mutation.Where(ps...)
+ return _u
}
// SetUpdatedAt sets the "updated_at" field.
-func (atu *AuthTokensUpdate) SetUpdatedAt(t time.Time) *AuthTokensUpdate {
- atu.mutation.SetUpdatedAt(t)
- return atu
+func (_u *AuthTokensUpdate) SetUpdatedAt(v time.Time) *AuthTokensUpdate {
+ _u.mutation.SetUpdatedAt(v)
+ return _u
}
// SetToken sets the "token" field.
-func (atu *AuthTokensUpdate) SetToken(b []byte) *AuthTokensUpdate {
- atu.mutation.SetToken(b)
- return atu
+func (_u *AuthTokensUpdate) SetToken(v []byte) *AuthTokensUpdate {
+ _u.mutation.SetToken(v)
+ return _u
}
// SetExpiresAt sets the "expires_at" field.
-func (atu *AuthTokensUpdate) SetExpiresAt(t time.Time) *AuthTokensUpdate {
- atu.mutation.SetExpiresAt(t)
- return atu
+func (_u *AuthTokensUpdate) SetExpiresAt(v time.Time) *AuthTokensUpdate {
+ _u.mutation.SetExpiresAt(v)
+ return _u
}
// SetNillableExpiresAt sets the "expires_at" field if the given value is not nil.
-func (atu *AuthTokensUpdate) SetNillableExpiresAt(t *time.Time) *AuthTokensUpdate {
- if t != nil {
- atu.SetExpiresAt(*t)
+func (_u *AuthTokensUpdate) SetNillableExpiresAt(v *time.Time) *AuthTokensUpdate {
+ if v != nil {
+ _u.SetExpiresAt(*v)
}
- return atu
+ return _u
}
// SetUserID sets the "user" edge to the User entity by ID.
-func (atu *AuthTokensUpdate) SetUserID(id uuid.UUID) *AuthTokensUpdate {
- atu.mutation.SetUserID(id)
- return atu
+func (_u *AuthTokensUpdate) SetUserID(id uuid.UUID) *AuthTokensUpdate {
+ _u.mutation.SetUserID(id)
+ return _u
}
// SetNillableUserID sets the "user" edge to the User entity by ID if the given value is not nil.
-func (atu *AuthTokensUpdate) SetNillableUserID(id *uuid.UUID) *AuthTokensUpdate {
+func (_u *AuthTokensUpdate) SetNillableUserID(id *uuid.UUID) *AuthTokensUpdate {
if id != nil {
- atu = atu.SetUserID(*id)
+ _u = _u.SetUserID(*id)
}
- return atu
+ return _u
}
// SetUser sets the "user" edge to the User entity.
-func (atu *AuthTokensUpdate) SetUser(u *User) *AuthTokensUpdate {
- return atu.SetUserID(u.ID)
+func (_u *AuthTokensUpdate) SetUser(v *User) *AuthTokensUpdate {
+ return _u.SetUserID(v.ID)
}
// SetRolesID sets the "roles" edge to the AuthRoles entity by ID.
-func (atu *AuthTokensUpdate) SetRolesID(id int) *AuthTokensUpdate {
- atu.mutation.SetRolesID(id)
- return atu
+func (_u *AuthTokensUpdate) SetRolesID(id int) *AuthTokensUpdate {
+ _u.mutation.SetRolesID(id)
+ return _u
}
// SetNillableRolesID sets the "roles" edge to the AuthRoles entity by ID if the given value is not nil.
-func (atu *AuthTokensUpdate) SetNillableRolesID(id *int) *AuthTokensUpdate {
+func (_u *AuthTokensUpdate) SetNillableRolesID(id *int) *AuthTokensUpdate {
if id != nil {
- atu = atu.SetRolesID(*id)
+ _u = _u.SetRolesID(*id)
}
- return atu
+ return _u
}
// SetRoles sets the "roles" edge to the AuthRoles entity.
-func (atu *AuthTokensUpdate) SetRoles(a *AuthRoles) *AuthTokensUpdate {
- return atu.SetRolesID(a.ID)
+func (_u *AuthTokensUpdate) SetRoles(v *AuthRoles) *AuthTokensUpdate {
+ return _u.SetRolesID(v.ID)
}
// Mutation returns the AuthTokensMutation object of the builder.
-func (atu *AuthTokensUpdate) Mutation() *AuthTokensMutation {
- return atu.mutation
+func (_u *AuthTokensUpdate) Mutation() *AuthTokensMutation {
+ return _u.mutation
}
// ClearUser clears the "user" edge to the User entity.
-func (atu *AuthTokensUpdate) ClearUser() *AuthTokensUpdate {
- atu.mutation.ClearUser()
- return atu
+func (_u *AuthTokensUpdate) ClearUser() *AuthTokensUpdate {
+ _u.mutation.ClearUser()
+ return _u
}
// ClearRoles clears the "roles" edge to the AuthRoles entity.
-func (atu *AuthTokensUpdate) ClearRoles() *AuthTokensUpdate {
- atu.mutation.ClearRoles()
- return atu
+func (_u *AuthTokensUpdate) ClearRoles() *AuthTokensUpdate {
+ _u.mutation.ClearRoles()
+ return _u
}
// Save executes the query and returns the number of nodes affected by the update operation.
-func (atu *AuthTokensUpdate) Save(ctx context.Context) (int, error) {
- atu.defaults()
- return withHooks(ctx, atu.sqlSave, atu.mutation, atu.hooks)
+func (_u *AuthTokensUpdate) Save(ctx context.Context) (int, error) {
+ _u.defaults()
+ return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
}
// SaveX is like Save, but panics if an error occurs.
-func (atu *AuthTokensUpdate) SaveX(ctx context.Context) int {
- affected, err := atu.Save(ctx)
+func (_u *AuthTokensUpdate) SaveX(ctx context.Context) int {
+ affected, err := _u.Save(ctx)
if err != nil {
panic(err)
}
@@ -128,45 +128,45 @@ func (atu *AuthTokensUpdate) SaveX(ctx context.Context) int {
}
// Exec executes the query.
-func (atu *AuthTokensUpdate) Exec(ctx context.Context) error {
- _, err := atu.Save(ctx)
+func (_u *AuthTokensUpdate) Exec(ctx context.Context) error {
+ _, err := _u.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
-func (atu *AuthTokensUpdate) ExecX(ctx context.Context) {
- if err := atu.Exec(ctx); err != nil {
+func (_u *AuthTokensUpdate) ExecX(ctx context.Context) {
+ if err := _u.Exec(ctx); err != nil {
panic(err)
}
}
// defaults sets the default values of the builder before save.
-func (atu *AuthTokensUpdate) defaults() {
- if _, ok := atu.mutation.UpdatedAt(); !ok {
+func (_u *AuthTokensUpdate) defaults() {
+ if _, ok := _u.mutation.UpdatedAt(); !ok {
v := authtokens.UpdateDefaultUpdatedAt()
- atu.mutation.SetUpdatedAt(v)
+ _u.mutation.SetUpdatedAt(v)
}
}
-func (atu *AuthTokensUpdate) sqlSave(ctx context.Context) (n int, err error) {
+func (_u *AuthTokensUpdate) sqlSave(ctx context.Context) (_node int, err error) {
_spec := sqlgraph.NewUpdateSpec(authtokens.Table, authtokens.Columns, sqlgraph.NewFieldSpec(authtokens.FieldID, field.TypeUUID))
- if ps := atu.mutation.predicates; len(ps) > 0 {
+ if ps := _u.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
- if value, ok := atu.mutation.UpdatedAt(); ok {
+ if value, ok := _u.mutation.UpdatedAt(); ok {
_spec.SetField(authtokens.FieldUpdatedAt, field.TypeTime, value)
}
- if value, ok := atu.mutation.Token(); ok {
+ if value, ok := _u.mutation.Token(); ok {
_spec.SetField(authtokens.FieldToken, field.TypeBytes, value)
}
- if value, ok := atu.mutation.ExpiresAt(); ok {
+ if value, ok := _u.mutation.ExpiresAt(); ok {
_spec.SetField(authtokens.FieldExpiresAt, field.TypeTime, value)
}
- if atu.mutation.UserCleared() {
+ if _u.mutation.UserCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -179,7 +179,7 @@ func (atu *AuthTokensUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := atu.mutation.UserIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.UserIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -195,7 +195,7 @@ func (atu *AuthTokensUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- if atu.mutation.RolesCleared() {
+ if _u.mutation.RolesCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2O,
Inverse: false,
@@ -208,7 +208,7 @@ func (atu *AuthTokensUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := atu.mutation.RolesIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.RolesIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2O,
Inverse: false,
@@ -224,7 +224,7 @@ func (atu *AuthTokensUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- if n, err = sqlgraph.UpdateNodes(ctx, atu.driver, _spec); err != nil {
+ if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil {
if _, ok := err.(*sqlgraph.NotFoundError); ok {
err = &NotFoundError{authtokens.Label}
} else if sqlgraph.IsConstraintError(err) {
@@ -232,8 +232,8 @@ func (atu *AuthTokensUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
return 0, err
}
- atu.mutation.done = true
- return n, nil
+ _u.mutation.done = true
+ return _node, nil
}
// AuthTokensUpdateOne is the builder for updating a single AuthTokens entity.
@@ -245,108 +245,108 @@ type AuthTokensUpdateOne struct {
}
// SetUpdatedAt sets the "updated_at" field.
-func (atuo *AuthTokensUpdateOne) SetUpdatedAt(t time.Time) *AuthTokensUpdateOne {
- atuo.mutation.SetUpdatedAt(t)
- return atuo
+func (_u *AuthTokensUpdateOne) SetUpdatedAt(v time.Time) *AuthTokensUpdateOne {
+ _u.mutation.SetUpdatedAt(v)
+ return _u
}
// SetToken sets the "token" field.
-func (atuo *AuthTokensUpdateOne) SetToken(b []byte) *AuthTokensUpdateOne {
- atuo.mutation.SetToken(b)
- return atuo
+func (_u *AuthTokensUpdateOne) SetToken(v []byte) *AuthTokensUpdateOne {
+ _u.mutation.SetToken(v)
+ return _u
}
// SetExpiresAt sets the "expires_at" field.
-func (atuo *AuthTokensUpdateOne) SetExpiresAt(t time.Time) *AuthTokensUpdateOne {
- atuo.mutation.SetExpiresAt(t)
- return atuo
+func (_u *AuthTokensUpdateOne) SetExpiresAt(v time.Time) *AuthTokensUpdateOne {
+ _u.mutation.SetExpiresAt(v)
+ return _u
}
// SetNillableExpiresAt sets the "expires_at" field if the given value is not nil.
-func (atuo *AuthTokensUpdateOne) SetNillableExpiresAt(t *time.Time) *AuthTokensUpdateOne {
- if t != nil {
- atuo.SetExpiresAt(*t)
+func (_u *AuthTokensUpdateOne) SetNillableExpiresAt(v *time.Time) *AuthTokensUpdateOne {
+ if v != nil {
+ _u.SetExpiresAt(*v)
}
- return atuo
+ return _u
}
// SetUserID sets the "user" edge to the User entity by ID.
-func (atuo *AuthTokensUpdateOne) SetUserID(id uuid.UUID) *AuthTokensUpdateOne {
- atuo.mutation.SetUserID(id)
- return atuo
+func (_u *AuthTokensUpdateOne) SetUserID(id uuid.UUID) *AuthTokensUpdateOne {
+ _u.mutation.SetUserID(id)
+ return _u
}
// SetNillableUserID sets the "user" edge to the User entity by ID if the given value is not nil.
-func (atuo *AuthTokensUpdateOne) SetNillableUserID(id *uuid.UUID) *AuthTokensUpdateOne {
+func (_u *AuthTokensUpdateOne) SetNillableUserID(id *uuid.UUID) *AuthTokensUpdateOne {
if id != nil {
- atuo = atuo.SetUserID(*id)
+ _u = _u.SetUserID(*id)
}
- return atuo
+ return _u
}
// SetUser sets the "user" edge to the User entity.
-func (atuo *AuthTokensUpdateOne) SetUser(u *User) *AuthTokensUpdateOne {
- return atuo.SetUserID(u.ID)
+func (_u *AuthTokensUpdateOne) SetUser(v *User) *AuthTokensUpdateOne {
+ return _u.SetUserID(v.ID)
}
// SetRolesID sets the "roles" edge to the AuthRoles entity by ID.
-func (atuo *AuthTokensUpdateOne) SetRolesID(id int) *AuthTokensUpdateOne {
- atuo.mutation.SetRolesID(id)
- return atuo
+func (_u *AuthTokensUpdateOne) SetRolesID(id int) *AuthTokensUpdateOne {
+ _u.mutation.SetRolesID(id)
+ return _u
}
// SetNillableRolesID sets the "roles" edge to the AuthRoles entity by ID if the given value is not nil.
-func (atuo *AuthTokensUpdateOne) SetNillableRolesID(id *int) *AuthTokensUpdateOne {
+func (_u *AuthTokensUpdateOne) SetNillableRolesID(id *int) *AuthTokensUpdateOne {
if id != nil {
- atuo = atuo.SetRolesID(*id)
+ _u = _u.SetRolesID(*id)
}
- return atuo
+ return _u
}
// SetRoles sets the "roles" edge to the AuthRoles entity.
-func (atuo *AuthTokensUpdateOne) SetRoles(a *AuthRoles) *AuthTokensUpdateOne {
- return atuo.SetRolesID(a.ID)
+func (_u *AuthTokensUpdateOne) SetRoles(v *AuthRoles) *AuthTokensUpdateOne {
+ return _u.SetRolesID(v.ID)
}
// Mutation returns the AuthTokensMutation object of the builder.
-func (atuo *AuthTokensUpdateOne) Mutation() *AuthTokensMutation {
- return atuo.mutation
+func (_u *AuthTokensUpdateOne) Mutation() *AuthTokensMutation {
+ return _u.mutation
}
// ClearUser clears the "user" edge to the User entity.
-func (atuo *AuthTokensUpdateOne) ClearUser() *AuthTokensUpdateOne {
- atuo.mutation.ClearUser()
- return atuo
+func (_u *AuthTokensUpdateOne) ClearUser() *AuthTokensUpdateOne {
+ _u.mutation.ClearUser()
+ return _u
}
// ClearRoles clears the "roles" edge to the AuthRoles entity.
-func (atuo *AuthTokensUpdateOne) ClearRoles() *AuthTokensUpdateOne {
- atuo.mutation.ClearRoles()
- return atuo
+func (_u *AuthTokensUpdateOne) ClearRoles() *AuthTokensUpdateOne {
+ _u.mutation.ClearRoles()
+ return _u
}
// Where appends a list predicates to the AuthTokensUpdate builder.
-func (atuo *AuthTokensUpdateOne) Where(ps ...predicate.AuthTokens) *AuthTokensUpdateOne {
- atuo.mutation.Where(ps...)
- return atuo
+func (_u *AuthTokensUpdateOne) Where(ps ...predicate.AuthTokens) *AuthTokensUpdateOne {
+ _u.mutation.Where(ps...)
+ return _u
}
// Select allows selecting one or more fields (columns) of the returned entity.
// The default is selecting all fields defined in the entity schema.
-func (atuo *AuthTokensUpdateOne) Select(field string, fields ...string) *AuthTokensUpdateOne {
- atuo.fields = append([]string{field}, fields...)
- return atuo
+func (_u *AuthTokensUpdateOne) Select(field string, fields ...string) *AuthTokensUpdateOne {
+ _u.fields = append([]string{field}, fields...)
+ return _u
}
// Save executes the query and returns the updated AuthTokens entity.
-func (atuo *AuthTokensUpdateOne) Save(ctx context.Context) (*AuthTokens, error) {
- atuo.defaults()
- return withHooks(ctx, atuo.sqlSave, atuo.mutation, atuo.hooks)
+func (_u *AuthTokensUpdateOne) Save(ctx context.Context) (*AuthTokens, error) {
+ _u.defaults()
+ return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
}
// SaveX is like Save, but panics if an error occurs.
-func (atuo *AuthTokensUpdateOne) SaveX(ctx context.Context) *AuthTokens {
- node, err := atuo.Save(ctx)
+func (_u *AuthTokensUpdateOne) SaveX(ctx context.Context) *AuthTokens {
+ node, err := _u.Save(ctx)
if err != nil {
panic(err)
}
@@ -354,34 +354,34 @@ func (atuo *AuthTokensUpdateOne) SaveX(ctx context.Context) *AuthTokens {
}
// Exec executes the query on the entity.
-func (atuo *AuthTokensUpdateOne) Exec(ctx context.Context) error {
- _, err := atuo.Save(ctx)
+func (_u *AuthTokensUpdateOne) Exec(ctx context.Context) error {
+ _, err := _u.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
-func (atuo *AuthTokensUpdateOne) ExecX(ctx context.Context) {
- if err := atuo.Exec(ctx); err != nil {
+func (_u *AuthTokensUpdateOne) ExecX(ctx context.Context) {
+ if err := _u.Exec(ctx); err != nil {
panic(err)
}
}
// defaults sets the default values of the builder before save.
-func (atuo *AuthTokensUpdateOne) defaults() {
- if _, ok := atuo.mutation.UpdatedAt(); !ok {
+func (_u *AuthTokensUpdateOne) defaults() {
+ if _, ok := _u.mutation.UpdatedAt(); !ok {
v := authtokens.UpdateDefaultUpdatedAt()
- atuo.mutation.SetUpdatedAt(v)
+ _u.mutation.SetUpdatedAt(v)
}
}
-func (atuo *AuthTokensUpdateOne) sqlSave(ctx context.Context) (_node *AuthTokens, err error) {
+func (_u *AuthTokensUpdateOne) sqlSave(ctx context.Context) (_node *AuthTokens, err error) {
_spec := sqlgraph.NewUpdateSpec(authtokens.Table, authtokens.Columns, sqlgraph.NewFieldSpec(authtokens.FieldID, field.TypeUUID))
- id, ok := atuo.mutation.ID()
+ id, ok := _u.mutation.ID()
if !ok {
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "AuthTokens.id" for update`)}
}
_spec.Node.ID.Value = id
- if fields := atuo.fields; len(fields) > 0 {
+ if fields := _u.fields; len(fields) > 0 {
_spec.Node.Columns = make([]string, 0, len(fields))
_spec.Node.Columns = append(_spec.Node.Columns, authtokens.FieldID)
for _, f := range fields {
@@ -393,23 +393,23 @@ func (atuo *AuthTokensUpdateOne) sqlSave(ctx context.Context) (_node *AuthTokens
}
}
}
- if ps := atuo.mutation.predicates; len(ps) > 0 {
+ if ps := _u.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
- if value, ok := atuo.mutation.UpdatedAt(); ok {
+ if value, ok := _u.mutation.UpdatedAt(); ok {
_spec.SetField(authtokens.FieldUpdatedAt, field.TypeTime, value)
}
- if value, ok := atuo.mutation.Token(); ok {
+ if value, ok := _u.mutation.Token(); ok {
_spec.SetField(authtokens.FieldToken, field.TypeBytes, value)
}
- if value, ok := atuo.mutation.ExpiresAt(); ok {
+ if value, ok := _u.mutation.ExpiresAt(); ok {
_spec.SetField(authtokens.FieldExpiresAt, field.TypeTime, value)
}
- if atuo.mutation.UserCleared() {
+ if _u.mutation.UserCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -422,7 +422,7 @@ func (atuo *AuthTokensUpdateOne) sqlSave(ctx context.Context) (_node *AuthTokens
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := atuo.mutation.UserIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.UserIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -438,7 +438,7 @@ func (atuo *AuthTokensUpdateOne) sqlSave(ctx context.Context) (_node *AuthTokens
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- if atuo.mutation.RolesCleared() {
+ if _u.mutation.RolesCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2O,
Inverse: false,
@@ -451,7 +451,7 @@ func (atuo *AuthTokensUpdateOne) sqlSave(ctx context.Context) (_node *AuthTokens
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := atuo.mutation.RolesIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.RolesIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2O,
Inverse: false,
@@ -467,10 +467,10 @@ func (atuo *AuthTokensUpdateOne) sqlSave(ctx context.Context) (_node *AuthTokens
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- _node = &AuthTokens{config: atuo.config}
+ _node = &AuthTokens{config: _u.config}
_spec.Assign = _node.assignValues
_spec.ScanValues = _node.scanValues
- if err = sqlgraph.UpdateNode(ctx, atuo.driver, _spec); err != nil {
+ if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil {
if _, ok := err.(*sqlgraph.NotFoundError); ok {
err = &NotFoundError{authtokens.Label}
} else if sqlgraph.IsConstraintError(err) {
@@ -478,6 +478,6 @@ func (atuo *AuthTokensUpdateOne) sqlSave(ctx context.Context) (_node *AuthTokens
}
return nil, err
}
- atuo.mutation.done = true
+ _u.mutation.done = true
return _node, nil
}
diff --git a/backend/internal/data/ent/client.go b/backend/internal/data/ent/client.go
index babad945..6c6c30b9 100644
--- a/backend/internal/data/ent/client.go
+++ b/backend/internal/data/ent/client.go
@@ -353,8 +353,8 @@ func (c *AttachmentClient) Update() *AttachmentUpdate {
}
// UpdateOne returns an update builder for the given entity.
-func (c *AttachmentClient) UpdateOne(a *Attachment) *AttachmentUpdateOne {
- mutation := newAttachmentMutation(c.config, OpUpdateOne, withAttachment(a))
+func (c *AttachmentClient) UpdateOne(_m *Attachment) *AttachmentUpdateOne {
+ mutation := newAttachmentMutation(c.config, OpUpdateOne, withAttachment(_m))
return &AttachmentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
@@ -371,8 +371,8 @@ func (c *AttachmentClient) Delete() *AttachmentDelete {
}
// DeleteOne returns a builder for deleting the given entity.
-func (c *AttachmentClient) DeleteOne(a *Attachment) *AttachmentDeleteOne {
- return c.DeleteOneID(a.ID)
+func (c *AttachmentClient) DeleteOne(_m *Attachment) *AttachmentDeleteOne {
+ return c.DeleteOneID(_m.ID)
}
// DeleteOneID returns a builder for deleting the given entity by its id.
@@ -407,32 +407,32 @@ func (c *AttachmentClient) GetX(ctx context.Context, id uuid.UUID) *Attachment {
}
// QueryItem queries the item edge of a Attachment.
-func (c *AttachmentClient) QueryItem(a *Attachment) *ItemQuery {
+func (c *AttachmentClient) QueryItem(_m *Attachment) *ItemQuery {
query := (&ItemClient{config: c.config}).Query()
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := a.ID
+ id := _m.ID
step := sqlgraph.NewStep(
sqlgraph.From(attachment.Table, attachment.FieldID, id),
sqlgraph.To(item.Table, item.FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, attachment.ItemTable, attachment.ItemColumn),
)
- fromV = sqlgraph.Neighbors(a.driver.Dialect(), step)
+ fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
return fromV, nil
}
return query
}
// QueryThumbnail queries the thumbnail edge of a Attachment.
-func (c *AttachmentClient) QueryThumbnail(a *Attachment) *AttachmentQuery {
+func (c *AttachmentClient) QueryThumbnail(_m *Attachment) *AttachmentQuery {
query := (&AttachmentClient{config: c.config}).Query()
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := a.ID
+ id := _m.ID
step := sqlgraph.NewStep(
sqlgraph.From(attachment.Table, attachment.FieldID, id),
sqlgraph.To(attachment.Table, attachment.FieldID),
sqlgraph.Edge(sqlgraph.O2O, false, attachment.ThumbnailTable, attachment.ThumbnailColumn),
)
- fromV = sqlgraph.Neighbors(a.driver.Dialect(), step)
+ fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
return fromV, nil
}
return query
@@ -518,8 +518,8 @@ func (c *AuthRolesClient) Update() *AuthRolesUpdate {
}
// UpdateOne returns an update builder for the given entity.
-func (c *AuthRolesClient) UpdateOne(ar *AuthRoles) *AuthRolesUpdateOne {
- mutation := newAuthRolesMutation(c.config, OpUpdateOne, withAuthRoles(ar))
+func (c *AuthRolesClient) UpdateOne(_m *AuthRoles) *AuthRolesUpdateOne {
+ mutation := newAuthRolesMutation(c.config, OpUpdateOne, withAuthRoles(_m))
return &AuthRolesUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
@@ -536,8 +536,8 @@ func (c *AuthRolesClient) Delete() *AuthRolesDelete {
}
// DeleteOne returns a builder for deleting the given entity.
-func (c *AuthRolesClient) DeleteOne(ar *AuthRoles) *AuthRolesDeleteOne {
- return c.DeleteOneID(ar.ID)
+func (c *AuthRolesClient) DeleteOne(_m *AuthRoles) *AuthRolesDeleteOne {
+ return c.DeleteOneID(_m.ID)
}
// DeleteOneID returns a builder for deleting the given entity by its id.
@@ -572,16 +572,16 @@ func (c *AuthRolesClient) GetX(ctx context.Context, id int) *AuthRoles {
}
// QueryToken queries the token edge of a AuthRoles.
-func (c *AuthRolesClient) QueryToken(ar *AuthRoles) *AuthTokensQuery {
+func (c *AuthRolesClient) QueryToken(_m *AuthRoles) *AuthTokensQuery {
query := (&AuthTokensClient{config: c.config}).Query()
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := ar.ID
+ id := _m.ID
step := sqlgraph.NewStep(
sqlgraph.From(authroles.Table, authroles.FieldID, id),
sqlgraph.To(authtokens.Table, authtokens.FieldID),
sqlgraph.Edge(sqlgraph.O2O, true, authroles.TokenTable, authroles.TokenColumn),
)
- fromV = sqlgraph.Neighbors(ar.driver.Dialect(), step)
+ fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
return fromV, nil
}
return query
@@ -667,8 +667,8 @@ func (c *AuthTokensClient) Update() *AuthTokensUpdate {
}
// UpdateOne returns an update builder for the given entity.
-func (c *AuthTokensClient) UpdateOne(at *AuthTokens) *AuthTokensUpdateOne {
- mutation := newAuthTokensMutation(c.config, OpUpdateOne, withAuthTokens(at))
+func (c *AuthTokensClient) UpdateOne(_m *AuthTokens) *AuthTokensUpdateOne {
+ mutation := newAuthTokensMutation(c.config, OpUpdateOne, withAuthTokens(_m))
return &AuthTokensUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
@@ -685,8 +685,8 @@ func (c *AuthTokensClient) Delete() *AuthTokensDelete {
}
// DeleteOne returns a builder for deleting the given entity.
-func (c *AuthTokensClient) DeleteOne(at *AuthTokens) *AuthTokensDeleteOne {
- return c.DeleteOneID(at.ID)
+func (c *AuthTokensClient) DeleteOne(_m *AuthTokens) *AuthTokensDeleteOne {
+ return c.DeleteOneID(_m.ID)
}
// DeleteOneID returns a builder for deleting the given entity by its id.
@@ -721,32 +721,32 @@ func (c *AuthTokensClient) GetX(ctx context.Context, id uuid.UUID) *AuthTokens {
}
// QueryUser queries the user edge of a AuthTokens.
-func (c *AuthTokensClient) QueryUser(at *AuthTokens) *UserQuery {
+func (c *AuthTokensClient) QueryUser(_m *AuthTokens) *UserQuery {
query := (&UserClient{config: c.config}).Query()
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := at.ID
+ id := _m.ID
step := sqlgraph.NewStep(
sqlgraph.From(authtokens.Table, authtokens.FieldID, id),
sqlgraph.To(user.Table, user.FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, authtokens.UserTable, authtokens.UserColumn),
)
- fromV = sqlgraph.Neighbors(at.driver.Dialect(), step)
+ fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
return fromV, nil
}
return query
}
// QueryRoles queries the roles edge of a AuthTokens.
-func (c *AuthTokensClient) QueryRoles(at *AuthTokens) *AuthRolesQuery {
+func (c *AuthTokensClient) QueryRoles(_m *AuthTokens) *AuthRolesQuery {
query := (&AuthRolesClient{config: c.config}).Query()
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := at.ID
+ id := _m.ID
step := sqlgraph.NewStep(
sqlgraph.From(authtokens.Table, authtokens.FieldID, id),
sqlgraph.To(authroles.Table, authroles.FieldID),
sqlgraph.Edge(sqlgraph.O2O, false, authtokens.RolesTable, authtokens.RolesColumn),
)
- fromV = sqlgraph.Neighbors(at.driver.Dialect(), step)
+ fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
return fromV, nil
}
return query
@@ -832,8 +832,8 @@ func (c *GroupClient) Update() *GroupUpdate {
}
// UpdateOne returns an update builder for the given entity.
-func (c *GroupClient) UpdateOne(gr *Group) *GroupUpdateOne {
- mutation := newGroupMutation(c.config, OpUpdateOne, withGroup(gr))
+func (c *GroupClient) UpdateOne(_m *Group) *GroupUpdateOne {
+ mutation := newGroupMutation(c.config, OpUpdateOne, withGroup(_m))
return &GroupUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
@@ -850,8 +850,8 @@ func (c *GroupClient) Delete() *GroupDelete {
}
// DeleteOne returns a builder for deleting the given entity.
-func (c *GroupClient) DeleteOne(gr *Group) *GroupDeleteOne {
- return c.DeleteOneID(gr.ID)
+func (c *GroupClient) DeleteOne(_m *Group) *GroupDeleteOne {
+ return c.DeleteOneID(_m.ID)
}
// DeleteOneID returns a builder for deleting the given entity by its id.
@@ -886,96 +886,96 @@ func (c *GroupClient) GetX(ctx context.Context, id uuid.UUID) *Group {
}
// QueryUsers queries the users edge of a Group.
-func (c *GroupClient) QueryUsers(gr *Group) *UserQuery {
+func (c *GroupClient) QueryUsers(_m *Group) *UserQuery {
query := (&UserClient{config: c.config}).Query()
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := gr.ID
+ id := _m.ID
step := sqlgraph.NewStep(
sqlgraph.From(group.Table, group.FieldID, id),
sqlgraph.To(user.Table, user.FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, group.UsersTable, group.UsersColumn),
)
- fromV = sqlgraph.Neighbors(gr.driver.Dialect(), step)
+ fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
return fromV, nil
}
return query
}
// QueryLocations queries the locations edge of a Group.
-func (c *GroupClient) QueryLocations(gr *Group) *LocationQuery {
+func (c *GroupClient) QueryLocations(_m *Group) *LocationQuery {
query := (&LocationClient{config: c.config}).Query()
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := gr.ID
+ id := _m.ID
step := sqlgraph.NewStep(
sqlgraph.From(group.Table, group.FieldID, id),
sqlgraph.To(location.Table, location.FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, group.LocationsTable, group.LocationsColumn),
)
- fromV = sqlgraph.Neighbors(gr.driver.Dialect(), step)
+ fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
return fromV, nil
}
return query
}
// QueryItems queries the items edge of a Group.
-func (c *GroupClient) QueryItems(gr *Group) *ItemQuery {
+func (c *GroupClient) QueryItems(_m *Group) *ItemQuery {
query := (&ItemClient{config: c.config}).Query()
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := gr.ID
+ id := _m.ID
step := sqlgraph.NewStep(
sqlgraph.From(group.Table, group.FieldID, id),
sqlgraph.To(item.Table, item.FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, group.ItemsTable, group.ItemsColumn),
)
- fromV = sqlgraph.Neighbors(gr.driver.Dialect(), step)
+ fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
return fromV, nil
}
return query
}
// QueryLabels queries the labels edge of a Group.
-func (c *GroupClient) QueryLabels(gr *Group) *LabelQuery {
+func (c *GroupClient) QueryLabels(_m *Group) *LabelQuery {
query := (&LabelClient{config: c.config}).Query()
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := gr.ID
+ id := _m.ID
step := sqlgraph.NewStep(
sqlgraph.From(group.Table, group.FieldID, id),
sqlgraph.To(label.Table, label.FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, group.LabelsTable, group.LabelsColumn),
)
- fromV = sqlgraph.Neighbors(gr.driver.Dialect(), step)
+ fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
return fromV, nil
}
return query
}
// QueryInvitationTokens queries the invitation_tokens edge of a Group.
-func (c *GroupClient) QueryInvitationTokens(gr *Group) *GroupInvitationTokenQuery {
+func (c *GroupClient) QueryInvitationTokens(_m *Group) *GroupInvitationTokenQuery {
query := (&GroupInvitationTokenClient{config: c.config}).Query()
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := gr.ID
+ id := _m.ID
step := sqlgraph.NewStep(
sqlgraph.From(group.Table, group.FieldID, id),
sqlgraph.To(groupinvitationtoken.Table, groupinvitationtoken.FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, group.InvitationTokensTable, group.InvitationTokensColumn),
)
- fromV = sqlgraph.Neighbors(gr.driver.Dialect(), step)
+ fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
return fromV, nil
}
return query
}
// QueryNotifiers queries the notifiers edge of a Group.
-func (c *GroupClient) QueryNotifiers(gr *Group) *NotifierQuery {
+func (c *GroupClient) QueryNotifiers(_m *Group) *NotifierQuery {
query := (&NotifierClient{config: c.config}).Query()
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := gr.ID
+ id := _m.ID
step := sqlgraph.NewStep(
sqlgraph.From(group.Table, group.FieldID, id),
sqlgraph.To(notifier.Table, notifier.FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, group.NotifiersTable, group.NotifiersColumn),
)
- fromV = sqlgraph.Neighbors(gr.driver.Dialect(), step)
+ fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
return fromV, nil
}
return query
@@ -1061,8 +1061,8 @@ func (c *GroupInvitationTokenClient) Update() *GroupInvitationTokenUpdate {
}
// UpdateOne returns an update builder for the given entity.
-func (c *GroupInvitationTokenClient) UpdateOne(git *GroupInvitationToken) *GroupInvitationTokenUpdateOne {
- mutation := newGroupInvitationTokenMutation(c.config, OpUpdateOne, withGroupInvitationToken(git))
+func (c *GroupInvitationTokenClient) UpdateOne(_m *GroupInvitationToken) *GroupInvitationTokenUpdateOne {
+ mutation := newGroupInvitationTokenMutation(c.config, OpUpdateOne, withGroupInvitationToken(_m))
return &GroupInvitationTokenUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
@@ -1079,8 +1079,8 @@ func (c *GroupInvitationTokenClient) Delete() *GroupInvitationTokenDelete {
}
// DeleteOne returns a builder for deleting the given entity.
-func (c *GroupInvitationTokenClient) DeleteOne(git *GroupInvitationToken) *GroupInvitationTokenDeleteOne {
- return c.DeleteOneID(git.ID)
+func (c *GroupInvitationTokenClient) DeleteOne(_m *GroupInvitationToken) *GroupInvitationTokenDeleteOne {
+ return c.DeleteOneID(_m.ID)
}
// DeleteOneID returns a builder for deleting the given entity by its id.
@@ -1115,16 +1115,16 @@ func (c *GroupInvitationTokenClient) GetX(ctx context.Context, id uuid.UUID) *Gr
}
// QueryGroup queries the group edge of a GroupInvitationToken.
-func (c *GroupInvitationTokenClient) QueryGroup(git *GroupInvitationToken) *GroupQuery {
+func (c *GroupInvitationTokenClient) QueryGroup(_m *GroupInvitationToken) *GroupQuery {
query := (&GroupClient{config: c.config}).Query()
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := git.ID
+ id := _m.ID
step := sqlgraph.NewStep(
sqlgraph.From(groupinvitationtoken.Table, groupinvitationtoken.FieldID, id),
sqlgraph.To(group.Table, group.FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, groupinvitationtoken.GroupTable, groupinvitationtoken.GroupColumn),
)
- fromV = sqlgraph.Neighbors(git.driver.Dialect(), step)
+ fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
return fromV, nil
}
return query
@@ -1210,8 +1210,8 @@ func (c *ItemClient) Update() *ItemUpdate {
}
// UpdateOne returns an update builder for the given entity.
-func (c *ItemClient) UpdateOne(i *Item) *ItemUpdateOne {
- mutation := newItemMutation(c.config, OpUpdateOne, withItem(i))
+func (c *ItemClient) UpdateOne(_m *Item) *ItemUpdateOne {
+ mutation := newItemMutation(c.config, OpUpdateOne, withItem(_m))
return &ItemUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
@@ -1228,8 +1228,8 @@ func (c *ItemClient) Delete() *ItemDelete {
}
// DeleteOne returns a builder for deleting the given entity.
-func (c *ItemClient) DeleteOne(i *Item) *ItemDeleteOne {
- return c.DeleteOneID(i.ID)
+func (c *ItemClient) DeleteOne(_m *Item) *ItemDeleteOne {
+ return c.DeleteOneID(_m.ID)
}
// DeleteOneID returns a builder for deleting the given entity by its id.
@@ -1264,128 +1264,128 @@ func (c *ItemClient) GetX(ctx context.Context, id uuid.UUID) *Item {
}
// QueryGroup queries the group edge of a Item.
-func (c *ItemClient) QueryGroup(i *Item) *GroupQuery {
+func (c *ItemClient) QueryGroup(_m *Item) *GroupQuery {
query := (&GroupClient{config: c.config}).Query()
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := i.ID
+ id := _m.ID
step := sqlgraph.NewStep(
sqlgraph.From(item.Table, item.FieldID, id),
sqlgraph.To(group.Table, group.FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, item.GroupTable, item.GroupColumn),
)
- fromV = sqlgraph.Neighbors(i.driver.Dialect(), step)
+ fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
return fromV, nil
}
return query
}
// QueryParent queries the parent edge of a Item.
-func (c *ItemClient) QueryParent(i *Item) *ItemQuery {
+func (c *ItemClient) QueryParent(_m *Item) *ItemQuery {
query := (&ItemClient{config: c.config}).Query()
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := i.ID
+ id := _m.ID
step := sqlgraph.NewStep(
sqlgraph.From(item.Table, item.FieldID, id),
sqlgraph.To(item.Table, item.FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, item.ParentTable, item.ParentColumn),
)
- fromV = sqlgraph.Neighbors(i.driver.Dialect(), step)
+ fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
return fromV, nil
}
return query
}
// QueryChildren queries the children edge of a Item.
-func (c *ItemClient) QueryChildren(i *Item) *ItemQuery {
+func (c *ItemClient) QueryChildren(_m *Item) *ItemQuery {
query := (&ItemClient{config: c.config}).Query()
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := i.ID
+ id := _m.ID
step := sqlgraph.NewStep(
sqlgraph.From(item.Table, item.FieldID, id),
sqlgraph.To(item.Table, item.FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, item.ChildrenTable, item.ChildrenColumn),
)
- fromV = sqlgraph.Neighbors(i.driver.Dialect(), step)
+ fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
return fromV, nil
}
return query
}
// QueryLabel queries the label edge of a Item.
-func (c *ItemClient) QueryLabel(i *Item) *LabelQuery {
+func (c *ItemClient) QueryLabel(_m *Item) *LabelQuery {
query := (&LabelClient{config: c.config}).Query()
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := i.ID
+ id := _m.ID
step := sqlgraph.NewStep(
sqlgraph.From(item.Table, item.FieldID, id),
sqlgraph.To(label.Table, label.FieldID),
sqlgraph.Edge(sqlgraph.M2M, true, item.LabelTable, item.LabelPrimaryKey...),
)
- fromV = sqlgraph.Neighbors(i.driver.Dialect(), step)
+ fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
return fromV, nil
}
return query
}
// QueryLocation queries the location edge of a Item.
-func (c *ItemClient) QueryLocation(i *Item) *LocationQuery {
+func (c *ItemClient) QueryLocation(_m *Item) *LocationQuery {
query := (&LocationClient{config: c.config}).Query()
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := i.ID
+ id := _m.ID
step := sqlgraph.NewStep(
sqlgraph.From(item.Table, item.FieldID, id),
sqlgraph.To(location.Table, location.FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, item.LocationTable, item.LocationColumn),
)
- fromV = sqlgraph.Neighbors(i.driver.Dialect(), step)
+ fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
return fromV, nil
}
return query
}
// QueryFields queries the fields edge of a Item.
-func (c *ItemClient) QueryFields(i *Item) *ItemFieldQuery {
+func (c *ItemClient) QueryFields(_m *Item) *ItemFieldQuery {
query := (&ItemFieldClient{config: c.config}).Query()
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := i.ID
+ id := _m.ID
step := sqlgraph.NewStep(
sqlgraph.From(item.Table, item.FieldID, id),
sqlgraph.To(itemfield.Table, itemfield.FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, item.FieldsTable, item.FieldsColumn),
)
- fromV = sqlgraph.Neighbors(i.driver.Dialect(), step)
+ fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
return fromV, nil
}
return query
}
// QueryMaintenanceEntries queries the maintenance_entries edge of a Item.
-func (c *ItemClient) QueryMaintenanceEntries(i *Item) *MaintenanceEntryQuery {
+func (c *ItemClient) QueryMaintenanceEntries(_m *Item) *MaintenanceEntryQuery {
query := (&MaintenanceEntryClient{config: c.config}).Query()
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := i.ID
+ id := _m.ID
step := sqlgraph.NewStep(
sqlgraph.From(item.Table, item.FieldID, id),
sqlgraph.To(maintenanceentry.Table, maintenanceentry.FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, item.MaintenanceEntriesTable, item.MaintenanceEntriesColumn),
)
- fromV = sqlgraph.Neighbors(i.driver.Dialect(), step)
+ fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
return fromV, nil
}
return query
}
// QueryAttachments queries the attachments edge of a Item.
-func (c *ItemClient) QueryAttachments(i *Item) *AttachmentQuery {
+func (c *ItemClient) QueryAttachments(_m *Item) *AttachmentQuery {
query := (&AttachmentClient{config: c.config}).Query()
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := i.ID
+ id := _m.ID
step := sqlgraph.NewStep(
sqlgraph.From(item.Table, item.FieldID, id),
sqlgraph.To(attachment.Table, attachment.FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, item.AttachmentsTable, item.AttachmentsColumn),
)
- fromV = sqlgraph.Neighbors(i.driver.Dialect(), step)
+ fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
return fromV, nil
}
return query
@@ -1471,8 +1471,8 @@ func (c *ItemFieldClient) Update() *ItemFieldUpdate {
}
// UpdateOne returns an update builder for the given entity.
-func (c *ItemFieldClient) UpdateOne(_if *ItemField) *ItemFieldUpdateOne {
- mutation := newItemFieldMutation(c.config, OpUpdateOne, withItemField(_if))
+func (c *ItemFieldClient) UpdateOne(_m *ItemField) *ItemFieldUpdateOne {
+ mutation := newItemFieldMutation(c.config, OpUpdateOne, withItemField(_m))
return &ItemFieldUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
@@ -1489,8 +1489,8 @@ func (c *ItemFieldClient) Delete() *ItemFieldDelete {
}
// DeleteOne returns a builder for deleting the given entity.
-func (c *ItemFieldClient) DeleteOne(_if *ItemField) *ItemFieldDeleteOne {
- return c.DeleteOneID(_if.ID)
+func (c *ItemFieldClient) DeleteOne(_m *ItemField) *ItemFieldDeleteOne {
+ return c.DeleteOneID(_m.ID)
}
// DeleteOneID returns a builder for deleting the given entity by its id.
@@ -1525,16 +1525,16 @@ func (c *ItemFieldClient) GetX(ctx context.Context, id uuid.UUID) *ItemField {
}
// QueryItem queries the item edge of a ItemField.
-func (c *ItemFieldClient) QueryItem(_if *ItemField) *ItemQuery {
+func (c *ItemFieldClient) QueryItem(_m *ItemField) *ItemQuery {
query := (&ItemClient{config: c.config}).Query()
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _if.ID
+ id := _m.ID
step := sqlgraph.NewStep(
sqlgraph.From(itemfield.Table, itemfield.FieldID, id),
sqlgraph.To(item.Table, item.FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, itemfield.ItemTable, itemfield.ItemColumn),
)
- fromV = sqlgraph.Neighbors(_if.driver.Dialect(), step)
+ fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
return fromV, nil
}
return query
@@ -1620,8 +1620,8 @@ func (c *LabelClient) Update() *LabelUpdate {
}
// UpdateOne returns an update builder for the given entity.
-func (c *LabelClient) UpdateOne(l *Label) *LabelUpdateOne {
- mutation := newLabelMutation(c.config, OpUpdateOne, withLabel(l))
+func (c *LabelClient) UpdateOne(_m *Label) *LabelUpdateOne {
+ mutation := newLabelMutation(c.config, OpUpdateOne, withLabel(_m))
return &LabelUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
@@ -1638,8 +1638,8 @@ func (c *LabelClient) Delete() *LabelDelete {
}
// DeleteOne returns a builder for deleting the given entity.
-func (c *LabelClient) DeleteOne(l *Label) *LabelDeleteOne {
- return c.DeleteOneID(l.ID)
+func (c *LabelClient) DeleteOne(_m *Label) *LabelDeleteOne {
+ return c.DeleteOneID(_m.ID)
}
// DeleteOneID returns a builder for deleting the given entity by its id.
@@ -1674,32 +1674,32 @@ func (c *LabelClient) GetX(ctx context.Context, id uuid.UUID) *Label {
}
// QueryGroup queries the group edge of a Label.
-func (c *LabelClient) QueryGroup(l *Label) *GroupQuery {
+func (c *LabelClient) QueryGroup(_m *Label) *GroupQuery {
query := (&GroupClient{config: c.config}).Query()
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := l.ID
+ id := _m.ID
step := sqlgraph.NewStep(
sqlgraph.From(label.Table, label.FieldID, id),
sqlgraph.To(group.Table, group.FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, label.GroupTable, label.GroupColumn),
)
- fromV = sqlgraph.Neighbors(l.driver.Dialect(), step)
+ fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
return fromV, nil
}
return query
}
// QueryItems queries the items edge of a Label.
-func (c *LabelClient) QueryItems(l *Label) *ItemQuery {
+func (c *LabelClient) QueryItems(_m *Label) *ItemQuery {
query := (&ItemClient{config: c.config}).Query()
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := l.ID
+ id := _m.ID
step := sqlgraph.NewStep(
sqlgraph.From(label.Table, label.FieldID, id),
sqlgraph.To(item.Table, item.FieldID),
sqlgraph.Edge(sqlgraph.M2M, false, label.ItemsTable, label.ItemsPrimaryKey...),
)
- fromV = sqlgraph.Neighbors(l.driver.Dialect(), step)
+ fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
return fromV, nil
}
return query
@@ -1785,8 +1785,8 @@ func (c *LocationClient) Update() *LocationUpdate {
}
// UpdateOne returns an update builder for the given entity.
-func (c *LocationClient) UpdateOne(l *Location) *LocationUpdateOne {
- mutation := newLocationMutation(c.config, OpUpdateOne, withLocation(l))
+func (c *LocationClient) UpdateOne(_m *Location) *LocationUpdateOne {
+ mutation := newLocationMutation(c.config, OpUpdateOne, withLocation(_m))
return &LocationUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
@@ -1803,8 +1803,8 @@ func (c *LocationClient) Delete() *LocationDelete {
}
// DeleteOne returns a builder for deleting the given entity.
-func (c *LocationClient) DeleteOne(l *Location) *LocationDeleteOne {
- return c.DeleteOneID(l.ID)
+func (c *LocationClient) DeleteOne(_m *Location) *LocationDeleteOne {
+ return c.DeleteOneID(_m.ID)
}
// DeleteOneID returns a builder for deleting the given entity by its id.
@@ -1839,64 +1839,64 @@ func (c *LocationClient) GetX(ctx context.Context, id uuid.UUID) *Location {
}
// QueryGroup queries the group edge of a Location.
-func (c *LocationClient) QueryGroup(l *Location) *GroupQuery {
+func (c *LocationClient) QueryGroup(_m *Location) *GroupQuery {
query := (&GroupClient{config: c.config}).Query()
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := l.ID
+ id := _m.ID
step := sqlgraph.NewStep(
sqlgraph.From(location.Table, location.FieldID, id),
sqlgraph.To(group.Table, group.FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, location.GroupTable, location.GroupColumn),
)
- fromV = sqlgraph.Neighbors(l.driver.Dialect(), step)
+ fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
return fromV, nil
}
return query
}
// QueryParent queries the parent edge of a Location.
-func (c *LocationClient) QueryParent(l *Location) *LocationQuery {
+func (c *LocationClient) QueryParent(_m *Location) *LocationQuery {
query := (&LocationClient{config: c.config}).Query()
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := l.ID
+ id := _m.ID
step := sqlgraph.NewStep(
sqlgraph.From(location.Table, location.FieldID, id),
sqlgraph.To(location.Table, location.FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, location.ParentTable, location.ParentColumn),
)
- fromV = sqlgraph.Neighbors(l.driver.Dialect(), step)
+ fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
return fromV, nil
}
return query
}
// QueryChildren queries the children edge of a Location.
-func (c *LocationClient) QueryChildren(l *Location) *LocationQuery {
+func (c *LocationClient) QueryChildren(_m *Location) *LocationQuery {
query := (&LocationClient{config: c.config}).Query()
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := l.ID
+ id := _m.ID
step := sqlgraph.NewStep(
sqlgraph.From(location.Table, location.FieldID, id),
sqlgraph.To(location.Table, location.FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, location.ChildrenTable, location.ChildrenColumn),
)
- fromV = sqlgraph.Neighbors(l.driver.Dialect(), step)
+ fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
return fromV, nil
}
return query
}
// QueryItems queries the items edge of a Location.
-func (c *LocationClient) QueryItems(l *Location) *ItemQuery {
+func (c *LocationClient) QueryItems(_m *Location) *ItemQuery {
query := (&ItemClient{config: c.config}).Query()
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := l.ID
+ id := _m.ID
step := sqlgraph.NewStep(
sqlgraph.From(location.Table, location.FieldID, id),
sqlgraph.To(item.Table, item.FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, location.ItemsTable, location.ItemsColumn),
)
- fromV = sqlgraph.Neighbors(l.driver.Dialect(), step)
+ fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
return fromV, nil
}
return query
@@ -1982,8 +1982,8 @@ func (c *MaintenanceEntryClient) Update() *MaintenanceEntryUpdate {
}
// UpdateOne returns an update builder for the given entity.
-func (c *MaintenanceEntryClient) UpdateOne(me *MaintenanceEntry) *MaintenanceEntryUpdateOne {
- mutation := newMaintenanceEntryMutation(c.config, OpUpdateOne, withMaintenanceEntry(me))
+func (c *MaintenanceEntryClient) UpdateOne(_m *MaintenanceEntry) *MaintenanceEntryUpdateOne {
+ mutation := newMaintenanceEntryMutation(c.config, OpUpdateOne, withMaintenanceEntry(_m))
return &MaintenanceEntryUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
@@ -2000,8 +2000,8 @@ func (c *MaintenanceEntryClient) Delete() *MaintenanceEntryDelete {
}
// DeleteOne returns a builder for deleting the given entity.
-func (c *MaintenanceEntryClient) DeleteOne(me *MaintenanceEntry) *MaintenanceEntryDeleteOne {
- return c.DeleteOneID(me.ID)
+func (c *MaintenanceEntryClient) DeleteOne(_m *MaintenanceEntry) *MaintenanceEntryDeleteOne {
+ return c.DeleteOneID(_m.ID)
}
// DeleteOneID returns a builder for deleting the given entity by its id.
@@ -2036,16 +2036,16 @@ func (c *MaintenanceEntryClient) GetX(ctx context.Context, id uuid.UUID) *Mainte
}
// QueryItem queries the item edge of a MaintenanceEntry.
-func (c *MaintenanceEntryClient) QueryItem(me *MaintenanceEntry) *ItemQuery {
+func (c *MaintenanceEntryClient) QueryItem(_m *MaintenanceEntry) *ItemQuery {
query := (&ItemClient{config: c.config}).Query()
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := me.ID
+ id := _m.ID
step := sqlgraph.NewStep(
sqlgraph.From(maintenanceentry.Table, maintenanceentry.FieldID, id),
sqlgraph.To(item.Table, item.FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, maintenanceentry.ItemTable, maintenanceentry.ItemColumn),
)
- fromV = sqlgraph.Neighbors(me.driver.Dialect(), step)
+ fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
return fromV, nil
}
return query
@@ -2131,8 +2131,8 @@ func (c *NotifierClient) Update() *NotifierUpdate {
}
// UpdateOne returns an update builder for the given entity.
-func (c *NotifierClient) UpdateOne(n *Notifier) *NotifierUpdateOne {
- mutation := newNotifierMutation(c.config, OpUpdateOne, withNotifier(n))
+func (c *NotifierClient) UpdateOne(_m *Notifier) *NotifierUpdateOne {
+ mutation := newNotifierMutation(c.config, OpUpdateOne, withNotifier(_m))
return &NotifierUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
@@ -2149,8 +2149,8 @@ func (c *NotifierClient) Delete() *NotifierDelete {
}
// DeleteOne returns a builder for deleting the given entity.
-func (c *NotifierClient) DeleteOne(n *Notifier) *NotifierDeleteOne {
- return c.DeleteOneID(n.ID)
+func (c *NotifierClient) DeleteOne(_m *Notifier) *NotifierDeleteOne {
+ return c.DeleteOneID(_m.ID)
}
// DeleteOneID returns a builder for deleting the given entity by its id.
@@ -2185,32 +2185,32 @@ func (c *NotifierClient) GetX(ctx context.Context, id uuid.UUID) *Notifier {
}
// QueryGroup queries the group edge of a Notifier.
-func (c *NotifierClient) QueryGroup(n *Notifier) *GroupQuery {
+func (c *NotifierClient) QueryGroup(_m *Notifier) *GroupQuery {
query := (&GroupClient{config: c.config}).Query()
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := n.ID
+ id := _m.ID
step := sqlgraph.NewStep(
sqlgraph.From(notifier.Table, notifier.FieldID, id),
sqlgraph.To(group.Table, group.FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, notifier.GroupTable, notifier.GroupColumn),
)
- fromV = sqlgraph.Neighbors(n.driver.Dialect(), step)
+ fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
return fromV, nil
}
return query
}
// QueryUser queries the user edge of a Notifier.
-func (c *NotifierClient) QueryUser(n *Notifier) *UserQuery {
+func (c *NotifierClient) QueryUser(_m *Notifier) *UserQuery {
query := (&UserClient{config: c.config}).Query()
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := n.ID
+ id := _m.ID
step := sqlgraph.NewStep(
sqlgraph.From(notifier.Table, notifier.FieldID, id),
sqlgraph.To(user.Table, user.FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, notifier.UserTable, notifier.UserColumn),
)
- fromV = sqlgraph.Neighbors(n.driver.Dialect(), step)
+ fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
return fromV, nil
}
return query
@@ -2296,8 +2296,8 @@ func (c *UserClient) Update() *UserUpdate {
}
// UpdateOne returns an update builder for the given entity.
-func (c *UserClient) UpdateOne(u *User) *UserUpdateOne {
- mutation := newUserMutation(c.config, OpUpdateOne, withUser(u))
+func (c *UserClient) UpdateOne(_m *User) *UserUpdateOne {
+ mutation := newUserMutation(c.config, OpUpdateOne, withUser(_m))
return &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
@@ -2314,8 +2314,8 @@ func (c *UserClient) Delete() *UserDelete {
}
// DeleteOne returns a builder for deleting the given entity.
-func (c *UserClient) DeleteOne(u *User) *UserDeleteOne {
- return c.DeleteOneID(u.ID)
+func (c *UserClient) DeleteOne(_m *User) *UserDeleteOne {
+ return c.DeleteOneID(_m.ID)
}
// DeleteOneID returns a builder for deleting the given entity by its id.
@@ -2350,48 +2350,48 @@ func (c *UserClient) GetX(ctx context.Context, id uuid.UUID) *User {
}
// QueryGroup queries the group edge of a User.
-func (c *UserClient) QueryGroup(u *User) *GroupQuery {
+func (c *UserClient) QueryGroup(_m *User) *GroupQuery {
query := (&GroupClient{config: c.config}).Query()
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := u.ID
+ id := _m.ID
step := sqlgraph.NewStep(
sqlgraph.From(user.Table, user.FieldID, id),
sqlgraph.To(group.Table, group.FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, user.GroupTable, user.GroupColumn),
)
- fromV = sqlgraph.Neighbors(u.driver.Dialect(), step)
+ fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
return fromV, nil
}
return query
}
// QueryAuthTokens queries the auth_tokens edge of a User.
-func (c *UserClient) QueryAuthTokens(u *User) *AuthTokensQuery {
+func (c *UserClient) QueryAuthTokens(_m *User) *AuthTokensQuery {
query := (&AuthTokensClient{config: c.config}).Query()
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := u.ID
+ id := _m.ID
step := sqlgraph.NewStep(
sqlgraph.From(user.Table, user.FieldID, id),
sqlgraph.To(authtokens.Table, authtokens.FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, user.AuthTokensTable, user.AuthTokensColumn),
)
- fromV = sqlgraph.Neighbors(u.driver.Dialect(), step)
+ fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
return fromV, nil
}
return query
}
// QueryNotifiers queries the notifiers edge of a User.
-func (c *UserClient) QueryNotifiers(u *User) *NotifierQuery {
+func (c *UserClient) QueryNotifiers(_m *User) *NotifierQuery {
query := (&NotifierClient{config: c.config}).Query()
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := u.ID
+ id := _m.ID
step := sqlgraph.NewStep(
sqlgraph.From(user.Table, user.FieldID, id),
sqlgraph.To(notifier.Table, notifier.FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, user.NotifiersTable, user.NotifiersColumn),
)
- fromV = sqlgraph.Neighbors(u.driver.Dialect(), step)
+ fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
return fromV, nil
}
return query
diff --git a/backend/internal/data/ent/ent.go b/backend/internal/data/ent/ent.go
index 3f735825..173be97f 100644
--- a/backend/internal/data/ent/ent.go
+++ b/backend/internal/data/ent/ent.go
@@ -81,7 +81,7 @@ var (
)
// checkColumn checks if the column exists in the given table.
-func checkColumn(table, column string) error {
+func checkColumn(t, c string) error {
initCheck.Do(func() {
columnCheck = sql.NewColumnCheck(map[string]func(string) bool{
attachment.Table: attachment.ValidColumn,
@@ -98,7 +98,7 @@ func checkColumn(table, column string) error {
user.Table: user.ValidColumn,
})
})
- return columnCheck(table, column)
+ return columnCheck(t, c)
}
// Asc applies the given fields in ASC order.
diff --git a/backend/internal/data/ent/group.go b/backend/internal/data/ent/group.go
index 97ada2fe..9bb043aa 100644
--- a/backend/internal/data/ent/group.go
+++ b/backend/internal/data/ent/group.go
@@ -125,7 +125,7 @@ func (*Group) scanValues(columns []string) ([]any, error) {
// assignValues assigns the values that were returned from sql.Rows (after scanning)
// to the Group fields.
-func (gr *Group) assignValues(columns []string, values []any) error {
+func (_m *Group) assignValues(columns []string, values []any) error {
if m, n := len(values), len(columns); m < n {
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
}
@@ -135,34 +135,34 @@ func (gr *Group) assignValues(columns []string, values []any) error {
if value, ok := values[i].(*uuid.UUID); !ok {
return fmt.Errorf("unexpected type %T for field id", values[i])
} else if value != nil {
- gr.ID = *value
+ _m.ID = *value
}
case group.FieldCreatedAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field created_at", values[i])
} else if value.Valid {
- gr.CreatedAt = value.Time
+ _m.CreatedAt = value.Time
}
case group.FieldUpdatedAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field updated_at", values[i])
} else if value.Valid {
- gr.UpdatedAt = value.Time
+ _m.UpdatedAt = value.Time
}
case group.FieldName:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field name", values[i])
} else if value.Valid {
- gr.Name = value.String
+ _m.Name = value.String
}
case group.FieldCurrency:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field currency", values[i])
} else if value.Valid {
- gr.Currency = value.String
+ _m.Currency = value.String
}
default:
- gr.selectValues.Set(columns[i], values[i])
+ _m.selectValues.Set(columns[i], values[i])
}
}
return nil
@@ -170,74 +170,74 @@ func (gr *Group) assignValues(columns []string, values []any) error {
// Value returns the ent.Value that was dynamically selected and assigned to the Group.
// This includes values selected through modifiers, order, etc.
-func (gr *Group) Value(name string) (ent.Value, error) {
- return gr.selectValues.Get(name)
+func (_m *Group) Value(name string) (ent.Value, error) {
+ return _m.selectValues.Get(name)
}
// QueryUsers queries the "users" edge of the Group entity.
-func (gr *Group) QueryUsers() *UserQuery {
- return NewGroupClient(gr.config).QueryUsers(gr)
+func (_m *Group) QueryUsers() *UserQuery {
+ return NewGroupClient(_m.config).QueryUsers(_m)
}
// QueryLocations queries the "locations" edge of the Group entity.
-func (gr *Group) QueryLocations() *LocationQuery {
- return NewGroupClient(gr.config).QueryLocations(gr)
+func (_m *Group) QueryLocations() *LocationQuery {
+ return NewGroupClient(_m.config).QueryLocations(_m)
}
// QueryItems queries the "items" edge of the Group entity.
-func (gr *Group) QueryItems() *ItemQuery {
- return NewGroupClient(gr.config).QueryItems(gr)
+func (_m *Group) QueryItems() *ItemQuery {
+ return NewGroupClient(_m.config).QueryItems(_m)
}
// QueryLabels queries the "labels" edge of the Group entity.
-func (gr *Group) QueryLabels() *LabelQuery {
- return NewGroupClient(gr.config).QueryLabels(gr)
+func (_m *Group) QueryLabels() *LabelQuery {
+ return NewGroupClient(_m.config).QueryLabels(_m)
}
// QueryInvitationTokens queries the "invitation_tokens" edge of the Group entity.
-func (gr *Group) QueryInvitationTokens() *GroupInvitationTokenQuery {
- return NewGroupClient(gr.config).QueryInvitationTokens(gr)
+func (_m *Group) QueryInvitationTokens() *GroupInvitationTokenQuery {
+ return NewGroupClient(_m.config).QueryInvitationTokens(_m)
}
// QueryNotifiers queries the "notifiers" edge of the Group entity.
-func (gr *Group) QueryNotifiers() *NotifierQuery {
- return NewGroupClient(gr.config).QueryNotifiers(gr)
+func (_m *Group) QueryNotifiers() *NotifierQuery {
+ return NewGroupClient(_m.config).QueryNotifiers(_m)
}
// Update returns a builder for updating this Group.
// Note that you need to call Group.Unwrap() before calling this method if this Group
// was returned from a transaction, and the transaction was committed or rolled back.
-func (gr *Group) Update() *GroupUpdateOne {
- return NewGroupClient(gr.config).UpdateOne(gr)
+func (_m *Group) Update() *GroupUpdateOne {
+ return NewGroupClient(_m.config).UpdateOne(_m)
}
// Unwrap unwraps the Group 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 (gr *Group) Unwrap() *Group {
- _tx, ok := gr.config.driver.(*txDriver)
+func (_m *Group) Unwrap() *Group {
+ _tx, ok := _m.config.driver.(*txDriver)
if !ok {
panic("ent: Group is not a transactional entity")
}
- gr.config.driver = _tx.drv
- return gr
+ _m.config.driver = _tx.drv
+ return _m
}
// String implements the fmt.Stringer.
-func (gr *Group) String() string {
+func (_m *Group) String() string {
var builder strings.Builder
builder.WriteString("Group(")
- builder.WriteString(fmt.Sprintf("id=%v, ", gr.ID))
+ builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
builder.WriteString("created_at=")
- builder.WriteString(gr.CreatedAt.Format(time.ANSIC))
+ builder.WriteString(_m.CreatedAt.Format(time.ANSIC))
builder.WriteString(", ")
builder.WriteString("updated_at=")
- builder.WriteString(gr.UpdatedAt.Format(time.ANSIC))
+ builder.WriteString(_m.UpdatedAt.Format(time.ANSIC))
builder.WriteString(", ")
builder.WriteString("name=")
- builder.WriteString(gr.Name)
+ builder.WriteString(_m.Name)
builder.WriteString(", ")
builder.WriteString("currency=")
- builder.WriteString(gr.Currency)
+ builder.WriteString(_m.Currency)
builder.WriteByte(')')
return builder.String()
}
diff --git a/backend/internal/data/ent/group_create.go b/backend/internal/data/ent/group_create.go
index a1039166..978220cd 100644
--- a/backend/internal/data/ent/group_create.go
+++ b/backend/internal/data/ent/group_create.go
@@ -28,171 +28,171 @@ type GroupCreate struct {
}
// SetCreatedAt sets the "created_at" field.
-func (gc *GroupCreate) SetCreatedAt(t time.Time) *GroupCreate {
- gc.mutation.SetCreatedAt(t)
- return gc
+func (_c *GroupCreate) SetCreatedAt(v time.Time) *GroupCreate {
+ _c.mutation.SetCreatedAt(v)
+ return _c
}
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
-func (gc *GroupCreate) SetNillableCreatedAt(t *time.Time) *GroupCreate {
- if t != nil {
- gc.SetCreatedAt(*t)
+func (_c *GroupCreate) SetNillableCreatedAt(v *time.Time) *GroupCreate {
+ if v != nil {
+ _c.SetCreatedAt(*v)
}
- return gc
+ return _c
}
// SetUpdatedAt sets the "updated_at" field.
-func (gc *GroupCreate) SetUpdatedAt(t time.Time) *GroupCreate {
- gc.mutation.SetUpdatedAt(t)
- return gc
+func (_c *GroupCreate) SetUpdatedAt(v time.Time) *GroupCreate {
+ _c.mutation.SetUpdatedAt(v)
+ return _c
}
// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
-func (gc *GroupCreate) SetNillableUpdatedAt(t *time.Time) *GroupCreate {
- if t != nil {
- gc.SetUpdatedAt(*t)
+func (_c *GroupCreate) SetNillableUpdatedAt(v *time.Time) *GroupCreate {
+ if v != nil {
+ _c.SetUpdatedAt(*v)
}
- return gc
+ return _c
}
// SetName sets the "name" field.
-func (gc *GroupCreate) SetName(s string) *GroupCreate {
- gc.mutation.SetName(s)
- return gc
+func (_c *GroupCreate) SetName(v string) *GroupCreate {
+ _c.mutation.SetName(v)
+ return _c
}
// SetCurrency sets the "currency" field.
-func (gc *GroupCreate) SetCurrency(s string) *GroupCreate {
- gc.mutation.SetCurrency(s)
- return gc
+func (_c *GroupCreate) SetCurrency(v string) *GroupCreate {
+ _c.mutation.SetCurrency(v)
+ return _c
}
// SetNillableCurrency sets the "currency" field if the given value is not nil.
-func (gc *GroupCreate) SetNillableCurrency(s *string) *GroupCreate {
- if s != nil {
- gc.SetCurrency(*s)
+func (_c *GroupCreate) SetNillableCurrency(v *string) *GroupCreate {
+ if v != nil {
+ _c.SetCurrency(*v)
}
- return gc
+ return _c
}
// SetID sets the "id" field.
-func (gc *GroupCreate) SetID(u uuid.UUID) *GroupCreate {
- gc.mutation.SetID(u)
- return gc
+func (_c *GroupCreate) SetID(v uuid.UUID) *GroupCreate {
+ _c.mutation.SetID(v)
+ return _c
}
// SetNillableID sets the "id" field if the given value is not nil.
-func (gc *GroupCreate) SetNillableID(u *uuid.UUID) *GroupCreate {
- if u != nil {
- gc.SetID(*u)
+func (_c *GroupCreate) SetNillableID(v *uuid.UUID) *GroupCreate {
+ if v != nil {
+ _c.SetID(*v)
}
- return gc
+ return _c
}
// AddUserIDs adds the "users" edge to the User entity by IDs.
-func (gc *GroupCreate) AddUserIDs(ids ...uuid.UUID) *GroupCreate {
- gc.mutation.AddUserIDs(ids...)
- return gc
+func (_c *GroupCreate) AddUserIDs(ids ...uuid.UUID) *GroupCreate {
+ _c.mutation.AddUserIDs(ids...)
+ return _c
}
// AddUsers adds the "users" edges to the User entity.
-func (gc *GroupCreate) AddUsers(u ...*User) *GroupCreate {
- ids := make([]uuid.UUID, len(u))
- for i := range u {
- ids[i] = u[i].ID
+func (_c *GroupCreate) AddUsers(v ...*User) *GroupCreate {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return gc.AddUserIDs(ids...)
+ return _c.AddUserIDs(ids...)
}
// AddLocationIDs adds the "locations" edge to the Location entity by IDs.
-func (gc *GroupCreate) AddLocationIDs(ids ...uuid.UUID) *GroupCreate {
- gc.mutation.AddLocationIDs(ids...)
- return gc
+func (_c *GroupCreate) AddLocationIDs(ids ...uuid.UUID) *GroupCreate {
+ _c.mutation.AddLocationIDs(ids...)
+ return _c
}
// AddLocations adds the "locations" edges to the Location entity.
-func (gc *GroupCreate) AddLocations(l ...*Location) *GroupCreate {
- ids := make([]uuid.UUID, len(l))
- for i := range l {
- ids[i] = l[i].ID
+func (_c *GroupCreate) AddLocations(v ...*Location) *GroupCreate {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return gc.AddLocationIDs(ids...)
+ return _c.AddLocationIDs(ids...)
}
// AddItemIDs adds the "items" edge to the Item entity by IDs.
-func (gc *GroupCreate) AddItemIDs(ids ...uuid.UUID) *GroupCreate {
- gc.mutation.AddItemIDs(ids...)
- return gc
+func (_c *GroupCreate) AddItemIDs(ids ...uuid.UUID) *GroupCreate {
+ _c.mutation.AddItemIDs(ids...)
+ return _c
}
// AddItems adds the "items" edges to the Item entity.
-func (gc *GroupCreate) AddItems(i ...*Item) *GroupCreate {
- ids := make([]uuid.UUID, len(i))
- for j := range i {
- ids[j] = i[j].ID
+func (_c *GroupCreate) AddItems(v ...*Item) *GroupCreate {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return gc.AddItemIDs(ids...)
+ return _c.AddItemIDs(ids...)
}
// AddLabelIDs adds the "labels" edge to the Label entity by IDs.
-func (gc *GroupCreate) AddLabelIDs(ids ...uuid.UUID) *GroupCreate {
- gc.mutation.AddLabelIDs(ids...)
- return gc
+func (_c *GroupCreate) AddLabelIDs(ids ...uuid.UUID) *GroupCreate {
+ _c.mutation.AddLabelIDs(ids...)
+ return _c
}
// AddLabels adds the "labels" edges to the Label entity.
-func (gc *GroupCreate) AddLabels(l ...*Label) *GroupCreate {
- ids := make([]uuid.UUID, len(l))
- for i := range l {
- ids[i] = l[i].ID
+func (_c *GroupCreate) AddLabels(v ...*Label) *GroupCreate {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return gc.AddLabelIDs(ids...)
+ return _c.AddLabelIDs(ids...)
}
// AddInvitationTokenIDs adds the "invitation_tokens" edge to the GroupInvitationToken entity by IDs.
-func (gc *GroupCreate) AddInvitationTokenIDs(ids ...uuid.UUID) *GroupCreate {
- gc.mutation.AddInvitationTokenIDs(ids...)
- return gc
+func (_c *GroupCreate) AddInvitationTokenIDs(ids ...uuid.UUID) *GroupCreate {
+ _c.mutation.AddInvitationTokenIDs(ids...)
+ return _c
}
// AddInvitationTokens adds the "invitation_tokens" edges to the GroupInvitationToken entity.
-func (gc *GroupCreate) AddInvitationTokens(g ...*GroupInvitationToken) *GroupCreate {
- ids := make([]uuid.UUID, len(g))
- for i := range g {
- ids[i] = g[i].ID
+func (_c *GroupCreate) AddInvitationTokens(v ...*GroupInvitationToken) *GroupCreate {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return gc.AddInvitationTokenIDs(ids...)
+ return _c.AddInvitationTokenIDs(ids...)
}
// AddNotifierIDs adds the "notifiers" edge to the Notifier entity by IDs.
-func (gc *GroupCreate) AddNotifierIDs(ids ...uuid.UUID) *GroupCreate {
- gc.mutation.AddNotifierIDs(ids...)
- return gc
+func (_c *GroupCreate) AddNotifierIDs(ids ...uuid.UUID) *GroupCreate {
+ _c.mutation.AddNotifierIDs(ids...)
+ return _c
}
// AddNotifiers adds the "notifiers" edges to the Notifier entity.
-func (gc *GroupCreate) AddNotifiers(n ...*Notifier) *GroupCreate {
- ids := make([]uuid.UUID, len(n))
- for i := range n {
- ids[i] = n[i].ID
+func (_c *GroupCreate) AddNotifiers(v ...*Notifier) *GroupCreate {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return gc.AddNotifierIDs(ids...)
+ return _c.AddNotifierIDs(ids...)
}
// Mutation returns the GroupMutation object of the builder.
-func (gc *GroupCreate) Mutation() *GroupMutation {
- return gc.mutation
+func (_c *GroupCreate) Mutation() *GroupMutation {
+ return _c.mutation
}
// Save creates the Group in the database.
-func (gc *GroupCreate) Save(ctx context.Context) (*Group, error) {
- gc.defaults()
- return withHooks(ctx, gc.sqlSave, gc.mutation, gc.hooks)
+func (_c *GroupCreate) Save(ctx context.Context) (*Group, error) {
+ _c.defaults()
+ return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
}
// SaveX calls Save and panics if Save returns an error.
-func (gc *GroupCreate) SaveX(ctx context.Context) *Group {
- v, err := gc.Save(ctx)
+func (_c *GroupCreate) SaveX(ctx context.Context) *Group {
+ v, err := _c.Save(ctx)
if err != nil {
panic(err)
}
@@ -200,66 +200,66 @@ func (gc *GroupCreate) SaveX(ctx context.Context) *Group {
}
// Exec executes the query.
-func (gc *GroupCreate) Exec(ctx context.Context) error {
- _, err := gc.Save(ctx)
+func (_c *GroupCreate) Exec(ctx context.Context) error {
+ _, err := _c.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
-func (gc *GroupCreate) ExecX(ctx context.Context) {
- if err := gc.Exec(ctx); err != nil {
+func (_c *GroupCreate) ExecX(ctx context.Context) {
+ if err := _c.Exec(ctx); err != nil {
panic(err)
}
}
// defaults sets the default values of the builder before save.
-func (gc *GroupCreate) defaults() {
- if _, ok := gc.mutation.CreatedAt(); !ok {
+func (_c *GroupCreate) defaults() {
+ if _, ok := _c.mutation.CreatedAt(); !ok {
v := group.DefaultCreatedAt()
- gc.mutation.SetCreatedAt(v)
+ _c.mutation.SetCreatedAt(v)
}
- if _, ok := gc.mutation.UpdatedAt(); !ok {
+ if _, ok := _c.mutation.UpdatedAt(); !ok {
v := group.DefaultUpdatedAt()
- gc.mutation.SetUpdatedAt(v)
+ _c.mutation.SetUpdatedAt(v)
}
- if _, ok := gc.mutation.Currency(); !ok {
+ if _, ok := _c.mutation.Currency(); !ok {
v := group.DefaultCurrency
- gc.mutation.SetCurrency(v)
+ _c.mutation.SetCurrency(v)
}
- if _, ok := gc.mutation.ID(); !ok {
+ if _, ok := _c.mutation.ID(); !ok {
v := group.DefaultID()
- gc.mutation.SetID(v)
+ _c.mutation.SetID(v)
}
}
// check runs all checks and user-defined validators on the builder.
-func (gc *GroupCreate) check() error {
- if _, ok := gc.mutation.CreatedAt(); !ok {
+func (_c *GroupCreate) check() error {
+ if _, ok := _c.mutation.CreatedAt(); !ok {
return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "Group.created_at"`)}
}
- if _, ok := gc.mutation.UpdatedAt(); !ok {
+ if _, ok := _c.mutation.UpdatedAt(); !ok {
return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "Group.updated_at"`)}
}
- if _, ok := gc.mutation.Name(); !ok {
+ if _, ok := _c.mutation.Name(); !ok {
return &ValidationError{Name: "name", err: errors.New(`ent: missing required field "Group.name"`)}
}
- if v, ok := gc.mutation.Name(); ok {
+ if v, ok := _c.mutation.Name(); ok {
if err := group.NameValidator(v); err != nil {
return &ValidationError{Name: "name", err: fmt.Errorf(`ent: validator failed for field "Group.name": %w`, err)}
}
}
- if _, ok := gc.mutation.Currency(); !ok {
+ if _, ok := _c.mutation.Currency(); !ok {
return &ValidationError{Name: "currency", err: errors.New(`ent: missing required field "Group.currency"`)}
}
return nil
}
-func (gc *GroupCreate) sqlSave(ctx context.Context) (*Group, error) {
- if err := gc.check(); err != nil {
+func (_c *GroupCreate) sqlSave(ctx context.Context) (*Group, error) {
+ if err := _c.check(); err != nil {
return nil, err
}
- _node, _spec := gc.createSpec()
- if err := sqlgraph.CreateNode(ctx, gc.driver, _spec); err != nil {
+ _node, _spec := _c.createSpec()
+ if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil {
if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
@@ -272,37 +272,37 @@ func (gc *GroupCreate) sqlSave(ctx context.Context) (*Group, error) {
return nil, err
}
}
- gc.mutation.id = &_node.ID
- gc.mutation.done = true
+ _c.mutation.id = &_node.ID
+ _c.mutation.done = true
return _node, nil
}
-func (gc *GroupCreate) createSpec() (*Group, *sqlgraph.CreateSpec) {
+func (_c *GroupCreate) createSpec() (*Group, *sqlgraph.CreateSpec) {
var (
- _node = &Group{config: gc.config}
+ _node = &Group{config: _c.config}
_spec = sqlgraph.NewCreateSpec(group.Table, sqlgraph.NewFieldSpec(group.FieldID, field.TypeUUID))
)
- if id, ok := gc.mutation.ID(); ok {
+ if id, ok := _c.mutation.ID(); ok {
_node.ID = id
_spec.ID.Value = &id
}
- if value, ok := gc.mutation.CreatedAt(); ok {
+ if value, ok := _c.mutation.CreatedAt(); ok {
_spec.SetField(group.FieldCreatedAt, field.TypeTime, value)
_node.CreatedAt = value
}
- if value, ok := gc.mutation.UpdatedAt(); ok {
+ if value, ok := _c.mutation.UpdatedAt(); ok {
_spec.SetField(group.FieldUpdatedAt, field.TypeTime, value)
_node.UpdatedAt = value
}
- if value, ok := gc.mutation.Name(); ok {
+ if value, ok := _c.mutation.Name(); ok {
_spec.SetField(group.FieldName, field.TypeString, value)
_node.Name = value
}
- if value, ok := gc.mutation.Currency(); ok {
+ if value, ok := _c.mutation.Currency(); ok {
_spec.SetField(group.FieldCurrency, field.TypeString, value)
_node.Currency = value
}
- if nodes := gc.mutation.UsersIDs(); len(nodes) > 0 {
+ if nodes := _c.mutation.UsersIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -318,7 +318,7 @@ func (gc *GroupCreate) createSpec() (*Group, *sqlgraph.CreateSpec) {
}
_spec.Edges = append(_spec.Edges, edge)
}
- if nodes := gc.mutation.LocationsIDs(); len(nodes) > 0 {
+ if nodes := _c.mutation.LocationsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -334,7 +334,7 @@ func (gc *GroupCreate) createSpec() (*Group, *sqlgraph.CreateSpec) {
}
_spec.Edges = append(_spec.Edges, edge)
}
- if nodes := gc.mutation.ItemsIDs(); len(nodes) > 0 {
+ if nodes := _c.mutation.ItemsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -350,7 +350,7 @@ func (gc *GroupCreate) createSpec() (*Group, *sqlgraph.CreateSpec) {
}
_spec.Edges = append(_spec.Edges, edge)
}
- if nodes := gc.mutation.LabelsIDs(); len(nodes) > 0 {
+ if nodes := _c.mutation.LabelsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -366,7 +366,7 @@ func (gc *GroupCreate) createSpec() (*Group, *sqlgraph.CreateSpec) {
}
_spec.Edges = append(_spec.Edges, edge)
}
- if nodes := gc.mutation.InvitationTokensIDs(); len(nodes) > 0 {
+ if nodes := _c.mutation.InvitationTokensIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -382,7 +382,7 @@ func (gc *GroupCreate) createSpec() (*Group, *sqlgraph.CreateSpec) {
}
_spec.Edges = append(_spec.Edges, edge)
}
- if nodes := gc.mutation.NotifiersIDs(); len(nodes) > 0 {
+ if nodes := _c.mutation.NotifiersIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -409,16 +409,16 @@ type GroupCreateBulk struct {
}
// Save creates the Group entities in the database.
-func (gcb *GroupCreateBulk) Save(ctx context.Context) ([]*Group, error) {
- if gcb.err != nil {
- return nil, gcb.err
- }
- specs := make([]*sqlgraph.CreateSpec, len(gcb.builders))
- nodes := make([]*Group, len(gcb.builders))
- mutators := make([]Mutator, len(gcb.builders))
- for i := range gcb.builders {
+func (_c *GroupCreateBulk) Save(ctx context.Context) ([]*Group, error) {
+ if _c.err != nil {
+ return nil, _c.err
+ }
+ specs := make([]*sqlgraph.CreateSpec, len(_c.builders))
+ nodes := make([]*Group, len(_c.builders))
+ mutators := make([]Mutator, len(_c.builders))
+ for i := range _c.builders {
func(i int, root context.Context) {
- builder := gcb.builders[i]
+ builder := _c.builders[i]
builder.defaults()
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
mutation, ok := m.(*GroupMutation)
@@ -432,11 +432,11 @@ func (gcb *GroupCreateBulk) Save(ctx context.Context) ([]*Group, error) {
var err error
nodes[i], specs[i] = builder.createSpec()
if i < len(mutators)-1 {
- _, err = mutators[i+1].Mutate(root, gcb.builders[i+1].mutation)
+ _, err = mutators[i+1].Mutate(root, _c.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, gcb.driver, spec); err != nil {
+ if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil {
if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
@@ -456,7 +456,7 @@ func (gcb *GroupCreateBulk) Save(ctx context.Context) ([]*Group, error) {
}(i, ctx)
}
if len(mutators) > 0 {
- if _, err := mutators[0].Mutate(ctx, gcb.builders[0].mutation); err != nil {
+ if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil {
return nil, err
}
}
@@ -464,8 +464,8 @@ func (gcb *GroupCreateBulk) Save(ctx context.Context) ([]*Group, error) {
}
// SaveX is like Save, but panics if an error occurs.
-func (gcb *GroupCreateBulk) SaveX(ctx context.Context) []*Group {
- v, err := gcb.Save(ctx)
+func (_c *GroupCreateBulk) SaveX(ctx context.Context) []*Group {
+ v, err := _c.Save(ctx)
if err != nil {
panic(err)
}
@@ -473,14 +473,14 @@ func (gcb *GroupCreateBulk) SaveX(ctx context.Context) []*Group {
}
// Exec executes the query.
-func (gcb *GroupCreateBulk) Exec(ctx context.Context) error {
- _, err := gcb.Save(ctx)
+func (_c *GroupCreateBulk) Exec(ctx context.Context) error {
+ _, err := _c.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
-func (gcb *GroupCreateBulk) ExecX(ctx context.Context) {
- if err := gcb.Exec(ctx); err != nil {
+func (_c *GroupCreateBulk) ExecX(ctx context.Context) {
+ if err := _c.Exec(ctx); err != nil {
panic(err)
}
}
diff --git a/backend/internal/data/ent/group_delete.go b/backend/internal/data/ent/group_delete.go
index 430dd5f1..dc16ab46 100644
--- a/backend/internal/data/ent/group_delete.go
+++ b/backend/internal/data/ent/group_delete.go
@@ -20,56 +20,56 @@ type GroupDelete struct {
}
// Where appends a list predicates to the GroupDelete builder.
-func (gd *GroupDelete) Where(ps ...predicate.Group) *GroupDelete {
- gd.mutation.Where(ps...)
- return gd
+func (_d *GroupDelete) Where(ps ...predicate.Group) *GroupDelete {
+ _d.mutation.Where(ps...)
+ return _d
}
// Exec executes the deletion query and returns how many vertices were deleted.
-func (gd *GroupDelete) Exec(ctx context.Context) (int, error) {
- return withHooks(ctx, gd.sqlExec, gd.mutation, gd.hooks)
+func (_d *GroupDelete) Exec(ctx context.Context) (int, error) {
+ return withHooks(ctx, _d.sqlExec, _d.mutation, _d.hooks)
}
// ExecX is like Exec, but panics if an error occurs.
-func (gd *GroupDelete) ExecX(ctx context.Context) int {
- n, err := gd.Exec(ctx)
+func (_d *GroupDelete) ExecX(ctx context.Context) int {
+ n, err := _d.Exec(ctx)
if err != nil {
panic(err)
}
return n
}
-func (gd *GroupDelete) sqlExec(ctx context.Context) (int, error) {
+func (_d *GroupDelete) sqlExec(ctx context.Context) (int, error) {
_spec := sqlgraph.NewDeleteSpec(group.Table, sqlgraph.NewFieldSpec(group.FieldID, field.TypeUUID))
- if ps := gd.mutation.predicates; len(ps) > 0 {
+ if ps := _d.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
- affected, err := sqlgraph.DeleteNodes(ctx, gd.driver, _spec)
+ affected, err := sqlgraph.DeleteNodes(ctx, _d.driver, _spec)
if err != nil && sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
- gd.mutation.done = true
+ _d.mutation.done = true
return affected, err
}
// GroupDeleteOne is the builder for deleting a single Group entity.
type GroupDeleteOne struct {
- gd *GroupDelete
+ _d *GroupDelete
}
// Where appends a list predicates to the GroupDelete builder.
-func (gdo *GroupDeleteOne) Where(ps ...predicate.Group) *GroupDeleteOne {
- gdo.gd.mutation.Where(ps...)
- return gdo
+func (_d *GroupDeleteOne) Where(ps ...predicate.Group) *GroupDeleteOne {
+ _d._d.mutation.Where(ps...)
+ return _d
}
// Exec executes the deletion query.
-func (gdo *GroupDeleteOne) Exec(ctx context.Context) error {
- n, err := gdo.gd.Exec(ctx)
+func (_d *GroupDeleteOne) Exec(ctx context.Context) error {
+ n, err := _d._d.Exec(ctx)
switch {
case err != nil:
return err
@@ -81,8 +81,8 @@ func (gdo *GroupDeleteOne) Exec(ctx context.Context) error {
}
// ExecX is like Exec, but panics if an error occurs.
-func (gdo *GroupDeleteOne) ExecX(ctx context.Context) {
- if err := gdo.Exec(ctx); err != nil {
+func (_d *GroupDeleteOne) ExecX(ctx context.Context) {
+ if err := _d.Exec(ctx); err != nil {
panic(err)
}
}
diff --git a/backend/internal/data/ent/group_query.go b/backend/internal/data/ent/group_query.go
index fa5aa28e..69d4e4a4 100644
--- a/backend/internal/data/ent/group_query.go
+++ b/backend/internal/data/ent/group_query.go
@@ -42,44 +42,44 @@ type GroupQuery struct {
}
// Where adds a new predicate for the GroupQuery builder.
-func (gq *GroupQuery) Where(ps ...predicate.Group) *GroupQuery {
- gq.predicates = append(gq.predicates, ps...)
- return gq
+func (_q *GroupQuery) Where(ps ...predicate.Group) *GroupQuery {
+ _q.predicates = append(_q.predicates, ps...)
+ return _q
}
// Limit the number of records to be returned by this query.
-func (gq *GroupQuery) Limit(limit int) *GroupQuery {
- gq.ctx.Limit = &limit
- return gq
+func (_q *GroupQuery) Limit(limit int) *GroupQuery {
+ _q.ctx.Limit = &limit
+ return _q
}
// Offset to start from.
-func (gq *GroupQuery) Offset(offset int) *GroupQuery {
- gq.ctx.Offset = &offset
- return gq
+func (_q *GroupQuery) Offset(offset int) *GroupQuery {
+ _q.ctx.Offset = &offset
+ return _q
}
// Unique configures the query builder to filter duplicate records on query.
// By default, unique is set to true, and can be disabled using this method.
-func (gq *GroupQuery) Unique(unique bool) *GroupQuery {
- gq.ctx.Unique = &unique
- return gq
+func (_q *GroupQuery) Unique(unique bool) *GroupQuery {
+ _q.ctx.Unique = &unique
+ return _q
}
// Order specifies how the records should be ordered.
-func (gq *GroupQuery) Order(o ...group.OrderOption) *GroupQuery {
- gq.order = append(gq.order, o...)
- return gq
+func (_q *GroupQuery) Order(o ...group.OrderOption) *GroupQuery {
+ _q.order = append(_q.order, o...)
+ return _q
}
// QueryUsers chains the current query on the "users" edge.
-func (gq *GroupQuery) QueryUsers() *UserQuery {
- query := (&UserClient{config: gq.config}).Query()
+func (_q *GroupQuery) QueryUsers() *UserQuery {
+ query := (&UserClient{config: _q.config}).Query()
query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
- if err := gq.prepareQuery(ctx); err != nil {
+ if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
- selector := gq.sqlQuery(ctx)
+ selector := _q.sqlQuery(ctx)
if err := selector.Err(); err != nil {
return nil, err
}
@@ -88,20 +88,20 @@ func (gq *GroupQuery) QueryUsers() *UserQuery {
sqlgraph.To(user.Table, user.FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, group.UsersTable, group.UsersColumn),
)
- fromU = sqlgraph.SetNeighbors(gq.driver.Dialect(), step)
+ fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step)
return fromU, nil
}
return query
}
// QueryLocations chains the current query on the "locations" edge.
-func (gq *GroupQuery) QueryLocations() *LocationQuery {
- query := (&LocationClient{config: gq.config}).Query()
+func (_q *GroupQuery) QueryLocations() *LocationQuery {
+ query := (&LocationClient{config: _q.config}).Query()
query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
- if err := gq.prepareQuery(ctx); err != nil {
+ if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
- selector := gq.sqlQuery(ctx)
+ selector := _q.sqlQuery(ctx)
if err := selector.Err(); err != nil {
return nil, err
}
@@ -110,20 +110,20 @@ func (gq *GroupQuery) QueryLocations() *LocationQuery {
sqlgraph.To(location.Table, location.FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, group.LocationsTable, group.LocationsColumn),
)
- fromU = sqlgraph.SetNeighbors(gq.driver.Dialect(), step)
+ fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step)
return fromU, nil
}
return query
}
// QueryItems chains the current query on the "items" edge.
-func (gq *GroupQuery) QueryItems() *ItemQuery {
- query := (&ItemClient{config: gq.config}).Query()
+func (_q *GroupQuery) QueryItems() *ItemQuery {
+ query := (&ItemClient{config: _q.config}).Query()
query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
- if err := gq.prepareQuery(ctx); err != nil {
+ if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
- selector := gq.sqlQuery(ctx)
+ selector := _q.sqlQuery(ctx)
if err := selector.Err(); err != nil {
return nil, err
}
@@ -132,20 +132,20 @@ func (gq *GroupQuery) QueryItems() *ItemQuery {
sqlgraph.To(item.Table, item.FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, group.ItemsTable, group.ItemsColumn),
)
- fromU = sqlgraph.SetNeighbors(gq.driver.Dialect(), step)
+ fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step)
return fromU, nil
}
return query
}
// QueryLabels chains the current query on the "labels" edge.
-func (gq *GroupQuery) QueryLabels() *LabelQuery {
- query := (&LabelClient{config: gq.config}).Query()
+func (_q *GroupQuery) QueryLabels() *LabelQuery {
+ query := (&LabelClient{config: _q.config}).Query()
query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
- if err := gq.prepareQuery(ctx); err != nil {
+ if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
- selector := gq.sqlQuery(ctx)
+ selector := _q.sqlQuery(ctx)
if err := selector.Err(); err != nil {
return nil, err
}
@@ -154,20 +154,20 @@ func (gq *GroupQuery) QueryLabels() *LabelQuery {
sqlgraph.To(label.Table, label.FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, group.LabelsTable, group.LabelsColumn),
)
- fromU = sqlgraph.SetNeighbors(gq.driver.Dialect(), step)
+ fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step)
return fromU, nil
}
return query
}
// QueryInvitationTokens chains the current query on the "invitation_tokens" edge.
-func (gq *GroupQuery) QueryInvitationTokens() *GroupInvitationTokenQuery {
- query := (&GroupInvitationTokenClient{config: gq.config}).Query()
+func (_q *GroupQuery) QueryInvitationTokens() *GroupInvitationTokenQuery {
+ query := (&GroupInvitationTokenClient{config: _q.config}).Query()
query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
- if err := gq.prepareQuery(ctx); err != nil {
+ if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
- selector := gq.sqlQuery(ctx)
+ selector := _q.sqlQuery(ctx)
if err := selector.Err(); err != nil {
return nil, err
}
@@ -176,20 +176,20 @@ func (gq *GroupQuery) QueryInvitationTokens() *GroupInvitationTokenQuery {
sqlgraph.To(groupinvitationtoken.Table, groupinvitationtoken.FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, group.InvitationTokensTable, group.InvitationTokensColumn),
)
- fromU = sqlgraph.SetNeighbors(gq.driver.Dialect(), step)
+ fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step)
return fromU, nil
}
return query
}
// QueryNotifiers chains the current query on the "notifiers" edge.
-func (gq *GroupQuery) QueryNotifiers() *NotifierQuery {
- query := (&NotifierClient{config: gq.config}).Query()
+func (_q *GroupQuery) QueryNotifiers() *NotifierQuery {
+ query := (&NotifierClient{config: _q.config}).Query()
query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
- if err := gq.prepareQuery(ctx); err != nil {
+ if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
- selector := gq.sqlQuery(ctx)
+ selector := _q.sqlQuery(ctx)
if err := selector.Err(); err != nil {
return nil, err
}
@@ -198,7 +198,7 @@ func (gq *GroupQuery) QueryNotifiers() *NotifierQuery {
sqlgraph.To(notifier.Table, notifier.FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, group.NotifiersTable, group.NotifiersColumn),
)
- fromU = sqlgraph.SetNeighbors(gq.driver.Dialect(), step)
+ fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step)
return fromU, nil
}
return query
@@ -206,8 +206,8 @@ func (gq *GroupQuery) QueryNotifiers() *NotifierQuery {
// First returns the first Group entity from the query.
// Returns a *NotFoundError when no Group was found.
-func (gq *GroupQuery) First(ctx context.Context) (*Group, error) {
- nodes, err := gq.Limit(1).All(setContextOp(ctx, gq.ctx, ent.OpQueryFirst))
+func (_q *GroupQuery) First(ctx context.Context) (*Group, error) {
+ nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst))
if err != nil {
return nil, err
}
@@ -218,8 +218,8 @@ func (gq *GroupQuery) First(ctx context.Context) (*Group, error) {
}
// FirstX is like First, but panics if an error occurs.
-func (gq *GroupQuery) FirstX(ctx context.Context) *Group {
- node, err := gq.First(ctx)
+func (_q *GroupQuery) FirstX(ctx context.Context) *Group {
+ node, err := _q.First(ctx)
if err != nil && !IsNotFound(err) {
panic(err)
}
@@ -228,9 +228,9 @@ func (gq *GroupQuery) FirstX(ctx context.Context) *Group {
// FirstID returns the first Group ID from the query.
// Returns a *NotFoundError when no Group ID was found.
-func (gq *GroupQuery) FirstID(ctx context.Context) (id uuid.UUID, err error) {
+func (_q *GroupQuery) FirstID(ctx context.Context) (id uuid.UUID, err error) {
var ids []uuid.UUID
- if ids, err = gq.Limit(1).IDs(setContextOp(ctx, gq.ctx, ent.OpQueryFirstID)); err != nil {
+ if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil {
return
}
if len(ids) == 0 {
@@ -241,8 +241,8 @@ func (gq *GroupQuery) FirstID(ctx context.Context) (id uuid.UUID, err error) {
}
// FirstIDX is like FirstID, but panics if an error occurs.
-func (gq *GroupQuery) FirstIDX(ctx context.Context) uuid.UUID {
- id, err := gq.FirstID(ctx)
+func (_q *GroupQuery) FirstIDX(ctx context.Context) uuid.UUID {
+ id, err := _q.FirstID(ctx)
if err != nil && !IsNotFound(err) {
panic(err)
}
@@ -252,8 +252,8 @@ func (gq *GroupQuery) FirstIDX(ctx context.Context) uuid.UUID {
// Only returns a single Group entity found by the query, ensuring it only returns one.
// Returns a *NotSingularError when more than one Group entity is found.
// Returns a *NotFoundError when no Group entities are found.
-func (gq *GroupQuery) Only(ctx context.Context) (*Group, error) {
- nodes, err := gq.Limit(2).All(setContextOp(ctx, gq.ctx, ent.OpQueryOnly))
+func (_q *GroupQuery) Only(ctx context.Context) (*Group, error) {
+ nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly))
if err != nil {
return nil, err
}
@@ -268,8 +268,8 @@ func (gq *GroupQuery) Only(ctx context.Context) (*Group, error) {
}
// OnlyX is like Only, but panics if an error occurs.
-func (gq *GroupQuery) OnlyX(ctx context.Context) *Group {
- node, err := gq.Only(ctx)
+func (_q *GroupQuery) OnlyX(ctx context.Context) *Group {
+ node, err := _q.Only(ctx)
if err != nil {
panic(err)
}
@@ -279,9 +279,9 @@ func (gq *GroupQuery) OnlyX(ctx context.Context) *Group {
// OnlyID is like Only, but returns the only Group ID in the query.
// Returns a *NotSingularError when more than one Group ID is found.
// Returns a *NotFoundError when no entities are found.
-func (gq *GroupQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error) {
+func (_q *GroupQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error) {
var ids []uuid.UUID
- if ids, err = gq.Limit(2).IDs(setContextOp(ctx, gq.ctx, ent.OpQueryOnlyID)); err != nil {
+ if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil {
return
}
switch len(ids) {
@@ -296,8 +296,8 @@ func (gq *GroupQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error) {
}
// OnlyIDX is like OnlyID, but panics if an error occurs.
-func (gq *GroupQuery) OnlyIDX(ctx context.Context) uuid.UUID {
- id, err := gq.OnlyID(ctx)
+func (_q *GroupQuery) OnlyIDX(ctx context.Context) uuid.UUID {
+ id, err := _q.OnlyID(ctx)
if err != nil {
panic(err)
}
@@ -305,18 +305,18 @@ func (gq *GroupQuery) OnlyIDX(ctx context.Context) uuid.UUID {
}
// All executes the query and returns a list of Groups.
-func (gq *GroupQuery) All(ctx context.Context) ([]*Group, error) {
- ctx = setContextOp(ctx, gq.ctx, ent.OpQueryAll)
- if err := gq.prepareQuery(ctx); err != nil {
+func (_q *GroupQuery) All(ctx context.Context) ([]*Group, error) {
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll)
+ if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
qr := querierAll[[]*Group, *GroupQuery]()
- return withInterceptors[[]*Group](ctx, gq, qr, gq.inters)
+ return withInterceptors[[]*Group](ctx, _q, qr, _q.inters)
}
// AllX is like All, but panics if an error occurs.
-func (gq *GroupQuery) AllX(ctx context.Context) []*Group {
- nodes, err := gq.All(ctx)
+func (_q *GroupQuery) AllX(ctx context.Context) []*Group {
+ nodes, err := _q.All(ctx)
if err != nil {
panic(err)
}
@@ -324,20 +324,20 @@ func (gq *GroupQuery) AllX(ctx context.Context) []*Group {
}
// IDs executes the query and returns a list of Group IDs.
-func (gq *GroupQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error) {
- if gq.ctx.Unique == nil && gq.path != nil {
- gq.Unique(true)
+func (_q *GroupQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error) {
+ if _q.ctx.Unique == nil && _q.path != nil {
+ _q.Unique(true)
}
- ctx = setContextOp(ctx, gq.ctx, ent.OpQueryIDs)
- if err = gq.Select(group.FieldID).Scan(ctx, &ids); err != nil {
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs)
+ if err = _q.Select(group.FieldID).Scan(ctx, &ids); err != nil {
return nil, err
}
return ids, nil
}
// IDsX is like IDs, but panics if an error occurs.
-func (gq *GroupQuery) IDsX(ctx context.Context) []uuid.UUID {
- ids, err := gq.IDs(ctx)
+func (_q *GroupQuery) IDsX(ctx context.Context) []uuid.UUID {
+ ids, err := _q.IDs(ctx)
if err != nil {
panic(err)
}
@@ -345,17 +345,17 @@ func (gq *GroupQuery) IDsX(ctx context.Context) []uuid.UUID {
}
// Count returns the count of the given query.
-func (gq *GroupQuery) Count(ctx context.Context) (int, error) {
- ctx = setContextOp(ctx, gq.ctx, ent.OpQueryCount)
- if err := gq.prepareQuery(ctx); err != nil {
+func (_q *GroupQuery) Count(ctx context.Context) (int, error) {
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryCount)
+ if err := _q.prepareQuery(ctx); err != nil {
return 0, err
}
- return withInterceptors[int](ctx, gq, querierCount[*GroupQuery](), gq.inters)
+ return withInterceptors[int](ctx, _q, querierCount[*GroupQuery](), _q.inters)
}
// CountX is like Count, but panics if an error occurs.
-func (gq *GroupQuery) CountX(ctx context.Context) int {
- count, err := gq.Count(ctx)
+func (_q *GroupQuery) CountX(ctx context.Context) int {
+ count, err := _q.Count(ctx)
if err != nil {
panic(err)
}
@@ -363,9 +363,9 @@ func (gq *GroupQuery) CountX(ctx context.Context) int {
}
// Exist returns true if the query has elements in the graph.
-func (gq *GroupQuery) Exist(ctx context.Context) (bool, error) {
- ctx = setContextOp(ctx, gq.ctx, ent.OpQueryExist)
- switch _, err := gq.FirstID(ctx); {
+func (_q *GroupQuery) Exist(ctx context.Context) (bool, error) {
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryExist)
+ switch _, err := _q.FirstID(ctx); {
case IsNotFound(err):
return false, nil
case err != nil:
@@ -376,8 +376,8 @@ func (gq *GroupQuery) Exist(ctx context.Context) (bool, error) {
}
// ExistX is like Exist, but panics if an error occurs.
-func (gq *GroupQuery) ExistX(ctx context.Context) bool {
- exist, err := gq.Exist(ctx)
+func (_q *GroupQuery) ExistX(ctx context.Context) bool {
+ exist, err := _q.Exist(ctx)
if err != nil {
panic(err)
}
@@ -386,92 +386,92 @@ func (gq *GroupQuery) ExistX(ctx context.Context) bool {
// Clone returns a duplicate of the GroupQuery builder, including all associated steps. It can be
// used to prepare common query builders and use them differently after the clone is made.
-func (gq *GroupQuery) Clone() *GroupQuery {
- if gq == nil {
+func (_q *GroupQuery) Clone() *GroupQuery {
+ if _q == nil {
return nil
}
return &GroupQuery{
- config: gq.config,
- ctx: gq.ctx.Clone(),
- order: append([]group.OrderOption{}, gq.order...),
- inters: append([]Interceptor{}, gq.inters...),
- predicates: append([]predicate.Group{}, gq.predicates...),
- withUsers: gq.withUsers.Clone(),
- withLocations: gq.withLocations.Clone(),
- withItems: gq.withItems.Clone(),
- withLabels: gq.withLabels.Clone(),
- withInvitationTokens: gq.withInvitationTokens.Clone(),
- withNotifiers: gq.withNotifiers.Clone(),
+ config: _q.config,
+ ctx: _q.ctx.Clone(),
+ order: append([]group.OrderOption{}, _q.order...),
+ inters: append([]Interceptor{}, _q.inters...),
+ predicates: append([]predicate.Group{}, _q.predicates...),
+ withUsers: _q.withUsers.Clone(),
+ withLocations: _q.withLocations.Clone(),
+ withItems: _q.withItems.Clone(),
+ withLabels: _q.withLabels.Clone(),
+ withInvitationTokens: _q.withInvitationTokens.Clone(),
+ withNotifiers: _q.withNotifiers.Clone(),
// clone intermediate query.
- sql: gq.sql.Clone(),
- path: gq.path,
+ sql: _q.sql.Clone(),
+ path: _q.path,
}
}
// WithUsers tells the query-builder to eager-load the nodes that are connected to
// the "users" edge. The optional arguments are used to configure the query builder of the edge.
-func (gq *GroupQuery) WithUsers(opts ...func(*UserQuery)) *GroupQuery {
- query := (&UserClient{config: gq.config}).Query()
+func (_q *GroupQuery) WithUsers(opts ...func(*UserQuery)) *GroupQuery {
+ query := (&UserClient{config: _q.config}).Query()
for _, opt := range opts {
opt(query)
}
- gq.withUsers = query
- return gq
+ _q.withUsers = query
+ return _q
}
// WithLocations tells the query-builder to eager-load the nodes that are connected to
// the "locations" edge. The optional arguments are used to configure the query builder of the edge.
-func (gq *GroupQuery) WithLocations(opts ...func(*LocationQuery)) *GroupQuery {
- query := (&LocationClient{config: gq.config}).Query()
+func (_q *GroupQuery) WithLocations(opts ...func(*LocationQuery)) *GroupQuery {
+ query := (&LocationClient{config: _q.config}).Query()
for _, opt := range opts {
opt(query)
}
- gq.withLocations = query
- return gq
+ _q.withLocations = query
+ return _q
}
// WithItems tells the query-builder to eager-load the nodes that are connected to
// the "items" edge. The optional arguments are used to configure the query builder of the edge.
-func (gq *GroupQuery) WithItems(opts ...func(*ItemQuery)) *GroupQuery {
- query := (&ItemClient{config: gq.config}).Query()
+func (_q *GroupQuery) WithItems(opts ...func(*ItemQuery)) *GroupQuery {
+ query := (&ItemClient{config: _q.config}).Query()
for _, opt := range opts {
opt(query)
}
- gq.withItems = query
- return gq
+ _q.withItems = query
+ return _q
}
// WithLabels tells the query-builder to eager-load the nodes that are connected to
// the "labels" edge. The optional arguments are used to configure the query builder of the edge.
-func (gq *GroupQuery) WithLabels(opts ...func(*LabelQuery)) *GroupQuery {
- query := (&LabelClient{config: gq.config}).Query()
+func (_q *GroupQuery) WithLabels(opts ...func(*LabelQuery)) *GroupQuery {
+ query := (&LabelClient{config: _q.config}).Query()
for _, opt := range opts {
opt(query)
}
- gq.withLabels = query
- return gq
+ _q.withLabels = query
+ return _q
}
// WithInvitationTokens tells the query-builder to eager-load the nodes that are connected to
// the "invitation_tokens" edge. The optional arguments are used to configure the query builder of the edge.
-func (gq *GroupQuery) WithInvitationTokens(opts ...func(*GroupInvitationTokenQuery)) *GroupQuery {
- query := (&GroupInvitationTokenClient{config: gq.config}).Query()
+func (_q *GroupQuery) WithInvitationTokens(opts ...func(*GroupInvitationTokenQuery)) *GroupQuery {
+ query := (&GroupInvitationTokenClient{config: _q.config}).Query()
for _, opt := range opts {
opt(query)
}
- gq.withInvitationTokens = query
- return gq
+ _q.withInvitationTokens = query
+ return _q
}
// WithNotifiers tells the query-builder to eager-load the nodes that are connected to
// the "notifiers" edge. The optional arguments are used to configure the query builder of the edge.
-func (gq *GroupQuery) WithNotifiers(opts ...func(*NotifierQuery)) *GroupQuery {
- query := (&NotifierClient{config: gq.config}).Query()
+func (_q *GroupQuery) WithNotifiers(opts ...func(*NotifierQuery)) *GroupQuery {
+ query := (&NotifierClient{config: _q.config}).Query()
for _, opt := range opts {
opt(query)
}
- gq.withNotifiers = query
- return gq
+ _q.withNotifiers = query
+ return _q
}
// GroupBy is used to group vertices by one or more fields/columns.
@@ -488,10 +488,10 @@ func (gq *GroupQuery) WithNotifiers(opts ...func(*NotifierQuery)) *GroupQuery {
// GroupBy(group.FieldCreatedAt).
// Aggregate(ent.Count()).
// Scan(ctx, &v)
-func (gq *GroupQuery) GroupBy(field string, fields ...string) *GroupGroupBy {
- gq.ctx.Fields = append([]string{field}, fields...)
- grbuild := &GroupGroupBy{build: gq}
- grbuild.flds = &gq.ctx.Fields
+func (_q *GroupQuery) GroupBy(field string, fields ...string) *GroupGroupBy {
+ _q.ctx.Fields = append([]string{field}, fields...)
+ grbuild := &GroupGroupBy{build: _q}
+ grbuild.flds = &_q.ctx.Fields
grbuild.label = group.Label
grbuild.scan = grbuild.Scan
return grbuild
@@ -509,63 +509,63 @@ func (gq *GroupQuery) GroupBy(field string, fields ...string) *GroupGroupBy {
// client.Group.Query().
// Select(group.FieldCreatedAt).
// Scan(ctx, &v)
-func (gq *GroupQuery) Select(fields ...string) *GroupSelect {
- gq.ctx.Fields = append(gq.ctx.Fields, fields...)
- sbuild := &GroupSelect{GroupQuery: gq}
+func (_q *GroupQuery) Select(fields ...string) *GroupSelect {
+ _q.ctx.Fields = append(_q.ctx.Fields, fields...)
+ sbuild := &GroupSelect{GroupQuery: _q}
sbuild.label = group.Label
- sbuild.flds, sbuild.scan = &gq.ctx.Fields, sbuild.Scan
+ sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan
return sbuild
}
// Aggregate returns a GroupSelect configured with the given aggregations.
-func (gq *GroupQuery) Aggregate(fns ...AggregateFunc) *GroupSelect {
- return gq.Select().Aggregate(fns...)
+func (_q *GroupQuery) Aggregate(fns ...AggregateFunc) *GroupSelect {
+ return _q.Select().Aggregate(fns...)
}
-func (gq *GroupQuery) prepareQuery(ctx context.Context) error {
- for _, inter := range gq.inters {
+func (_q *GroupQuery) prepareQuery(ctx context.Context) error {
+ for _, inter := range _q.inters {
if inter == nil {
return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)")
}
if trv, ok := inter.(Traverser); ok {
- if err := trv.Traverse(ctx, gq); err != nil {
+ if err := trv.Traverse(ctx, _q); err != nil {
return err
}
}
}
- for _, f := range gq.ctx.Fields {
+ for _, f := range _q.ctx.Fields {
if !group.ValidColumn(f) {
return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
}
}
- if gq.path != nil {
- prev, err := gq.path(ctx)
+ if _q.path != nil {
+ prev, err := _q.path(ctx)
if err != nil {
return err
}
- gq.sql = prev
+ _q.sql = prev
}
return nil
}
-func (gq *GroupQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Group, error) {
+func (_q *GroupQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Group, error) {
var (
nodes = []*Group{}
- _spec = gq.querySpec()
+ _spec = _q.querySpec()
loadedTypes = [6]bool{
- gq.withUsers != nil,
- gq.withLocations != nil,
- gq.withItems != nil,
- gq.withLabels != nil,
- gq.withInvitationTokens != nil,
- gq.withNotifiers != nil,
+ _q.withUsers != nil,
+ _q.withLocations != nil,
+ _q.withItems != nil,
+ _q.withLabels != nil,
+ _q.withInvitationTokens != nil,
+ _q.withNotifiers != nil,
}
)
_spec.ScanValues = func(columns []string) ([]any, error) {
return (*Group).scanValues(nil, columns)
}
_spec.Assign = func(columns []string, values []any) error {
- node := &Group{config: gq.config}
+ node := &Group{config: _q.config}
nodes = append(nodes, node)
node.Edges.loadedTypes = loadedTypes
return node.assignValues(columns, values)
@@ -573,42 +573,42 @@ func (gq *GroupQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Group,
for i := range hooks {
hooks[i](ctx, _spec)
}
- if err := sqlgraph.QueryNodes(ctx, gq.driver, _spec); err != nil {
+ if err := sqlgraph.QueryNodes(ctx, _q.driver, _spec); err != nil {
return nil, err
}
if len(nodes) == 0 {
return nodes, nil
}
- if query := gq.withUsers; query != nil {
- if err := gq.loadUsers(ctx, query, nodes,
+ if query := _q.withUsers; query != nil {
+ if err := _q.loadUsers(ctx, query, nodes,
func(n *Group) { n.Edges.Users = []*User{} },
func(n *Group, e *User) { n.Edges.Users = append(n.Edges.Users, e) }); err != nil {
return nil, err
}
}
- if query := gq.withLocations; query != nil {
- if err := gq.loadLocations(ctx, query, nodes,
+ if query := _q.withLocations; query != nil {
+ if err := _q.loadLocations(ctx, query, nodes,
func(n *Group) { n.Edges.Locations = []*Location{} },
func(n *Group, e *Location) { n.Edges.Locations = append(n.Edges.Locations, e) }); err != nil {
return nil, err
}
}
- if query := gq.withItems; query != nil {
- if err := gq.loadItems(ctx, query, nodes,
+ if query := _q.withItems; query != nil {
+ if err := _q.loadItems(ctx, query, nodes,
func(n *Group) { n.Edges.Items = []*Item{} },
func(n *Group, e *Item) { n.Edges.Items = append(n.Edges.Items, e) }); err != nil {
return nil, err
}
}
- if query := gq.withLabels; query != nil {
- if err := gq.loadLabels(ctx, query, nodes,
+ if query := _q.withLabels; query != nil {
+ if err := _q.loadLabels(ctx, query, nodes,
func(n *Group) { n.Edges.Labels = []*Label{} },
func(n *Group, e *Label) { n.Edges.Labels = append(n.Edges.Labels, e) }); err != nil {
return nil, err
}
}
- if query := gq.withInvitationTokens; query != nil {
- if err := gq.loadInvitationTokens(ctx, query, nodes,
+ if query := _q.withInvitationTokens; query != nil {
+ if err := _q.loadInvitationTokens(ctx, query, nodes,
func(n *Group) { n.Edges.InvitationTokens = []*GroupInvitationToken{} },
func(n *Group, e *GroupInvitationToken) {
n.Edges.InvitationTokens = append(n.Edges.InvitationTokens, e)
@@ -616,8 +616,8 @@ func (gq *GroupQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Group,
return nil, err
}
}
- if query := gq.withNotifiers; query != nil {
- if err := gq.loadNotifiers(ctx, query, nodes,
+ if query := _q.withNotifiers; query != nil {
+ if err := _q.loadNotifiers(ctx, query, nodes,
func(n *Group) { n.Edges.Notifiers = []*Notifier{} },
func(n *Group, e *Notifier) { n.Edges.Notifiers = append(n.Edges.Notifiers, e) }); err != nil {
return nil, err
@@ -626,7 +626,7 @@ func (gq *GroupQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Group,
return nodes, nil
}
-func (gq *GroupQuery) loadUsers(ctx context.Context, query *UserQuery, nodes []*Group, init func(*Group), assign func(*Group, *User)) error {
+func (_q *GroupQuery) loadUsers(ctx context.Context, query *UserQuery, nodes []*Group, init func(*Group), assign func(*Group, *User)) error {
fks := make([]driver.Value, 0, len(nodes))
nodeids := make(map[uuid.UUID]*Group)
for i := range nodes {
@@ -657,7 +657,7 @@ func (gq *GroupQuery) loadUsers(ctx context.Context, query *UserQuery, nodes []*
}
return nil
}
-func (gq *GroupQuery) loadLocations(ctx context.Context, query *LocationQuery, nodes []*Group, init func(*Group), assign func(*Group, *Location)) error {
+func (_q *GroupQuery) loadLocations(ctx context.Context, query *LocationQuery, nodes []*Group, init func(*Group), assign func(*Group, *Location)) error {
fks := make([]driver.Value, 0, len(nodes))
nodeids := make(map[uuid.UUID]*Group)
for i := range nodes {
@@ -688,7 +688,7 @@ func (gq *GroupQuery) loadLocations(ctx context.Context, query *LocationQuery, n
}
return nil
}
-func (gq *GroupQuery) loadItems(ctx context.Context, query *ItemQuery, nodes []*Group, init func(*Group), assign func(*Group, *Item)) error {
+func (_q *GroupQuery) loadItems(ctx context.Context, query *ItemQuery, nodes []*Group, init func(*Group), assign func(*Group, *Item)) error {
fks := make([]driver.Value, 0, len(nodes))
nodeids := make(map[uuid.UUID]*Group)
for i := range nodes {
@@ -719,7 +719,7 @@ func (gq *GroupQuery) loadItems(ctx context.Context, query *ItemQuery, nodes []*
}
return nil
}
-func (gq *GroupQuery) loadLabels(ctx context.Context, query *LabelQuery, nodes []*Group, init func(*Group), assign func(*Group, *Label)) error {
+func (_q *GroupQuery) loadLabels(ctx context.Context, query *LabelQuery, nodes []*Group, init func(*Group), assign func(*Group, *Label)) error {
fks := make([]driver.Value, 0, len(nodes))
nodeids := make(map[uuid.UUID]*Group)
for i := range nodes {
@@ -750,7 +750,7 @@ func (gq *GroupQuery) loadLabels(ctx context.Context, query *LabelQuery, nodes [
}
return nil
}
-func (gq *GroupQuery) loadInvitationTokens(ctx context.Context, query *GroupInvitationTokenQuery, nodes []*Group, init func(*Group), assign func(*Group, *GroupInvitationToken)) error {
+func (_q *GroupQuery) loadInvitationTokens(ctx context.Context, query *GroupInvitationTokenQuery, nodes []*Group, init func(*Group), assign func(*Group, *GroupInvitationToken)) error {
fks := make([]driver.Value, 0, len(nodes))
nodeids := make(map[uuid.UUID]*Group)
for i := range nodes {
@@ -781,7 +781,7 @@ func (gq *GroupQuery) loadInvitationTokens(ctx context.Context, query *GroupInvi
}
return nil
}
-func (gq *GroupQuery) loadNotifiers(ctx context.Context, query *NotifierQuery, nodes []*Group, init func(*Group), assign func(*Group, *Notifier)) error {
+func (_q *GroupQuery) loadNotifiers(ctx context.Context, query *NotifierQuery, nodes []*Group, init func(*Group), assign func(*Group, *Notifier)) error {
fks := make([]driver.Value, 0, len(nodes))
nodeids := make(map[uuid.UUID]*Group)
for i := range nodes {
@@ -812,24 +812,24 @@ func (gq *GroupQuery) loadNotifiers(ctx context.Context, query *NotifierQuery, n
return nil
}
-func (gq *GroupQuery) sqlCount(ctx context.Context) (int, error) {
- _spec := gq.querySpec()
- _spec.Node.Columns = gq.ctx.Fields
- if len(gq.ctx.Fields) > 0 {
- _spec.Unique = gq.ctx.Unique != nil && *gq.ctx.Unique
+func (_q *GroupQuery) sqlCount(ctx context.Context) (int, error) {
+ _spec := _q.querySpec()
+ _spec.Node.Columns = _q.ctx.Fields
+ if len(_q.ctx.Fields) > 0 {
+ _spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique
}
- return sqlgraph.CountNodes(ctx, gq.driver, _spec)
+ return sqlgraph.CountNodes(ctx, _q.driver, _spec)
}
-func (gq *GroupQuery) querySpec() *sqlgraph.QuerySpec {
+func (_q *GroupQuery) querySpec() *sqlgraph.QuerySpec {
_spec := sqlgraph.NewQuerySpec(group.Table, group.Columns, sqlgraph.NewFieldSpec(group.FieldID, field.TypeUUID))
- _spec.From = gq.sql
- if unique := gq.ctx.Unique; unique != nil {
+ _spec.From = _q.sql
+ if unique := _q.ctx.Unique; unique != nil {
_spec.Unique = *unique
- } else if gq.path != nil {
+ } else if _q.path != nil {
_spec.Unique = true
}
- if fields := gq.ctx.Fields; len(fields) > 0 {
+ if fields := _q.ctx.Fields; len(fields) > 0 {
_spec.Node.Columns = make([]string, 0, len(fields))
_spec.Node.Columns = append(_spec.Node.Columns, group.FieldID)
for i := range fields {
@@ -838,20 +838,20 @@ func (gq *GroupQuery) querySpec() *sqlgraph.QuerySpec {
}
}
}
- if ps := gq.predicates; len(ps) > 0 {
+ if ps := _q.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
- if limit := gq.ctx.Limit; limit != nil {
+ if limit := _q.ctx.Limit; limit != nil {
_spec.Limit = *limit
}
- if offset := gq.ctx.Offset; offset != nil {
+ if offset := _q.ctx.Offset; offset != nil {
_spec.Offset = *offset
}
- if ps := gq.order; len(ps) > 0 {
+ if ps := _q.order; len(ps) > 0 {
_spec.Order = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
@@ -861,33 +861,33 @@ func (gq *GroupQuery) querySpec() *sqlgraph.QuerySpec {
return _spec
}
-func (gq *GroupQuery) sqlQuery(ctx context.Context) *sql.Selector {
- builder := sql.Dialect(gq.driver.Dialect())
+func (_q *GroupQuery) sqlQuery(ctx context.Context) *sql.Selector {
+ builder := sql.Dialect(_q.driver.Dialect())
t1 := builder.Table(group.Table)
- columns := gq.ctx.Fields
+ columns := _q.ctx.Fields
if len(columns) == 0 {
columns = group.Columns
}
selector := builder.Select(t1.Columns(columns...)...).From(t1)
- if gq.sql != nil {
- selector = gq.sql
+ if _q.sql != nil {
+ selector = _q.sql
selector.Select(selector.Columns(columns...)...)
}
- if gq.ctx.Unique != nil && *gq.ctx.Unique {
+ if _q.ctx.Unique != nil && *_q.ctx.Unique {
selector.Distinct()
}
- for _, p := range gq.predicates {
+ for _, p := range _q.predicates {
p(selector)
}
- for _, p := range gq.order {
+ for _, p := range _q.order {
p(selector)
}
- if offset := gq.ctx.Offset; offset != nil {
+ if offset := _q.ctx.Offset; offset != nil {
// limit is mandatory for offset clause. We start
// with default value, and override it below if needed.
selector.Offset(*offset).Limit(math.MaxInt32)
}
- if limit := gq.ctx.Limit; limit != nil {
+ if limit := _q.ctx.Limit; limit != nil {
selector.Limit(*limit)
}
return selector
@@ -900,41 +900,41 @@ type GroupGroupBy struct {
}
// Aggregate adds the given aggregation functions to the group-by query.
-func (ggb *GroupGroupBy) Aggregate(fns ...AggregateFunc) *GroupGroupBy {
- ggb.fns = append(ggb.fns, fns...)
- return ggb
+func (_g *GroupGroupBy) Aggregate(fns ...AggregateFunc) *GroupGroupBy {
+ _g.fns = append(_g.fns, fns...)
+ return _g
}
// Scan applies the selector query and scans the result into the given value.
-func (ggb *GroupGroupBy) Scan(ctx context.Context, v any) error {
- ctx = setContextOp(ctx, ggb.build.ctx, ent.OpQueryGroupBy)
- if err := ggb.build.prepareQuery(ctx); err != nil {
+func (_g *GroupGroupBy) Scan(ctx context.Context, v any) error {
+ ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy)
+ if err := _g.build.prepareQuery(ctx); err != nil {
return err
}
- return scanWithInterceptors[*GroupQuery, *GroupGroupBy](ctx, ggb.build, ggb, ggb.build.inters, v)
+ return scanWithInterceptors[*GroupQuery, *GroupGroupBy](ctx, _g.build, _g, _g.build.inters, v)
}
-func (ggb *GroupGroupBy) sqlScan(ctx context.Context, root *GroupQuery, v any) error {
+func (_g *GroupGroupBy) sqlScan(ctx context.Context, root *GroupQuery, v any) error {
selector := root.sqlQuery(ctx).Select()
- aggregation := make([]string, 0, len(ggb.fns))
- for _, fn := range ggb.fns {
+ aggregation := make([]string, 0, len(_g.fns))
+ for _, fn := range _g.fns {
aggregation = append(aggregation, fn(selector))
}
if len(selector.SelectedColumns()) == 0 {
- columns := make([]string, 0, len(*ggb.flds)+len(ggb.fns))
- for _, f := range *ggb.flds {
+ columns := make([]string, 0, len(*_g.flds)+len(_g.fns))
+ for _, f := range *_g.flds {
columns = append(columns, selector.C(f))
}
columns = append(columns, aggregation...)
selector.Select(columns...)
}
- selector.GroupBy(selector.Columns(*ggb.flds...)...)
+ selector.GroupBy(selector.Columns(*_g.flds...)...)
if err := selector.Err(); err != nil {
return err
}
rows := &sql.Rows{}
query, args := selector.Query()
- if err := ggb.build.driver.Query(ctx, query, args, rows); err != nil {
+ if err := _g.build.driver.Query(ctx, query, args, rows); err != nil {
return err
}
defer rows.Close()
@@ -948,27 +948,27 @@ type GroupSelect struct {
}
// Aggregate adds the given aggregation functions to the selector query.
-func (gs *GroupSelect) Aggregate(fns ...AggregateFunc) *GroupSelect {
- gs.fns = append(gs.fns, fns...)
- return gs
+func (_s *GroupSelect) Aggregate(fns ...AggregateFunc) *GroupSelect {
+ _s.fns = append(_s.fns, fns...)
+ return _s
}
// Scan applies the selector query and scans the result into the given value.
-func (gs *GroupSelect) Scan(ctx context.Context, v any) error {
- ctx = setContextOp(ctx, gs.ctx, ent.OpQuerySelect)
- if err := gs.prepareQuery(ctx); err != nil {
+func (_s *GroupSelect) Scan(ctx context.Context, v any) error {
+ ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect)
+ if err := _s.prepareQuery(ctx); err != nil {
return err
}
- return scanWithInterceptors[*GroupQuery, *GroupSelect](ctx, gs.GroupQuery, gs, gs.inters, v)
+ return scanWithInterceptors[*GroupQuery, *GroupSelect](ctx, _s.GroupQuery, _s, _s.inters, v)
}
-func (gs *GroupSelect) sqlScan(ctx context.Context, root *GroupQuery, v any) error {
+func (_s *GroupSelect) sqlScan(ctx context.Context, root *GroupQuery, v any) error {
selector := root.sqlQuery(ctx)
- aggregation := make([]string, 0, len(gs.fns))
- for _, fn := range gs.fns {
+ aggregation := make([]string, 0, len(_s.fns))
+ for _, fn := range _s.fns {
aggregation = append(aggregation, fn(selector))
}
- switch n := len(*gs.selector.flds); {
+ switch n := len(*_s.selector.flds); {
case n == 0 && len(aggregation) > 0:
selector.Select(aggregation...)
case n != 0 && len(aggregation) > 0:
@@ -976,7 +976,7 @@ func (gs *GroupSelect) sqlScan(ctx context.Context, root *GroupQuery, v any) err
}
rows := &sql.Rows{}
query, args := selector.Query()
- if err := gs.driver.Query(ctx, query, args, rows); err != nil {
+ if err := _s.driver.Query(ctx, query, args, rows); err != nil {
return err
}
defer rows.Close()
diff --git a/backend/internal/data/ent/group_update.go b/backend/internal/data/ent/group_update.go
index 920ca853..c0acecfe 100644
--- a/backend/internal/data/ent/group_update.go
+++ b/backend/internal/data/ent/group_update.go
@@ -30,275 +30,275 @@ type GroupUpdate struct {
}
// Where appends a list predicates to the GroupUpdate builder.
-func (gu *GroupUpdate) Where(ps ...predicate.Group) *GroupUpdate {
- gu.mutation.Where(ps...)
- return gu
+func (_u *GroupUpdate) Where(ps ...predicate.Group) *GroupUpdate {
+ _u.mutation.Where(ps...)
+ return _u
}
// SetUpdatedAt sets the "updated_at" field.
-func (gu *GroupUpdate) SetUpdatedAt(t time.Time) *GroupUpdate {
- gu.mutation.SetUpdatedAt(t)
- return gu
+func (_u *GroupUpdate) SetUpdatedAt(v time.Time) *GroupUpdate {
+ _u.mutation.SetUpdatedAt(v)
+ return _u
}
// SetName sets the "name" field.
-func (gu *GroupUpdate) SetName(s string) *GroupUpdate {
- gu.mutation.SetName(s)
- return gu
+func (_u *GroupUpdate) SetName(v string) *GroupUpdate {
+ _u.mutation.SetName(v)
+ return _u
}
// SetNillableName sets the "name" field if the given value is not nil.
-func (gu *GroupUpdate) SetNillableName(s *string) *GroupUpdate {
- if s != nil {
- gu.SetName(*s)
+func (_u *GroupUpdate) SetNillableName(v *string) *GroupUpdate {
+ if v != nil {
+ _u.SetName(*v)
}
- return gu
+ return _u
}
// SetCurrency sets the "currency" field.
-func (gu *GroupUpdate) SetCurrency(s string) *GroupUpdate {
- gu.mutation.SetCurrency(s)
- return gu
+func (_u *GroupUpdate) SetCurrency(v string) *GroupUpdate {
+ _u.mutation.SetCurrency(v)
+ return _u
}
// SetNillableCurrency sets the "currency" field if the given value is not nil.
-func (gu *GroupUpdate) SetNillableCurrency(s *string) *GroupUpdate {
- if s != nil {
- gu.SetCurrency(*s)
+func (_u *GroupUpdate) SetNillableCurrency(v *string) *GroupUpdate {
+ if v != nil {
+ _u.SetCurrency(*v)
}
- return gu
+ return _u
}
// AddUserIDs adds the "users" edge to the User entity by IDs.
-func (gu *GroupUpdate) AddUserIDs(ids ...uuid.UUID) *GroupUpdate {
- gu.mutation.AddUserIDs(ids...)
- return gu
+func (_u *GroupUpdate) AddUserIDs(ids ...uuid.UUID) *GroupUpdate {
+ _u.mutation.AddUserIDs(ids...)
+ return _u
}
// AddUsers adds the "users" edges to the User entity.
-func (gu *GroupUpdate) AddUsers(u ...*User) *GroupUpdate {
- ids := make([]uuid.UUID, len(u))
- for i := range u {
- ids[i] = u[i].ID
+func (_u *GroupUpdate) AddUsers(v ...*User) *GroupUpdate {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return gu.AddUserIDs(ids...)
+ return _u.AddUserIDs(ids...)
}
// AddLocationIDs adds the "locations" edge to the Location entity by IDs.
-func (gu *GroupUpdate) AddLocationIDs(ids ...uuid.UUID) *GroupUpdate {
- gu.mutation.AddLocationIDs(ids...)
- return gu
+func (_u *GroupUpdate) AddLocationIDs(ids ...uuid.UUID) *GroupUpdate {
+ _u.mutation.AddLocationIDs(ids...)
+ return _u
}
// AddLocations adds the "locations" edges to the Location entity.
-func (gu *GroupUpdate) AddLocations(l ...*Location) *GroupUpdate {
- ids := make([]uuid.UUID, len(l))
- for i := range l {
- ids[i] = l[i].ID
+func (_u *GroupUpdate) AddLocations(v ...*Location) *GroupUpdate {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return gu.AddLocationIDs(ids...)
+ return _u.AddLocationIDs(ids...)
}
// AddItemIDs adds the "items" edge to the Item entity by IDs.
-func (gu *GroupUpdate) AddItemIDs(ids ...uuid.UUID) *GroupUpdate {
- gu.mutation.AddItemIDs(ids...)
- return gu
+func (_u *GroupUpdate) AddItemIDs(ids ...uuid.UUID) *GroupUpdate {
+ _u.mutation.AddItemIDs(ids...)
+ return _u
}
// AddItems adds the "items" edges to the Item entity.
-func (gu *GroupUpdate) AddItems(i ...*Item) *GroupUpdate {
- ids := make([]uuid.UUID, len(i))
- for j := range i {
- ids[j] = i[j].ID
+func (_u *GroupUpdate) AddItems(v ...*Item) *GroupUpdate {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return gu.AddItemIDs(ids...)
+ return _u.AddItemIDs(ids...)
}
// AddLabelIDs adds the "labels" edge to the Label entity by IDs.
-func (gu *GroupUpdate) AddLabelIDs(ids ...uuid.UUID) *GroupUpdate {
- gu.mutation.AddLabelIDs(ids...)
- return gu
+func (_u *GroupUpdate) AddLabelIDs(ids ...uuid.UUID) *GroupUpdate {
+ _u.mutation.AddLabelIDs(ids...)
+ return _u
}
// AddLabels adds the "labels" edges to the Label entity.
-func (gu *GroupUpdate) AddLabels(l ...*Label) *GroupUpdate {
- ids := make([]uuid.UUID, len(l))
- for i := range l {
- ids[i] = l[i].ID
+func (_u *GroupUpdate) AddLabels(v ...*Label) *GroupUpdate {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return gu.AddLabelIDs(ids...)
+ return _u.AddLabelIDs(ids...)
}
// AddInvitationTokenIDs adds the "invitation_tokens" edge to the GroupInvitationToken entity by IDs.
-func (gu *GroupUpdate) AddInvitationTokenIDs(ids ...uuid.UUID) *GroupUpdate {
- gu.mutation.AddInvitationTokenIDs(ids...)
- return gu
+func (_u *GroupUpdate) AddInvitationTokenIDs(ids ...uuid.UUID) *GroupUpdate {
+ _u.mutation.AddInvitationTokenIDs(ids...)
+ return _u
}
// AddInvitationTokens adds the "invitation_tokens" edges to the GroupInvitationToken entity.
-func (gu *GroupUpdate) AddInvitationTokens(g ...*GroupInvitationToken) *GroupUpdate {
- ids := make([]uuid.UUID, len(g))
- for i := range g {
- ids[i] = g[i].ID
+func (_u *GroupUpdate) AddInvitationTokens(v ...*GroupInvitationToken) *GroupUpdate {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return gu.AddInvitationTokenIDs(ids...)
+ return _u.AddInvitationTokenIDs(ids...)
}
// AddNotifierIDs adds the "notifiers" edge to the Notifier entity by IDs.
-func (gu *GroupUpdate) AddNotifierIDs(ids ...uuid.UUID) *GroupUpdate {
- gu.mutation.AddNotifierIDs(ids...)
- return gu
+func (_u *GroupUpdate) AddNotifierIDs(ids ...uuid.UUID) *GroupUpdate {
+ _u.mutation.AddNotifierIDs(ids...)
+ return _u
}
// AddNotifiers adds the "notifiers" edges to the Notifier entity.
-func (gu *GroupUpdate) AddNotifiers(n ...*Notifier) *GroupUpdate {
- ids := make([]uuid.UUID, len(n))
- for i := range n {
- ids[i] = n[i].ID
+func (_u *GroupUpdate) AddNotifiers(v ...*Notifier) *GroupUpdate {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return gu.AddNotifierIDs(ids...)
+ return _u.AddNotifierIDs(ids...)
}
// Mutation returns the GroupMutation object of the builder.
-func (gu *GroupUpdate) Mutation() *GroupMutation {
- return gu.mutation
+func (_u *GroupUpdate) Mutation() *GroupMutation {
+ return _u.mutation
}
// ClearUsers clears all "users" edges to the User entity.
-func (gu *GroupUpdate) ClearUsers() *GroupUpdate {
- gu.mutation.ClearUsers()
- return gu
+func (_u *GroupUpdate) ClearUsers() *GroupUpdate {
+ _u.mutation.ClearUsers()
+ return _u
}
// RemoveUserIDs removes the "users" edge to User entities by IDs.
-func (gu *GroupUpdate) RemoveUserIDs(ids ...uuid.UUID) *GroupUpdate {
- gu.mutation.RemoveUserIDs(ids...)
- return gu
+func (_u *GroupUpdate) RemoveUserIDs(ids ...uuid.UUID) *GroupUpdate {
+ _u.mutation.RemoveUserIDs(ids...)
+ return _u
}
// RemoveUsers removes "users" edges to User entities.
-func (gu *GroupUpdate) RemoveUsers(u ...*User) *GroupUpdate {
- ids := make([]uuid.UUID, len(u))
- for i := range u {
- ids[i] = u[i].ID
+func (_u *GroupUpdate) RemoveUsers(v ...*User) *GroupUpdate {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return gu.RemoveUserIDs(ids...)
+ return _u.RemoveUserIDs(ids...)
}
// ClearLocations clears all "locations" edges to the Location entity.
-func (gu *GroupUpdate) ClearLocations() *GroupUpdate {
- gu.mutation.ClearLocations()
- return gu
+func (_u *GroupUpdate) ClearLocations() *GroupUpdate {
+ _u.mutation.ClearLocations()
+ return _u
}
// RemoveLocationIDs removes the "locations" edge to Location entities by IDs.
-func (gu *GroupUpdate) RemoveLocationIDs(ids ...uuid.UUID) *GroupUpdate {
- gu.mutation.RemoveLocationIDs(ids...)
- return gu
+func (_u *GroupUpdate) RemoveLocationIDs(ids ...uuid.UUID) *GroupUpdate {
+ _u.mutation.RemoveLocationIDs(ids...)
+ return _u
}
// RemoveLocations removes "locations" edges to Location entities.
-func (gu *GroupUpdate) RemoveLocations(l ...*Location) *GroupUpdate {
- ids := make([]uuid.UUID, len(l))
- for i := range l {
- ids[i] = l[i].ID
+func (_u *GroupUpdate) RemoveLocations(v ...*Location) *GroupUpdate {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return gu.RemoveLocationIDs(ids...)
+ return _u.RemoveLocationIDs(ids...)
}
// ClearItems clears all "items" edges to the Item entity.
-func (gu *GroupUpdate) ClearItems() *GroupUpdate {
- gu.mutation.ClearItems()
- return gu
+func (_u *GroupUpdate) ClearItems() *GroupUpdate {
+ _u.mutation.ClearItems()
+ return _u
}
// RemoveItemIDs removes the "items" edge to Item entities by IDs.
-func (gu *GroupUpdate) RemoveItemIDs(ids ...uuid.UUID) *GroupUpdate {
- gu.mutation.RemoveItemIDs(ids...)
- return gu
+func (_u *GroupUpdate) RemoveItemIDs(ids ...uuid.UUID) *GroupUpdate {
+ _u.mutation.RemoveItemIDs(ids...)
+ return _u
}
// RemoveItems removes "items" edges to Item entities.
-func (gu *GroupUpdate) RemoveItems(i ...*Item) *GroupUpdate {
- ids := make([]uuid.UUID, len(i))
- for j := range i {
- ids[j] = i[j].ID
+func (_u *GroupUpdate) RemoveItems(v ...*Item) *GroupUpdate {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return gu.RemoveItemIDs(ids...)
+ return _u.RemoveItemIDs(ids...)
}
// ClearLabels clears all "labels" edges to the Label entity.
-func (gu *GroupUpdate) ClearLabels() *GroupUpdate {
- gu.mutation.ClearLabels()
- return gu
+func (_u *GroupUpdate) ClearLabels() *GroupUpdate {
+ _u.mutation.ClearLabels()
+ return _u
}
// RemoveLabelIDs removes the "labels" edge to Label entities by IDs.
-func (gu *GroupUpdate) RemoveLabelIDs(ids ...uuid.UUID) *GroupUpdate {
- gu.mutation.RemoveLabelIDs(ids...)
- return gu
+func (_u *GroupUpdate) RemoveLabelIDs(ids ...uuid.UUID) *GroupUpdate {
+ _u.mutation.RemoveLabelIDs(ids...)
+ return _u
}
// RemoveLabels removes "labels" edges to Label entities.
-func (gu *GroupUpdate) RemoveLabels(l ...*Label) *GroupUpdate {
- ids := make([]uuid.UUID, len(l))
- for i := range l {
- ids[i] = l[i].ID
+func (_u *GroupUpdate) RemoveLabels(v ...*Label) *GroupUpdate {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return gu.RemoveLabelIDs(ids...)
+ return _u.RemoveLabelIDs(ids...)
}
// ClearInvitationTokens clears all "invitation_tokens" edges to the GroupInvitationToken entity.
-func (gu *GroupUpdate) ClearInvitationTokens() *GroupUpdate {
- gu.mutation.ClearInvitationTokens()
- return gu
+func (_u *GroupUpdate) ClearInvitationTokens() *GroupUpdate {
+ _u.mutation.ClearInvitationTokens()
+ return _u
}
// RemoveInvitationTokenIDs removes the "invitation_tokens" edge to GroupInvitationToken entities by IDs.
-func (gu *GroupUpdate) RemoveInvitationTokenIDs(ids ...uuid.UUID) *GroupUpdate {
- gu.mutation.RemoveInvitationTokenIDs(ids...)
- return gu
+func (_u *GroupUpdate) RemoveInvitationTokenIDs(ids ...uuid.UUID) *GroupUpdate {
+ _u.mutation.RemoveInvitationTokenIDs(ids...)
+ return _u
}
// RemoveInvitationTokens removes "invitation_tokens" edges to GroupInvitationToken entities.
-func (gu *GroupUpdate) RemoveInvitationTokens(g ...*GroupInvitationToken) *GroupUpdate {
- ids := make([]uuid.UUID, len(g))
- for i := range g {
- ids[i] = g[i].ID
+func (_u *GroupUpdate) RemoveInvitationTokens(v ...*GroupInvitationToken) *GroupUpdate {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return gu.RemoveInvitationTokenIDs(ids...)
+ return _u.RemoveInvitationTokenIDs(ids...)
}
// ClearNotifiers clears all "notifiers" edges to the Notifier entity.
-func (gu *GroupUpdate) ClearNotifiers() *GroupUpdate {
- gu.mutation.ClearNotifiers()
- return gu
+func (_u *GroupUpdate) ClearNotifiers() *GroupUpdate {
+ _u.mutation.ClearNotifiers()
+ return _u
}
// RemoveNotifierIDs removes the "notifiers" edge to Notifier entities by IDs.
-func (gu *GroupUpdate) RemoveNotifierIDs(ids ...uuid.UUID) *GroupUpdate {
- gu.mutation.RemoveNotifierIDs(ids...)
- return gu
+func (_u *GroupUpdate) RemoveNotifierIDs(ids ...uuid.UUID) *GroupUpdate {
+ _u.mutation.RemoveNotifierIDs(ids...)
+ return _u
}
// RemoveNotifiers removes "notifiers" edges to Notifier entities.
-func (gu *GroupUpdate) RemoveNotifiers(n ...*Notifier) *GroupUpdate {
- ids := make([]uuid.UUID, len(n))
- for i := range n {
- ids[i] = n[i].ID
+func (_u *GroupUpdate) RemoveNotifiers(v ...*Notifier) *GroupUpdate {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return gu.RemoveNotifierIDs(ids...)
+ return _u.RemoveNotifierIDs(ids...)
}
// Save executes the query and returns the number of nodes affected by the update operation.
-func (gu *GroupUpdate) Save(ctx context.Context) (int, error) {
- gu.defaults()
- return withHooks(ctx, gu.sqlSave, gu.mutation, gu.hooks)
+func (_u *GroupUpdate) Save(ctx context.Context) (int, error) {
+ _u.defaults()
+ return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
}
// SaveX is like Save, but panics if an error occurs.
-func (gu *GroupUpdate) SaveX(ctx context.Context) int {
- affected, err := gu.Save(ctx)
+func (_u *GroupUpdate) SaveX(ctx context.Context) int {
+ affected, err := _u.Save(ctx)
if err != nil {
panic(err)
}
@@ -306,29 +306,29 @@ func (gu *GroupUpdate) SaveX(ctx context.Context) int {
}
// Exec executes the query.
-func (gu *GroupUpdate) Exec(ctx context.Context) error {
- _, err := gu.Save(ctx)
+func (_u *GroupUpdate) Exec(ctx context.Context) error {
+ _, err := _u.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
-func (gu *GroupUpdate) ExecX(ctx context.Context) {
- if err := gu.Exec(ctx); err != nil {
+func (_u *GroupUpdate) ExecX(ctx context.Context) {
+ if err := _u.Exec(ctx); err != nil {
panic(err)
}
}
// defaults sets the default values of the builder before save.
-func (gu *GroupUpdate) defaults() {
- if _, ok := gu.mutation.UpdatedAt(); !ok {
+func (_u *GroupUpdate) defaults() {
+ if _, ok := _u.mutation.UpdatedAt(); !ok {
v := group.UpdateDefaultUpdatedAt()
- gu.mutation.SetUpdatedAt(v)
+ _u.mutation.SetUpdatedAt(v)
}
}
// check runs all checks and user-defined validators on the builder.
-func (gu *GroupUpdate) check() error {
- if v, ok := gu.mutation.Name(); ok {
+func (_u *GroupUpdate) check() error {
+ if v, ok := _u.mutation.Name(); ok {
if err := group.NameValidator(v); err != nil {
return &ValidationError{Name: "name", err: fmt.Errorf(`ent: validator failed for field "Group.name": %w`, err)}
}
@@ -336,28 +336,28 @@ func (gu *GroupUpdate) check() error {
return nil
}
-func (gu *GroupUpdate) sqlSave(ctx context.Context) (n int, err error) {
- if err := gu.check(); err != nil {
- return n, err
+func (_u *GroupUpdate) sqlSave(ctx context.Context) (_node int, err error) {
+ if err := _u.check(); err != nil {
+ return _node, err
}
_spec := sqlgraph.NewUpdateSpec(group.Table, group.Columns, sqlgraph.NewFieldSpec(group.FieldID, field.TypeUUID))
- if ps := gu.mutation.predicates; len(ps) > 0 {
+ if ps := _u.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
- if value, ok := gu.mutation.UpdatedAt(); ok {
+ if value, ok := _u.mutation.UpdatedAt(); ok {
_spec.SetField(group.FieldUpdatedAt, field.TypeTime, value)
}
- if value, ok := gu.mutation.Name(); ok {
+ if value, ok := _u.mutation.Name(); ok {
_spec.SetField(group.FieldName, field.TypeString, value)
}
- if value, ok := gu.mutation.Currency(); ok {
+ if value, ok := _u.mutation.Currency(); ok {
_spec.SetField(group.FieldCurrency, field.TypeString, value)
}
- if gu.mutation.UsersCleared() {
+ if _u.mutation.UsersCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -370,7 +370,7 @@ func (gu *GroupUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := gu.mutation.RemovedUsersIDs(); len(nodes) > 0 && !gu.mutation.UsersCleared() {
+ if nodes := _u.mutation.RemovedUsersIDs(); len(nodes) > 0 && !_u.mutation.UsersCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -386,7 +386,7 @@ func (gu *GroupUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := gu.mutation.UsersIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.UsersIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -402,7 +402,7 @@ func (gu *GroupUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- if gu.mutation.LocationsCleared() {
+ if _u.mutation.LocationsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -415,7 +415,7 @@ func (gu *GroupUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := gu.mutation.RemovedLocationsIDs(); len(nodes) > 0 && !gu.mutation.LocationsCleared() {
+ if nodes := _u.mutation.RemovedLocationsIDs(); len(nodes) > 0 && !_u.mutation.LocationsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -431,7 +431,7 @@ func (gu *GroupUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := gu.mutation.LocationsIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.LocationsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -447,7 +447,7 @@ func (gu *GroupUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- if gu.mutation.ItemsCleared() {
+ if _u.mutation.ItemsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -460,7 +460,7 @@ func (gu *GroupUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := gu.mutation.RemovedItemsIDs(); len(nodes) > 0 && !gu.mutation.ItemsCleared() {
+ if nodes := _u.mutation.RemovedItemsIDs(); len(nodes) > 0 && !_u.mutation.ItemsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -476,7 +476,7 @@ func (gu *GroupUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := gu.mutation.ItemsIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.ItemsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -492,7 +492,7 @@ func (gu *GroupUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- if gu.mutation.LabelsCleared() {
+ if _u.mutation.LabelsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -505,7 +505,7 @@ func (gu *GroupUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := gu.mutation.RemovedLabelsIDs(); len(nodes) > 0 && !gu.mutation.LabelsCleared() {
+ if nodes := _u.mutation.RemovedLabelsIDs(); len(nodes) > 0 && !_u.mutation.LabelsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -521,7 +521,7 @@ func (gu *GroupUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := gu.mutation.LabelsIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.LabelsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -537,7 +537,7 @@ func (gu *GroupUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- if gu.mutation.InvitationTokensCleared() {
+ if _u.mutation.InvitationTokensCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -550,7 +550,7 @@ func (gu *GroupUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := gu.mutation.RemovedInvitationTokensIDs(); len(nodes) > 0 && !gu.mutation.InvitationTokensCleared() {
+ if nodes := _u.mutation.RemovedInvitationTokensIDs(); len(nodes) > 0 && !_u.mutation.InvitationTokensCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -566,7 +566,7 @@ func (gu *GroupUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := gu.mutation.InvitationTokensIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.InvitationTokensIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -582,7 +582,7 @@ func (gu *GroupUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- if gu.mutation.NotifiersCleared() {
+ if _u.mutation.NotifiersCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -595,7 +595,7 @@ func (gu *GroupUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := gu.mutation.RemovedNotifiersIDs(); len(nodes) > 0 && !gu.mutation.NotifiersCleared() {
+ if nodes := _u.mutation.RemovedNotifiersIDs(); len(nodes) > 0 && !_u.mutation.NotifiersCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -611,7 +611,7 @@ func (gu *GroupUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := gu.mutation.NotifiersIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.NotifiersIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -627,7 +627,7 @@ func (gu *GroupUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- if n, err = sqlgraph.UpdateNodes(ctx, gu.driver, _spec); err != nil {
+ if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil {
if _, ok := err.(*sqlgraph.NotFoundError); ok {
err = &NotFoundError{group.Label}
} else if sqlgraph.IsConstraintError(err) {
@@ -635,8 +635,8 @@ func (gu *GroupUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
return 0, err
}
- gu.mutation.done = true
- return n, nil
+ _u.mutation.done = true
+ return _node, nil
}
// GroupUpdateOne is the builder for updating a single Group entity.
@@ -648,282 +648,282 @@ type GroupUpdateOne struct {
}
// SetUpdatedAt sets the "updated_at" field.
-func (guo *GroupUpdateOne) SetUpdatedAt(t time.Time) *GroupUpdateOne {
- guo.mutation.SetUpdatedAt(t)
- return guo
+func (_u *GroupUpdateOne) SetUpdatedAt(v time.Time) *GroupUpdateOne {
+ _u.mutation.SetUpdatedAt(v)
+ return _u
}
// SetName sets the "name" field.
-func (guo *GroupUpdateOne) SetName(s string) *GroupUpdateOne {
- guo.mutation.SetName(s)
- return guo
+func (_u *GroupUpdateOne) SetName(v string) *GroupUpdateOne {
+ _u.mutation.SetName(v)
+ return _u
}
// SetNillableName sets the "name" field if the given value is not nil.
-func (guo *GroupUpdateOne) SetNillableName(s *string) *GroupUpdateOne {
- if s != nil {
- guo.SetName(*s)
+func (_u *GroupUpdateOne) SetNillableName(v *string) *GroupUpdateOne {
+ if v != nil {
+ _u.SetName(*v)
}
- return guo
+ return _u
}
// SetCurrency sets the "currency" field.
-func (guo *GroupUpdateOne) SetCurrency(s string) *GroupUpdateOne {
- guo.mutation.SetCurrency(s)
- return guo
+func (_u *GroupUpdateOne) SetCurrency(v string) *GroupUpdateOne {
+ _u.mutation.SetCurrency(v)
+ return _u
}
// SetNillableCurrency sets the "currency" field if the given value is not nil.
-func (guo *GroupUpdateOne) SetNillableCurrency(s *string) *GroupUpdateOne {
- if s != nil {
- guo.SetCurrency(*s)
+func (_u *GroupUpdateOne) SetNillableCurrency(v *string) *GroupUpdateOne {
+ if v != nil {
+ _u.SetCurrency(*v)
}
- return guo
+ return _u
}
// AddUserIDs adds the "users" edge to the User entity by IDs.
-func (guo *GroupUpdateOne) AddUserIDs(ids ...uuid.UUID) *GroupUpdateOne {
- guo.mutation.AddUserIDs(ids...)
- return guo
+func (_u *GroupUpdateOne) AddUserIDs(ids ...uuid.UUID) *GroupUpdateOne {
+ _u.mutation.AddUserIDs(ids...)
+ return _u
}
// AddUsers adds the "users" edges to the User entity.
-func (guo *GroupUpdateOne) AddUsers(u ...*User) *GroupUpdateOne {
- ids := make([]uuid.UUID, len(u))
- for i := range u {
- ids[i] = u[i].ID
+func (_u *GroupUpdateOne) AddUsers(v ...*User) *GroupUpdateOne {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return guo.AddUserIDs(ids...)
+ return _u.AddUserIDs(ids...)
}
// AddLocationIDs adds the "locations" edge to the Location entity by IDs.
-func (guo *GroupUpdateOne) AddLocationIDs(ids ...uuid.UUID) *GroupUpdateOne {
- guo.mutation.AddLocationIDs(ids...)
- return guo
+func (_u *GroupUpdateOne) AddLocationIDs(ids ...uuid.UUID) *GroupUpdateOne {
+ _u.mutation.AddLocationIDs(ids...)
+ return _u
}
// AddLocations adds the "locations" edges to the Location entity.
-func (guo *GroupUpdateOne) AddLocations(l ...*Location) *GroupUpdateOne {
- ids := make([]uuid.UUID, len(l))
- for i := range l {
- ids[i] = l[i].ID
+func (_u *GroupUpdateOne) AddLocations(v ...*Location) *GroupUpdateOne {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return guo.AddLocationIDs(ids...)
+ return _u.AddLocationIDs(ids...)
}
// AddItemIDs adds the "items" edge to the Item entity by IDs.
-func (guo *GroupUpdateOne) AddItemIDs(ids ...uuid.UUID) *GroupUpdateOne {
- guo.mutation.AddItemIDs(ids...)
- return guo
+func (_u *GroupUpdateOne) AddItemIDs(ids ...uuid.UUID) *GroupUpdateOne {
+ _u.mutation.AddItemIDs(ids...)
+ return _u
}
// AddItems adds the "items" edges to the Item entity.
-func (guo *GroupUpdateOne) AddItems(i ...*Item) *GroupUpdateOne {
- ids := make([]uuid.UUID, len(i))
- for j := range i {
- ids[j] = i[j].ID
+func (_u *GroupUpdateOne) AddItems(v ...*Item) *GroupUpdateOne {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return guo.AddItemIDs(ids...)
+ return _u.AddItemIDs(ids...)
}
// AddLabelIDs adds the "labels" edge to the Label entity by IDs.
-func (guo *GroupUpdateOne) AddLabelIDs(ids ...uuid.UUID) *GroupUpdateOne {
- guo.mutation.AddLabelIDs(ids...)
- return guo
+func (_u *GroupUpdateOne) AddLabelIDs(ids ...uuid.UUID) *GroupUpdateOne {
+ _u.mutation.AddLabelIDs(ids...)
+ return _u
}
// AddLabels adds the "labels" edges to the Label entity.
-func (guo *GroupUpdateOne) AddLabels(l ...*Label) *GroupUpdateOne {
- ids := make([]uuid.UUID, len(l))
- for i := range l {
- ids[i] = l[i].ID
+func (_u *GroupUpdateOne) AddLabels(v ...*Label) *GroupUpdateOne {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return guo.AddLabelIDs(ids...)
+ return _u.AddLabelIDs(ids...)
}
// AddInvitationTokenIDs adds the "invitation_tokens" edge to the GroupInvitationToken entity by IDs.
-func (guo *GroupUpdateOne) AddInvitationTokenIDs(ids ...uuid.UUID) *GroupUpdateOne {
- guo.mutation.AddInvitationTokenIDs(ids...)
- return guo
+func (_u *GroupUpdateOne) AddInvitationTokenIDs(ids ...uuid.UUID) *GroupUpdateOne {
+ _u.mutation.AddInvitationTokenIDs(ids...)
+ return _u
}
// AddInvitationTokens adds the "invitation_tokens" edges to the GroupInvitationToken entity.
-func (guo *GroupUpdateOne) AddInvitationTokens(g ...*GroupInvitationToken) *GroupUpdateOne {
- ids := make([]uuid.UUID, len(g))
- for i := range g {
- ids[i] = g[i].ID
+func (_u *GroupUpdateOne) AddInvitationTokens(v ...*GroupInvitationToken) *GroupUpdateOne {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return guo.AddInvitationTokenIDs(ids...)
+ return _u.AddInvitationTokenIDs(ids...)
}
// AddNotifierIDs adds the "notifiers" edge to the Notifier entity by IDs.
-func (guo *GroupUpdateOne) AddNotifierIDs(ids ...uuid.UUID) *GroupUpdateOne {
- guo.mutation.AddNotifierIDs(ids...)
- return guo
+func (_u *GroupUpdateOne) AddNotifierIDs(ids ...uuid.UUID) *GroupUpdateOne {
+ _u.mutation.AddNotifierIDs(ids...)
+ return _u
}
// AddNotifiers adds the "notifiers" edges to the Notifier entity.
-func (guo *GroupUpdateOne) AddNotifiers(n ...*Notifier) *GroupUpdateOne {
- ids := make([]uuid.UUID, len(n))
- for i := range n {
- ids[i] = n[i].ID
+func (_u *GroupUpdateOne) AddNotifiers(v ...*Notifier) *GroupUpdateOne {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return guo.AddNotifierIDs(ids...)
+ return _u.AddNotifierIDs(ids...)
}
// Mutation returns the GroupMutation object of the builder.
-func (guo *GroupUpdateOne) Mutation() *GroupMutation {
- return guo.mutation
+func (_u *GroupUpdateOne) Mutation() *GroupMutation {
+ return _u.mutation
}
// ClearUsers clears all "users" edges to the User entity.
-func (guo *GroupUpdateOne) ClearUsers() *GroupUpdateOne {
- guo.mutation.ClearUsers()
- return guo
+func (_u *GroupUpdateOne) ClearUsers() *GroupUpdateOne {
+ _u.mutation.ClearUsers()
+ return _u
}
// RemoveUserIDs removes the "users" edge to User entities by IDs.
-func (guo *GroupUpdateOne) RemoveUserIDs(ids ...uuid.UUID) *GroupUpdateOne {
- guo.mutation.RemoveUserIDs(ids...)
- return guo
+func (_u *GroupUpdateOne) RemoveUserIDs(ids ...uuid.UUID) *GroupUpdateOne {
+ _u.mutation.RemoveUserIDs(ids...)
+ return _u
}
// RemoveUsers removes "users" edges to User entities.
-func (guo *GroupUpdateOne) RemoveUsers(u ...*User) *GroupUpdateOne {
- ids := make([]uuid.UUID, len(u))
- for i := range u {
- ids[i] = u[i].ID
+func (_u *GroupUpdateOne) RemoveUsers(v ...*User) *GroupUpdateOne {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return guo.RemoveUserIDs(ids...)
+ return _u.RemoveUserIDs(ids...)
}
// ClearLocations clears all "locations" edges to the Location entity.
-func (guo *GroupUpdateOne) ClearLocations() *GroupUpdateOne {
- guo.mutation.ClearLocations()
- return guo
+func (_u *GroupUpdateOne) ClearLocations() *GroupUpdateOne {
+ _u.mutation.ClearLocations()
+ return _u
}
// RemoveLocationIDs removes the "locations" edge to Location entities by IDs.
-func (guo *GroupUpdateOne) RemoveLocationIDs(ids ...uuid.UUID) *GroupUpdateOne {
- guo.mutation.RemoveLocationIDs(ids...)
- return guo
+func (_u *GroupUpdateOne) RemoveLocationIDs(ids ...uuid.UUID) *GroupUpdateOne {
+ _u.mutation.RemoveLocationIDs(ids...)
+ return _u
}
// RemoveLocations removes "locations" edges to Location entities.
-func (guo *GroupUpdateOne) RemoveLocations(l ...*Location) *GroupUpdateOne {
- ids := make([]uuid.UUID, len(l))
- for i := range l {
- ids[i] = l[i].ID
+func (_u *GroupUpdateOne) RemoveLocations(v ...*Location) *GroupUpdateOne {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return guo.RemoveLocationIDs(ids...)
+ return _u.RemoveLocationIDs(ids...)
}
// ClearItems clears all "items" edges to the Item entity.
-func (guo *GroupUpdateOne) ClearItems() *GroupUpdateOne {
- guo.mutation.ClearItems()
- return guo
+func (_u *GroupUpdateOne) ClearItems() *GroupUpdateOne {
+ _u.mutation.ClearItems()
+ return _u
}
// RemoveItemIDs removes the "items" edge to Item entities by IDs.
-func (guo *GroupUpdateOne) RemoveItemIDs(ids ...uuid.UUID) *GroupUpdateOne {
- guo.mutation.RemoveItemIDs(ids...)
- return guo
+func (_u *GroupUpdateOne) RemoveItemIDs(ids ...uuid.UUID) *GroupUpdateOne {
+ _u.mutation.RemoveItemIDs(ids...)
+ return _u
}
// RemoveItems removes "items" edges to Item entities.
-func (guo *GroupUpdateOne) RemoveItems(i ...*Item) *GroupUpdateOne {
- ids := make([]uuid.UUID, len(i))
- for j := range i {
- ids[j] = i[j].ID
+func (_u *GroupUpdateOne) RemoveItems(v ...*Item) *GroupUpdateOne {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return guo.RemoveItemIDs(ids...)
+ return _u.RemoveItemIDs(ids...)
}
// ClearLabels clears all "labels" edges to the Label entity.
-func (guo *GroupUpdateOne) ClearLabels() *GroupUpdateOne {
- guo.mutation.ClearLabels()
- return guo
+func (_u *GroupUpdateOne) ClearLabels() *GroupUpdateOne {
+ _u.mutation.ClearLabels()
+ return _u
}
// RemoveLabelIDs removes the "labels" edge to Label entities by IDs.
-func (guo *GroupUpdateOne) RemoveLabelIDs(ids ...uuid.UUID) *GroupUpdateOne {
- guo.mutation.RemoveLabelIDs(ids...)
- return guo
+func (_u *GroupUpdateOne) RemoveLabelIDs(ids ...uuid.UUID) *GroupUpdateOne {
+ _u.mutation.RemoveLabelIDs(ids...)
+ return _u
}
// RemoveLabels removes "labels" edges to Label entities.
-func (guo *GroupUpdateOne) RemoveLabels(l ...*Label) *GroupUpdateOne {
- ids := make([]uuid.UUID, len(l))
- for i := range l {
- ids[i] = l[i].ID
+func (_u *GroupUpdateOne) RemoveLabels(v ...*Label) *GroupUpdateOne {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return guo.RemoveLabelIDs(ids...)
+ return _u.RemoveLabelIDs(ids...)
}
// ClearInvitationTokens clears all "invitation_tokens" edges to the GroupInvitationToken entity.
-func (guo *GroupUpdateOne) ClearInvitationTokens() *GroupUpdateOne {
- guo.mutation.ClearInvitationTokens()
- return guo
+func (_u *GroupUpdateOne) ClearInvitationTokens() *GroupUpdateOne {
+ _u.mutation.ClearInvitationTokens()
+ return _u
}
// RemoveInvitationTokenIDs removes the "invitation_tokens" edge to GroupInvitationToken entities by IDs.
-func (guo *GroupUpdateOne) RemoveInvitationTokenIDs(ids ...uuid.UUID) *GroupUpdateOne {
- guo.mutation.RemoveInvitationTokenIDs(ids...)
- return guo
+func (_u *GroupUpdateOne) RemoveInvitationTokenIDs(ids ...uuid.UUID) *GroupUpdateOne {
+ _u.mutation.RemoveInvitationTokenIDs(ids...)
+ return _u
}
// RemoveInvitationTokens removes "invitation_tokens" edges to GroupInvitationToken entities.
-func (guo *GroupUpdateOne) RemoveInvitationTokens(g ...*GroupInvitationToken) *GroupUpdateOne {
- ids := make([]uuid.UUID, len(g))
- for i := range g {
- ids[i] = g[i].ID
+func (_u *GroupUpdateOne) RemoveInvitationTokens(v ...*GroupInvitationToken) *GroupUpdateOne {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return guo.RemoveInvitationTokenIDs(ids...)
+ return _u.RemoveInvitationTokenIDs(ids...)
}
// ClearNotifiers clears all "notifiers" edges to the Notifier entity.
-func (guo *GroupUpdateOne) ClearNotifiers() *GroupUpdateOne {
- guo.mutation.ClearNotifiers()
- return guo
+func (_u *GroupUpdateOne) ClearNotifiers() *GroupUpdateOne {
+ _u.mutation.ClearNotifiers()
+ return _u
}
// RemoveNotifierIDs removes the "notifiers" edge to Notifier entities by IDs.
-func (guo *GroupUpdateOne) RemoveNotifierIDs(ids ...uuid.UUID) *GroupUpdateOne {
- guo.mutation.RemoveNotifierIDs(ids...)
- return guo
+func (_u *GroupUpdateOne) RemoveNotifierIDs(ids ...uuid.UUID) *GroupUpdateOne {
+ _u.mutation.RemoveNotifierIDs(ids...)
+ return _u
}
// RemoveNotifiers removes "notifiers" edges to Notifier entities.
-func (guo *GroupUpdateOne) RemoveNotifiers(n ...*Notifier) *GroupUpdateOne {
- ids := make([]uuid.UUID, len(n))
- for i := range n {
- ids[i] = n[i].ID
+func (_u *GroupUpdateOne) RemoveNotifiers(v ...*Notifier) *GroupUpdateOne {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return guo.RemoveNotifierIDs(ids...)
+ return _u.RemoveNotifierIDs(ids...)
}
// Where appends a list predicates to the GroupUpdate builder.
-func (guo *GroupUpdateOne) Where(ps ...predicate.Group) *GroupUpdateOne {
- guo.mutation.Where(ps...)
- return guo
+func (_u *GroupUpdateOne) Where(ps ...predicate.Group) *GroupUpdateOne {
+ _u.mutation.Where(ps...)
+ return _u
}
// Select allows selecting one or more fields (columns) of the returned entity.
// The default is selecting all fields defined in the entity schema.
-func (guo *GroupUpdateOne) Select(field string, fields ...string) *GroupUpdateOne {
- guo.fields = append([]string{field}, fields...)
- return guo
+func (_u *GroupUpdateOne) Select(field string, fields ...string) *GroupUpdateOne {
+ _u.fields = append([]string{field}, fields...)
+ return _u
}
// Save executes the query and returns the updated Group entity.
-func (guo *GroupUpdateOne) Save(ctx context.Context) (*Group, error) {
- guo.defaults()
- return withHooks(ctx, guo.sqlSave, guo.mutation, guo.hooks)
+func (_u *GroupUpdateOne) Save(ctx context.Context) (*Group, error) {
+ _u.defaults()
+ return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
}
// SaveX is like Save, but panics if an error occurs.
-func (guo *GroupUpdateOne) SaveX(ctx context.Context) *Group {
- node, err := guo.Save(ctx)
+func (_u *GroupUpdateOne) SaveX(ctx context.Context) *Group {
+ node, err := _u.Save(ctx)
if err != nil {
panic(err)
}
@@ -931,29 +931,29 @@ func (guo *GroupUpdateOne) SaveX(ctx context.Context) *Group {
}
// Exec executes the query on the entity.
-func (guo *GroupUpdateOne) Exec(ctx context.Context) error {
- _, err := guo.Save(ctx)
+func (_u *GroupUpdateOne) Exec(ctx context.Context) error {
+ _, err := _u.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
-func (guo *GroupUpdateOne) ExecX(ctx context.Context) {
- if err := guo.Exec(ctx); err != nil {
+func (_u *GroupUpdateOne) ExecX(ctx context.Context) {
+ if err := _u.Exec(ctx); err != nil {
panic(err)
}
}
// defaults sets the default values of the builder before save.
-func (guo *GroupUpdateOne) defaults() {
- if _, ok := guo.mutation.UpdatedAt(); !ok {
+func (_u *GroupUpdateOne) defaults() {
+ if _, ok := _u.mutation.UpdatedAt(); !ok {
v := group.UpdateDefaultUpdatedAt()
- guo.mutation.SetUpdatedAt(v)
+ _u.mutation.SetUpdatedAt(v)
}
}
// check runs all checks and user-defined validators on the builder.
-func (guo *GroupUpdateOne) check() error {
- if v, ok := guo.mutation.Name(); ok {
+func (_u *GroupUpdateOne) check() error {
+ if v, ok := _u.mutation.Name(); ok {
if err := group.NameValidator(v); err != nil {
return &ValidationError{Name: "name", err: fmt.Errorf(`ent: validator failed for field "Group.name": %w`, err)}
}
@@ -961,17 +961,17 @@ func (guo *GroupUpdateOne) check() error {
return nil
}
-func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error) {
- if err := guo.check(); err != nil {
+func (_u *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error) {
+ if err := _u.check(); err != nil {
return _node, err
}
_spec := sqlgraph.NewUpdateSpec(group.Table, group.Columns, sqlgraph.NewFieldSpec(group.FieldID, field.TypeUUID))
- id, ok := guo.mutation.ID()
+ id, ok := _u.mutation.ID()
if !ok {
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Group.id" for update`)}
}
_spec.Node.ID.Value = id
- if fields := guo.fields; len(fields) > 0 {
+ if fields := _u.fields; len(fields) > 0 {
_spec.Node.Columns = make([]string, 0, len(fields))
_spec.Node.Columns = append(_spec.Node.Columns, group.FieldID)
for _, f := range fields {
@@ -983,23 +983,23 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error
}
}
}
- if ps := guo.mutation.predicates; len(ps) > 0 {
+ if ps := _u.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
- if value, ok := guo.mutation.UpdatedAt(); ok {
+ if value, ok := _u.mutation.UpdatedAt(); ok {
_spec.SetField(group.FieldUpdatedAt, field.TypeTime, value)
}
- if value, ok := guo.mutation.Name(); ok {
+ if value, ok := _u.mutation.Name(); ok {
_spec.SetField(group.FieldName, field.TypeString, value)
}
- if value, ok := guo.mutation.Currency(); ok {
+ if value, ok := _u.mutation.Currency(); ok {
_spec.SetField(group.FieldCurrency, field.TypeString, value)
}
- if guo.mutation.UsersCleared() {
+ if _u.mutation.UsersCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -1012,7 +1012,7 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := guo.mutation.RemovedUsersIDs(); len(nodes) > 0 && !guo.mutation.UsersCleared() {
+ if nodes := _u.mutation.RemovedUsersIDs(); len(nodes) > 0 && !_u.mutation.UsersCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -1028,7 +1028,7 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := guo.mutation.UsersIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.UsersIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -1044,7 +1044,7 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- if guo.mutation.LocationsCleared() {
+ if _u.mutation.LocationsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -1057,7 +1057,7 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := guo.mutation.RemovedLocationsIDs(); len(nodes) > 0 && !guo.mutation.LocationsCleared() {
+ if nodes := _u.mutation.RemovedLocationsIDs(); len(nodes) > 0 && !_u.mutation.LocationsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -1073,7 +1073,7 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := guo.mutation.LocationsIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.LocationsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -1089,7 +1089,7 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- if guo.mutation.ItemsCleared() {
+ if _u.mutation.ItemsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -1102,7 +1102,7 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := guo.mutation.RemovedItemsIDs(); len(nodes) > 0 && !guo.mutation.ItemsCleared() {
+ if nodes := _u.mutation.RemovedItemsIDs(); len(nodes) > 0 && !_u.mutation.ItemsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -1118,7 +1118,7 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := guo.mutation.ItemsIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.ItemsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -1134,7 +1134,7 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- if guo.mutation.LabelsCleared() {
+ if _u.mutation.LabelsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -1147,7 +1147,7 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := guo.mutation.RemovedLabelsIDs(); len(nodes) > 0 && !guo.mutation.LabelsCleared() {
+ if nodes := _u.mutation.RemovedLabelsIDs(); len(nodes) > 0 && !_u.mutation.LabelsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -1163,7 +1163,7 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := guo.mutation.LabelsIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.LabelsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -1179,7 +1179,7 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- if guo.mutation.InvitationTokensCleared() {
+ if _u.mutation.InvitationTokensCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -1192,7 +1192,7 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := guo.mutation.RemovedInvitationTokensIDs(); len(nodes) > 0 && !guo.mutation.InvitationTokensCleared() {
+ if nodes := _u.mutation.RemovedInvitationTokensIDs(); len(nodes) > 0 && !_u.mutation.InvitationTokensCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -1208,7 +1208,7 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := guo.mutation.InvitationTokensIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.InvitationTokensIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -1224,7 +1224,7 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- if guo.mutation.NotifiersCleared() {
+ if _u.mutation.NotifiersCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -1237,7 +1237,7 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := guo.mutation.RemovedNotifiersIDs(); len(nodes) > 0 && !guo.mutation.NotifiersCleared() {
+ if nodes := _u.mutation.RemovedNotifiersIDs(); len(nodes) > 0 && !_u.mutation.NotifiersCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -1253,7 +1253,7 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := guo.mutation.NotifiersIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.NotifiersIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -1269,10 +1269,10 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- _node = &Group{config: guo.config}
+ _node = &Group{config: _u.config}
_spec.Assign = _node.assignValues
_spec.ScanValues = _node.scanValues
- if err = sqlgraph.UpdateNode(ctx, guo.driver, _spec); err != nil {
+ if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil {
if _, ok := err.(*sqlgraph.NotFoundError); ok {
err = &NotFoundError{group.Label}
} else if sqlgraph.IsConstraintError(err) {
@@ -1280,6 +1280,6 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error
}
return nil, err
}
- guo.mutation.done = true
+ _u.mutation.done = true
return _node, nil
}
diff --git a/backend/internal/data/ent/groupinvitationtoken.go b/backend/internal/data/ent/groupinvitationtoken.go
index 4e5d3d5c..700420f6 100644
--- a/backend/internal/data/ent/groupinvitationtoken.go
+++ b/backend/internal/data/ent/groupinvitationtoken.go
@@ -80,7 +80,7 @@ func (*GroupInvitationToken) scanValues(columns []string) ([]any, error) {
// assignValues assigns the values that were returned from sql.Rows (after scanning)
// to the GroupInvitationToken fields.
-func (git *GroupInvitationToken) assignValues(columns []string, values []any) error {
+func (_m *GroupInvitationToken) assignValues(columns []string, values []any) error {
if m, n := len(values), len(columns); m < n {
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
}
@@ -90,47 +90,47 @@ func (git *GroupInvitationToken) assignValues(columns []string, values []any) er
if value, ok := values[i].(*uuid.UUID); !ok {
return fmt.Errorf("unexpected type %T for field id", values[i])
} else if value != nil {
- git.ID = *value
+ _m.ID = *value
}
case groupinvitationtoken.FieldCreatedAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field created_at", values[i])
} else if value.Valid {
- git.CreatedAt = value.Time
+ _m.CreatedAt = value.Time
}
case groupinvitationtoken.FieldUpdatedAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field updated_at", values[i])
} else if value.Valid {
- git.UpdatedAt = value.Time
+ _m.UpdatedAt = value.Time
}
case groupinvitationtoken.FieldToken:
if value, ok := values[i].(*[]byte); !ok {
return fmt.Errorf("unexpected type %T for field token", values[i])
} else if value != nil {
- git.Token = *value
+ _m.Token = *value
}
case groupinvitationtoken.FieldExpiresAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field expires_at", values[i])
} else if value.Valid {
- git.ExpiresAt = value.Time
+ _m.ExpiresAt = value.Time
}
case groupinvitationtoken.FieldUses:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field uses", values[i])
} else if value.Valid {
- git.Uses = int(value.Int64)
+ _m.Uses = int(value.Int64)
}
case groupinvitationtoken.ForeignKeys[0]:
if value, ok := values[i].(*sql.NullScanner); !ok {
return fmt.Errorf("unexpected type %T for field group_invitation_tokens", values[i])
} else if value.Valid {
- git.group_invitation_tokens = new(uuid.UUID)
- *git.group_invitation_tokens = *value.S.(*uuid.UUID)
+ _m.group_invitation_tokens = new(uuid.UUID)
+ *_m.group_invitation_tokens = *value.S.(*uuid.UUID)
}
default:
- git.selectValues.Set(columns[i], values[i])
+ _m.selectValues.Set(columns[i], values[i])
}
}
return nil
@@ -138,52 +138,52 @@ func (git *GroupInvitationToken) assignValues(columns []string, values []any) er
// Value returns the ent.Value that was dynamically selected and assigned to the GroupInvitationToken.
// This includes values selected through modifiers, order, etc.
-func (git *GroupInvitationToken) Value(name string) (ent.Value, error) {
- return git.selectValues.Get(name)
+func (_m *GroupInvitationToken) Value(name string) (ent.Value, error) {
+ return _m.selectValues.Get(name)
}
// QueryGroup queries the "group" edge of the GroupInvitationToken entity.
-func (git *GroupInvitationToken) QueryGroup() *GroupQuery {
- return NewGroupInvitationTokenClient(git.config).QueryGroup(git)
+func (_m *GroupInvitationToken) QueryGroup() *GroupQuery {
+ return NewGroupInvitationTokenClient(_m.config).QueryGroup(_m)
}
// Update returns a builder for updating this GroupInvitationToken.
// Note that you need to call GroupInvitationToken.Unwrap() before calling this method if this GroupInvitationToken
// was returned from a transaction, and the transaction was committed or rolled back.
-func (git *GroupInvitationToken) Update() *GroupInvitationTokenUpdateOne {
- return NewGroupInvitationTokenClient(git.config).UpdateOne(git)
+func (_m *GroupInvitationToken) Update() *GroupInvitationTokenUpdateOne {
+ return NewGroupInvitationTokenClient(_m.config).UpdateOne(_m)
}
// Unwrap unwraps the GroupInvitationToken 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 (git *GroupInvitationToken) Unwrap() *GroupInvitationToken {
- _tx, ok := git.config.driver.(*txDriver)
+func (_m *GroupInvitationToken) Unwrap() *GroupInvitationToken {
+ _tx, ok := _m.config.driver.(*txDriver)
if !ok {
panic("ent: GroupInvitationToken is not a transactional entity")
}
- git.config.driver = _tx.drv
- return git
+ _m.config.driver = _tx.drv
+ return _m
}
// String implements the fmt.Stringer.
-func (git *GroupInvitationToken) String() string {
+func (_m *GroupInvitationToken) String() string {
var builder strings.Builder
builder.WriteString("GroupInvitationToken(")
- builder.WriteString(fmt.Sprintf("id=%v, ", git.ID))
+ builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
builder.WriteString("created_at=")
- builder.WriteString(git.CreatedAt.Format(time.ANSIC))
+ builder.WriteString(_m.CreatedAt.Format(time.ANSIC))
builder.WriteString(", ")
builder.WriteString("updated_at=")
- builder.WriteString(git.UpdatedAt.Format(time.ANSIC))
+ builder.WriteString(_m.UpdatedAt.Format(time.ANSIC))
builder.WriteString(", ")
builder.WriteString("token=")
- builder.WriteString(fmt.Sprintf("%v", git.Token))
+ builder.WriteString(fmt.Sprintf("%v", _m.Token))
builder.WriteString(", ")
builder.WriteString("expires_at=")
- builder.WriteString(git.ExpiresAt.Format(time.ANSIC))
+ builder.WriteString(_m.ExpiresAt.Format(time.ANSIC))
builder.WriteString(", ")
builder.WriteString("uses=")
- builder.WriteString(fmt.Sprintf("%v", git.Uses))
+ builder.WriteString(fmt.Sprintf("%v", _m.Uses))
builder.WriteByte(')')
return builder.String()
}
diff --git a/backend/internal/data/ent/groupinvitationtoken_create.go b/backend/internal/data/ent/groupinvitationtoken_create.go
index 8fa97cab..b274234d 100644
--- a/backend/internal/data/ent/groupinvitationtoken_create.go
+++ b/backend/internal/data/ent/groupinvitationtoken_create.go
@@ -23,114 +23,114 @@ type GroupInvitationTokenCreate struct {
}
// SetCreatedAt sets the "created_at" field.
-func (gitc *GroupInvitationTokenCreate) SetCreatedAt(t time.Time) *GroupInvitationTokenCreate {
- gitc.mutation.SetCreatedAt(t)
- return gitc
+func (_c *GroupInvitationTokenCreate) SetCreatedAt(v time.Time) *GroupInvitationTokenCreate {
+ _c.mutation.SetCreatedAt(v)
+ return _c
}
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
-func (gitc *GroupInvitationTokenCreate) SetNillableCreatedAt(t *time.Time) *GroupInvitationTokenCreate {
- if t != nil {
- gitc.SetCreatedAt(*t)
+func (_c *GroupInvitationTokenCreate) SetNillableCreatedAt(v *time.Time) *GroupInvitationTokenCreate {
+ if v != nil {
+ _c.SetCreatedAt(*v)
}
- return gitc
+ return _c
}
// SetUpdatedAt sets the "updated_at" field.
-func (gitc *GroupInvitationTokenCreate) SetUpdatedAt(t time.Time) *GroupInvitationTokenCreate {
- gitc.mutation.SetUpdatedAt(t)
- return gitc
+func (_c *GroupInvitationTokenCreate) SetUpdatedAt(v time.Time) *GroupInvitationTokenCreate {
+ _c.mutation.SetUpdatedAt(v)
+ return _c
}
// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
-func (gitc *GroupInvitationTokenCreate) SetNillableUpdatedAt(t *time.Time) *GroupInvitationTokenCreate {
- if t != nil {
- gitc.SetUpdatedAt(*t)
+func (_c *GroupInvitationTokenCreate) SetNillableUpdatedAt(v *time.Time) *GroupInvitationTokenCreate {
+ if v != nil {
+ _c.SetUpdatedAt(*v)
}
- return gitc
+ return _c
}
// SetToken sets the "token" field.
-func (gitc *GroupInvitationTokenCreate) SetToken(b []byte) *GroupInvitationTokenCreate {
- gitc.mutation.SetToken(b)
- return gitc
+func (_c *GroupInvitationTokenCreate) SetToken(v []byte) *GroupInvitationTokenCreate {
+ _c.mutation.SetToken(v)
+ return _c
}
// SetExpiresAt sets the "expires_at" field.
-func (gitc *GroupInvitationTokenCreate) SetExpiresAt(t time.Time) *GroupInvitationTokenCreate {
- gitc.mutation.SetExpiresAt(t)
- return gitc
+func (_c *GroupInvitationTokenCreate) SetExpiresAt(v time.Time) *GroupInvitationTokenCreate {
+ _c.mutation.SetExpiresAt(v)
+ return _c
}
// SetNillableExpiresAt sets the "expires_at" field if the given value is not nil.
-func (gitc *GroupInvitationTokenCreate) SetNillableExpiresAt(t *time.Time) *GroupInvitationTokenCreate {
- if t != nil {
- gitc.SetExpiresAt(*t)
+func (_c *GroupInvitationTokenCreate) SetNillableExpiresAt(v *time.Time) *GroupInvitationTokenCreate {
+ if v != nil {
+ _c.SetExpiresAt(*v)
}
- return gitc
+ return _c
}
// SetUses sets the "uses" field.
-func (gitc *GroupInvitationTokenCreate) SetUses(i int) *GroupInvitationTokenCreate {
- gitc.mutation.SetUses(i)
- return gitc
+func (_c *GroupInvitationTokenCreate) SetUses(v int) *GroupInvitationTokenCreate {
+ _c.mutation.SetUses(v)
+ return _c
}
// SetNillableUses sets the "uses" field if the given value is not nil.
-func (gitc *GroupInvitationTokenCreate) SetNillableUses(i *int) *GroupInvitationTokenCreate {
- if i != nil {
- gitc.SetUses(*i)
+func (_c *GroupInvitationTokenCreate) SetNillableUses(v *int) *GroupInvitationTokenCreate {
+ if v != nil {
+ _c.SetUses(*v)
}
- return gitc
+ return _c
}
// SetID sets the "id" field.
-func (gitc *GroupInvitationTokenCreate) SetID(u uuid.UUID) *GroupInvitationTokenCreate {
- gitc.mutation.SetID(u)
- return gitc
+func (_c *GroupInvitationTokenCreate) SetID(v uuid.UUID) *GroupInvitationTokenCreate {
+ _c.mutation.SetID(v)
+ return _c
}
// SetNillableID sets the "id" field if the given value is not nil.
-func (gitc *GroupInvitationTokenCreate) SetNillableID(u *uuid.UUID) *GroupInvitationTokenCreate {
- if u != nil {
- gitc.SetID(*u)
+func (_c *GroupInvitationTokenCreate) SetNillableID(v *uuid.UUID) *GroupInvitationTokenCreate {
+ if v != nil {
+ _c.SetID(*v)
}
- return gitc
+ return _c
}
// SetGroupID sets the "group" edge to the Group entity by ID.
-func (gitc *GroupInvitationTokenCreate) SetGroupID(id uuid.UUID) *GroupInvitationTokenCreate {
- gitc.mutation.SetGroupID(id)
- return gitc
+func (_c *GroupInvitationTokenCreate) SetGroupID(id uuid.UUID) *GroupInvitationTokenCreate {
+ _c.mutation.SetGroupID(id)
+ return _c
}
// SetNillableGroupID sets the "group" edge to the Group entity by ID if the given value is not nil.
-func (gitc *GroupInvitationTokenCreate) SetNillableGroupID(id *uuid.UUID) *GroupInvitationTokenCreate {
+func (_c *GroupInvitationTokenCreate) SetNillableGroupID(id *uuid.UUID) *GroupInvitationTokenCreate {
if id != nil {
- gitc = gitc.SetGroupID(*id)
+ _c = _c.SetGroupID(*id)
}
- return gitc
+ return _c
}
// SetGroup sets the "group" edge to the Group entity.
-func (gitc *GroupInvitationTokenCreate) SetGroup(g *Group) *GroupInvitationTokenCreate {
- return gitc.SetGroupID(g.ID)
+func (_c *GroupInvitationTokenCreate) SetGroup(v *Group) *GroupInvitationTokenCreate {
+ return _c.SetGroupID(v.ID)
}
// Mutation returns the GroupInvitationTokenMutation object of the builder.
-func (gitc *GroupInvitationTokenCreate) Mutation() *GroupInvitationTokenMutation {
- return gitc.mutation
+func (_c *GroupInvitationTokenCreate) Mutation() *GroupInvitationTokenMutation {
+ return _c.mutation
}
// Save creates the GroupInvitationToken in the database.
-func (gitc *GroupInvitationTokenCreate) Save(ctx context.Context) (*GroupInvitationToken, error) {
- gitc.defaults()
- return withHooks(ctx, gitc.sqlSave, gitc.mutation, gitc.hooks)
+func (_c *GroupInvitationTokenCreate) Save(ctx context.Context) (*GroupInvitationToken, error) {
+ _c.defaults()
+ return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
}
// SaveX calls Save and panics if Save returns an error.
-func (gitc *GroupInvitationTokenCreate) SaveX(ctx context.Context) *GroupInvitationToken {
- v, err := gitc.Save(ctx)
+func (_c *GroupInvitationTokenCreate) SaveX(ctx context.Context) *GroupInvitationToken {
+ v, err := _c.Save(ctx)
if err != nil {
panic(err)
}
@@ -138,68 +138,68 @@ func (gitc *GroupInvitationTokenCreate) SaveX(ctx context.Context) *GroupInvitat
}
// Exec executes the query.
-func (gitc *GroupInvitationTokenCreate) Exec(ctx context.Context) error {
- _, err := gitc.Save(ctx)
+func (_c *GroupInvitationTokenCreate) Exec(ctx context.Context) error {
+ _, err := _c.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
-func (gitc *GroupInvitationTokenCreate) ExecX(ctx context.Context) {
- if err := gitc.Exec(ctx); err != nil {
+func (_c *GroupInvitationTokenCreate) ExecX(ctx context.Context) {
+ if err := _c.Exec(ctx); err != nil {
panic(err)
}
}
// defaults sets the default values of the builder before save.
-func (gitc *GroupInvitationTokenCreate) defaults() {
- if _, ok := gitc.mutation.CreatedAt(); !ok {
+func (_c *GroupInvitationTokenCreate) defaults() {
+ if _, ok := _c.mutation.CreatedAt(); !ok {
v := groupinvitationtoken.DefaultCreatedAt()
- gitc.mutation.SetCreatedAt(v)
+ _c.mutation.SetCreatedAt(v)
}
- if _, ok := gitc.mutation.UpdatedAt(); !ok {
+ if _, ok := _c.mutation.UpdatedAt(); !ok {
v := groupinvitationtoken.DefaultUpdatedAt()
- gitc.mutation.SetUpdatedAt(v)
+ _c.mutation.SetUpdatedAt(v)
}
- if _, ok := gitc.mutation.ExpiresAt(); !ok {
+ if _, ok := _c.mutation.ExpiresAt(); !ok {
v := groupinvitationtoken.DefaultExpiresAt()
- gitc.mutation.SetExpiresAt(v)
+ _c.mutation.SetExpiresAt(v)
}
- if _, ok := gitc.mutation.Uses(); !ok {
+ if _, ok := _c.mutation.Uses(); !ok {
v := groupinvitationtoken.DefaultUses
- gitc.mutation.SetUses(v)
+ _c.mutation.SetUses(v)
}
- if _, ok := gitc.mutation.ID(); !ok {
+ if _, ok := _c.mutation.ID(); !ok {
v := groupinvitationtoken.DefaultID()
- gitc.mutation.SetID(v)
+ _c.mutation.SetID(v)
}
}
// check runs all checks and user-defined validators on the builder.
-func (gitc *GroupInvitationTokenCreate) check() error {
- if _, ok := gitc.mutation.CreatedAt(); !ok {
+func (_c *GroupInvitationTokenCreate) check() error {
+ if _, ok := _c.mutation.CreatedAt(); !ok {
return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "GroupInvitationToken.created_at"`)}
}
- if _, ok := gitc.mutation.UpdatedAt(); !ok {
+ if _, ok := _c.mutation.UpdatedAt(); !ok {
return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "GroupInvitationToken.updated_at"`)}
}
- if _, ok := gitc.mutation.Token(); !ok {
+ if _, ok := _c.mutation.Token(); !ok {
return &ValidationError{Name: "token", err: errors.New(`ent: missing required field "GroupInvitationToken.token"`)}
}
- if _, ok := gitc.mutation.ExpiresAt(); !ok {
+ if _, ok := _c.mutation.ExpiresAt(); !ok {
return &ValidationError{Name: "expires_at", err: errors.New(`ent: missing required field "GroupInvitationToken.expires_at"`)}
}
- if _, ok := gitc.mutation.Uses(); !ok {
+ if _, ok := _c.mutation.Uses(); !ok {
return &ValidationError{Name: "uses", err: errors.New(`ent: missing required field "GroupInvitationToken.uses"`)}
}
return nil
}
-func (gitc *GroupInvitationTokenCreate) sqlSave(ctx context.Context) (*GroupInvitationToken, error) {
- if err := gitc.check(); err != nil {
+func (_c *GroupInvitationTokenCreate) sqlSave(ctx context.Context) (*GroupInvitationToken, error) {
+ if err := _c.check(); err != nil {
return nil, err
}
- _node, _spec := gitc.createSpec()
- if err := sqlgraph.CreateNode(ctx, gitc.driver, _spec); err != nil {
+ _node, _spec := _c.createSpec()
+ if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil {
if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
@@ -212,41 +212,41 @@ func (gitc *GroupInvitationTokenCreate) sqlSave(ctx context.Context) (*GroupInvi
return nil, err
}
}
- gitc.mutation.id = &_node.ID
- gitc.mutation.done = true
+ _c.mutation.id = &_node.ID
+ _c.mutation.done = true
return _node, nil
}
-func (gitc *GroupInvitationTokenCreate) createSpec() (*GroupInvitationToken, *sqlgraph.CreateSpec) {
+func (_c *GroupInvitationTokenCreate) createSpec() (*GroupInvitationToken, *sqlgraph.CreateSpec) {
var (
- _node = &GroupInvitationToken{config: gitc.config}
+ _node = &GroupInvitationToken{config: _c.config}
_spec = sqlgraph.NewCreateSpec(groupinvitationtoken.Table, sqlgraph.NewFieldSpec(groupinvitationtoken.FieldID, field.TypeUUID))
)
- if id, ok := gitc.mutation.ID(); ok {
+ if id, ok := _c.mutation.ID(); ok {
_node.ID = id
_spec.ID.Value = &id
}
- if value, ok := gitc.mutation.CreatedAt(); ok {
+ if value, ok := _c.mutation.CreatedAt(); ok {
_spec.SetField(groupinvitationtoken.FieldCreatedAt, field.TypeTime, value)
_node.CreatedAt = value
}
- if value, ok := gitc.mutation.UpdatedAt(); ok {
+ if value, ok := _c.mutation.UpdatedAt(); ok {
_spec.SetField(groupinvitationtoken.FieldUpdatedAt, field.TypeTime, value)
_node.UpdatedAt = value
}
- if value, ok := gitc.mutation.Token(); ok {
+ if value, ok := _c.mutation.Token(); ok {
_spec.SetField(groupinvitationtoken.FieldToken, field.TypeBytes, value)
_node.Token = value
}
- if value, ok := gitc.mutation.ExpiresAt(); ok {
+ if value, ok := _c.mutation.ExpiresAt(); ok {
_spec.SetField(groupinvitationtoken.FieldExpiresAt, field.TypeTime, value)
_node.ExpiresAt = value
}
- if value, ok := gitc.mutation.Uses(); ok {
+ if value, ok := _c.mutation.Uses(); ok {
_spec.SetField(groupinvitationtoken.FieldUses, field.TypeInt, value)
_node.Uses = value
}
- if nodes := gitc.mutation.GroupIDs(); len(nodes) > 0 {
+ if nodes := _c.mutation.GroupIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -274,16 +274,16 @@ type GroupInvitationTokenCreateBulk struct {
}
// Save creates the GroupInvitationToken entities in the database.
-func (gitcb *GroupInvitationTokenCreateBulk) Save(ctx context.Context) ([]*GroupInvitationToken, error) {
- if gitcb.err != nil {
- return nil, gitcb.err
- }
- specs := make([]*sqlgraph.CreateSpec, len(gitcb.builders))
- nodes := make([]*GroupInvitationToken, len(gitcb.builders))
- mutators := make([]Mutator, len(gitcb.builders))
- for i := range gitcb.builders {
+func (_c *GroupInvitationTokenCreateBulk) Save(ctx context.Context) ([]*GroupInvitationToken, error) {
+ if _c.err != nil {
+ return nil, _c.err
+ }
+ specs := make([]*sqlgraph.CreateSpec, len(_c.builders))
+ nodes := make([]*GroupInvitationToken, len(_c.builders))
+ mutators := make([]Mutator, len(_c.builders))
+ for i := range _c.builders {
func(i int, root context.Context) {
- builder := gitcb.builders[i]
+ builder := _c.builders[i]
builder.defaults()
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
mutation, ok := m.(*GroupInvitationTokenMutation)
@@ -297,11 +297,11 @@ func (gitcb *GroupInvitationTokenCreateBulk) Save(ctx context.Context) ([]*Group
var err error
nodes[i], specs[i] = builder.createSpec()
if i < len(mutators)-1 {
- _, err = mutators[i+1].Mutate(root, gitcb.builders[i+1].mutation)
+ _, err = mutators[i+1].Mutate(root, _c.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, gitcb.driver, spec); err != nil {
+ if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil {
if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
@@ -321,7 +321,7 @@ func (gitcb *GroupInvitationTokenCreateBulk) Save(ctx context.Context) ([]*Group
}(i, ctx)
}
if len(mutators) > 0 {
- if _, err := mutators[0].Mutate(ctx, gitcb.builders[0].mutation); err != nil {
+ if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil {
return nil, err
}
}
@@ -329,8 +329,8 @@ func (gitcb *GroupInvitationTokenCreateBulk) Save(ctx context.Context) ([]*Group
}
// SaveX is like Save, but panics if an error occurs.
-func (gitcb *GroupInvitationTokenCreateBulk) SaveX(ctx context.Context) []*GroupInvitationToken {
- v, err := gitcb.Save(ctx)
+func (_c *GroupInvitationTokenCreateBulk) SaveX(ctx context.Context) []*GroupInvitationToken {
+ v, err := _c.Save(ctx)
if err != nil {
panic(err)
}
@@ -338,14 +338,14 @@ func (gitcb *GroupInvitationTokenCreateBulk) SaveX(ctx context.Context) []*Group
}
// Exec executes the query.
-func (gitcb *GroupInvitationTokenCreateBulk) Exec(ctx context.Context) error {
- _, err := gitcb.Save(ctx)
+func (_c *GroupInvitationTokenCreateBulk) Exec(ctx context.Context) error {
+ _, err := _c.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
-func (gitcb *GroupInvitationTokenCreateBulk) ExecX(ctx context.Context) {
- if err := gitcb.Exec(ctx); err != nil {
+func (_c *GroupInvitationTokenCreateBulk) ExecX(ctx context.Context) {
+ if err := _c.Exec(ctx); err != nil {
panic(err)
}
}
diff --git a/backend/internal/data/ent/groupinvitationtoken_delete.go b/backend/internal/data/ent/groupinvitationtoken_delete.go
index e49acf50..3a548b47 100644
--- a/backend/internal/data/ent/groupinvitationtoken_delete.go
+++ b/backend/internal/data/ent/groupinvitationtoken_delete.go
@@ -20,56 +20,56 @@ type GroupInvitationTokenDelete struct {
}
// Where appends a list predicates to the GroupInvitationTokenDelete builder.
-func (gitd *GroupInvitationTokenDelete) Where(ps ...predicate.GroupInvitationToken) *GroupInvitationTokenDelete {
- gitd.mutation.Where(ps...)
- return gitd
+func (_d *GroupInvitationTokenDelete) Where(ps ...predicate.GroupInvitationToken) *GroupInvitationTokenDelete {
+ _d.mutation.Where(ps...)
+ return _d
}
// Exec executes the deletion query and returns how many vertices were deleted.
-func (gitd *GroupInvitationTokenDelete) Exec(ctx context.Context) (int, error) {
- return withHooks(ctx, gitd.sqlExec, gitd.mutation, gitd.hooks)
+func (_d *GroupInvitationTokenDelete) Exec(ctx context.Context) (int, error) {
+ return withHooks(ctx, _d.sqlExec, _d.mutation, _d.hooks)
}
// ExecX is like Exec, but panics if an error occurs.
-func (gitd *GroupInvitationTokenDelete) ExecX(ctx context.Context) int {
- n, err := gitd.Exec(ctx)
+func (_d *GroupInvitationTokenDelete) ExecX(ctx context.Context) int {
+ n, err := _d.Exec(ctx)
if err != nil {
panic(err)
}
return n
}
-func (gitd *GroupInvitationTokenDelete) sqlExec(ctx context.Context) (int, error) {
+func (_d *GroupInvitationTokenDelete) sqlExec(ctx context.Context) (int, error) {
_spec := sqlgraph.NewDeleteSpec(groupinvitationtoken.Table, sqlgraph.NewFieldSpec(groupinvitationtoken.FieldID, field.TypeUUID))
- if ps := gitd.mutation.predicates; len(ps) > 0 {
+ if ps := _d.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
- affected, err := sqlgraph.DeleteNodes(ctx, gitd.driver, _spec)
+ affected, err := sqlgraph.DeleteNodes(ctx, _d.driver, _spec)
if err != nil && sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
- gitd.mutation.done = true
+ _d.mutation.done = true
return affected, err
}
// GroupInvitationTokenDeleteOne is the builder for deleting a single GroupInvitationToken entity.
type GroupInvitationTokenDeleteOne struct {
- gitd *GroupInvitationTokenDelete
+ _d *GroupInvitationTokenDelete
}
// Where appends a list predicates to the GroupInvitationTokenDelete builder.
-func (gitdo *GroupInvitationTokenDeleteOne) Where(ps ...predicate.GroupInvitationToken) *GroupInvitationTokenDeleteOne {
- gitdo.gitd.mutation.Where(ps...)
- return gitdo
+func (_d *GroupInvitationTokenDeleteOne) Where(ps ...predicate.GroupInvitationToken) *GroupInvitationTokenDeleteOne {
+ _d._d.mutation.Where(ps...)
+ return _d
}
// Exec executes the deletion query.
-func (gitdo *GroupInvitationTokenDeleteOne) Exec(ctx context.Context) error {
- n, err := gitdo.gitd.Exec(ctx)
+func (_d *GroupInvitationTokenDeleteOne) Exec(ctx context.Context) error {
+ n, err := _d._d.Exec(ctx)
switch {
case err != nil:
return err
@@ -81,8 +81,8 @@ func (gitdo *GroupInvitationTokenDeleteOne) Exec(ctx context.Context) error {
}
// ExecX is like Exec, but panics if an error occurs.
-func (gitdo *GroupInvitationTokenDeleteOne) ExecX(ctx context.Context) {
- if err := gitdo.Exec(ctx); err != nil {
+func (_d *GroupInvitationTokenDeleteOne) ExecX(ctx context.Context) {
+ if err := _d.Exec(ctx); err != nil {
panic(err)
}
}
diff --git a/backend/internal/data/ent/groupinvitationtoken_query.go b/backend/internal/data/ent/groupinvitationtoken_query.go
index dfd78746..fd2bae8e 100644
--- a/backend/internal/data/ent/groupinvitationtoken_query.go
+++ b/backend/internal/data/ent/groupinvitationtoken_query.go
@@ -32,44 +32,44 @@ type GroupInvitationTokenQuery struct {
}
// Where adds a new predicate for the GroupInvitationTokenQuery builder.
-func (gitq *GroupInvitationTokenQuery) Where(ps ...predicate.GroupInvitationToken) *GroupInvitationTokenQuery {
- gitq.predicates = append(gitq.predicates, ps...)
- return gitq
+func (_q *GroupInvitationTokenQuery) Where(ps ...predicate.GroupInvitationToken) *GroupInvitationTokenQuery {
+ _q.predicates = append(_q.predicates, ps...)
+ return _q
}
// Limit the number of records to be returned by this query.
-func (gitq *GroupInvitationTokenQuery) Limit(limit int) *GroupInvitationTokenQuery {
- gitq.ctx.Limit = &limit
- return gitq
+func (_q *GroupInvitationTokenQuery) Limit(limit int) *GroupInvitationTokenQuery {
+ _q.ctx.Limit = &limit
+ return _q
}
// Offset to start from.
-func (gitq *GroupInvitationTokenQuery) Offset(offset int) *GroupInvitationTokenQuery {
- gitq.ctx.Offset = &offset
- return gitq
+func (_q *GroupInvitationTokenQuery) Offset(offset int) *GroupInvitationTokenQuery {
+ _q.ctx.Offset = &offset
+ return _q
}
// Unique configures the query builder to filter duplicate records on query.
// By default, unique is set to true, and can be disabled using this method.
-func (gitq *GroupInvitationTokenQuery) Unique(unique bool) *GroupInvitationTokenQuery {
- gitq.ctx.Unique = &unique
- return gitq
+func (_q *GroupInvitationTokenQuery) Unique(unique bool) *GroupInvitationTokenQuery {
+ _q.ctx.Unique = &unique
+ return _q
}
// Order specifies how the records should be ordered.
-func (gitq *GroupInvitationTokenQuery) Order(o ...groupinvitationtoken.OrderOption) *GroupInvitationTokenQuery {
- gitq.order = append(gitq.order, o...)
- return gitq
+func (_q *GroupInvitationTokenQuery) Order(o ...groupinvitationtoken.OrderOption) *GroupInvitationTokenQuery {
+ _q.order = append(_q.order, o...)
+ return _q
}
// QueryGroup chains the current query on the "group" edge.
-func (gitq *GroupInvitationTokenQuery) QueryGroup() *GroupQuery {
- query := (&GroupClient{config: gitq.config}).Query()
+func (_q *GroupInvitationTokenQuery) QueryGroup() *GroupQuery {
+ query := (&GroupClient{config: _q.config}).Query()
query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
- if err := gitq.prepareQuery(ctx); err != nil {
+ if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
- selector := gitq.sqlQuery(ctx)
+ selector := _q.sqlQuery(ctx)
if err := selector.Err(); err != nil {
return nil, err
}
@@ -78,7 +78,7 @@ func (gitq *GroupInvitationTokenQuery) QueryGroup() *GroupQuery {
sqlgraph.To(group.Table, group.FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, groupinvitationtoken.GroupTable, groupinvitationtoken.GroupColumn),
)
- fromU = sqlgraph.SetNeighbors(gitq.driver.Dialect(), step)
+ fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step)
return fromU, nil
}
return query
@@ -86,8 +86,8 @@ func (gitq *GroupInvitationTokenQuery) QueryGroup() *GroupQuery {
// First returns the first GroupInvitationToken entity from the query.
// Returns a *NotFoundError when no GroupInvitationToken was found.
-func (gitq *GroupInvitationTokenQuery) First(ctx context.Context) (*GroupInvitationToken, error) {
- nodes, err := gitq.Limit(1).All(setContextOp(ctx, gitq.ctx, ent.OpQueryFirst))
+func (_q *GroupInvitationTokenQuery) First(ctx context.Context) (*GroupInvitationToken, error) {
+ nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst))
if err != nil {
return nil, err
}
@@ -98,8 +98,8 @@ func (gitq *GroupInvitationTokenQuery) First(ctx context.Context) (*GroupInvitat
}
// FirstX is like First, but panics if an error occurs.
-func (gitq *GroupInvitationTokenQuery) FirstX(ctx context.Context) *GroupInvitationToken {
- node, err := gitq.First(ctx)
+func (_q *GroupInvitationTokenQuery) FirstX(ctx context.Context) *GroupInvitationToken {
+ node, err := _q.First(ctx)
if err != nil && !IsNotFound(err) {
panic(err)
}
@@ -108,9 +108,9 @@ func (gitq *GroupInvitationTokenQuery) FirstX(ctx context.Context) *GroupInvitat
// FirstID returns the first GroupInvitationToken ID from the query.
// Returns a *NotFoundError when no GroupInvitationToken ID was found.
-func (gitq *GroupInvitationTokenQuery) FirstID(ctx context.Context) (id uuid.UUID, err error) {
+func (_q *GroupInvitationTokenQuery) FirstID(ctx context.Context) (id uuid.UUID, err error) {
var ids []uuid.UUID
- if ids, err = gitq.Limit(1).IDs(setContextOp(ctx, gitq.ctx, ent.OpQueryFirstID)); err != nil {
+ if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil {
return
}
if len(ids) == 0 {
@@ -121,8 +121,8 @@ func (gitq *GroupInvitationTokenQuery) FirstID(ctx context.Context) (id uuid.UUI
}
// FirstIDX is like FirstID, but panics if an error occurs.
-func (gitq *GroupInvitationTokenQuery) FirstIDX(ctx context.Context) uuid.UUID {
- id, err := gitq.FirstID(ctx)
+func (_q *GroupInvitationTokenQuery) FirstIDX(ctx context.Context) uuid.UUID {
+ id, err := _q.FirstID(ctx)
if err != nil && !IsNotFound(err) {
panic(err)
}
@@ -132,8 +132,8 @@ func (gitq *GroupInvitationTokenQuery) FirstIDX(ctx context.Context) uuid.UUID {
// Only returns a single GroupInvitationToken entity found by the query, ensuring it only returns one.
// Returns a *NotSingularError when more than one GroupInvitationToken entity is found.
// Returns a *NotFoundError when no GroupInvitationToken entities are found.
-func (gitq *GroupInvitationTokenQuery) Only(ctx context.Context) (*GroupInvitationToken, error) {
- nodes, err := gitq.Limit(2).All(setContextOp(ctx, gitq.ctx, ent.OpQueryOnly))
+func (_q *GroupInvitationTokenQuery) Only(ctx context.Context) (*GroupInvitationToken, error) {
+ nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly))
if err != nil {
return nil, err
}
@@ -148,8 +148,8 @@ func (gitq *GroupInvitationTokenQuery) Only(ctx context.Context) (*GroupInvitati
}
// OnlyX is like Only, but panics if an error occurs.
-func (gitq *GroupInvitationTokenQuery) OnlyX(ctx context.Context) *GroupInvitationToken {
- node, err := gitq.Only(ctx)
+func (_q *GroupInvitationTokenQuery) OnlyX(ctx context.Context) *GroupInvitationToken {
+ node, err := _q.Only(ctx)
if err != nil {
panic(err)
}
@@ -159,9 +159,9 @@ func (gitq *GroupInvitationTokenQuery) OnlyX(ctx context.Context) *GroupInvitati
// OnlyID is like Only, but returns the only GroupInvitationToken ID in the query.
// Returns a *NotSingularError when more than one GroupInvitationToken ID is found.
// Returns a *NotFoundError when no entities are found.
-func (gitq *GroupInvitationTokenQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error) {
+func (_q *GroupInvitationTokenQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error) {
var ids []uuid.UUID
- if ids, err = gitq.Limit(2).IDs(setContextOp(ctx, gitq.ctx, ent.OpQueryOnlyID)); err != nil {
+ if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil {
return
}
switch len(ids) {
@@ -176,8 +176,8 @@ func (gitq *GroupInvitationTokenQuery) OnlyID(ctx context.Context) (id uuid.UUID
}
// OnlyIDX is like OnlyID, but panics if an error occurs.
-func (gitq *GroupInvitationTokenQuery) OnlyIDX(ctx context.Context) uuid.UUID {
- id, err := gitq.OnlyID(ctx)
+func (_q *GroupInvitationTokenQuery) OnlyIDX(ctx context.Context) uuid.UUID {
+ id, err := _q.OnlyID(ctx)
if err != nil {
panic(err)
}
@@ -185,18 +185,18 @@ func (gitq *GroupInvitationTokenQuery) OnlyIDX(ctx context.Context) uuid.UUID {
}
// All executes the query and returns a list of GroupInvitationTokens.
-func (gitq *GroupInvitationTokenQuery) All(ctx context.Context) ([]*GroupInvitationToken, error) {
- ctx = setContextOp(ctx, gitq.ctx, ent.OpQueryAll)
- if err := gitq.prepareQuery(ctx); err != nil {
+func (_q *GroupInvitationTokenQuery) All(ctx context.Context) ([]*GroupInvitationToken, error) {
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll)
+ if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
qr := querierAll[[]*GroupInvitationToken, *GroupInvitationTokenQuery]()
- return withInterceptors[[]*GroupInvitationToken](ctx, gitq, qr, gitq.inters)
+ return withInterceptors[[]*GroupInvitationToken](ctx, _q, qr, _q.inters)
}
// AllX is like All, but panics if an error occurs.
-func (gitq *GroupInvitationTokenQuery) AllX(ctx context.Context) []*GroupInvitationToken {
- nodes, err := gitq.All(ctx)
+func (_q *GroupInvitationTokenQuery) AllX(ctx context.Context) []*GroupInvitationToken {
+ nodes, err := _q.All(ctx)
if err != nil {
panic(err)
}
@@ -204,20 +204,20 @@ func (gitq *GroupInvitationTokenQuery) AllX(ctx context.Context) []*GroupInvitat
}
// IDs executes the query and returns a list of GroupInvitationToken IDs.
-func (gitq *GroupInvitationTokenQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error) {
- if gitq.ctx.Unique == nil && gitq.path != nil {
- gitq.Unique(true)
+func (_q *GroupInvitationTokenQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error) {
+ if _q.ctx.Unique == nil && _q.path != nil {
+ _q.Unique(true)
}
- ctx = setContextOp(ctx, gitq.ctx, ent.OpQueryIDs)
- if err = gitq.Select(groupinvitationtoken.FieldID).Scan(ctx, &ids); err != nil {
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs)
+ if err = _q.Select(groupinvitationtoken.FieldID).Scan(ctx, &ids); err != nil {
return nil, err
}
return ids, nil
}
// IDsX is like IDs, but panics if an error occurs.
-func (gitq *GroupInvitationTokenQuery) IDsX(ctx context.Context) []uuid.UUID {
- ids, err := gitq.IDs(ctx)
+func (_q *GroupInvitationTokenQuery) IDsX(ctx context.Context) []uuid.UUID {
+ ids, err := _q.IDs(ctx)
if err != nil {
panic(err)
}
@@ -225,17 +225,17 @@ func (gitq *GroupInvitationTokenQuery) IDsX(ctx context.Context) []uuid.UUID {
}
// Count returns the count of the given query.
-func (gitq *GroupInvitationTokenQuery) Count(ctx context.Context) (int, error) {
- ctx = setContextOp(ctx, gitq.ctx, ent.OpQueryCount)
- if err := gitq.prepareQuery(ctx); err != nil {
+func (_q *GroupInvitationTokenQuery) Count(ctx context.Context) (int, error) {
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryCount)
+ if err := _q.prepareQuery(ctx); err != nil {
return 0, err
}
- return withInterceptors[int](ctx, gitq, querierCount[*GroupInvitationTokenQuery](), gitq.inters)
+ return withInterceptors[int](ctx, _q, querierCount[*GroupInvitationTokenQuery](), _q.inters)
}
// CountX is like Count, but panics if an error occurs.
-func (gitq *GroupInvitationTokenQuery) CountX(ctx context.Context) int {
- count, err := gitq.Count(ctx)
+func (_q *GroupInvitationTokenQuery) CountX(ctx context.Context) int {
+ count, err := _q.Count(ctx)
if err != nil {
panic(err)
}
@@ -243,9 +243,9 @@ func (gitq *GroupInvitationTokenQuery) CountX(ctx context.Context) int {
}
// Exist returns true if the query has elements in the graph.
-func (gitq *GroupInvitationTokenQuery) Exist(ctx context.Context) (bool, error) {
- ctx = setContextOp(ctx, gitq.ctx, ent.OpQueryExist)
- switch _, err := gitq.FirstID(ctx); {
+func (_q *GroupInvitationTokenQuery) Exist(ctx context.Context) (bool, error) {
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryExist)
+ switch _, err := _q.FirstID(ctx); {
case IsNotFound(err):
return false, nil
case err != nil:
@@ -256,8 +256,8 @@ func (gitq *GroupInvitationTokenQuery) Exist(ctx context.Context) (bool, error)
}
// ExistX is like Exist, but panics if an error occurs.
-func (gitq *GroupInvitationTokenQuery) ExistX(ctx context.Context) bool {
- exist, err := gitq.Exist(ctx)
+func (_q *GroupInvitationTokenQuery) ExistX(ctx context.Context) bool {
+ exist, err := _q.Exist(ctx)
if err != nil {
panic(err)
}
@@ -266,32 +266,32 @@ func (gitq *GroupInvitationTokenQuery) ExistX(ctx context.Context) bool {
// Clone returns a duplicate of the GroupInvitationTokenQuery builder, including all associated steps. It can be
// used to prepare common query builders and use them differently after the clone is made.
-func (gitq *GroupInvitationTokenQuery) Clone() *GroupInvitationTokenQuery {
- if gitq == nil {
+func (_q *GroupInvitationTokenQuery) Clone() *GroupInvitationTokenQuery {
+ if _q == nil {
return nil
}
return &GroupInvitationTokenQuery{
- config: gitq.config,
- ctx: gitq.ctx.Clone(),
- order: append([]groupinvitationtoken.OrderOption{}, gitq.order...),
- inters: append([]Interceptor{}, gitq.inters...),
- predicates: append([]predicate.GroupInvitationToken{}, gitq.predicates...),
- withGroup: gitq.withGroup.Clone(),
+ config: _q.config,
+ ctx: _q.ctx.Clone(),
+ order: append([]groupinvitationtoken.OrderOption{}, _q.order...),
+ inters: append([]Interceptor{}, _q.inters...),
+ predicates: append([]predicate.GroupInvitationToken{}, _q.predicates...),
+ withGroup: _q.withGroup.Clone(),
// clone intermediate query.
- sql: gitq.sql.Clone(),
- path: gitq.path,
+ sql: _q.sql.Clone(),
+ path: _q.path,
}
}
// WithGroup tells the query-builder to eager-load the nodes that are connected to
// the "group" edge. The optional arguments are used to configure the query builder of the edge.
-func (gitq *GroupInvitationTokenQuery) WithGroup(opts ...func(*GroupQuery)) *GroupInvitationTokenQuery {
- query := (&GroupClient{config: gitq.config}).Query()
+func (_q *GroupInvitationTokenQuery) WithGroup(opts ...func(*GroupQuery)) *GroupInvitationTokenQuery {
+ query := (&GroupClient{config: _q.config}).Query()
for _, opt := range opts {
opt(query)
}
- gitq.withGroup = query
- return gitq
+ _q.withGroup = query
+ return _q
}
// GroupBy is used to group vertices by one or more fields/columns.
@@ -308,10 +308,10 @@ func (gitq *GroupInvitationTokenQuery) WithGroup(opts ...func(*GroupQuery)) *Gro
// GroupBy(groupinvitationtoken.FieldCreatedAt).
// Aggregate(ent.Count()).
// Scan(ctx, &v)
-func (gitq *GroupInvitationTokenQuery) GroupBy(field string, fields ...string) *GroupInvitationTokenGroupBy {
- gitq.ctx.Fields = append([]string{field}, fields...)
- grbuild := &GroupInvitationTokenGroupBy{build: gitq}
- grbuild.flds = &gitq.ctx.Fields
+func (_q *GroupInvitationTokenQuery) GroupBy(field string, fields ...string) *GroupInvitationTokenGroupBy {
+ _q.ctx.Fields = append([]string{field}, fields...)
+ grbuild := &GroupInvitationTokenGroupBy{build: _q}
+ grbuild.flds = &_q.ctx.Fields
grbuild.label = groupinvitationtoken.Label
grbuild.scan = grbuild.Scan
return grbuild
@@ -329,55 +329,55 @@ func (gitq *GroupInvitationTokenQuery) GroupBy(field string, fields ...string) *
// client.GroupInvitationToken.Query().
// Select(groupinvitationtoken.FieldCreatedAt).
// Scan(ctx, &v)
-func (gitq *GroupInvitationTokenQuery) Select(fields ...string) *GroupInvitationTokenSelect {
- gitq.ctx.Fields = append(gitq.ctx.Fields, fields...)
- sbuild := &GroupInvitationTokenSelect{GroupInvitationTokenQuery: gitq}
+func (_q *GroupInvitationTokenQuery) Select(fields ...string) *GroupInvitationTokenSelect {
+ _q.ctx.Fields = append(_q.ctx.Fields, fields...)
+ sbuild := &GroupInvitationTokenSelect{GroupInvitationTokenQuery: _q}
sbuild.label = groupinvitationtoken.Label
- sbuild.flds, sbuild.scan = &gitq.ctx.Fields, sbuild.Scan
+ sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan
return sbuild
}
// Aggregate returns a GroupInvitationTokenSelect configured with the given aggregations.
-func (gitq *GroupInvitationTokenQuery) Aggregate(fns ...AggregateFunc) *GroupInvitationTokenSelect {
- return gitq.Select().Aggregate(fns...)
+func (_q *GroupInvitationTokenQuery) Aggregate(fns ...AggregateFunc) *GroupInvitationTokenSelect {
+ return _q.Select().Aggregate(fns...)
}
-func (gitq *GroupInvitationTokenQuery) prepareQuery(ctx context.Context) error {
- for _, inter := range gitq.inters {
+func (_q *GroupInvitationTokenQuery) prepareQuery(ctx context.Context) error {
+ for _, inter := range _q.inters {
if inter == nil {
return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)")
}
if trv, ok := inter.(Traverser); ok {
- if err := trv.Traverse(ctx, gitq); err != nil {
+ if err := trv.Traverse(ctx, _q); err != nil {
return err
}
}
}
- for _, f := range gitq.ctx.Fields {
+ for _, f := range _q.ctx.Fields {
if !groupinvitationtoken.ValidColumn(f) {
return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
}
}
- if gitq.path != nil {
- prev, err := gitq.path(ctx)
+ if _q.path != nil {
+ prev, err := _q.path(ctx)
if err != nil {
return err
}
- gitq.sql = prev
+ _q.sql = prev
}
return nil
}
-func (gitq *GroupInvitationTokenQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*GroupInvitationToken, error) {
+func (_q *GroupInvitationTokenQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*GroupInvitationToken, error) {
var (
nodes = []*GroupInvitationToken{}
- withFKs = gitq.withFKs
- _spec = gitq.querySpec()
+ withFKs = _q.withFKs
+ _spec = _q.querySpec()
loadedTypes = [1]bool{
- gitq.withGroup != nil,
+ _q.withGroup != nil,
}
)
- if gitq.withGroup != nil {
+ if _q.withGroup != nil {
withFKs = true
}
if withFKs {
@@ -387,7 +387,7 @@ func (gitq *GroupInvitationTokenQuery) sqlAll(ctx context.Context, hooks ...quer
return (*GroupInvitationToken).scanValues(nil, columns)
}
_spec.Assign = func(columns []string, values []any) error {
- node := &GroupInvitationToken{config: gitq.config}
+ node := &GroupInvitationToken{config: _q.config}
nodes = append(nodes, node)
node.Edges.loadedTypes = loadedTypes
return node.assignValues(columns, values)
@@ -395,14 +395,14 @@ func (gitq *GroupInvitationTokenQuery) sqlAll(ctx context.Context, hooks ...quer
for i := range hooks {
hooks[i](ctx, _spec)
}
- if err := sqlgraph.QueryNodes(ctx, gitq.driver, _spec); err != nil {
+ if err := sqlgraph.QueryNodes(ctx, _q.driver, _spec); err != nil {
return nil, err
}
if len(nodes) == 0 {
return nodes, nil
}
- if query := gitq.withGroup; query != nil {
- if err := gitq.loadGroup(ctx, query, nodes, nil,
+ if query := _q.withGroup; query != nil {
+ if err := _q.loadGroup(ctx, query, nodes, nil,
func(n *GroupInvitationToken, e *Group) { n.Edges.Group = e }); err != nil {
return nil, err
}
@@ -410,7 +410,7 @@ func (gitq *GroupInvitationTokenQuery) sqlAll(ctx context.Context, hooks ...quer
return nodes, nil
}
-func (gitq *GroupInvitationTokenQuery) loadGroup(ctx context.Context, query *GroupQuery, nodes []*GroupInvitationToken, init func(*GroupInvitationToken), assign func(*GroupInvitationToken, *Group)) error {
+func (_q *GroupInvitationTokenQuery) loadGroup(ctx context.Context, query *GroupQuery, nodes []*GroupInvitationToken, init func(*GroupInvitationToken), assign func(*GroupInvitationToken, *Group)) error {
ids := make([]uuid.UUID, 0, len(nodes))
nodeids := make(map[uuid.UUID][]*GroupInvitationToken)
for i := range nodes {
@@ -443,24 +443,24 @@ func (gitq *GroupInvitationTokenQuery) loadGroup(ctx context.Context, query *Gro
return nil
}
-func (gitq *GroupInvitationTokenQuery) sqlCount(ctx context.Context) (int, error) {
- _spec := gitq.querySpec()
- _spec.Node.Columns = gitq.ctx.Fields
- if len(gitq.ctx.Fields) > 0 {
- _spec.Unique = gitq.ctx.Unique != nil && *gitq.ctx.Unique
+func (_q *GroupInvitationTokenQuery) sqlCount(ctx context.Context) (int, error) {
+ _spec := _q.querySpec()
+ _spec.Node.Columns = _q.ctx.Fields
+ if len(_q.ctx.Fields) > 0 {
+ _spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique
}
- return sqlgraph.CountNodes(ctx, gitq.driver, _spec)
+ return sqlgraph.CountNodes(ctx, _q.driver, _spec)
}
-func (gitq *GroupInvitationTokenQuery) querySpec() *sqlgraph.QuerySpec {
+func (_q *GroupInvitationTokenQuery) querySpec() *sqlgraph.QuerySpec {
_spec := sqlgraph.NewQuerySpec(groupinvitationtoken.Table, groupinvitationtoken.Columns, sqlgraph.NewFieldSpec(groupinvitationtoken.FieldID, field.TypeUUID))
- _spec.From = gitq.sql
- if unique := gitq.ctx.Unique; unique != nil {
+ _spec.From = _q.sql
+ if unique := _q.ctx.Unique; unique != nil {
_spec.Unique = *unique
- } else if gitq.path != nil {
+ } else if _q.path != nil {
_spec.Unique = true
}
- if fields := gitq.ctx.Fields; len(fields) > 0 {
+ if fields := _q.ctx.Fields; len(fields) > 0 {
_spec.Node.Columns = make([]string, 0, len(fields))
_spec.Node.Columns = append(_spec.Node.Columns, groupinvitationtoken.FieldID)
for i := range fields {
@@ -469,20 +469,20 @@ func (gitq *GroupInvitationTokenQuery) querySpec() *sqlgraph.QuerySpec {
}
}
}
- if ps := gitq.predicates; len(ps) > 0 {
+ if ps := _q.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
- if limit := gitq.ctx.Limit; limit != nil {
+ if limit := _q.ctx.Limit; limit != nil {
_spec.Limit = *limit
}
- if offset := gitq.ctx.Offset; offset != nil {
+ if offset := _q.ctx.Offset; offset != nil {
_spec.Offset = *offset
}
- if ps := gitq.order; len(ps) > 0 {
+ if ps := _q.order; len(ps) > 0 {
_spec.Order = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
@@ -492,33 +492,33 @@ func (gitq *GroupInvitationTokenQuery) querySpec() *sqlgraph.QuerySpec {
return _spec
}
-func (gitq *GroupInvitationTokenQuery) sqlQuery(ctx context.Context) *sql.Selector {
- builder := sql.Dialect(gitq.driver.Dialect())
+func (_q *GroupInvitationTokenQuery) sqlQuery(ctx context.Context) *sql.Selector {
+ builder := sql.Dialect(_q.driver.Dialect())
t1 := builder.Table(groupinvitationtoken.Table)
- columns := gitq.ctx.Fields
+ columns := _q.ctx.Fields
if len(columns) == 0 {
columns = groupinvitationtoken.Columns
}
selector := builder.Select(t1.Columns(columns...)...).From(t1)
- if gitq.sql != nil {
- selector = gitq.sql
+ if _q.sql != nil {
+ selector = _q.sql
selector.Select(selector.Columns(columns...)...)
}
- if gitq.ctx.Unique != nil && *gitq.ctx.Unique {
+ if _q.ctx.Unique != nil && *_q.ctx.Unique {
selector.Distinct()
}
- for _, p := range gitq.predicates {
+ for _, p := range _q.predicates {
p(selector)
}
- for _, p := range gitq.order {
+ for _, p := range _q.order {
p(selector)
}
- if offset := gitq.ctx.Offset; offset != nil {
+ if offset := _q.ctx.Offset; offset != nil {
// limit is mandatory for offset clause. We start
// with default value, and override it below if needed.
selector.Offset(*offset).Limit(math.MaxInt32)
}
- if limit := gitq.ctx.Limit; limit != nil {
+ if limit := _q.ctx.Limit; limit != nil {
selector.Limit(*limit)
}
return selector
@@ -531,41 +531,41 @@ type GroupInvitationTokenGroupBy struct {
}
// Aggregate adds the given aggregation functions to the group-by query.
-func (gitgb *GroupInvitationTokenGroupBy) Aggregate(fns ...AggregateFunc) *GroupInvitationTokenGroupBy {
- gitgb.fns = append(gitgb.fns, fns...)
- return gitgb
+func (_g *GroupInvitationTokenGroupBy) Aggregate(fns ...AggregateFunc) *GroupInvitationTokenGroupBy {
+ _g.fns = append(_g.fns, fns...)
+ return _g
}
// Scan applies the selector query and scans the result into the given value.
-func (gitgb *GroupInvitationTokenGroupBy) Scan(ctx context.Context, v any) error {
- ctx = setContextOp(ctx, gitgb.build.ctx, ent.OpQueryGroupBy)
- if err := gitgb.build.prepareQuery(ctx); err != nil {
+func (_g *GroupInvitationTokenGroupBy) Scan(ctx context.Context, v any) error {
+ ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy)
+ if err := _g.build.prepareQuery(ctx); err != nil {
return err
}
- return scanWithInterceptors[*GroupInvitationTokenQuery, *GroupInvitationTokenGroupBy](ctx, gitgb.build, gitgb, gitgb.build.inters, v)
+ return scanWithInterceptors[*GroupInvitationTokenQuery, *GroupInvitationTokenGroupBy](ctx, _g.build, _g, _g.build.inters, v)
}
-func (gitgb *GroupInvitationTokenGroupBy) sqlScan(ctx context.Context, root *GroupInvitationTokenQuery, v any) error {
+func (_g *GroupInvitationTokenGroupBy) sqlScan(ctx context.Context, root *GroupInvitationTokenQuery, v any) error {
selector := root.sqlQuery(ctx).Select()
- aggregation := make([]string, 0, len(gitgb.fns))
- for _, fn := range gitgb.fns {
+ aggregation := make([]string, 0, len(_g.fns))
+ for _, fn := range _g.fns {
aggregation = append(aggregation, fn(selector))
}
if len(selector.SelectedColumns()) == 0 {
- columns := make([]string, 0, len(*gitgb.flds)+len(gitgb.fns))
- for _, f := range *gitgb.flds {
+ columns := make([]string, 0, len(*_g.flds)+len(_g.fns))
+ for _, f := range *_g.flds {
columns = append(columns, selector.C(f))
}
columns = append(columns, aggregation...)
selector.Select(columns...)
}
- selector.GroupBy(selector.Columns(*gitgb.flds...)...)
+ selector.GroupBy(selector.Columns(*_g.flds...)...)
if err := selector.Err(); err != nil {
return err
}
rows := &sql.Rows{}
query, args := selector.Query()
- if err := gitgb.build.driver.Query(ctx, query, args, rows); err != nil {
+ if err := _g.build.driver.Query(ctx, query, args, rows); err != nil {
return err
}
defer rows.Close()
@@ -579,27 +579,27 @@ type GroupInvitationTokenSelect struct {
}
// Aggregate adds the given aggregation functions to the selector query.
-func (gits *GroupInvitationTokenSelect) Aggregate(fns ...AggregateFunc) *GroupInvitationTokenSelect {
- gits.fns = append(gits.fns, fns...)
- return gits
+func (_s *GroupInvitationTokenSelect) Aggregate(fns ...AggregateFunc) *GroupInvitationTokenSelect {
+ _s.fns = append(_s.fns, fns...)
+ return _s
}
// Scan applies the selector query and scans the result into the given value.
-func (gits *GroupInvitationTokenSelect) Scan(ctx context.Context, v any) error {
- ctx = setContextOp(ctx, gits.ctx, ent.OpQuerySelect)
- if err := gits.prepareQuery(ctx); err != nil {
+func (_s *GroupInvitationTokenSelect) Scan(ctx context.Context, v any) error {
+ ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect)
+ if err := _s.prepareQuery(ctx); err != nil {
return err
}
- return scanWithInterceptors[*GroupInvitationTokenQuery, *GroupInvitationTokenSelect](ctx, gits.GroupInvitationTokenQuery, gits, gits.inters, v)
+ return scanWithInterceptors[*GroupInvitationTokenQuery, *GroupInvitationTokenSelect](ctx, _s.GroupInvitationTokenQuery, _s, _s.inters, v)
}
-func (gits *GroupInvitationTokenSelect) sqlScan(ctx context.Context, root *GroupInvitationTokenQuery, v any) error {
+func (_s *GroupInvitationTokenSelect) sqlScan(ctx context.Context, root *GroupInvitationTokenQuery, v any) error {
selector := root.sqlQuery(ctx)
- aggregation := make([]string, 0, len(gits.fns))
- for _, fn := range gits.fns {
+ aggregation := make([]string, 0, len(_s.fns))
+ for _, fn := range _s.fns {
aggregation = append(aggregation, fn(selector))
}
- switch n := len(*gits.selector.flds); {
+ switch n := len(*_s.selector.flds); {
case n == 0 && len(aggregation) > 0:
selector.Select(aggregation...)
case n != 0 && len(aggregation) > 0:
@@ -607,7 +607,7 @@ func (gits *GroupInvitationTokenSelect) sqlScan(ctx context.Context, root *Group
}
rows := &sql.Rows{}
query, args := selector.Query()
- if err := gits.driver.Query(ctx, query, args, rows); err != nil {
+ if err := _s.driver.Query(ctx, query, args, rows); err != nil {
return err
}
defer rows.Close()
diff --git a/backend/internal/data/ent/groupinvitationtoken_update.go b/backend/internal/data/ent/groupinvitationtoken_update.go
index 38f4b2c4..1c964bbc 100644
--- a/backend/internal/data/ent/groupinvitationtoken_update.go
+++ b/backend/internal/data/ent/groupinvitationtoken_update.go
@@ -25,97 +25,97 @@ type GroupInvitationTokenUpdate struct {
}
// Where appends a list predicates to the GroupInvitationTokenUpdate builder.
-func (gitu *GroupInvitationTokenUpdate) Where(ps ...predicate.GroupInvitationToken) *GroupInvitationTokenUpdate {
- gitu.mutation.Where(ps...)
- return gitu
+func (_u *GroupInvitationTokenUpdate) Where(ps ...predicate.GroupInvitationToken) *GroupInvitationTokenUpdate {
+ _u.mutation.Where(ps...)
+ return _u
}
// SetUpdatedAt sets the "updated_at" field.
-func (gitu *GroupInvitationTokenUpdate) SetUpdatedAt(t time.Time) *GroupInvitationTokenUpdate {
- gitu.mutation.SetUpdatedAt(t)
- return gitu
+func (_u *GroupInvitationTokenUpdate) SetUpdatedAt(v time.Time) *GroupInvitationTokenUpdate {
+ _u.mutation.SetUpdatedAt(v)
+ return _u
}
// SetToken sets the "token" field.
-func (gitu *GroupInvitationTokenUpdate) SetToken(b []byte) *GroupInvitationTokenUpdate {
- gitu.mutation.SetToken(b)
- return gitu
+func (_u *GroupInvitationTokenUpdate) SetToken(v []byte) *GroupInvitationTokenUpdate {
+ _u.mutation.SetToken(v)
+ return _u
}
// SetExpiresAt sets the "expires_at" field.
-func (gitu *GroupInvitationTokenUpdate) SetExpiresAt(t time.Time) *GroupInvitationTokenUpdate {
- gitu.mutation.SetExpiresAt(t)
- return gitu
+func (_u *GroupInvitationTokenUpdate) SetExpiresAt(v time.Time) *GroupInvitationTokenUpdate {
+ _u.mutation.SetExpiresAt(v)
+ return _u
}
// SetNillableExpiresAt sets the "expires_at" field if the given value is not nil.
-func (gitu *GroupInvitationTokenUpdate) SetNillableExpiresAt(t *time.Time) *GroupInvitationTokenUpdate {
- if t != nil {
- gitu.SetExpiresAt(*t)
+func (_u *GroupInvitationTokenUpdate) SetNillableExpiresAt(v *time.Time) *GroupInvitationTokenUpdate {
+ if v != nil {
+ _u.SetExpiresAt(*v)
}
- return gitu
+ return _u
}
// SetUses sets the "uses" field.
-func (gitu *GroupInvitationTokenUpdate) SetUses(i int) *GroupInvitationTokenUpdate {
- gitu.mutation.ResetUses()
- gitu.mutation.SetUses(i)
- return gitu
+func (_u *GroupInvitationTokenUpdate) SetUses(v int) *GroupInvitationTokenUpdate {
+ _u.mutation.ResetUses()
+ _u.mutation.SetUses(v)
+ return _u
}
// SetNillableUses sets the "uses" field if the given value is not nil.
-func (gitu *GroupInvitationTokenUpdate) SetNillableUses(i *int) *GroupInvitationTokenUpdate {
- if i != nil {
- gitu.SetUses(*i)
+func (_u *GroupInvitationTokenUpdate) SetNillableUses(v *int) *GroupInvitationTokenUpdate {
+ if v != nil {
+ _u.SetUses(*v)
}
- return gitu
+ return _u
}
-// AddUses adds i to the "uses" field.
-func (gitu *GroupInvitationTokenUpdate) AddUses(i int) *GroupInvitationTokenUpdate {
- gitu.mutation.AddUses(i)
- return gitu
+// AddUses adds value to the "uses" field.
+func (_u *GroupInvitationTokenUpdate) AddUses(v int) *GroupInvitationTokenUpdate {
+ _u.mutation.AddUses(v)
+ return _u
}
// SetGroupID sets the "group" edge to the Group entity by ID.
-func (gitu *GroupInvitationTokenUpdate) SetGroupID(id uuid.UUID) *GroupInvitationTokenUpdate {
- gitu.mutation.SetGroupID(id)
- return gitu
+func (_u *GroupInvitationTokenUpdate) SetGroupID(id uuid.UUID) *GroupInvitationTokenUpdate {
+ _u.mutation.SetGroupID(id)
+ return _u
}
// SetNillableGroupID sets the "group" edge to the Group entity by ID if the given value is not nil.
-func (gitu *GroupInvitationTokenUpdate) SetNillableGroupID(id *uuid.UUID) *GroupInvitationTokenUpdate {
+func (_u *GroupInvitationTokenUpdate) SetNillableGroupID(id *uuid.UUID) *GroupInvitationTokenUpdate {
if id != nil {
- gitu = gitu.SetGroupID(*id)
+ _u = _u.SetGroupID(*id)
}
- return gitu
+ return _u
}
// SetGroup sets the "group" edge to the Group entity.
-func (gitu *GroupInvitationTokenUpdate) SetGroup(g *Group) *GroupInvitationTokenUpdate {
- return gitu.SetGroupID(g.ID)
+func (_u *GroupInvitationTokenUpdate) SetGroup(v *Group) *GroupInvitationTokenUpdate {
+ return _u.SetGroupID(v.ID)
}
// Mutation returns the GroupInvitationTokenMutation object of the builder.
-func (gitu *GroupInvitationTokenUpdate) Mutation() *GroupInvitationTokenMutation {
- return gitu.mutation
+func (_u *GroupInvitationTokenUpdate) Mutation() *GroupInvitationTokenMutation {
+ return _u.mutation
}
// ClearGroup clears the "group" edge to the Group entity.
-func (gitu *GroupInvitationTokenUpdate) ClearGroup() *GroupInvitationTokenUpdate {
- gitu.mutation.ClearGroup()
- return gitu
+func (_u *GroupInvitationTokenUpdate) ClearGroup() *GroupInvitationTokenUpdate {
+ _u.mutation.ClearGroup()
+ return _u
}
// Save executes the query and returns the number of nodes affected by the update operation.
-func (gitu *GroupInvitationTokenUpdate) Save(ctx context.Context) (int, error) {
- gitu.defaults()
- return withHooks(ctx, gitu.sqlSave, gitu.mutation, gitu.hooks)
+func (_u *GroupInvitationTokenUpdate) Save(ctx context.Context) (int, error) {
+ _u.defaults()
+ return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
}
// SaveX is like Save, but panics if an error occurs.
-func (gitu *GroupInvitationTokenUpdate) SaveX(ctx context.Context) int {
- affected, err := gitu.Save(ctx)
+func (_u *GroupInvitationTokenUpdate) SaveX(ctx context.Context) int {
+ affected, err := _u.Save(ctx)
if err != nil {
panic(err)
}
@@ -123,51 +123,51 @@ func (gitu *GroupInvitationTokenUpdate) SaveX(ctx context.Context) int {
}
// Exec executes the query.
-func (gitu *GroupInvitationTokenUpdate) Exec(ctx context.Context) error {
- _, err := gitu.Save(ctx)
+func (_u *GroupInvitationTokenUpdate) Exec(ctx context.Context) error {
+ _, err := _u.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
-func (gitu *GroupInvitationTokenUpdate) ExecX(ctx context.Context) {
- if err := gitu.Exec(ctx); err != nil {
+func (_u *GroupInvitationTokenUpdate) ExecX(ctx context.Context) {
+ if err := _u.Exec(ctx); err != nil {
panic(err)
}
}
// defaults sets the default values of the builder before save.
-func (gitu *GroupInvitationTokenUpdate) defaults() {
- if _, ok := gitu.mutation.UpdatedAt(); !ok {
+func (_u *GroupInvitationTokenUpdate) defaults() {
+ if _, ok := _u.mutation.UpdatedAt(); !ok {
v := groupinvitationtoken.UpdateDefaultUpdatedAt()
- gitu.mutation.SetUpdatedAt(v)
+ _u.mutation.SetUpdatedAt(v)
}
}
-func (gitu *GroupInvitationTokenUpdate) sqlSave(ctx context.Context) (n int, err error) {
+func (_u *GroupInvitationTokenUpdate) sqlSave(ctx context.Context) (_node int, err error) {
_spec := sqlgraph.NewUpdateSpec(groupinvitationtoken.Table, groupinvitationtoken.Columns, sqlgraph.NewFieldSpec(groupinvitationtoken.FieldID, field.TypeUUID))
- if ps := gitu.mutation.predicates; len(ps) > 0 {
+ if ps := _u.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
- if value, ok := gitu.mutation.UpdatedAt(); ok {
+ if value, ok := _u.mutation.UpdatedAt(); ok {
_spec.SetField(groupinvitationtoken.FieldUpdatedAt, field.TypeTime, value)
}
- if value, ok := gitu.mutation.Token(); ok {
+ if value, ok := _u.mutation.Token(); ok {
_spec.SetField(groupinvitationtoken.FieldToken, field.TypeBytes, value)
}
- if value, ok := gitu.mutation.ExpiresAt(); ok {
+ if value, ok := _u.mutation.ExpiresAt(); ok {
_spec.SetField(groupinvitationtoken.FieldExpiresAt, field.TypeTime, value)
}
- if value, ok := gitu.mutation.Uses(); ok {
+ if value, ok := _u.mutation.Uses(); ok {
_spec.SetField(groupinvitationtoken.FieldUses, field.TypeInt, value)
}
- if value, ok := gitu.mutation.AddedUses(); ok {
+ if value, ok := _u.mutation.AddedUses(); ok {
_spec.AddField(groupinvitationtoken.FieldUses, field.TypeInt, value)
}
- if gitu.mutation.GroupCleared() {
+ if _u.mutation.GroupCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -180,7 +180,7 @@ func (gitu *GroupInvitationTokenUpdate) sqlSave(ctx context.Context) (n int, err
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := gitu.mutation.GroupIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.GroupIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -196,7 +196,7 @@ func (gitu *GroupInvitationTokenUpdate) sqlSave(ctx context.Context) (n int, err
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- if n, err = sqlgraph.UpdateNodes(ctx, gitu.driver, _spec); err != nil {
+ if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil {
if _, ok := err.(*sqlgraph.NotFoundError); ok {
err = &NotFoundError{groupinvitationtoken.Label}
} else if sqlgraph.IsConstraintError(err) {
@@ -204,8 +204,8 @@ func (gitu *GroupInvitationTokenUpdate) sqlSave(ctx context.Context) (n int, err
}
return 0, err
}
- gitu.mutation.done = true
- return n, nil
+ _u.mutation.done = true
+ return _node, nil
}
// GroupInvitationTokenUpdateOne is the builder for updating a single GroupInvitationToken entity.
@@ -217,104 +217,104 @@ type GroupInvitationTokenUpdateOne struct {
}
// SetUpdatedAt sets the "updated_at" field.
-func (gituo *GroupInvitationTokenUpdateOne) SetUpdatedAt(t time.Time) *GroupInvitationTokenUpdateOne {
- gituo.mutation.SetUpdatedAt(t)
- return gituo
+func (_u *GroupInvitationTokenUpdateOne) SetUpdatedAt(v time.Time) *GroupInvitationTokenUpdateOne {
+ _u.mutation.SetUpdatedAt(v)
+ return _u
}
// SetToken sets the "token" field.
-func (gituo *GroupInvitationTokenUpdateOne) SetToken(b []byte) *GroupInvitationTokenUpdateOne {
- gituo.mutation.SetToken(b)
- return gituo
+func (_u *GroupInvitationTokenUpdateOne) SetToken(v []byte) *GroupInvitationTokenUpdateOne {
+ _u.mutation.SetToken(v)
+ return _u
}
// SetExpiresAt sets the "expires_at" field.
-func (gituo *GroupInvitationTokenUpdateOne) SetExpiresAt(t time.Time) *GroupInvitationTokenUpdateOne {
- gituo.mutation.SetExpiresAt(t)
- return gituo
+func (_u *GroupInvitationTokenUpdateOne) SetExpiresAt(v time.Time) *GroupInvitationTokenUpdateOne {
+ _u.mutation.SetExpiresAt(v)
+ return _u
}
// SetNillableExpiresAt sets the "expires_at" field if the given value is not nil.
-func (gituo *GroupInvitationTokenUpdateOne) SetNillableExpiresAt(t *time.Time) *GroupInvitationTokenUpdateOne {
- if t != nil {
- gituo.SetExpiresAt(*t)
+func (_u *GroupInvitationTokenUpdateOne) SetNillableExpiresAt(v *time.Time) *GroupInvitationTokenUpdateOne {
+ if v != nil {
+ _u.SetExpiresAt(*v)
}
- return gituo
+ return _u
}
// SetUses sets the "uses" field.
-func (gituo *GroupInvitationTokenUpdateOne) SetUses(i int) *GroupInvitationTokenUpdateOne {
- gituo.mutation.ResetUses()
- gituo.mutation.SetUses(i)
- return gituo
+func (_u *GroupInvitationTokenUpdateOne) SetUses(v int) *GroupInvitationTokenUpdateOne {
+ _u.mutation.ResetUses()
+ _u.mutation.SetUses(v)
+ return _u
}
// SetNillableUses sets the "uses" field if the given value is not nil.
-func (gituo *GroupInvitationTokenUpdateOne) SetNillableUses(i *int) *GroupInvitationTokenUpdateOne {
- if i != nil {
- gituo.SetUses(*i)
+func (_u *GroupInvitationTokenUpdateOne) SetNillableUses(v *int) *GroupInvitationTokenUpdateOne {
+ if v != nil {
+ _u.SetUses(*v)
}
- return gituo
+ return _u
}
-// AddUses adds i to the "uses" field.
-func (gituo *GroupInvitationTokenUpdateOne) AddUses(i int) *GroupInvitationTokenUpdateOne {
- gituo.mutation.AddUses(i)
- return gituo
+// AddUses adds value to the "uses" field.
+func (_u *GroupInvitationTokenUpdateOne) AddUses(v int) *GroupInvitationTokenUpdateOne {
+ _u.mutation.AddUses(v)
+ return _u
}
// SetGroupID sets the "group" edge to the Group entity by ID.
-func (gituo *GroupInvitationTokenUpdateOne) SetGroupID(id uuid.UUID) *GroupInvitationTokenUpdateOne {
- gituo.mutation.SetGroupID(id)
- return gituo
+func (_u *GroupInvitationTokenUpdateOne) SetGroupID(id uuid.UUID) *GroupInvitationTokenUpdateOne {
+ _u.mutation.SetGroupID(id)
+ return _u
}
// SetNillableGroupID sets the "group" edge to the Group entity by ID if the given value is not nil.
-func (gituo *GroupInvitationTokenUpdateOne) SetNillableGroupID(id *uuid.UUID) *GroupInvitationTokenUpdateOne {
+func (_u *GroupInvitationTokenUpdateOne) SetNillableGroupID(id *uuid.UUID) *GroupInvitationTokenUpdateOne {
if id != nil {
- gituo = gituo.SetGroupID(*id)
+ _u = _u.SetGroupID(*id)
}
- return gituo
+ return _u
}
// SetGroup sets the "group" edge to the Group entity.
-func (gituo *GroupInvitationTokenUpdateOne) SetGroup(g *Group) *GroupInvitationTokenUpdateOne {
- return gituo.SetGroupID(g.ID)
+func (_u *GroupInvitationTokenUpdateOne) SetGroup(v *Group) *GroupInvitationTokenUpdateOne {
+ return _u.SetGroupID(v.ID)
}
// Mutation returns the GroupInvitationTokenMutation object of the builder.
-func (gituo *GroupInvitationTokenUpdateOne) Mutation() *GroupInvitationTokenMutation {
- return gituo.mutation
+func (_u *GroupInvitationTokenUpdateOne) Mutation() *GroupInvitationTokenMutation {
+ return _u.mutation
}
// ClearGroup clears the "group" edge to the Group entity.
-func (gituo *GroupInvitationTokenUpdateOne) ClearGroup() *GroupInvitationTokenUpdateOne {
- gituo.mutation.ClearGroup()
- return gituo
+func (_u *GroupInvitationTokenUpdateOne) ClearGroup() *GroupInvitationTokenUpdateOne {
+ _u.mutation.ClearGroup()
+ return _u
}
// Where appends a list predicates to the GroupInvitationTokenUpdate builder.
-func (gituo *GroupInvitationTokenUpdateOne) Where(ps ...predicate.GroupInvitationToken) *GroupInvitationTokenUpdateOne {
- gituo.mutation.Where(ps...)
- return gituo
+func (_u *GroupInvitationTokenUpdateOne) Where(ps ...predicate.GroupInvitationToken) *GroupInvitationTokenUpdateOne {
+ _u.mutation.Where(ps...)
+ return _u
}
// Select allows selecting one or more fields (columns) of the returned entity.
// The default is selecting all fields defined in the entity schema.
-func (gituo *GroupInvitationTokenUpdateOne) Select(field string, fields ...string) *GroupInvitationTokenUpdateOne {
- gituo.fields = append([]string{field}, fields...)
- return gituo
+func (_u *GroupInvitationTokenUpdateOne) Select(field string, fields ...string) *GroupInvitationTokenUpdateOne {
+ _u.fields = append([]string{field}, fields...)
+ return _u
}
// Save executes the query and returns the updated GroupInvitationToken entity.
-func (gituo *GroupInvitationTokenUpdateOne) Save(ctx context.Context) (*GroupInvitationToken, error) {
- gituo.defaults()
- return withHooks(ctx, gituo.sqlSave, gituo.mutation, gituo.hooks)
+func (_u *GroupInvitationTokenUpdateOne) Save(ctx context.Context) (*GroupInvitationToken, error) {
+ _u.defaults()
+ return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
}
// SaveX is like Save, but panics if an error occurs.
-func (gituo *GroupInvitationTokenUpdateOne) SaveX(ctx context.Context) *GroupInvitationToken {
- node, err := gituo.Save(ctx)
+func (_u *GroupInvitationTokenUpdateOne) SaveX(ctx context.Context) *GroupInvitationToken {
+ node, err := _u.Save(ctx)
if err != nil {
panic(err)
}
@@ -322,34 +322,34 @@ func (gituo *GroupInvitationTokenUpdateOne) SaveX(ctx context.Context) *GroupInv
}
// Exec executes the query on the entity.
-func (gituo *GroupInvitationTokenUpdateOne) Exec(ctx context.Context) error {
- _, err := gituo.Save(ctx)
+func (_u *GroupInvitationTokenUpdateOne) Exec(ctx context.Context) error {
+ _, err := _u.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
-func (gituo *GroupInvitationTokenUpdateOne) ExecX(ctx context.Context) {
- if err := gituo.Exec(ctx); err != nil {
+func (_u *GroupInvitationTokenUpdateOne) ExecX(ctx context.Context) {
+ if err := _u.Exec(ctx); err != nil {
panic(err)
}
}
// defaults sets the default values of the builder before save.
-func (gituo *GroupInvitationTokenUpdateOne) defaults() {
- if _, ok := gituo.mutation.UpdatedAt(); !ok {
+func (_u *GroupInvitationTokenUpdateOne) defaults() {
+ if _, ok := _u.mutation.UpdatedAt(); !ok {
v := groupinvitationtoken.UpdateDefaultUpdatedAt()
- gituo.mutation.SetUpdatedAt(v)
+ _u.mutation.SetUpdatedAt(v)
}
}
-func (gituo *GroupInvitationTokenUpdateOne) sqlSave(ctx context.Context) (_node *GroupInvitationToken, err error) {
+func (_u *GroupInvitationTokenUpdateOne) sqlSave(ctx context.Context) (_node *GroupInvitationToken, err error) {
_spec := sqlgraph.NewUpdateSpec(groupinvitationtoken.Table, groupinvitationtoken.Columns, sqlgraph.NewFieldSpec(groupinvitationtoken.FieldID, field.TypeUUID))
- id, ok := gituo.mutation.ID()
+ id, ok := _u.mutation.ID()
if !ok {
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "GroupInvitationToken.id" for update`)}
}
_spec.Node.ID.Value = id
- if fields := gituo.fields; len(fields) > 0 {
+ if fields := _u.fields; len(fields) > 0 {
_spec.Node.Columns = make([]string, 0, len(fields))
_spec.Node.Columns = append(_spec.Node.Columns, groupinvitationtoken.FieldID)
for _, f := range fields {
@@ -361,29 +361,29 @@ func (gituo *GroupInvitationTokenUpdateOne) sqlSave(ctx context.Context) (_node
}
}
}
- if ps := gituo.mutation.predicates; len(ps) > 0 {
+ if ps := _u.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
- if value, ok := gituo.mutation.UpdatedAt(); ok {
+ if value, ok := _u.mutation.UpdatedAt(); ok {
_spec.SetField(groupinvitationtoken.FieldUpdatedAt, field.TypeTime, value)
}
- if value, ok := gituo.mutation.Token(); ok {
+ if value, ok := _u.mutation.Token(); ok {
_spec.SetField(groupinvitationtoken.FieldToken, field.TypeBytes, value)
}
- if value, ok := gituo.mutation.ExpiresAt(); ok {
+ if value, ok := _u.mutation.ExpiresAt(); ok {
_spec.SetField(groupinvitationtoken.FieldExpiresAt, field.TypeTime, value)
}
- if value, ok := gituo.mutation.Uses(); ok {
+ if value, ok := _u.mutation.Uses(); ok {
_spec.SetField(groupinvitationtoken.FieldUses, field.TypeInt, value)
}
- if value, ok := gituo.mutation.AddedUses(); ok {
+ if value, ok := _u.mutation.AddedUses(); ok {
_spec.AddField(groupinvitationtoken.FieldUses, field.TypeInt, value)
}
- if gituo.mutation.GroupCleared() {
+ if _u.mutation.GroupCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -396,7 +396,7 @@ func (gituo *GroupInvitationTokenUpdateOne) sqlSave(ctx context.Context) (_node
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := gituo.mutation.GroupIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.GroupIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -412,10 +412,10 @@ func (gituo *GroupInvitationTokenUpdateOne) sqlSave(ctx context.Context) (_node
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- _node = &GroupInvitationToken{config: gituo.config}
+ _node = &GroupInvitationToken{config: _u.config}
_spec.Assign = _node.assignValues
_spec.ScanValues = _node.scanValues
- if err = sqlgraph.UpdateNode(ctx, gituo.driver, _spec); err != nil {
+ if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil {
if _, ok := err.(*sqlgraph.NotFoundError); ok {
err = &NotFoundError{groupinvitationtoken.Label}
} else if sqlgraph.IsConstraintError(err) {
@@ -423,6 +423,6 @@ func (gituo *GroupInvitationTokenUpdateOne) sqlSave(ctx context.Context) (_node
}
return nil, err
}
- gituo.mutation.done = true
+ _u.mutation.done = true
return _node, nil
}
diff --git a/backend/internal/data/ent/has_id.go b/backend/internal/data/ent/has_id.go
index 9e0f33bf..758b3145 100644
--- a/backend/internal/data/ent/has_id.go
+++ b/backend/internal/data/ent/has_id.go
@@ -4,50 +4,50 @@ package ent
import "github.com/google/uuid"
-func (a *Attachment) GetID() uuid.UUID {
- return a.ID
+func (_m *Attachment) GetID() uuid.UUID {
+ return _m.ID
}
-func (ar *AuthRoles) GetID() int {
- return ar.ID
+func (_m *AuthRoles) GetID() int {
+ return _m.ID
}
-func (at *AuthTokens) GetID() uuid.UUID {
- return at.ID
+func (_m *AuthTokens) GetID() uuid.UUID {
+ return _m.ID
}
-func (gr *Group) GetID() uuid.UUID {
- return gr.ID
+func (_m *Group) GetID() uuid.UUID {
+ return _m.ID
}
-func (git *GroupInvitationToken) GetID() uuid.UUID {
- return git.ID
+func (_m *GroupInvitationToken) GetID() uuid.UUID {
+ return _m.ID
}
-func (i *Item) GetID() uuid.UUID {
- return i.ID
+func (_m *Item) GetID() uuid.UUID {
+ return _m.ID
}
-func (_if *ItemField) GetID() uuid.UUID {
- return _if.ID
+func (_m *ItemField) GetID() uuid.UUID {
+ return _m.ID
}
-func (l *Label) GetID() uuid.UUID {
- return l.ID
+func (_m *Label) GetID() uuid.UUID {
+ return _m.ID
}
-func (l *Location) GetID() uuid.UUID {
- return l.ID
+func (_m *Location) GetID() uuid.UUID {
+ return _m.ID
}
-func (me *MaintenanceEntry) GetID() uuid.UUID {
- return me.ID
+func (_m *MaintenanceEntry) GetID() uuid.UUID {
+ return _m.ID
}
-func (n *Notifier) GetID() uuid.UUID {
- return n.ID
+func (_m *Notifier) GetID() uuid.UUID {
+ return _m.ID
}
-func (u *User) GetID() uuid.UUID {
- return u.ID
+func (_m *User) GetID() uuid.UUID {
+ return _m.ID
}
diff --git a/backend/internal/data/ent/item.go b/backend/internal/data/ent/item.go
index 07712bd1..27c4f38d 100644
--- a/backend/internal/data/ent/item.go
+++ b/backend/internal/data/ent/item.go
@@ -210,185 +210,185 @@ func (*Item) scanValues(columns []string) ([]any, error) {
// assignValues assigns the values that were returned from sql.Rows (after scanning)
// to the Item fields.
-func (i *Item) assignValues(columns []string, values []any) error {
+func (_m *Item) assignValues(columns []string, values []any) error {
if m, n := len(values), len(columns); m < n {
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
}
- for j := range columns {
- switch columns[j] {
+ for i := range columns {
+ switch columns[i] {
case item.FieldID:
- if value, ok := values[j].(*uuid.UUID); !ok {
- return fmt.Errorf("unexpected type %T for field id", values[j])
+ if value, ok := values[i].(*uuid.UUID); !ok {
+ return fmt.Errorf("unexpected type %T for field id", values[i])
} else if value != nil {
- i.ID = *value
+ _m.ID = *value
}
case item.FieldCreatedAt:
- if value, ok := values[j].(*sql.NullTime); !ok {
- return fmt.Errorf("unexpected type %T for field created_at", values[j])
+ if value, ok := values[i].(*sql.NullTime); !ok {
+ return fmt.Errorf("unexpected type %T for field created_at", values[i])
} else if value.Valid {
- i.CreatedAt = value.Time
+ _m.CreatedAt = value.Time
}
case item.FieldUpdatedAt:
- if value, ok := values[j].(*sql.NullTime); !ok {
- return fmt.Errorf("unexpected type %T for field updated_at", values[j])
+ if value, ok := values[i].(*sql.NullTime); !ok {
+ return fmt.Errorf("unexpected type %T for field updated_at", values[i])
} else if value.Valid {
- i.UpdatedAt = value.Time
+ _m.UpdatedAt = value.Time
}
case item.FieldName:
- if value, ok := values[j].(*sql.NullString); !ok {
- return fmt.Errorf("unexpected type %T for field name", values[j])
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field name", values[i])
} else if value.Valid {
- i.Name = value.String
+ _m.Name = value.String
}
case item.FieldDescription:
- if value, ok := values[j].(*sql.NullString); !ok {
- return fmt.Errorf("unexpected type %T for field description", values[j])
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field description", values[i])
} else if value.Valid {
- i.Description = value.String
+ _m.Description = value.String
}
case item.FieldImportRef:
- if value, ok := values[j].(*sql.NullString); !ok {
- return fmt.Errorf("unexpected type %T for field import_ref", values[j])
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field import_ref", values[i])
} else if value.Valid {
- i.ImportRef = value.String
+ _m.ImportRef = value.String
}
case item.FieldNotes:
- if value, ok := values[j].(*sql.NullString); !ok {
- return fmt.Errorf("unexpected type %T for field notes", values[j])
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field notes", values[i])
} else if value.Valid {
- i.Notes = value.String
+ _m.Notes = value.String
}
case item.FieldQuantity:
- if value, ok := values[j].(*sql.NullInt64); !ok {
- return fmt.Errorf("unexpected type %T for field quantity", values[j])
+ if value, ok := values[i].(*sql.NullInt64); !ok {
+ return fmt.Errorf("unexpected type %T for field quantity", values[i])
} else if value.Valid {
- i.Quantity = int(value.Int64)
+ _m.Quantity = int(value.Int64)
}
case item.FieldInsured:
- if value, ok := values[j].(*sql.NullBool); !ok {
- return fmt.Errorf("unexpected type %T for field insured", values[j])
+ if value, ok := values[i].(*sql.NullBool); !ok {
+ return fmt.Errorf("unexpected type %T for field insured", values[i])
} else if value.Valid {
- i.Insured = value.Bool
+ _m.Insured = value.Bool
}
case item.FieldArchived:
- if value, ok := values[j].(*sql.NullBool); !ok {
- return fmt.Errorf("unexpected type %T for field archived", values[j])
+ if value, ok := values[i].(*sql.NullBool); !ok {
+ return fmt.Errorf("unexpected type %T for field archived", values[i])
} else if value.Valid {
- i.Archived = value.Bool
+ _m.Archived = value.Bool
}
case item.FieldAssetID:
- if value, ok := values[j].(*sql.NullInt64); !ok {
- return fmt.Errorf("unexpected type %T for field asset_id", values[j])
+ if value, ok := values[i].(*sql.NullInt64); !ok {
+ return fmt.Errorf("unexpected type %T for field asset_id", values[i])
} else if value.Valid {
- i.AssetID = int(value.Int64)
+ _m.AssetID = int(value.Int64)
}
case item.FieldSyncChildItemsLocations:
- if value, ok := values[j].(*sql.NullBool); !ok {
- return fmt.Errorf("unexpected type %T for field sync_child_items_locations", values[j])
+ if value, ok := values[i].(*sql.NullBool); !ok {
+ return fmt.Errorf("unexpected type %T for field sync_child_items_locations", values[i])
} else if value.Valid {
- i.SyncChildItemsLocations = value.Bool
+ _m.SyncChildItemsLocations = value.Bool
}
case item.FieldSerialNumber:
- if value, ok := values[j].(*sql.NullString); !ok {
- return fmt.Errorf("unexpected type %T for field serial_number", values[j])
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field serial_number", values[i])
} else if value.Valid {
- i.SerialNumber = value.String
+ _m.SerialNumber = value.String
}
case item.FieldModelNumber:
- if value, ok := values[j].(*sql.NullString); !ok {
- return fmt.Errorf("unexpected type %T for field model_number", values[j])
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field model_number", values[i])
} else if value.Valid {
- i.ModelNumber = value.String
+ _m.ModelNumber = value.String
}
case item.FieldManufacturer:
- if value, ok := values[j].(*sql.NullString); !ok {
- return fmt.Errorf("unexpected type %T for field manufacturer", values[j])
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field manufacturer", values[i])
} else if value.Valid {
- i.Manufacturer = value.String
+ _m.Manufacturer = value.String
}
case item.FieldLifetimeWarranty:
- if value, ok := values[j].(*sql.NullBool); !ok {
- return fmt.Errorf("unexpected type %T for field lifetime_warranty", values[j])
+ if value, ok := values[i].(*sql.NullBool); !ok {
+ return fmt.Errorf("unexpected type %T for field lifetime_warranty", values[i])
} else if value.Valid {
- i.LifetimeWarranty = value.Bool
+ _m.LifetimeWarranty = value.Bool
}
case item.FieldWarrantyExpires:
- if value, ok := values[j].(*sql.NullTime); !ok {
- return fmt.Errorf("unexpected type %T for field warranty_expires", values[j])
+ if value, ok := values[i].(*sql.NullTime); !ok {
+ return fmt.Errorf("unexpected type %T for field warranty_expires", values[i])
} else if value.Valid {
- i.WarrantyExpires = value.Time
+ _m.WarrantyExpires = value.Time
}
case item.FieldWarrantyDetails:
- if value, ok := values[j].(*sql.NullString); !ok {
- return fmt.Errorf("unexpected type %T for field warranty_details", values[j])
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field warranty_details", values[i])
} else if value.Valid {
- i.WarrantyDetails = value.String
+ _m.WarrantyDetails = value.String
}
case item.FieldPurchaseTime:
- if value, ok := values[j].(*sql.NullTime); !ok {
- return fmt.Errorf("unexpected type %T for field purchase_time", values[j])
+ if value, ok := values[i].(*sql.NullTime); !ok {
+ return fmt.Errorf("unexpected type %T for field purchase_time", values[i])
} else if value.Valid {
- i.PurchaseTime = value.Time
+ _m.PurchaseTime = value.Time
}
case item.FieldPurchaseFrom:
- if value, ok := values[j].(*sql.NullString); !ok {
- return fmt.Errorf("unexpected type %T for field purchase_from", values[j])
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field purchase_from", values[i])
} else if value.Valid {
- i.PurchaseFrom = value.String
+ _m.PurchaseFrom = value.String
}
case item.FieldPurchasePrice:
- if value, ok := values[j].(*sql.NullFloat64); !ok {
- return fmt.Errorf("unexpected type %T for field purchase_price", values[j])
+ if value, ok := values[i].(*sql.NullFloat64); !ok {
+ return fmt.Errorf("unexpected type %T for field purchase_price", values[i])
} else if value.Valid {
- i.PurchasePrice = value.Float64
+ _m.PurchasePrice = value.Float64
}
case item.FieldSoldTime:
- if value, ok := values[j].(*sql.NullTime); !ok {
- return fmt.Errorf("unexpected type %T for field sold_time", values[j])
+ if value, ok := values[i].(*sql.NullTime); !ok {
+ return fmt.Errorf("unexpected type %T for field sold_time", values[i])
} else if value.Valid {
- i.SoldTime = value.Time
+ _m.SoldTime = value.Time
}
case item.FieldSoldTo:
- if value, ok := values[j].(*sql.NullString); !ok {
- return fmt.Errorf("unexpected type %T for field sold_to", values[j])
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field sold_to", values[i])
} else if value.Valid {
- i.SoldTo = value.String
+ _m.SoldTo = value.String
}
case item.FieldSoldPrice:
- if value, ok := values[j].(*sql.NullFloat64); !ok {
- return fmt.Errorf("unexpected type %T for field sold_price", values[j])
+ if value, ok := values[i].(*sql.NullFloat64); !ok {
+ return fmt.Errorf("unexpected type %T for field sold_price", values[i])
} else if value.Valid {
- i.SoldPrice = value.Float64
+ _m.SoldPrice = value.Float64
}
case item.FieldSoldNotes:
- if value, ok := values[j].(*sql.NullString); !ok {
- return fmt.Errorf("unexpected type %T for field sold_notes", values[j])
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field sold_notes", values[i])
} else if value.Valid {
- i.SoldNotes = value.String
+ _m.SoldNotes = value.String
}
case item.ForeignKeys[0]:
- if value, ok := values[j].(*sql.NullScanner); !ok {
- return fmt.Errorf("unexpected type %T for field group_items", values[j])
+ if value, ok := values[i].(*sql.NullScanner); !ok {
+ return fmt.Errorf("unexpected type %T for field group_items", values[i])
} else if value.Valid {
- i.group_items = new(uuid.UUID)
- *i.group_items = *value.S.(*uuid.UUID)
+ _m.group_items = new(uuid.UUID)
+ *_m.group_items = *value.S.(*uuid.UUID)
}
case item.ForeignKeys[1]:
- if value, ok := values[j].(*sql.NullScanner); !ok {
- return fmt.Errorf("unexpected type %T for field item_children", values[j])
+ if value, ok := values[i].(*sql.NullScanner); !ok {
+ return fmt.Errorf("unexpected type %T for field item_children", values[i])
} else if value.Valid {
- i.item_children = new(uuid.UUID)
- *i.item_children = *value.S.(*uuid.UUID)
+ _m.item_children = new(uuid.UUID)
+ *_m.item_children = *value.S.(*uuid.UUID)
}
case item.ForeignKeys[2]:
- if value, ok := values[j].(*sql.NullScanner); !ok {
- return fmt.Errorf("unexpected type %T for field location_items", values[j])
+ if value, ok := values[i].(*sql.NullScanner); !ok {
+ return fmt.Errorf("unexpected type %T for field location_items", values[i])
} else if value.Valid {
- i.location_items = new(uuid.UUID)
- *i.location_items = *value.S.(*uuid.UUID)
+ _m.location_items = new(uuid.UUID)
+ *_m.location_items = *value.S.(*uuid.UUID)
}
default:
- i.selectValues.Set(columns[j], values[j])
+ _m.selectValues.Set(columns[i], values[i])
}
}
return nil
@@ -396,144 +396,144 @@ func (i *Item) assignValues(columns []string, values []any) error {
// Value returns the ent.Value that was dynamically selected and assigned to the Item.
// This includes values selected through modifiers, order, etc.
-func (i *Item) Value(name string) (ent.Value, error) {
- return i.selectValues.Get(name)
+func (_m *Item) Value(name string) (ent.Value, error) {
+ return _m.selectValues.Get(name)
}
// QueryGroup queries the "group" edge of the Item entity.
-func (i *Item) QueryGroup() *GroupQuery {
- return NewItemClient(i.config).QueryGroup(i)
+func (_m *Item) QueryGroup() *GroupQuery {
+ return NewItemClient(_m.config).QueryGroup(_m)
}
// QueryParent queries the "parent" edge of the Item entity.
-func (i *Item) QueryParent() *ItemQuery {
- return NewItemClient(i.config).QueryParent(i)
+func (_m *Item) QueryParent() *ItemQuery {
+ return NewItemClient(_m.config).QueryParent(_m)
}
// QueryChildren queries the "children" edge of the Item entity.
-func (i *Item) QueryChildren() *ItemQuery {
- return NewItemClient(i.config).QueryChildren(i)
+func (_m *Item) QueryChildren() *ItemQuery {
+ return NewItemClient(_m.config).QueryChildren(_m)
}
// QueryLabel queries the "label" edge of the Item entity.
-func (i *Item) QueryLabel() *LabelQuery {
- return NewItemClient(i.config).QueryLabel(i)
+func (_m *Item) QueryLabel() *LabelQuery {
+ return NewItemClient(_m.config).QueryLabel(_m)
}
// QueryLocation queries the "location" edge of the Item entity.
-func (i *Item) QueryLocation() *LocationQuery {
- return NewItemClient(i.config).QueryLocation(i)
+func (_m *Item) QueryLocation() *LocationQuery {
+ return NewItemClient(_m.config).QueryLocation(_m)
}
// QueryFields queries the "fields" edge of the Item entity.
-func (i *Item) QueryFields() *ItemFieldQuery {
- return NewItemClient(i.config).QueryFields(i)
+func (_m *Item) QueryFields() *ItemFieldQuery {
+ return NewItemClient(_m.config).QueryFields(_m)
}
// QueryMaintenanceEntries queries the "maintenance_entries" edge of the Item entity.
-func (i *Item) QueryMaintenanceEntries() *MaintenanceEntryQuery {
- return NewItemClient(i.config).QueryMaintenanceEntries(i)
+func (_m *Item) QueryMaintenanceEntries() *MaintenanceEntryQuery {
+ return NewItemClient(_m.config).QueryMaintenanceEntries(_m)
}
// QueryAttachments queries the "attachments" edge of the Item entity.
-func (i *Item) QueryAttachments() *AttachmentQuery {
- return NewItemClient(i.config).QueryAttachments(i)
+func (_m *Item) QueryAttachments() *AttachmentQuery {
+ return NewItemClient(_m.config).QueryAttachments(_m)
}
// Update returns a builder for updating this Item.
// Note that you need to call Item.Unwrap() before calling this method if this Item
// was returned from a transaction, and the transaction was committed or rolled back.
-func (i *Item) Update() *ItemUpdateOne {
- return NewItemClient(i.config).UpdateOne(i)
+func (_m *Item) Update() *ItemUpdateOne {
+ return NewItemClient(_m.config).UpdateOne(_m)
}
// Unwrap unwraps the Item 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 (i *Item) Unwrap() *Item {
- _tx, ok := i.config.driver.(*txDriver)
+func (_m *Item) Unwrap() *Item {
+ _tx, ok := _m.config.driver.(*txDriver)
if !ok {
panic("ent: Item is not a transactional entity")
}
- i.config.driver = _tx.drv
- return i
+ _m.config.driver = _tx.drv
+ return _m
}
// String implements the fmt.Stringer.
-func (i *Item) String() string {
+func (_m *Item) String() string {
var builder strings.Builder
builder.WriteString("Item(")
- builder.WriteString(fmt.Sprintf("id=%v, ", i.ID))
+ builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
builder.WriteString("created_at=")
- builder.WriteString(i.CreatedAt.Format(time.ANSIC))
+ builder.WriteString(_m.CreatedAt.Format(time.ANSIC))
builder.WriteString(", ")
builder.WriteString("updated_at=")
- builder.WriteString(i.UpdatedAt.Format(time.ANSIC))
+ builder.WriteString(_m.UpdatedAt.Format(time.ANSIC))
builder.WriteString(", ")
builder.WriteString("name=")
- builder.WriteString(i.Name)
+ builder.WriteString(_m.Name)
builder.WriteString(", ")
builder.WriteString("description=")
- builder.WriteString(i.Description)
+ builder.WriteString(_m.Description)
builder.WriteString(", ")
builder.WriteString("import_ref=")
- builder.WriteString(i.ImportRef)
+ builder.WriteString(_m.ImportRef)
builder.WriteString(", ")
builder.WriteString("notes=")
- builder.WriteString(i.Notes)
+ builder.WriteString(_m.Notes)
builder.WriteString(", ")
builder.WriteString("quantity=")
- builder.WriteString(fmt.Sprintf("%v", i.Quantity))
+ builder.WriteString(fmt.Sprintf("%v", _m.Quantity))
builder.WriteString(", ")
builder.WriteString("insured=")
- builder.WriteString(fmt.Sprintf("%v", i.Insured))
+ builder.WriteString(fmt.Sprintf("%v", _m.Insured))
builder.WriteString(", ")
builder.WriteString("archived=")
- builder.WriteString(fmt.Sprintf("%v", i.Archived))
+ builder.WriteString(fmt.Sprintf("%v", _m.Archived))
builder.WriteString(", ")
builder.WriteString("asset_id=")
- builder.WriteString(fmt.Sprintf("%v", i.AssetID))
+ builder.WriteString(fmt.Sprintf("%v", _m.AssetID))
builder.WriteString(", ")
builder.WriteString("sync_child_items_locations=")
- builder.WriteString(fmt.Sprintf("%v", i.SyncChildItemsLocations))
+ builder.WriteString(fmt.Sprintf("%v", _m.SyncChildItemsLocations))
builder.WriteString(", ")
builder.WriteString("serial_number=")
- builder.WriteString(i.SerialNumber)
+ builder.WriteString(_m.SerialNumber)
builder.WriteString(", ")
builder.WriteString("model_number=")
- builder.WriteString(i.ModelNumber)
+ builder.WriteString(_m.ModelNumber)
builder.WriteString(", ")
builder.WriteString("manufacturer=")
- builder.WriteString(i.Manufacturer)
+ builder.WriteString(_m.Manufacturer)
builder.WriteString(", ")
builder.WriteString("lifetime_warranty=")
- builder.WriteString(fmt.Sprintf("%v", i.LifetimeWarranty))
+ builder.WriteString(fmt.Sprintf("%v", _m.LifetimeWarranty))
builder.WriteString(", ")
builder.WriteString("warranty_expires=")
- builder.WriteString(i.WarrantyExpires.Format(time.ANSIC))
+ builder.WriteString(_m.WarrantyExpires.Format(time.ANSIC))
builder.WriteString(", ")
builder.WriteString("warranty_details=")
- builder.WriteString(i.WarrantyDetails)
+ builder.WriteString(_m.WarrantyDetails)
builder.WriteString(", ")
builder.WriteString("purchase_time=")
- builder.WriteString(i.PurchaseTime.Format(time.ANSIC))
+ builder.WriteString(_m.PurchaseTime.Format(time.ANSIC))
builder.WriteString(", ")
builder.WriteString("purchase_from=")
- builder.WriteString(i.PurchaseFrom)
+ builder.WriteString(_m.PurchaseFrom)
builder.WriteString(", ")
builder.WriteString("purchase_price=")
- builder.WriteString(fmt.Sprintf("%v", i.PurchasePrice))
+ builder.WriteString(fmt.Sprintf("%v", _m.PurchasePrice))
builder.WriteString(", ")
builder.WriteString("sold_time=")
- builder.WriteString(i.SoldTime.Format(time.ANSIC))
+ builder.WriteString(_m.SoldTime.Format(time.ANSIC))
builder.WriteString(", ")
builder.WriteString("sold_to=")
- builder.WriteString(i.SoldTo)
+ builder.WriteString(_m.SoldTo)
builder.WriteString(", ")
builder.WriteString("sold_price=")
- builder.WriteString(fmt.Sprintf("%v", i.SoldPrice))
+ builder.WriteString(fmt.Sprintf("%v", _m.SoldPrice))
builder.WriteString(", ")
builder.WriteString("sold_notes=")
- builder.WriteString(i.SoldNotes)
+ builder.WriteString(_m.SoldNotes)
builder.WriteByte(')')
return builder.String()
}
diff --git a/backend/internal/data/ent/item_create.go b/backend/internal/data/ent/item_create.go
index a9b79cdd..48a77a8e 100644
--- a/backend/internal/data/ent/item_create.go
+++ b/backend/internal/data/ent/item_create.go
@@ -28,485 +28,485 @@ type ItemCreate struct {
}
// SetCreatedAt sets the "created_at" field.
-func (ic *ItemCreate) SetCreatedAt(t time.Time) *ItemCreate {
- ic.mutation.SetCreatedAt(t)
- return ic
+func (_c *ItemCreate) SetCreatedAt(v time.Time) *ItemCreate {
+ _c.mutation.SetCreatedAt(v)
+ return _c
}
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
-func (ic *ItemCreate) SetNillableCreatedAt(t *time.Time) *ItemCreate {
- if t != nil {
- ic.SetCreatedAt(*t)
+func (_c *ItemCreate) SetNillableCreatedAt(v *time.Time) *ItemCreate {
+ if v != nil {
+ _c.SetCreatedAt(*v)
}
- return ic
+ return _c
}
// SetUpdatedAt sets the "updated_at" field.
-func (ic *ItemCreate) SetUpdatedAt(t time.Time) *ItemCreate {
- ic.mutation.SetUpdatedAt(t)
- return ic
+func (_c *ItemCreate) SetUpdatedAt(v time.Time) *ItemCreate {
+ _c.mutation.SetUpdatedAt(v)
+ return _c
}
// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
-func (ic *ItemCreate) SetNillableUpdatedAt(t *time.Time) *ItemCreate {
- if t != nil {
- ic.SetUpdatedAt(*t)
+func (_c *ItemCreate) SetNillableUpdatedAt(v *time.Time) *ItemCreate {
+ if v != nil {
+ _c.SetUpdatedAt(*v)
}
- return ic
+ return _c
}
// SetName sets the "name" field.
-func (ic *ItemCreate) SetName(s string) *ItemCreate {
- ic.mutation.SetName(s)
- return ic
+func (_c *ItemCreate) SetName(v string) *ItemCreate {
+ _c.mutation.SetName(v)
+ return _c
}
// SetDescription sets the "description" field.
-func (ic *ItemCreate) SetDescription(s string) *ItemCreate {
- ic.mutation.SetDescription(s)
- return ic
+func (_c *ItemCreate) SetDescription(v string) *ItemCreate {
+ _c.mutation.SetDescription(v)
+ return _c
}
// SetNillableDescription sets the "description" field if the given value is not nil.
-func (ic *ItemCreate) SetNillableDescription(s *string) *ItemCreate {
- if s != nil {
- ic.SetDescription(*s)
+func (_c *ItemCreate) SetNillableDescription(v *string) *ItemCreate {
+ if v != nil {
+ _c.SetDescription(*v)
}
- return ic
+ return _c
}
// SetImportRef sets the "import_ref" field.
-func (ic *ItemCreate) SetImportRef(s string) *ItemCreate {
- ic.mutation.SetImportRef(s)
- return ic
+func (_c *ItemCreate) SetImportRef(v string) *ItemCreate {
+ _c.mutation.SetImportRef(v)
+ return _c
}
// SetNillableImportRef sets the "import_ref" field if the given value is not nil.
-func (ic *ItemCreate) SetNillableImportRef(s *string) *ItemCreate {
- if s != nil {
- ic.SetImportRef(*s)
+func (_c *ItemCreate) SetNillableImportRef(v *string) *ItemCreate {
+ if v != nil {
+ _c.SetImportRef(*v)
}
- return ic
+ return _c
}
// SetNotes sets the "notes" field.
-func (ic *ItemCreate) SetNotes(s string) *ItemCreate {
- ic.mutation.SetNotes(s)
- return ic
+func (_c *ItemCreate) SetNotes(v string) *ItemCreate {
+ _c.mutation.SetNotes(v)
+ return _c
}
// SetNillableNotes sets the "notes" field if the given value is not nil.
-func (ic *ItemCreate) SetNillableNotes(s *string) *ItemCreate {
- if s != nil {
- ic.SetNotes(*s)
+func (_c *ItemCreate) SetNillableNotes(v *string) *ItemCreate {
+ if v != nil {
+ _c.SetNotes(*v)
}
- return ic
+ return _c
}
// SetQuantity sets the "quantity" field.
-func (ic *ItemCreate) SetQuantity(i int) *ItemCreate {
- ic.mutation.SetQuantity(i)
- return ic
+func (_c *ItemCreate) SetQuantity(v int) *ItemCreate {
+ _c.mutation.SetQuantity(v)
+ return _c
}
// SetNillableQuantity sets the "quantity" field if the given value is not nil.
-func (ic *ItemCreate) SetNillableQuantity(i *int) *ItemCreate {
- if i != nil {
- ic.SetQuantity(*i)
+func (_c *ItemCreate) SetNillableQuantity(v *int) *ItemCreate {
+ if v != nil {
+ _c.SetQuantity(*v)
}
- return ic
+ return _c
}
// SetInsured sets the "insured" field.
-func (ic *ItemCreate) SetInsured(b bool) *ItemCreate {
- ic.mutation.SetInsured(b)
- return ic
+func (_c *ItemCreate) SetInsured(v bool) *ItemCreate {
+ _c.mutation.SetInsured(v)
+ return _c
}
// SetNillableInsured sets the "insured" field if the given value is not nil.
-func (ic *ItemCreate) SetNillableInsured(b *bool) *ItemCreate {
- if b != nil {
- ic.SetInsured(*b)
+func (_c *ItemCreate) SetNillableInsured(v *bool) *ItemCreate {
+ if v != nil {
+ _c.SetInsured(*v)
}
- return ic
+ return _c
}
// SetArchived sets the "archived" field.
-func (ic *ItemCreate) SetArchived(b bool) *ItemCreate {
- ic.mutation.SetArchived(b)
- return ic
+func (_c *ItemCreate) SetArchived(v bool) *ItemCreate {
+ _c.mutation.SetArchived(v)
+ return _c
}
// SetNillableArchived sets the "archived" field if the given value is not nil.
-func (ic *ItemCreate) SetNillableArchived(b *bool) *ItemCreate {
- if b != nil {
- ic.SetArchived(*b)
+func (_c *ItemCreate) SetNillableArchived(v *bool) *ItemCreate {
+ if v != nil {
+ _c.SetArchived(*v)
}
- return ic
+ return _c
}
// SetAssetID sets the "asset_id" field.
-func (ic *ItemCreate) SetAssetID(i int) *ItemCreate {
- ic.mutation.SetAssetID(i)
- return ic
+func (_c *ItemCreate) SetAssetID(v int) *ItemCreate {
+ _c.mutation.SetAssetID(v)
+ return _c
}
// SetNillableAssetID sets the "asset_id" field if the given value is not nil.
-func (ic *ItemCreate) SetNillableAssetID(i *int) *ItemCreate {
- if i != nil {
- ic.SetAssetID(*i)
+func (_c *ItemCreate) SetNillableAssetID(v *int) *ItemCreate {
+ if v != nil {
+ _c.SetAssetID(*v)
}
- return ic
+ return _c
}
// SetSyncChildItemsLocations sets the "sync_child_items_locations" field.
-func (ic *ItemCreate) SetSyncChildItemsLocations(b bool) *ItemCreate {
- ic.mutation.SetSyncChildItemsLocations(b)
- return ic
+func (_c *ItemCreate) SetSyncChildItemsLocations(v bool) *ItemCreate {
+ _c.mutation.SetSyncChildItemsLocations(v)
+ return _c
}
// SetNillableSyncChildItemsLocations sets the "sync_child_items_locations" field if the given value is not nil.
-func (ic *ItemCreate) SetNillableSyncChildItemsLocations(b *bool) *ItemCreate {
- if b != nil {
- ic.SetSyncChildItemsLocations(*b)
+func (_c *ItemCreate) SetNillableSyncChildItemsLocations(v *bool) *ItemCreate {
+ if v != nil {
+ _c.SetSyncChildItemsLocations(*v)
}
- return ic
+ return _c
}
// SetSerialNumber sets the "serial_number" field.
-func (ic *ItemCreate) SetSerialNumber(s string) *ItemCreate {
- ic.mutation.SetSerialNumber(s)
- return ic
+func (_c *ItemCreate) SetSerialNumber(v string) *ItemCreate {
+ _c.mutation.SetSerialNumber(v)
+ return _c
}
// SetNillableSerialNumber sets the "serial_number" field if the given value is not nil.
-func (ic *ItemCreate) SetNillableSerialNumber(s *string) *ItemCreate {
- if s != nil {
- ic.SetSerialNumber(*s)
+func (_c *ItemCreate) SetNillableSerialNumber(v *string) *ItemCreate {
+ if v != nil {
+ _c.SetSerialNumber(*v)
}
- return ic
+ return _c
}
// SetModelNumber sets the "model_number" field.
-func (ic *ItemCreate) SetModelNumber(s string) *ItemCreate {
- ic.mutation.SetModelNumber(s)
- return ic
+func (_c *ItemCreate) SetModelNumber(v string) *ItemCreate {
+ _c.mutation.SetModelNumber(v)
+ return _c
}
// SetNillableModelNumber sets the "model_number" field if the given value is not nil.
-func (ic *ItemCreate) SetNillableModelNumber(s *string) *ItemCreate {
- if s != nil {
- ic.SetModelNumber(*s)
+func (_c *ItemCreate) SetNillableModelNumber(v *string) *ItemCreate {
+ if v != nil {
+ _c.SetModelNumber(*v)
}
- return ic
+ return _c
}
// SetManufacturer sets the "manufacturer" field.
-func (ic *ItemCreate) SetManufacturer(s string) *ItemCreate {
- ic.mutation.SetManufacturer(s)
- return ic
+func (_c *ItemCreate) SetManufacturer(v string) *ItemCreate {
+ _c.mutation.SetManufacturer(v)
+ return _c
}
// SetNillableManufacturer sets the "manufacturer" field if the given value is not nil.
-func (ic *ItemCreate) SetNillableManufacturer(s *string) *ItemCreate {
- if s != nil {
- ic.SetManufacturer(*s)
+func (_c *ItemCreate) SetNillableManufacturer(v *string) *ItemCreate {
+ if v != nil {
+ _c.SetManufacturer(*v)
}
- return ic
+ return _c
}
// SetLifetimeWarranty sets the "lifetime_warranty" field.
-func (ic *ItemCreate) SetLifetimeWarranty(b bool) *ItemCreate {
- ic.mutation.SetLifetimeWarranty(b)
- return ic
+func (_c *ItemCreate) SetLifetimeWarranty(v bool) *ItemCreate {
+ _c.mutation.SetLifetimeWarranty(v)
+ return _c
}
// SetNillableLifetimeWarranty sets the "lifetime_warranty" field if the given value is not nil.
-func (ic *ItemCreate) SetNillableLifetimeWarranty(b *bool) *ItemCreate {
- if b != nil {
- ic.SetLifetimeWarranty(*b)
+func (_c *ItemCreate) SetNillableLifetimeWarranty(v *bool) *ItemCreate {
+ if v != nil {
+ _c.SetLifetimeWarranty(*v)
}
- return ic
+ return _c
}
// SetWarrantyExpires sets the "warranty_expires" field.
-func (ic *ItemCreate) SetWarrantyExpires(t time.Time) *ItemCreate {
- ic.mutation.SetWarrantyExpires(t)
- return ic
+func (_c *ItemCreate) SetWarrantyExpires(v time.Time) *ItemCreate {
+ _c.mutation.SetWarrantyExpires(v)
+ return _c
}
// SetNillableWarrantyExpires sets the "warranty_expires" field if the given value is not nil.
-func (ic *ItemCreate) SetNillableWarrantyExpires(t *time.Time) *ItemCreate {
- if t != nil {
- ic.SetWarrantyExpires(*t)
+func (_c *ItemCreate) SetNillableWarrantyExpires(v *time.Time) *ItemCreate {
+ if v != nil {
+ _c.SetWarrantyExpires(*v)
}
- return ic
+ return _c
}
// SetWarrantyDetails sets the "warranty_details" field.
-func (ic *ItemCreate) SetWarrantyDetails(s string) *ItemCreate {
- ic.mutation.SetWarrantyDetails(s)
- return ic
+func (_c *ItemCreate) SetWarrantyDetails(v string) *ItemCreate {
+ _c.mutation.SetWarrantyDetails(v)
+ return _c
}
// SetNillableWarrantyDetails sets the "warranty_details" field if the given value is not nil.
-func (ic *ItemCreate) SetNillableWarrantyDetails(s *string) *ItemCreate {
- if s != nil {
- ic.SetWarrantyDetails(*s)
+func (_c *ItemCreate) SetNillableWarrantyDetails(v *string) *ItemCreate {
+ if v != nil {
+ _c.SetWarrantyDetails(*v)
}
- return ic
+ return _c
}
// SetPurchaseTime sets the "purchase_time" field.
-func (ic *ItemCreate) SetPurchaseTime(t time.Time) *ItemCreate {
- ic.mutation.SetPurchaseTime(t)
- return ic
+func (_c *ItemCreate) SetPurchaseTime(v time.Time) *ItemCreate {
+ _c.mutation.SetPurchaseTime(v)
+ return _c
}
// SetNillablePurchaseTime sets the "purchase_time" field if the given value is not nil.
-func (ic *ItemCreate) SetNillablePurchaseTime(t *time.Time) *ItemCreate {
- if t != nil {
- ic.SetPurchaseTime(*t)
+func (_c *ItemCreate) SetNillablePurchaseTime(v *time.Time) *ItemCreate {
+ if v != nil {
+ _c.SetPurchaseTime(*v)
}
- return ic
+ return _c
}
// SetPurchaseFrom sets the "purchase_from" field.
-func (ic *ItemCreate) SetPurchaseFrom(s string) *ItemCreate {
- ic.mutation.SetPurchaseFrom(s)
- return ic
+func (_c *ItemCreate) SetPurchaseFrom(v string) *ItemCreate {
+ _c.mutation.SetPurchaseFrom(v)
+ return _c
}
// SetNillablePurchaseFrom sets the "purchase_from" field if the given value is not nil.
-func (ic *ItemCreate) SetNillablePurchaseFrom(s *string) *ItemCreate {
- if s != nil {
- ic.SetPurchaseFrom(*s)
+func (_c *ItemCreate) SetNillablePurchaseFrom(v *string) *ItemCreate {
+ if v != nil {
+ _c.SetPurchaseFrom(*v)
}
- return ic
+ return _c
}
// SetPurchasePrice sets the "purchase_price" field.
-func (ic *ItemCreate) SetPurchasePrice(f float64) *ItemCreate {
- ic.mutation.SetPurchasePrice(f)
- return ic
+func (_c *ItemCreate) SetPurchasePrice(v float64) *ItemCreate {
+ _c.mutation.SetPurchasePrice(v)
+ return _c
}
// SetNillablePurchasePrice sets the "purchase_price" field if the given value is not nil.
-func (ic *ItemCreate) SetNillablePurchasePrice(f *float64) *ItemCreate {
- if f != nil {
- ic.SetPurchasePrice(*f)
+func (_c *ItemCreate) SetNillablePurchasePrice(v *float64) *ItemCreate {
+ if v != nil {
+ _c.SetPurchasePrice(*v)
}
- return ic
+ return _c
}
// SetSoldTime sets the "sold_time" field.
-func (ic *ItemCreate) SetSoldTime(t time.Time) *ItemCreate {
- ic.mutation.SetSoldTime(t)
- return ic
+func (_c *ItemCreate) SetSoldTime(v time.Time) *ItemCreate {
+ _c.mutation.SetSoldTime(v)
+ return _c
}
// SetNillableSoldTime sets the "sold_time" field if the given value is not nil.
-func (ic *ItemCreate) SetNillableSoldTime(t *time.Time) *ItemCreate {
- if t != nil {
- ic.SetSoldTime(*t)
+func (_c *ItemCreate) SetNillableSoldTime(v *time.Time) *ItemCreate {
+ if v != nil {
+ _c.SetSoldTime(*v)
}
- return ic
+ return _c
}
// SetSoldTo sets the "sold_to" field.
-func (ic *ItemCreate) SetSoldTo(s string) *ItemCreate {
- ic.mutation.SetSoldTo(s)
- return ic
+func (_c *ItemCreate) SetSoldTo(v string) *ItemCreate {
+ _c.mutation.SetSoldTo(v)
+ return _c
}
// SetNillableSoldTo sets the "sold_to" field if the given value is not nil.
-func (ic *ItemCreate) SetNillableSoldTo(s *string) *ItemCreate {
- if s != nil {
- ic.SetSoldTo(*s)
+func (_c *ItemCreate) SetNillableSoldTo(v *string) *ItemCreate {
+ if v != nil {
+ _c.SetSoldTo(*v)
}
- return ic
+ return _c
}
// SetSoldPrice sets the "sold_price" field.
-func (ic *ItemCreate) SetSoldPrice(f float64) *ItemCreate {
- ic.mutation.SetSoldPrice(f)
- return ic
+func (_c *ItemCreate) SetSoldPrice(v float64) *ItemCreate {
+ _c.mutation.SetSoldPrice(v)
+ return _c
}
// SetNillableSoldPrice sets the "sold_price" field if the given value is not nil.
-func (ic *ItemCreate) SetNillableSoldPrice(f *float64) *ItemCreate {
- if f != nil {
- ic.SetSoldPrice(*f)
+func (_c *ItemCreate) SetNillableSoldPrice(v *float64) *ItemCreate {
+ if v != nil {
+ _c.SetSoldPrice(*v)
}
- return ic
+ return _c
}
// SetSoldNotes sets the "sold_notes" field.
-func (ic *ItemCreate) SetSoldNotes(s string) *ItemCreate {
- ic.mutation.SetSoldNotes(s)
- return ic
+func (_c *ItemCreate) SetSoldNotes(v string) *ItemCreate {
+ _c.mutation.SetSoldNotes(v)
+ return _c
}
// SetNillableSoldNotes sets the "sold_notes" field if the given value is not nil.
-func (ic *ItemCreate) SetNillableSoldNotes(s *string) *ItemCreate {
- if s != nil {
- ic.SetSoldNotes(*s)
+func (_c *ItemCreate) SetNillableSoldNotes(v *string) *ItemCreate {
+ if v != nil {
+ _c.SetSoldNotes(*v)
}
- return ic
+ return _c
}
// SetID sets the "id" field.
-func (ic *ItemCreate) SetID(u uuid.UUID) *ItemCreate {
- ic.mutation.SetID(u)
- return ic
+func (_c *ItemCreate) SetID(v uuid.UUID) *ItemCreate {
+ _c.mutation.SetID(v)
+ return _c
}
// SetNillableID sets the "id" field if the given value is not nil.
-func (ic *ItemCreate) SetNillableID(u *uuid.UUID) *ItemCreate {
- if u != nil {
- ic.SetID(*u)
+func (_c *ItemCreate) SetNillableID(v *uuid.UUID) *ItemCreate {
+ if v != nil {
+ _c.SetID(*v)
}
- return ic
+ return _c
}
// SetGroupID sets the "group" edge to the Group entity by ID.
-func (ic *ItemCreate) SetGroupID(id uuid.UUID) *ItemCreate {
- ic.mutation.SetGroupID(id)
- return ic
+func (_c *ItemCreate) SetGroupID(id uuid.UUID) *ItemCreate {
+ _c.mutation.SetGroupID(id)
+ return _c
}
// SetGroup sets the "group" edge to the Group entity.
-func (ic *ItemCreate) SetGroup(g *Group) *ItemCreate {
- return ic.SetGroupID(g.ID)
+func (_c *ItemCreate) SetGroup(v *Group) *ItemCreate {
+ return _c.SetGroupID(v.ID)
}
// SetParentID sets the "parent" edge to the Item entity by ID.
-func (ic *ItemCreate) SetParentID(id uuid.UUID) *ItemCreate {
- ic.mutation.SetParentID(id)
- return ic
+func (_c *ItemCreate) SetParentID(id uuid.UUID) *ItemCreate {
+ _c.mutation.SetParentID(id)
+ return _c
}
// SetNillableParentID sets the "parent" edge to the Item entity by ID if the given value is not nil.
-func (ic *ItemCreate) SetNillableParentID(id *uuid.UUID) *ItemCreate {
+func (_c *ItemCreate) SetNillableParentID(id *uuid.UUID) *ItemCreate {
if id != nil {
- ic = ic.SetParentID(*id)
+ _c = _c.SetParentID(*id)
}
- return ic
+ return _c
}
// SetParent sets the "parent" edge to the Item entity.
-func (ic *ItemCreate) SetParent(i *Item) *ItemCreate {
- return ic.SetParentID(i.ID)
+func (_c *ItemCreate) SetParent(v *Item) *ItemCreate {
+ return _c.SetParentID(v.ID)
}
// AddChildIDs adds the "children" edge to the Item entity by IDs.
-func (ic *ItemCreate) AddChildIDs(ids ...uuid.UUID) *ItemCreate {
- ic.mutation.AddChildIDs(ids...)
- return ic
+func (_c *ItemCreate) AddChildIDs(ids ...uuid.UUID) *ItemCreate {
+ _c.mutation.AddChildIDs(ids...)
+ return _c
}
// AddChildren adds the "children" edges to the Item entity.
-func (ic *ItemCreate) AddChildren(i ...*Item) *ItemCreate {
- ids := make([]uuid.UUID, len(i))
- for j := range i {
- ids[j] = i[j].ID
+func (_c *ItemCreate) AddChildren(v ...*Item) *ItemCreate {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return ic.AddChildIDs(ids...)
+ return _c.AddChildIDs(ids...)
}
// AddLabelIDs adds the "label" edge to the Label entity by IDs.
-func (ic *ItemCreate) AddLabelIDs(ids ...uuid.UUID) *ItemCreate {
- ic.mutation.AddLabelIDs(ids...)
- return ic
+func (_c *ItemCreate) AddLabelIDs(ids ...uuid.UUID) *ItemCreate {
+ _c.mutation.AddLabelIDs(ids...)
+ return _c
}
// AddLabel adds the "label" edges to the Label entity.
-func (ic *ItemCreate) AddLabel(l ...*Label) *ItemCreate {
- ids := make([]uuid.UUID, len(l))
- for i := range l {
- ids[i] = l[i].ID
+func (_c *ItemCreate) AddLabel(v ...*Label) *ItemCreate {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return ic.AddLabelIDs(ids...)
+ return _c.AddLabelIDs(ids...)
}
// SetLocationID sets the "location" edge to the Location entity by ID.
-func (ic *ItemCreate) SetLocationID(id uuid.UUID) *ItemCreate {
- ic.mutation.SetLocationID(id)
- return ic
+func (_c *ItemCreate) SetLocationID(id uuid.UUID) *ItemCreate {
+ _c.mutation.SetLocationID(id)
+ return _c
}
// SetNillableLocationID sets the "location" edge to the Location entity by ID if the given value is not nil.
-func (ic *ItemCreate) SetNillableLocationID(id *uuid.UUID) *ItemCreate {
+func (_c *ItemCreate) SetNillableLocationID(id *uuid.UUID) *ItemCreate {
if id != nil {
- ic = ic.SetLocationID(*id)
+ _c = _c.SetLocationID(*id)
}
- return ic
+ return _c
}
// SetLocation sets the "location" edge to the Location entity.
-func (ic *ItemCreate) SetLocation(l *Location) *ItemCreate {
- return ic.SetLocationID(l.ID)
+func (_c *ItemCreate) SetLocation(v *Location) *ItemCreate {
+ return _c.SetLocationID(v.ID)
}
// AddFieldIDs adds the "fields" edge to the ItemField entity by IDs.
-func (ic *ItemCreate) AddFieldIDs(ids ...uuid.UUID) *ItemCreate {
- ic.mutation.AddFieldIDs(ids...)
- return ic
+func (_c *ItemCreate) AddFieldIDs(ids ...uuid.UUID) *ItemCreate {
+ _c.mutation.AddFieldIDs(ids...)
+ return _c
}
// AddFields adds the "fields" edges to the ItemField entity.
-func (ic *ItemCreate) AddFields(i ...*ItemField) *ItemCreate {
- ids := make([]uuid.UUID, len(i))
- for j := range i {
- ids[j] = i[j].ID
+func (_c *ItemCreate) AddFields(v ...*ItemField) *ItemCreate {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return ic.AddFieldIDs(ids...)
+ return _c.AddFieldIDs(ids...)
}
// AddMaintenanceEntryIDs adds the "maintenance_entries" edge to the MaintenanceEntry entity by IDs.
-func (ic *ItemCreate) AddMaintenanceEntryIDs(ids ...uuid.UUID) *ItemCreate {
- ic.mutation.AddMaintenanceEntryIDs(ids...)
- return ic
+func (_c *ItemCreate) AddMaintenanceEntryIDs(ids ...uuid.UUID) *ItemCreate {
+ _c.mutation.AddMaintenanceEntryIDs(ids...)
+ return _c
}
// AddMaintenanceEntries adds the "maintenance_entries" edges to the MaintenanceEntry entity.
-func (ic *ItemCreate) AddMaintenanceEntries(m ...*MaintenanceEntry) *ItemCreate {
- ids := make([]uuid.UUID, len(m))
- for i := range m {
- ids[i] = m[i].ID
+func (_c *ItemCreate) AddMaintenanceEntries(v ...*MaintenanceEntry) *ItemCreate {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return ic.AddMaintenanceEntryIDs(ids...)
+ return _c.AddMaintenanceEntryIDs(ids...)
}
// AddAttachmentIDs adds the "attachments" edge to the Attachment entity by IDs.
-func (ic *ItemCreate) AddAttachmentIDs(ids ...uuid.UUID) *ItemCreate {
- ic.mutation.AddAttachmentIDs(ids...)
- return ic
+func (_c *ItemCreate) AddAttachmentIDs(ids ...uuid.UUID) *ItemCreate {
+ _c.mutation.AddAttachmentIDs(ids...)
+ return _c
}
// AddAttachments adds the "attachments" edges to the Attachment entity.
-func (ic *ItemCreate) AddAttachments(a ...*Attachment) *ItemCreate {
- ids := make([]uuid.UUID, len(a))
- for i := range a {
- ids[i] = a[i].ID
+func (_c *ItemCreate) AddAttachments(v ...*Attachment) *ItemCreate {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return ic.AddAttachmentIDs(ids...)
+ return _c.AddAttachmentIDs(ids...)
}
// Mutation returns the ItemMutation object of the builder.
-func (ic *ItemCreate) Mutation() *ItemMutation {
- return ic.mutation
+func (_c *ItemCreate) Mutation() *ItemMutation {
+ return _c.mutation
}
// Save creates the Item in the database.
-func (ic *ItemCreate) Save(ctx context.Context) (*Item, error) {
- ic.defaults()
- return withHooks(ctx, ic.sqlSave, ic.mutation, ic.hooks)
+func (_c *ItemCreate) Save(ctx context.Context) (*Item, error) {
+ _c.defaults()
+ return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
}
// SaveX calls Save and panics if Save returns an error.
-func (ic *ItemCreate) SaveX(ctx context.Context) *Item {
- v, err := ic.Save(ctx)
+func (_c *ItemCreate) SaveX(ctx context.Context) *Item {
+ v, err := _c.Save(ctx)
if err != nil {
panic(err)
}
@@ -514,158 +514,158 @@ func (ic *ItemCreate) SaveX(ctx context.Context) *Item {
}
// Exec executes the query.
-func (ic *ItemCreate) Exec(ctx context.Context) error {
- _, err := ic.Save(ctx)
+func (_c *ItemCreate) Exec(ctx context.Context) error {
+ _, err := _c.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
-func (ic *ItemCreate) ExecX(ctx context.Context) {
- if err := ic.Exec(ctx); err != nil {
+func (_c *ItemCreate) ExecX(ctx context.Context) {
+ if err := _c.Exec(ctx); err != nil {
panic(err)
}
}
// defaults sets the default values of the builder before save.
-func (ic *ItemCreate) defaults() {
- if _, ok := ic.mutation.CreatedAt(); !ok {
+func (_c *ItemCreate) defaults() {
+ if _, ok := _c.mutation.CreatedAt(); !ok {
v := item.DefaultCreatedAt()
- ic.mutation.SetCreatedAt(v)
+ _c.mutation.SetCreatedAt(v)
}
- if _, ok := ic.mutation.UpdatedAt(); !ok {
+ if _, ok := _c.mutation.UpdatedAt(); !ok {
v := item.DefaultUpdatedAt()
- ic.mutation.SetUpdatedAt(v)
+ _c.mutation.SetUpdatedAt(v)
}
- if _, ok := ic.mutation.Quantity(); !ok {
+ if _, ok := _c.mutation.Quantity(); !ok {
v := item.DefaultQuantity
- ic.mutation.SetQuantity(v)
+ _c.mutation.SetQuantity(v)
}
- if _, ok := ic.mutation.Insured(); !ok {
+ if _, ok := _c.mutation.Insured(); !ok {
v := item.DefaultInsured
- ic.mutation.SetInsured(v)
+ _c.mutation.SetInsured(v)
}
- if _, ok := ic.mutation.Archived(); !ok {
+ if _, ok := _c.mutation.Archived(); !ok {
v := item.DefaultArchived
- ic.mutation.SetArchived(v)
+ _c.mutation.SetArchived(v)
}
- if _, ok := ic.mutation.AssetID(); !ok {
+ if _, ok := _c.mutation.AssetID(); !ok {
v := item.DefaultAssetID
- ic.mutation.SetAssetID(v)
+ _c.mutation.SetAssetID(v)
}
- if _, ok := ic.mutation.SyncChildItemsLocations(); !ok {
+ if _, ok := _c.mutation.SyncChildItemsLocations(); !ok {
v := item.DefaultSyncChildItemsLocations
- ic.mutation.SetSyncChildItemsLocations(v)
+ _c.mutation.SetSyncChildItemsLocations(v)
}
- if _, ok := ic.mutation.LifetimeWarranty(); !ok {
+ if _, ok := _c.mutation.LifetimeWarranty(); !ok {
v := item.DefaultLifetimeWarranty
- ic.mutation.SetLifetimeWarranty(v)
+ _c.mutation.SetLifetimeWarranty(v)
}
- if _, ok := ic.mutation.PurchasePrice(); !ok {
+ if _, ok := _c.mutation.PurchasePrice(); !ok {
v := item.DefaultPurchasePrice
- ic.mutation.SetPurchasePrice(v)
+ _c.mutation.SetPurchasePrice(v)
}
- if _, ok := ic.mutation.SoldPrice(); !ok {
+ if _, ok := _c.mutation.SoldPrice(); !ok {
v := item.DefaultSoldPrice
- ic.mutation.SetSoldPrice(v)
+ _c.mutation.SetSoldPrice(v)
}
- if _, ok := ic.mutation.ID(); !ok {
+ if _, ok := _c.mutation.ID(); !ok {
v := item.DefaultID()
- ic.mutation.SetID(v)
+ _c.mutation.SetID(v)
}
}
// check runs all checks and user-defined validators on the builder.
-func (ic *ItemCreate) check() error {
- if _, ok := ic.mutation.CreatedAt(); !ok {
+func (_c *ItemCreate) check() error {
+ if _, ok := _c.mutation.CreatedAt(); !ok {
return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "Item.created_at"`)}
}
- if _, ok := ic.mutation.UpdatedAt(); !ok {
+ if _, ok := _c.mutation.UpdatedAt(); !ok {
return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "Item.updated_at"`)}
}
- if _, ok := ic.mutation.Name(); !ok {
+ if _, ok := _c.mutation.Name(); !ok {
return &ValidationError{Name: "name", err: errors.New(`ent: missing required field "Item.name"`)}
}
- if v, ok := ic.mutation.Name(); ok {
+ if v, ok := _c.mutation.Name(); ok {
if err := item.NameValidator(v); err != nil {
return &ValidationError{Name: "name", err: fmt.Errorf(`ent: validator failed for field "Item.name": %w`, err)}
}
}
- if v, ok := ic.mutation.Description(); ok {
+ if v, ok := _c.mutation.Description(); ok {
if err := item.DescriptionValidator(v); err != nil {
return &ValidationError{Name: "description", err: fmt.Errorf(`ent: validator failed for field "Item.description": %w`, err)}
}
}
- if v, ok := ic.mutation.ImportRef(); ok {
+ if v, ok := _c.mutation.ImportRef(); ok {
if err := item.ImportRefValidator(v); err != nil {
return &ValidationError{Name: "import_ref", err: fmt.Errorf(`ent: validator failed for field "Item.import_ref": %w`, err)}
}
}
- if v, ok := ic.mutation.Notes(); ok {
+ if v, ok := _c.mutation.Notes(); ok {
if err := item.NotesValidator(v); err != nil {
return &ValidationError{Name: "notes", err: fmt.Errorf(`ent: validator failed for field "Item.notes": %w`, err)}
}
}
- if _, ok := ic.mutation.Quantity(); !ok {
+ if _, ok := _c.mutation.Quantity(); !ok {
return &ValidationError{Name: "quantity", err: errors.New(`ent: missing required field "Item.quantity"`)}
}
- if _, ok := ic.mutation.Insured(); !ok {
+ if _, ok := _c.mutation.Insured(); !ok {
return &ValidationError{Name: "insured", err: errors.New(`ent: missing required field "Item.insured"`)}
}
- if _, ok := ic.mutation.Archived(); !ok {
+ if _, ok := _c.mutation.Archived(); !ok {
return &ValidationError{Name: "archived", err: errors.New(`ent: missing required field "Item.archived"`)}
}
- if _, ok := ic.mutation.AssetID(); !ok {
+ if _, ok := _c.mutation.AssetID(); !ok {
return &ValidationError{Name: "asset_id", err: errors.New(`ent: missing required field "Item.asset_id"`)}
}
- if _, ok := ic.mutation.SyncChildItemsLocations(); !ok {
+ if _, ok := _c.mutation.SyncChildItemsLocations(); !ok {
return &ValidationError{Name: "sync_child_items_locations", err: errors.New(`ent: missing required field "Item.sync_child_items_locations"`)}
}
- if v, ok := ic.mutation.SerialNumber(); ok {
+ if v, ok := _c.mutation.SerialNumber(); ok {
if err := item.SerialNumberValidator(v); err != nil {
return &ValidationError{Name: "serial_number", err: fmt.Errorf(`ent: validator failed for field "Item.serial_number": %w`, err)}
}
}
- if v, ok := ic.mutation.ModelNumber(); ok {
+ if v, ok := _c.mutation.ModelNumber(); ok {
if err := item.ModelNumberValidator(v); err != nil {
return &ValidationError{Name: "model_number", err: fmt.Errorf(`ent: validator failed for field "Item.model_number": %w`, err)}
}
}
- if v, ok := ic.mutation.Manufacturer(); ok {
+ if v, ok := _c.mutation.Manufacturer(); ok {
if err := item.ManufacturerValidator(v); err != nil {
return &ValidationError{Name: "manufacturer", err: fmt.Errorf(`ent: validator failed for field "Item.manufacturer": %w`, err)}
}
}
- if _, ok := ic.mutation.LifetimeWarranty(); !ok {
+ if _, ok := _c.mutation.LifetimeWarranty(); !ok {
return &ValidationError{Name: "lifetime_warranty", err: errors.New(`ent: missing required field "Item.lifetime_warranty"`)}
}
- if v, ok := ic.mutation.WarrantyDetails(); ok {
+ if v, ok := _c.mutation.WarrantyDetails(); ok {
if err := item.WarrantyDetailsValidator(v); err != nil {
return &ValidationError{Name: "warranty_details", err: fmt.Errorf(`ent: validator failed for field "Item.warranty_details": %w`, err)}
}
}
- if _, ok := ic.mutation.PurchasePrice(); !ok {
+ if _, ok := _c.mutation.PurchasePrice(); !ok {
return &ValidationError{Name: "purchase_price", err: errors.New(`ent: missing required field "Item.purchase_price"`)}
}
- if _, ok := ic.mutation.SoldPrice(); !ok {
+ if _, ok := _c.mutation.SoldPrice(); !ok {
return &ValidationError{Name: "sold_price", err: errors.New(`ent: missing required field "Item.sold_price"`)}
}
- if v, ok := ic.mutation.SoldNotes(); ok {
+ if v, ok := _c.mutation.SoldNotes(); ok {
if err := item.SoldNotesValidator(v); err != nil {
return &ValidationError{Name: "sold_notes", err: fmt.Errorf(`ent: validator failed for field "Item.sold_notes": %w`, err)}
}
}
- if len(ic.mutation.GroupIDs()) == 0 {
+ if len(_c.mutation.GroupIDs()) == 0 {
return &ValidationError{Name: "group", err: errors.New(`ent: missing required edge "Item.group"`)}
}
return nil
}
-func (ic *ItemCreate) sqlSave(ctx context.Context) (*Item, error) {
- if err := ic.check(); err != nil {
+func (_c *ItemCreate) sqlSave(ctx context.Context) (*Item, error) {
+ if err := _c.check(); err != nil {
return nil, err
}
- _node, _spec := ic.createSpec()
- if err := sqlgraph.CreateNode(ctx, ic.driver, _spec); err != nil {
+ _node, _spec := _c.createSpec()
+ if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil {
if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
@@ -678,117 +678,117 @@ func (ic *ItemCreate) sqlSave(ctx context.Context) (*Item, error) {
return nil, err
}
}
- ic.mutation.id = &_node.ID
- ic.mutation.done = true
+ _c.mutation.id = &_node.ID
+ _c.mutation.done = true
return _node, nil
}
-func (ic *ItemCreate) createSpec() (*Item, *sqlgraph.CreateSpec) {
+func (_c *ItemCreate) createSpec() (*Item, *sqlgraph.CreateSpec) {
var (
- _node = &Item{config: ic.config}
+ _node = &Item{config: _c.config}
_spec = sqlgraph.NewCreateSpec(item.Table, sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID))
)
- if id, ok := ic.mutation.ID(); ok {
+ if id, ok := _c.mutation.ID(); ok {
_node.ID = id
_spec.ID.Value = &id
}
- if value, ok := ic.mutation.CreatedAt(); ok {
+ if value, ok := _c.mutation.CreatedAt(); ok {
_spec.SetField(item.FieldCreatedAt, field.TypeTime, value)
_node.CreatedAt = value
}
- if value, ok := ic.mutation.UpdatedAt(); ok {
+ if value, ok := _c.mutation.UpdatedAt(); ok {
_spec.SetField(item.FieldUpdatedAt, field.TypeTime, value)
_node.UpdatedAt = value
}
- if value, ok := ic.mutation.Name(); ok {
+ if value, ok := _c.mutation.Name(); ok {
_spec.SetField(item.FieldName, field.TypeString, value)
_node.Name = value
}
- if value, ok := ic.mutation.Description(); ok {
+ if value, ok := _c.mutation.Description(); ok {
_spec.SetField(item.FieldDescription, field.TypeString, value)
_node.Description = value
}
- if value, ok := ic.mutation.ImportRef(); ok {
+ if value, ok := _c.mutation.ImportRef(); ok {
_spec.SetField(item.FieldImportRef, field.TypeString, value)
_node.ImportRef = value
}
- if value, ok := ic.mutation.Notes(); ok {
+ if value, ok := _c.mutation.Notes(); ok {
_spec.SetField(item.FieldNotes, field.TypeString, value)
_node.Notes = value
}
- if value, ok := ic.mutation.Quantity(); ok {
+ if value, ok := _c.mutation.Quantity(); ok {
_spec.SetField(item.FieldQuantity, field.TypeInt, value)
_node.Quantity = value
}
- if value, ok := ic.mutation.Insured(); ok {
+ if value, ok := _c.mutation.Insured(); ok {
_spec.SetField(item.FieldInsured, field.TypeBool, value)
_node.Insured = value
}
- if value, ok := ic.mutation.Archived(); ok {
+ if value, ok := _c.mutation.Archived(); ok {
_spec.SetField(item.FieldArchived, field.TypeBool, value)
_node.Archived = value
}
- if value, ok := ic.mutation.AssetID(); ok {
+ if value, ok := _c.mutation.AssetID(); ok {
_spec.SetField(item.FieldAssetID, field.TypeInt, value)
_node.AssetID = value
}
- if value, ok := ic.mutation.SyncChildItemsLocations(); ok {
+ if value, ok := _c.mutation.SyncChildItemsLocations(); ok {
_spec.SetField(item.FieldSyncChildItemsLocations, field.TypeBool, value)
_node.SyncChildItemsLocations = value
}
- if value, ok := ic.mutation.SerialNumber(); ok {
+ if value, ok := _c.mutation.SerialNumber(); ok {
_spec.SetField(item.FieldSerialNumber, field.TypeString, value)
_node.SerialNumber = value
}
- if value, ok := ic.mutation.ModelNumber(); ok {
+ if value, ok := _c.mutation.ModelNumber(); ok {
_spec.SetField(item.FieldModelNumber, field.TypeString, value)
_node.ModelNumber = value
}
- if value, ok := ic.mutation.Manufacturer(); ok {
+ if value, ok := _c.mutation.Manufacturer(); ok {
_spec.SetField(item.FieldManufacturer, field.TypeString, value)
_node.Manufacturer = value
}
- if value, ok := ic.mutation.LifetimeWarranty(); ok {
+ if value, ok := _c.mutation.LifetimeWarranty(); ok {
_spec.SetField(item.FieldLifetimeWarranty, field.TypeBool, value)
_node.LifetimeWarranty = value
}
- if value, ok := ic.mutation.WarrantyExpires(); ok {
+ if value, ok := _c.mutation.WarrantyExpires(); ok {
_spec.SetField(item.FieldWarrantyExpires, field.TypeTime, value)
_node.WarrantyExpires = value
}
- if value, ok := ic.mutation.WarrantyDetails(); ok {
+ if value, ok := _c.mutation.WarrantyDetails(); ok {
_spec.SetField(item.FieldWarrantyDetails, field.TypeString, value)
_node.WarrantyDetails = value
}
- if value, ok := ic.mutation.PurchaseTime(); ok {
+ if value, ok := _c.mutation.PurchaseTime(); ok {
_spec.SetField(item.FieldPurchaseTime, field.TypeTime, value)
_node.PurchaseTime = value
}
- if value, ok := ic.mutation.PurchaseFrom(); ok {
+ if value, ok := _c.mutation.PurchaseFrom(); ok {
_spec.SetField(item.FieldPurchaseFrom, field.TypeString, value)
_node.PurchaseFrom = value
}
- if value, ok := ic.mutation.PurchasePrice(); ok {
+ if value, ok := _c.mutation.PurchasePrice(); ok {
_spec.SetField(item.FieldPurchasePrice, field.TypeFloat64, value)
_node.PurchasePrice = value
}
- if value, ok := ic.mutation.SoldTime(); ok {
+ if value, ok := _c.mutation.SoldTime(); ok {
_spec.SetField(item.FieldSoldTime, field.TypeTime, value)
_node.SoldTime = value
}
- if value, ok := ic.mutation.SoldTo(); ok {
+ if value, ok := _c.mutation.SoldTo(); ok {
_spec.SetField(item.FieldSoldTo, field.TypeString, value)
_node.SoldTo = value
}
- if value, ok := ic.mutation.SoldPrice(); ok {
+ if value, ok := _c.mutation.SoldPrice(); ok {
_spec.SetField(item.FieldSoldPrice, field.TypeFloat64, value)
_node.SoldPrice = value
}
- if value, ok := ic.mutation.SoldNotes(); ok {
+ if value, ok := _c.mutation.SoldNotes(); ok {
_spec.SetField(item.FieldSoldNotes, field.TypeString, value)
_node.SoldNotes = value
}
- if nodes := ic.mutation.GroupIDs(); len(nodes) > 0 {
+ if nodes := _c.mutation.GroupIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -805,7 +805,7 @@ func (ic *ItemCreate) createSpec() (*Item, *sqlgraph.CreateSpec) {
_node.group_items = &nodes[0]
_spec.Edges = append(_spec.Edges, edge)
}
- if nodes := ic.mutation.ParentIDs(); len(nodes) > 0 {
+ if nodes := _c.mutation.ParentIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -822,7 +822,7 @@ func (ic *ItemCreate) createSpec() (*Item, *sqlgraph.CreateSpec) {
_node.item_children = &nodes[0]
_spec.Edges = append(_spec.Edges, edge)
}
- if nodes := ic.mutation.ChildrenIDs(); len(nodes) > 0 {
+ if nodes := _c.mutation.ChildrenIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -838,7 +838,7 @@ func (ic *ItemCreate) createSpec() (*Item, *sqlgraph.CreateSpec) {
}
_spec.Edges = append(_spec.Edges, edge)
}
- if nodes := ic.mutation.LabelIDs(); len(nodes) > 0 {
+ if nodes := _c.mutation.LabelIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2M,
Inverse: true,
@@ -854,7 +854,7 @@ func (ic *ItemCreate) createSpec() (*Item, *sqlgraph.CreateSpec) {
}
_spec.Edges = append(_spec.Edges, edge)
}
- if nodes := ic.mutation.LocationIDs(); len(nodes) > 0 {
+ if nodes := _c.mutation.LocationIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -871,7 +871,7 @@ func (ic *ItemCreate) createSpec() (*Item, *sqlgraph.CreateSpec) {
_node.location_items = &nodes[0]
_spec.Edges = append(_spec.Edges, edge)
}
- if nodes := ic.mutation.FieldsIDs(); len(nodes) > 0 {
+ if nodes := _c.mutation.FieldsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -887,7 +887,7 @@ func (ic *ItemCreate) createSpec() (*Item, *sqlgraph.CreateSpec) {
}
_spec.Edges = append(_spec.Edges, edge)
}
- if nodes := ic.mutation.MaintenanceEntriesIDs(); len(nodes) > 0 {
+ if nodes := _c.mutation.MaintenanceEntriesIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -903,7 +903,7 @@ func (ic *ItemCreate) createSpec() (*Item, *sqlgraph.CreateSpec) {
}
_spec.Edges = append(_spec.Edges, edge)
}
- if nodes := ic.mutation.AttachmentsIDs(); len(nodes) > 0 {
+ if nodes := _c.mutation.AttachmentsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -930,16 +930,16 @@ type ItemCreateBulk struct {
}
// Save creates the Item entities in the database.
-func (icb *ItemCreateBulk) Save(ctx context.Context) ([]*Item, error) {
- if icb.err != nil {
- return nil, icb.err
- }
- specs := make([]*sqlgraph.CreateSpec, len(icb.builders))
- nodes := make([]*Item, len(icb.builders))
- mutators := make([]Mutator, len(icb.builders))
- for i := range icb.builders {
+func (_c *ItemCreateBulk) Save(ctx context.Context) ([]*Item, error) {
+ if _c.err != nil {
+ return nil, _c.err
+ }
+ specs := make([]*sqlgraph.CreateSpec, len(_c.builders))
+ nodes := make([]*Item, len(_c.builders))
+ mutators := make([]Mutator, len(_c.builders))
+ for i := range _c.builders {
func(i int, root context.Context) {
- builder := icb.builders[i]
+ builder := _c.builders[i]
builder.defaults()
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
mutation, ok := m.(*ItemMutation)
@@ -953,11 +953,11 @@ func (icb *ItemCreateBulk) Save(ctx context.Context) ([]*Item, error) {
var err error
nodes[i], specs[i] = builder.createSpec()
if i < len(mutators)-1 {
- _, err = mutators[i+1].Mutate(root, icb.builders[i+1].mutation)
+ _, err = mutators[i+1].Mutate(root, _c.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, icb.driver, spec); err != nil {
+ if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil {
if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
@@ -977,7 +977,7 @@ func (icb *ItemCreateBulk) Save(ctx context.Context) ([]*Item, error) {
}(i, ctx)
}
if len(mutators) > 0 {
- if _, err := mutators[0].Mutate(ctx, icb.builders[0].mutation); err != nil {
+ if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil {
return nil, err
}
}
@@ -985,8 +985,8 @@ func (icb *ItemCreateBulk) Save(ctx context.Context) ([]*Item, error) {
}
// SaveX is like Save, but panics if an error occurs.
-func (icb *ItemCreateBulk) SaveX(ctx context.Context) []*Item {
- v, err := icb.Save(ctx)
+func (_c *ItemCreateBulk) SaveX(ctx context.Context) []*Item {
+ v, err := _c.Save(ctx)
if err != nil {
panic(err)
}
@@ -994,14 +994,14 @@ func (icb *ItemCreateBulk) SaveX(ctx context.Context) []*Item {
}
// Exec executes the query.
-func (icb *ItemCreateBulk) Exec(ctx context.Context) error {
- _, err := icb.Save(ctx)
+func (_c *ItemCreateBulk) Exec(ctx context.Context) error {
+ _, err := _c.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
-func (icb *ItemCreateBulk) ExecX(ctx context.Context) {
- if err := icb.Exec(ctx); err != nil {
+func (_c *ItemCreateBulk) ExecX(ctx context.Context) {
+ if err := _c.Exec(ctx); err != nil {
panic(err)
}
}
diff --git a/backend/internal/data/ent/item_delete.go b/backend/internal/data/ent/item_delete.go
index 12bee591..7a01bffe 100644
--- a/backend/internal/data/ent/item_delete.go
+++ b/backend/internal/data/ent/item_delete.go
@@ -20,56 +20,56 @@ type ItemDelete struct {
}
// Where appends a list predicates to the ItemDelete builder.
-func (id *ItemDelete) Where(ps ...predicate.Item) *ItemDelete {
- id.mutation.Where(ps...)
- return id
+func (_d *ItemDelete) Where(ps ...predicate.Item) *ItemDelete {
+ _d.mutation.Where(ps...)
+ return _d
}
// Exec executes the deletion query and returns how many vertices were deleted.
-func (id *ItemDelete) Exec(ctx context.Context) (int, error) {
- return withHooks(ctx, id.sqlExec, id.mutation, id.hooks)
+func (_d *ItemDelete) Exec(ctx context.Context) (int, error) {
+ return withHooks(ctx, _d.sqlExec, _d.mutation, _d.hooks)
}
// ExecX is like Exec, but panics if an error occurs.
-func (id *ItemDelete) ExecX(ctx context.Context) int {
- n, err := id.Exec(ctx)
+func (_d *ItemDelete) ExecX(ctx context.Context) int {
+ n, err := _d.Exec(ctx)
if err != nil {
panic(err)
}
return n
}
-func (id *ItemDelete) sqlExec(ctx context.Context) (int, error) {
+func (_d *ItemDelete) sqlExec(ctx context.Context) (int, error) {
_spec := sqlgraph.NewDeleteSpec(item.Table, sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID))
- if ps := id.mutation.predicates; len(ps) > 0 {
+ if ps := _d.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
- affected, err := sqlgraph.DeleteNodes(ctx, id.driver, _spec)
+ affected, err := sqlgraph.DeleteNodes(ctx, _d.driver, _spec)
if err != nil && sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
- id.mutation.done = true
+ _d.mutation.done = true
return affected, err
}
// ItemDeleteOne is the builder for deleting a single Item entity.
type ItemDeleteOne struct {
- id *ItemDelete
+ _d *ItemDelete
}
// Where appends a list predicates to the ItemDelete builder.
-func (ido *ItemDeleteOne) Where(ps ...predicate.Item) *ItemDeleteOne {
- ido.id.mutation.Where(ps...)
- return ido
+func (_d *ItemDeleteOne) Where(ps ...predicate.Item) *ItemDeleteOne {
+ _d._d.mutation.Where(ps...)
+ return _d
}
// Exec executes the deletion query.
-func (ido *ItemDeleteOne) Exec(ctx context.Context) error {
- n, err := ido.id.Exec(ctx)
+func (_d *ItemDeleteOne) Exec(ctx context.Context) error {
+ n, err := _d._d.Exec(ctx)
switch {
case err != nil:
return err
@@ -81,8 +81,8 @@ func (ido *ItemDeleteOne) Exec(ctx context.Context) error {
}
// ExecX is like Exec, but panics if an error occurs.
-func (ido *ItemDeleteOne) ExecX(ctx context.Context) {
- if err := ido.Exec(ctx); err != nil {
+func (_d *ItemDeleteOne) ExecX(ctx context.Context) {
+ if err := _d.Exec(ctx); err != nil {
panic(err)
}
}
diff --git a/backend/internal/data/ent/item_query.go b/backend/internal/data/ent/item_query.go
index d83ddb89..8cb32410 100644
--- a/backend/internal/data/ent/item_query.go
+++ b/backend/internal/data/ent/item_query.go
@@ -45,44 +45,44 @@ type ItemQuery struct {
}
// Where adds a new predicate for the ItemQuery builder.
-func (iq *ItemQuery) Where(ps ...predicate.Item) *ItemQuery {
- iq.predicates = append(iq.predicates, ps...)
- return iq
+func (_q *ItemQuery) Where(ps ...predicate.Item) *ItemQuery {
+ _q.predicates = append(_q.predicates, ps...)
+ return _q
}
// Limit the number of records to be returned by this query.
-func (iq *ItemQuery) Limit(limit int) *ItemQuery {
- iq.ctx.Limit = &limit
- return iq
+func (_q *ItemQuery) Limit(limit int) *ItemQuery {
+ _q.ctx.Limit = &limit
+ return _q
}
// Offset to start from.
-func (iq *ItemQuery) Offset(offset int) *ItemQuery {
- iq.ctx.Offset = &offset
- return iq
+func (_q *ItemQuery) Offset(offset int) *ItemQuery {
+ _q.ctx.Offset = &offset
+ return _q
}
// Unique configures the query builder to filter duplicate records on query.
// By default, unique is set to true, and can be disabled using this method.
-func (iq *ItemQuery) Unique(unique bool) *ItemQuery {
- iq.ctx.Unique = &unique
- return iq
+func (_q *ItemQuery) Unique(unique bool) *ItemQuery {
+ _q.ctx.Unique = &unique
+ return _q
}
// Order specifies how the records should be ordered.
-func (iq *ItemQuery) Order(o ...item.OrderOption) *ItemQuery {
- iq.order = append(iq.order, o...)
- return iq
+func (_q *ItemQuery) Order(o ...item.OrderOption) *ItemQuery {
+ _q.order = append(_q.order, o...)
+ return _q
}
// QueryGroup chains the current query on the "group" edge.
-func (iq *ItemQuery) QueryGroup() *GroupQuery {
- query := (&GroupClient{config: iq.config}).Query()
+func (_q *ItemQuery) QueryGroup() *GroupQuery {
+ query := (&GroupClient{config: _q.config}).Query()
query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
- if err := iq.prepareQuery(ctx); err != nil {
+ if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
- selector := iq.sqlQuery(ctx)
+ selector := _q.sqlQuery(ctx)
if err := selector.Err(); err != nil {
return nil, err
}
@@ -91,20 +91,20 @@ func (iq *ItemQuery) QueryGroup() *GroupQuery {
sqlgraph.To(group.Table, group.FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, item.GroupTable, item.GroupColumn),
)
- fromU = sqlgraph.SetNeighbors(iq.driver.Dialect(), step)
+ fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step)
return fromU, nil
}
return query
}
// QueryParent chains the current query on the "parent" edge.
-func (iq *ItemQuery) QueryParent() *ItemQuery {
- query := (&ItemClient{config: iq.config}).Query()
+func (_q *ItemQuery) QueryParent() *ItemQuery {
+ query := (&ItemClient{config: _q.config}).Query()
query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
- if err := iq.prepareQuery(ctx); err != nil {
+ if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
- selector := iq.sqlQuery(ctx)
+ selector := _q.sqlQuery(ctx)
if err := selector.Err(); err != nil {
return nil, err
}
@@ -113,20 +113,20 @@ func (iq *ItemQuery) QueryParent() *ItemQuery {
sqlgraph.To(item.Table, item.FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, item.ParentTable, item.ParentColumn),
)
- fromU = sqlgraph.SetNeighbors(iq.driver.Dialect(), step)
+ fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step)
return fromU, nil
}
return query
}
// QueryChildren chains the current query on the "children" edge.
-func (iq *ItemQuery) QueryChildren() *ItemQuery {
- query := (&ItemClient{config: iq.config}).Query()
+func (_q *ItemQuery) QueryChildren() *ItemQuery {
+ query := (&ItemClient{config: _q.config}).Query()
query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
- if err := iq.prepareQuery(ctx); err != nil {
+ if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
- selector := iq.sqlQuery(ctx)
+ selector := _q.sqlQuery(ctx)
if err := selector.Err(); err != nil {
return nil, err
}
@@ -135,20 +135,20 @@ func (iq *ItemQuery) QueryChildren() *ItemQuery {
sqlgraph.To(item.Table, item.FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, item.ChildrenTable, item.ChildrenColumn),
)
- fromU = sqlgraph.SetNeighbors(iq.driver.Dialect(), step)
+ fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step)
return fromU, nil
}
return query
}
// QueryLabel chains the current query on the "label" edge.
-func (iq *ItemQuery) QueryLabel() *LabelQuery {
- query := (&LabelClient{config: iq.config}).Query()
+func (_q *ItemQuery) QueryLabel() *LabelQuery {
+ query := (&LabelClient{config: _q.config}).Query()
query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
- if err := iq.prepareQuery(ctx); err != nil {
+ if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
- selector := iq.sqlQuery(ctx)
+ selector := _q.sqlQuery(ctx)
if err := selector.Err(); err != nil {
return nil, err
}
@@ -157,20 +157,20 @@ func (iq *ItemQuery) QueryLabel() *LabelQuery {
sqlgraph.To(label.Table, label.FieldID),
sqlgraph.Edge(sqlgraph.M2M, true, item.LabelTable, item.LabelPrimaryKey...),
)
- fromU = sqlgraph.SetNeighbors(iq.driver.Dialect(), step)
+ fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step)
return fromU, nil
}
return query
}
// QueryLocation chains the current query on the "location" edge.
-func (iq *ItemQuery) QueryLocation() *LocationQuery {
- query := (&LocationClient{config: iq.config}).Query()
+func (_q *ItemQuery) QueryLocation() *LocationQuery {
+ query := (&LocationClient{config: _q.config}).Query()
query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
- if err := iq.prepareQuery(ctx); err != nil {
+ if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
- selector := iq.sqlQuery(ctx)
+ selector := _q.sqlQuery(ctx)
if err := selector.Err(); err != nil {
return nil, err
}
@@ -179,20 +179,20 @@ func (iq *ItemQuery) QueryLocation() *LocationQuery {
sqlgraph.To(location.Table, location.FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, item.LocationTable, item.LocationColumn),
)
- fromU = sqlgraph.SetNeighbors(iq.driver.Dialect(), step)
+ fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step)
return fromU, nil
}
return query
}
// QueryFields chains the current query on the "fields" edge.
-func (iq *ItemQuery) QueryFields() *ItemFieldQuery {
- query := (&ItemFieldClient{config: iq.config}).Query()
+func (_q *ItemQuery) QueryFields() *ItemFieldQuery {
+ query := (&ItemFieldClient{config: _q.config}).Query()
query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
- if err := iq.prepareQuery(ctx); err != nil {
+ if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
- selector := iq.sqlQuery(ctx)
+ selector := _q.sqlQuery(ctx)
if err := selector.Err(); err != nil {
return nil, err
}
@@ -201,20 +201,20 @@ func (iq *ItemQuery) QueryFields() *ItemFieldQuery {
sqlgraph.To(itemfield.Table, itemfield.FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, item.FieldsTable, item.FieldsColumn),
)
- fromU = sqlgraph.SetNeighbors(iq.driver.Dialect(), step)
+ fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step)
return fromU, nil
}
return query
}
// QueryMaintenanceEntries chains the current query on the "maintenance_entries" edge.
-func (iq *ItemQuery) QueryMaintenanceEntries() *MaintenanceEntryQuery {
- query := (&MaintenanceEntryClient{config: iq.config}).Query()
+func (_q *ItemQuery) QueryMaintenanceEntries() *MaintenanceEntryQuery {
+ query := (&MaintenanceEntryClient{config: _q.config}).Query()
query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
- if err := iq.prepareQuery(ctx); err != nil {
+ if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
- selector := iq.sqlQuery(ctx)
+ selector := _q.sqlQuery(ctx)
if err := selector.Err(); err != nil {
return nil, err
}
@@ -223,20 +223,20 @@ func (iq *ItemQuery) QueryMaintenanceEntries() *MaintenanceEntryQuery {
sqlgraph.To(maintenanceentry.Table, maintenanceentry.FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, item.MaintenanceEntriesTable, item.MaintenanceEntriesColumn),
)
- fromU = sqlgraph.SetNeighbors(iq.driver.Dialect(), step)
+ fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step)
return fromU, nil
}
return query
}
// QueryAttachments chains the current query on the "attachments" edge.
-func (iq *ItemQuery) QueryAttachments() *AttachmentQuery {
- query := (&AttachmentClient{config: iq.config}).Query()
+func (_q *ItemQuery) QueryAttachments() *AttachmentQuery {
+ query := (&AttachmentClient{config: _q.config}).Query()
query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
- if err := iq.prepareQuery(ctx); err != nil {
+ if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
- selector := iq.sqlQuery(ctx)
+ selector := _q.sqlQuery(ctx)
if err := selector.Err(); err != nil {
return nil, err
}
@@ -245,7 +245,7 @@ func (iq *ItemQuery) QueryAttachments() *AttachmentQuery {
sqlgraph.To(attachment.Table, attachment.FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, item.AttachmentsTable, item.AttachmentsColumn),
)
- fromU = sqlgraph.SetNeighbors(iq.driver.Dialect(), step)
+ fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step)
return fromU, nil
}
return query
@@ -253,8 +253,8 @@ func (iq *ItemQuery) QueryAttachments() *AttachmentQuery {
// First returns the first Item entity from the query.
// Returns a *NotFoundError when no Item was found.
-func (iq *ItemQuery) First(ctx context.Context) (*Item, error) {
- nodes, err := iq.Limit(1).All(setContextOp(ctx, iq.ctx, ent.OpQueryFirst))
+func (_q *ItemQuery) First(ctx context.Context) (*Item, error) {
+ nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst))
if err != nil {
return nil, err
}
@@ -265,8 +265,8 @@ func (iq *ItemQuery) First(ctx context.Context) (*Item, error) {
}
// FirstX is like First, but panics if an error occurs.
-func (iq *ItemQuery) FirstX(ctx context.Context) *Item {
- node, err := iq.First(ctx)
+func (_q *ItemQuery) FirstX(ctx context.Context) *Item {
+ node, err := _q.First(ctx)
if err != nil && !IsNotFound(err) {
panic(err)
}
@@ -275,9 +275,9 @@ func (iq *ItemQuery) FirstX(ctx context.Context) *Item {
// FirstID returns the first Item ID from the query.
// Returns a *NotFoundError when no Item ID was found.
-func (iq *ItemQuery) FirstID(ctx context.Context) (id uuid.UUID, err error) {
+func (_q *ItemQuery) FirstID(ctx context.Context) (id uuid.UUID, err error) {
var ids []uuid.UUID
- if ids, err = iq.Limit(1).IDs(setContextOp(ctx, iq.ctx, ent.OpQueryFirstID)); err != nil {
+ if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil {
return
}
if len(ids) == 0 {
@@ -288,8 +288,8 @@ func (iq *ItemQuery) FirstID(ctx context.Context) (id uuid.UUID, err error) {
}
// FirstIDX is like FirstID, but panics if an error occurs.
-func (iq *ItemQuery) FirstIDX(ctx context.Context) uuid.UUID {
- id, err := iq.FirstID(ctx)
+func (_q *ItemQuery) FirstIDX(ctx context.Context) uuid.UUID {
+ id, err := _q.FirstID(ctx)
if err != nil && !IsNotFound(err) {
panic(err)
}
@@ -299,8 +299,8 @@ func (iq *ItemQuery) FirstIDX(ctx context.Context) uuid.UUID {
// Only returns a single Item entity found by the query, ensuring it only returns one.
// Returns a *NotSingularError when more than one Item entity is found.
// Returns a *NotFoundError when no Item entities are found.
-func (iq *ItemQuery) Only(ctx context.Context) (*Item, error) {
- nodes, err := iq.Limit(2).All(setContextOp(ctx, iq.ctx, ent.OpQueryOnly))
+func (_q *ItemQuery) Only(ctx context.Context) (*Item, error) {
+ nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly))
if err != nil {
return nil, err
}
@@ -315,8 +315,8 @@ func (iq *ItemQuery) Only(ctx context.Context) (*Item, error) {
}
// OnlyX is like Only, but panics if an error occurs.
-func (iq *ItemQuery) OnlyX(ctx context.Context) *Item {
- node, err := iq.Only(ctx)
+func (_q *ItemQuery) OnlyX(ctx context.Context) *Item {
+ node, err := _q.Only(ctx)
if err != nil {
panic(err)
}
@@ -326,9 +326,9 @@ func (iq *ItemQuery) OnlyX(ctx context.Context) *Item {
// OnlyID is like Only, but returns the only Item ID in the query.
// Returns a *NotSingularError when more than one Item ID is found.
// Returns a *NotFoundError when no entities are found.
-func (iq *ItemQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error) {
+func (_q *ItemQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error) {
var ids []uuid.UUID
- if ids, err = iq.Limit(2).IDs(setContextOp(ctx, iq.ctx, ent.OpQueryOnlyID)); err != nil {
+ if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil {
return
}
switch len(ids) {
@@ -343,8 +343,8 @@ func (iq *ItemQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error) {
}
// OnlyIDX is like OnlyID, but panics if an error occurs.
-func (iq *ItemQuery) OnlyIDX(ctx context.Context) uuid.UUID {
- id, err := iq.OnlyID(ctx)
+func (_q *ItemQuery) OnlyIDX(ctx context.Context) uuid.UUID {
+ id, err := _q.OnlyID(ctx)
if err != nil {
panic(err)
}
@@ -352,18 +352,18 @@ func (iq *ItemQuery) OnlyIDX(ctx context.Context) uuid.UUID {
}
// All executes the query and returns a list of Items.
-func (iq *ItemQuery) All(ctx context.Context) ([]*Item, error) {
- ctx = setContextOp(ctx, iq.ctx, ent.OpQueryAll)
- if err := iq.prepareQuery(ctx); err != nil {
+func (_q *ItemQuery) All(ctx context.Context) ([]*Item, error) {
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll)
+ if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
qr := querierAll[[]*Item, *ItemQuery]()
- return withInterceptors[[]*Item](ctx, iq, qr, iq.inters)
+ return withInterceptors[[]*Item](ctx, _q, qr, _q.inters)
}
// AllX is like All, but panics if an error occurs.
-func (iq *ItemQuery) AllX(ctx context.Context) []*Item {
- nodes, err := iq.All(ctx)
+func (_q *ItemQuery) AllX(ctx context.Context) []*Item {
+ nodes, err := _q.All(ctx)
if err != nil {
panic(err)
}
@@ -371,20 +371,20 @@ func (iq *ItemQuery) AllX(ctx context.Context) []*Item {
}
// IDs executes the query and returns a list of Item IDs.
-func (iq *ItemQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error) {
- if iq.ctx.Unique == nil && iq.path != nil {
- iq.Unique(true)
+func (_q *ItemQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error) {
+ if _q.ctx.Unique == nil && _q.path != nil {
+ _q.Unique(true)
}
- ctx = setContextOp(ctx, iq.ctx, ent.OpQueryIDs)
- if err = iq.Select(item.FieldID).Scan(ctx, &ids); err != nil {
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs)
+ if err = _q.Select(item.FieldID).Scan(ctx, &ids); err != nil {
return nil, err
}
return ids, nil
}
// IDsX is like IDs, but panics if an error occurs.
-func (iq *ItemQuery) IDsX(ctx context.Context) []uuid.UUID {
- ids, err := iq.IDs(ctx)
+func (_q *ItemQuery) IDsX(ctx context.Context) []uuid.UUID {
+ ids, err := _q.IDs(ctx)
if err != nil {
panic(err)
}
@@ -392,17 +392,17 @@ func (iq *ItemQuery) IDsX(ctx context.Context) []uuid.UUID {
}
// Count returns the count of the given query.
-func (iq *ItemQuery) Count(ctx context.Context) (int, error) {
- ctx = setContextOp(ctx, iq.ctx, ent.OpQueryCount)
- if err := iq.prepareQuery(ctx); err != nil {
+func (_q *ItemQuery) Count(ctx context.Context) (int, error) {
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryCount)
+ if err := _q.prepareQuery(ctx); err != nil {
return 0, err
}
- return withInterceptors[int](ctx, iq, querierCount[*ItemQuery](), iq.inters)
+ return withInterceptors[int](ctx, _q, querierCount[*ItemQuery](), _q.inters)
}
// CountX is like Count, but panics if an error occurs.
-func (iq *ItemQuery) CountX(ctx context.Context) int {
- count, err := iq.Count(ctx)
+func (_q *ItemQuery) CountX(ctx context.Context) int {
+ count, err := _q.Count(ctx)
if err != nil {
panic(err)
}
@@ -410,9 +410,9 @@ func (iq *ItemQuery) CountX(ctx context.Context) int {
}
// Exist returns true if the query has elements in the graph.
-func (iq *ItemQuery) Exist(ctx context.Context) (bool, error) {
- ctx = setContextOp(ctx, iq.ctx, ent.OpQueryExist)
- switch _, err := iq.FirstID(ctx); {
+func (_q *ItemQuery) Exist(ctx context.Context) (bool, error) {
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryExist)
+ switch _, err := _q.FirstID(ctx); {
case IsNotFound(err):
return false, nil
case err != nil:
@@ -423,8 +423,8 @@ func (iq *ItemQuery) Exist(ctx context.Context) (bool, error) {
}
// ExistX is like Exist, but panics if an error occurs.
-func (iq *ItemQuery) ExistX(ctx context.Context) bool {
- exist, err := iq.Exist(ctx)
+func (_q *ItemQuery) ExistX(ctx context.Context) bool {
+ exist, err := _q.Exist(ctx)
if err != nil {
panic(err)
}
@@ -433,116 +433,116 @@ func (iq *ItemQuery) ExistX(ctx context.Context) bool {
// Clone returns a duplicate of the ItemQuery builder, including all associated steps. It can be
// used to prepare common query builders and use them differently after the clone is made.
-func (iq *ItemQuery) Clone() *ItemQuery {
- if iq == nil {
+func (_q *ItemQuery) Clone() *ItemQuery {
+ if _q == nil {
return nil
}
return &ItemQuery{
- config: iq.config,
- ctx: iq.ctx.Clone(),
- order: append([]item.OrderOption{}, iq.order...),
- inters: append([]Interceptor{}, iq.inters...),
- predicates: append([]predicate.Item{}, iq.predicates...),
- withGroup: iq.withGroup.Clone(),
- withParent: iq.withParent.Clone(),
- withChildren: iq.withChildren.Clone(),
- withLabel: iq.withLabel.Clone(),
- withLocation: iq.withLocation.Clone(),
- withFields: iq.withFields.Clone(),
- withMaintenanceEntries: iq.withMaintenanceEntries.Clone(),
- withAttachments: iq.withAttachments.Clone(),
+ config: _q.config,
+ ctx: _q.ctx.Clone(),
+ order: append([]item.OrderOption{}, _q.order...),
+ inters: append([]Interceptor{}, _q.inters...),
+ predicates: append([]predicate.Item{}, _q.predicates...),
+ withGroup: _q.withGroup.Clone(),
+ withParent: _q.withParent.Clone(),
+ withChildren: _q.withChildren.Clone(),
+ withLabel: _q.withLabel.Clone(),
+ withLocation: _q.withLocation.Clone(),
+ withFields: _q.withFields.Clone(),
+ withMaintenanceEntries: _q.withMaintenanceEntries.Clone(),
+ withAttachments: _q.withAttachments.Clone(),
// clone intermediate query.
- sql: iq.sql.Clone(),
- path: iq.path,
+ sql: _q.sql.Clone(),
+ path: _q.path,
}
}
// WithGroup tells the query-builder to eager-load the nodes that are connected to
// the "group" edge. The optional arguments are used to configure the query builder of the edge.
-func (iq *ItemQuery) WithGroup(opts ...func(*GroupQuery)) *ItemQuery {
- query := (&GroupClient{config: iq.config}).Query()
+func (_q *ItemQuery) WithGroup(opts ...func(*GroupQuery)) *ItemQuery {
+ query := (&GroupClient{config: _q.config}).Query()
for _, opt := range opts {
opt(query)
}
- iq.withGroup = query
- return iq
+ _q.withGroup = query
+ return _q
}
// WithParent tells the query-builder to eager-load the nodes that are connected to
// the "parent" edge. The optional arguments are used to configure the query builder of the edge.
-func (iq *ItemQuery) WithParent(opts ...func(*ItemQuery)) *ItemQuery {
- query := (&ItemClient{config: iq.config}).Query()
+func (_q *ItemQuery) WithParent(opts ...func(*ItemQuery)) *ItemQuery {
+ query := (&ItemClient{config: _q.config}).Query()
for _, opt := range opts {
opt(query)
}
- iq.withParent = query
- return iq
+ _q.withParent = query
+ return _q
}
// WithChildren tells the query-builder to eager-load the nodes that are connected to
// the "children" edge. The optional arguments are used to configure the query builder of the edge.
-func (iq *ItemQuery) WithChildren(opts ...func(*ItemQuery)) *ItemQuery {
- query := (&ItemClient{config: iq.config}).Query()
+func (_q *ItemQuery) WithChildren(opts ...func(*ItemQuery)) *ItemQuery {
+ query := (&ItemClient{config: _q.config}).Query()
for _, opt := range opts {
opt(query)
}
- iq.withChildren = query
- return iq
+ _q.withChildren = query
+ return _q
}
// WithLabel tells the query-builder to eager-load the nodes that are connected to
// the "label" edge. The optional arguments are used to configure the query builder of the edge.
-func (iq *ItemQuery) WithLabel(opts ...func(*LabelQuery)) *ItemQuery {
- query := (&LabelClient{config: iq.config}).Query()
+func (_q *ItemQuery) WithLabel(opts ...func(*LabelQuery)) *ItemQuery {
+ query := (&LabelClient{config: _q.config}).Query()
for _, opt := range opts {
opt(query)
}
- iq.withLabel = query
- return iq
+ _q.withLabel = query
+ return _q
}
// WithLocation tells the query-builder to eager-load the nodes that are connected to
// the "location" edge. The optional arguments are used to configure the query builder of the edge.
-func (iq *ItemQuery) WithLocation(opts ...func(*LocationQuery)) *ItemQuery {
- query := (&LocationClient{config: iq.config}).Query()
+func (_q *ItemQuery) WithLocation(opts ...func(*LocationQuery)) *ItemQuery {
+ query := (&LocationClient{config: _q.config}).Query()
for _, opt := range opts {
opt(query)
}
- iq.withLocation = query
- return iq
+ _q.withLocation = query
+ return _q
}
// WithFields tells the query-builder to eager-load the nodes that are connected to
// the "fields" edge. The optional arguments are used to configure the query builder of the edge.
-func (iq *ItemQuery) WithFields(opts ...func(*ItemFieldQuery)) *ItemQuery {
- query := (&ItemFieldClient{config: iq.config}).Query()
+func (_q *ItemQuery) WithFields(opts ...func(*ItemFieldQuery)) *ItemQuery {
+ query := (&ItemFieldClient{config: _q.config}).Query()
for _, opt := range opts {
opt(query)
}
- iq.withFields = query
- return iq
+ _q.withFields = query
+ return _q
}
// WithMaintenanceEntries tells the query-builder to eager-load the nodes that are connected to
// the "maintenance_entries" edge. The optional arguments are used to configure the query builder of the edge.
-func (iq *ItemQuery) WithMaintenanceEntries(opts ...func(*MaintenanceEntryQuery)) *ItemQuery {
- query := (&MaintenanceEntryClient{config: iq.config}).Query()
+func (_q *ItemQuery) WithMaintenanceEntries(opts ...func(*MaintenanceEntryQuery)) *ItemQuery {
+ query := (&MaintenanceEntryClient{config: _q.config}).Query()
for _, opt := range opts {
opt(query)
}
- iq.withMaintenanceEntries = query
- return iq
+ _q.withMaintenanceEntries = query
+ return _q
}
// WithAttachments tells the query-builder to eager-load the nodes that are connected to
// the "attachments" edge. The optional arguments are used to configure the query builder of the edge.
-func (iq *ItemQuery) WithAttachments(opts ...func(*AttachmentQuery)) *ItemQuery {
- query := (&AttachmentClient{config: iq.config}).Query()
+func (_q *ItemQuery) WithAttachments(opts ...func(*AttachmentQuery)) *ItemQuery {
+ query := (&AttachmentClient{config: _q.config}).Query()
for _, opt := range opts {
opt(query)
}
- iq.withAttachments = query
- return iq
+ _q.withAttachments = query
+ return _q
}
// GroupBy is used to group vertices by one or more fields/columns.
@@ -559,10 +559,10 @@ func (iq *ItemQuery) WithAttachments(opts ...func(*AttachmentQuery)) *ItemQuery
// GroupBy(item.FieldCreatedAt).
// Aggregate(ent.Count()).
// Scan(ctx, &v)
-func (iq *ItemQuery) GroupBy(field string, fields ...string) *ItemGroupBy {
- iq.ctx.Fields = append([]string{field}, fields...)
- grbuild := &ItemGroupBy{build: iq}
- grbuild.flds = &iq.ctx.Fields
+func (_q *ItemQuery) GroupBy(field string, fields ...string) *ItemGroupBy {
+ _q.ctx.Fields = append([]string{field}, fields...)
+ grbuild := &ItemGroupBy{build: _q}
+ grbuild.flds = &_q.ctx.Fields
grbuild.label = item.Label
grbuild.scan = grbuild.Scan
return grbuild
@@ -580,62 +580,62 @@ func (iq *ItemQuery) GroupBy(field string, fields ...string) *ItemGroupBy {
// client.Item.Query().
// Select(item.FieldCreatedAt).
// Scan(ctx, &v)
-func (iq *ItemQuery) Select(fields ...string) *ItemSelect {
- iq.ctx.Fields = append(iq.ctx.Fields, fields...)
- sbuild := &ItemSelect{ItemQuery: iq}
+func (_q *ItemQuery) Select(fields ...string) *ItemSelect {
+ _q.ctx.Fields = append(_q.ctx.Fields, fields...)
+ sbuild := &ItemSelect{ItemQuery: _q}
sbuild.label = item.Label
- sbuild.flds, sbuild.scan = &iq.ctx.Fields, sbuild.Scan
+ sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan
return sbuild
}
// Aggregate returns a ItemSelect configured with the given aggregations.
-func (iq *ItemQuery) Aggregate(fns ...AggregateFunc) *ItemSelect {
- return iq.Select().Aggregate(fns...)
+func (_q *ItemQuery) Aggregate(fns ...AggregateFunc) *ItemSelect {
+ return _q.Select().Aggregate(fns...)
}
-func (iq *ItemQuery) prepareQuery(ctx context.Context) error {
- for _, inter := range iq.inters {
+func (_q *ItemQuery) prepareQuery(ctx context.Context) error {
+ for _, inter := range _q.inters {
if inter == nil {
return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)")
}
if trv, ok := inter.(Traverser); ok {
- if err := trv.Traverse(ctx, iq); err != nil {
+ if err := trv.Traverse(ctx, _q); err != nil {
return err
}
}
}
- for _, f := range iq.ctx.Fields {
+ for _, f := range _q.ctx.Fields {
if !item.ValidColumn(f) {
return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
}
}
- if iq.path != nil {
- prev, err := iq.path(ctx)
+ if _q.path != nil {
+ prev, err := _q.path(ctx)
if err != nil {
return err
}
- iq.sql = prev
+ _q.sql = prev
}
return nil
}
-func (iq *ItemQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Item, error) {
+func (_q *ItemQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Item, error) {
var (
nodes = []*Item{}
- withFKs = iq.withFKs
- _spec = iq.querySpec()
+ withFKs = _q.withFKs
+ _spec = _q.querySpec()
loadedTypes = [8]bool{
- iq.withGroup != nil,
- iq.withParent != nil,
- iq.withChildren != nil,
- iq.withLabel != nil,
- iq.withLocation != nil,
- iq.withFields != nil,
- iq.withMaintenanceEntries != nil,
- iq.withAttachments != nil,
+ _q.withGroup != nil,
+ _q.withParent != nil,
+ _q.withChildren != nil,
+ _q.withLabel != nil,
+ _q.withLocation != nil,
+ _q.withFields != nil,
+ _q.withMaintenanceEntries != nil,
+ _q.withAttachments != nil,
}
)
- if iq.withGroup != nil || iq.withParent != nil || iq.withLocation != nil {
+ if _q.withGroup != nil || _q.withParent != nil || _q.withLocation != nil {
withFKs = true
}
if withFKs {
@@ -645,7 +645,7 @@ func (iq *ItemQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Item, e
return (*Item).scanValues(nil, columns)
}
_spec.Assign = func(columns []string, values []any) error {
- node := &Item{config: iq.config}
+ node := &Item{config: _q.config}
nodes = append(nodes, node)
node.Edges.loadedTypes = loadedTypes
return node.assignValues(columns, values)
@@ -653,60 +653,60 @@ func (iq *ItemQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Item, e
for i := range hooks {
hooks[i](ctx, _spec)
}
- if err := sqlgraph.QueryNodes(ctx, iq.driver, _spec); err != nil {
+ if err := sqlgraph.QueryNodes(ctx, _q.driver, _spec); err != nil {
return nil, err
}
if len(nodes) == 0 {
return nodes, nil
}
- if query := iq.withGroup; query != nil {
- if err := iq.loadGroup(ctx, query, nodes, nil,
+ if query := _q.withGroup; query != nil {
+ if err := _q.loadGroup(ctx, query, nodes, nil,
func(n *Item, e *Group) { n.Edges.Group = e }); err != nil {
return nil, err
}
}
- if query := iq.withParent; query != nil {
- if err := iq.loadParent(ctx, query, nodes, nil,
+ if query := _q.withParent; query != nil {
+ if err := _q.loadParent(ctx, query, nodes, nil,
func(n *Item, e *Item) { n.Edges.Parent = e }); err != nil {
return nil, err
}
}
- if query := iq.withChildren; query != nil {
- if err := iq.loadChildren(ctx, query, nodes,
+ if query := _q.withChildren; query != nil {
+ if err := _q.loadChildren(ctx, query, nodes,
func(n *Item) { n.Edges.Children = []*Item{} },
func(n *Item, e *Item) { n.Edges.Children = append(n.Edges.Children, e) }); err != nil {
return nil, err
}
}
- if query := iq.withLabel; query != nil {
- if err := iq.loadLabel(ctx, query, nodes,
+ if query := _q.withLabel; query != nil {
+ if err := _q.loadLabel(ctx, query, nodes,
func(n *Item) { n.Edges.Label = []*Label{} },
func(n *Item, e *Label) { n.Edges.Label = append(n.Edges.Label, e) }); err != nil {
return nil, err
}
}
- if query := iq.withLocation; query != nil {
- if err := iq.loadLocation(ctx, query, nodes, nil,
+ if query := _q.withLocation; query != nil {
+ if err := _q.loadLocation(ctx, query, nodes, nil,
func(n *Item, e *Location) { n.Edges.Location = e }); err != nil {
return nil, err
}
}
- if query := iq.withFields; query != nil {
- if err := iq.loadFields(ctx, query, nodes,
+ if query := _q.withFields; query != nil {
+ if err := _q.loadFields(ctx, query, nodes,
func(n *Item) { n.Edges.Fields = []*ItemField{} },
func(n *Item, e *ItemField) { n.Edges.Fields = append(n.Edges.Fields, e) }); err != nil {
return nil, err
}
}
- if query := iq.withMaintenanceEntries; query != nil {
- if err := iq.loadMaintenanceEntries(ctx, query, nodes,
+ if query := _q.withMaintenanceEntries; query != nil {
+ if err := _q.loadMaintenanceEntries(ctx, query, nodes,
func(n *Item) { n.Edges.MaintenanceEntries = []*MaintenanceEntry{} },
func(n *Item, e *MaintenanceEntry) { n.Edges.MaintenanceEntries = append(n.Edges.MaintenanceEntries, e) }); err != nil {
return nil, err
}
}
- if query := iq.withAttachments; query != nil {
- if err := iq.loadAttachments(ctx, query, nodes,
+ if query := _q.withAttachments; query != nil {
+ if err := _q.loadAttachments(ctx, query, nodes,
func(n *Item) { n.Edges.Attachments = []*Attachment{} },
func(n *Item, e *Attachment) { n.Edges.Attachments = append(n.Edges.Attachments, e) }); err != nil {
return nil, err
@@ -715,7 +715,7 @@ func (iq *ItemQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Item, e
return nodes, nil
}
-func (iq *ItemQuery) loadGroup(ctx context.Context, query *GroupQuery, nodes []*Item, init func(*Item), assign func(*Item, *Group)) error {
+func (_q *ItemQuery) loadGroup(ctx context.Context, query *GroupQuery, nodes []*Item, init func(*Item), assign func(*Item, *Group)) error {
ids := make([]uuid.UUID, 0, len(nodes))
nodeids := make(map[uuid.UUID][]*Item)
for i := range nodes {
@@ -747,7 +747,7 @@ func (iq *ItemQuery) loadGroup(ctx context.Context, query *GroupQuery, nodes []*
}
return nil
}
-func (iq *ItemQuery) loadParent(ctx context.Context, query *ItemQuery, nodes []*Item, init func(*Item), assign func(*Item, *Item)) error {
+func (_q *ItemQuery) loadParent(ctx context.Context, query *ItemQuery, nodes []*Item, init func(*Item), assign func(*Item, *Item)) error {
ids := make([]uuid.UUID, 0, len(nodes))
nodeids := make(map[uuid.UUID][]*Item)
for i := range nodes {
@@ -779,7 +779,7 @@ func (iq *ItemQuery) loadParent(ctx context.Context, query *ItemQuery, nodes []*
}
return nil
}
-func (iq *ItemQuery) loadChildren(ctx context.Context, query *ItemQuery, nodes []*Item, init func(*Item), assign func(*Item, *Item)) error {
+func (_q *ItemQuery) loadChildren(ctx context.Context, query *ItemQuery, nodes []*Item, init func(*Item), assign func(*Item, *Item)) error {
fks := make([]driver.Value, 0, len(nodes))
nodeids := make(map[uuid.UUID]*Item)
for i := range nodes {
@@ -810,7 +810,7 @@ func (iq *ItemQuery) loadChildren(ctx context.Context, query *ItemQuery, nodes [
}
return nil
}
-func (iq *ItemQuery) loadLabel(ctx context.Context, query *LabelQuery, nodes []*Item, init func(*Item), assign func(*Item, *Label)) error {
+func (_q *ItemQuery) loadLabel(ctx context.Context, query *LabelQuery, nodes []*Item, init func(*Item), assign func(*Item, *Label)) error {
edgeIDs := make([]driver.Value, len(nodes))
byID := make(map[uuid.UUID]*Item)
nids := make(map[uuid.UUID]map[*Item]struct{})
@@ -871,7 +871,7 @@ func (iq *ItemQuery) loadLabel(ctx context.Context, query *LabelQuery, nodes []*
}
return nil
}
-func (iq *ItemQuery) loadLocation(ctx context.Context, query *LocationQuery, nodes []*Item, init func(*Item), assign func(*Item, *Location)) error {
+func (_q *ItemQuery) loadLocation(ctx context.Context, query *LocationQuery, nodes []*Item, init func(*Item), assign func(*Item, *Location)) error {
ids := make([]uuid.UUID, 0, len(nodes))
nodeids := make(map[uuid.UUID][]*Item)
for i := range nodes {
@@ -903,7 +903,7 @@ func (iq *ItemQuery) loadLocation(ctx context.Context, query *LocationQuery, nod
}
return nil
}
-func (iq *ItemQuery) loadFields(ctx context.Context, query *ItemFieldQuery, nodes []*Item, init func(*Item), assign func(*Item, *ItemField)) error {
+func (_q *ItemQuery) loadFields(ctx context.Context, query *ItemFieldQuery, nodes []*Item, init func(*Item), assign func(*Item, *ItemField)) error {
fks := make([]driver.Value, 0, len(nodes))
nodeids := make(map[uuid.UUID]*Item)
for i := range nodes {
@@ -934,7 +934,7 @@ func (iq *ItemQuery) loadFields(ctx context.Context, query *ItemFieldQuery, node
}
return nil
}
-func (iq *ItemQuery) loadMaintenanceEntries(ctx context.Context, query *MaintenanceEntryQuery, nodes []*Item, init func(*Item), assign func(*Item, *MaintenanceEntry)) error {
+func (_q *ItemQuery) loadMaintenanceEntries(ctx context.Context, query *MaintenanceEntryQuery, nodes []*Item, init func(*Item), assign func(*Item, *MaintenanceEntry)) error {
fks := make([]driver.Value, 0, len(nodes))
nodeids := make(map[uuid.UUID]*Item)
for i := range nodes {
@@ -964,7 +964,7 @@ func (iq *ItemQuery) loadMaintenanceEntries(ctx context.Context, query *Maintena
}
return nil
}
-func (iq *ItemQuery) loadAttachments(ctx context.Context, query *AttachmentQuery, nodes []*Item, init func(*Item), assign func(*Item, *Attachment)) error {
+func (_q *ItemQuery) loadAttachments(ctx context.Context, query *AttachmentQuery, nodes []*Item, init func(*Item), assign func(*Item, *Attachment)) error {
fks := make([]driver.Value, 0, len(nodes))
nodeids := make(map[uuid.UUID]*Item)
for i := range nodes {
@@ -996,24 +996,24 @@ func (iq *ItemQuery) loadAttachments(ctx context.Context, query *AttachmentQuery
return nil
}
-func (iq *ItemQuery) sqlCount(ctx context.Context) (int, error) {
- _spec := iq.querySpec()
- _spec.Node.Columns = iq.ctx.Fields
- if len(iq.ctx.Fields) > 0 {
- _spec.Unique = iq.ctx.Unique != nil && *iq.ctx.Unique
+func (_q *ItemQuery) sqlCount(ctx context.Context) (int, error) {
+ _spec := _q.querySpec()
+ _spec.Node.Columns = _q.ctx.Fields
+ if len(_q.ctx.Fields) > 0 {
+ _spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique
}
- return sqlgraph.CountNodes(ctx, iq.driver, _spec)
+ return sqlgraph.CountNodes(ctx, _q.driver, _spec)
}
-func (iq *ItemQuery) querySpec() *sqlgraph.QuerySpec {
+func (_q *ItemQuery) querySpec() *sqlgraph.QuerySpec {
_spec := sqlgraph.NewQuerySpec(item.Table, item.Columns, sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID))
- _spec.From = iq.sql
- if unique := iq.ctx.Unique; unique != nil {
+ _spec.From = _q.sql
+ if unique := _q.ctx.Unique; unique != nil {
_spec.Unique = *unique
- } else if iq.path != nil {
+ } else if _q.path != nil {
_spec.Unique = true
}
- if fields := iq.ctx.Fields; len(fields) > 0 {
+ if fields := _q.ctx.Fields; len(fields) > 0 {
_spec.Node.Columns = make([]string, 0, len(fields))
_spec.Node.Columns = append(_spec.Node.Columns, item.FieldID)
for i := range fields {
@@ -1022,20 +1022,20 @@ func (iq *ItemQuery) querySpec() *sqlgraph.QuerySpec {
}
}
}
- if ps := iq.predicates; len(ps) > 0 {
+ if ps := _q.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
- if limit := iq.ctx.Limit; limit != nil {
+ if limit := _q.ctx.Limit; limit != nil {
_spec.Limit = *limit
}
- if offset := iq.ctx.Offset; offset != nil {
+ if offset := _q.ctx.Offset; offset != nil {
_spec.Offset = *offset
}
- if ps := iq.order; len(ps) > 0 {
+ if ps := _q.order; len(ps) > 0 {
_spec.Order = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
@@ -1045,33 +1045,33 @@ func (iq *ItemQuery) querySpec() *sqlgraph.QuerySpec {
return _spec
}
-func (iq *ItemQuery) sqlQuery(ctx context.Context) *sql.Selector {
- builder := sql.Dialect(iq.driver.Dialect())
+func (_q *ItemQuery) sqlQuery(ctx context.Context) *sql.Selector {
+ builder := sql.Dialect(_q.driver.Dialect())
t1 := builder.Table(item.Table)
- columns := iq.ctx.Fields
+ columns := _q.ctx.Fields
if len(columns) == 0 {
columns = item.Columns
}
selector := builder.Select(t1.Columns(columns...)...).From(t1)
- if iq.sql != nil {
- selector = iq.sql
+ if _q.sql != nil {
+ selector = _q.sql
selector.Select(selector.Columns(columns...)...)
}
- if iq.ctx.Unique != nil && *iq.ctx.Unique {
+ if _q.ctx.Unique != nil && *_q.ctx.Unique {
selector.Distinct()
}
- for _, p := range iq.predicates {
+ for _, p := range _q.predicates {
p(selector)
}
- for _, p := range iq.order {
+ for _, p := range _q.order {
p(selector)
}
- if offset := iq.ctx.Offset; offset != nil {
+ if offset := _q.ctx.Offset; offset != nil {
// limit is mandatory for offset clause. We start
// with default value, and override it below if needed.
selector.Offset(*offset).Limit(math.MaxInt32)
}
- if limit := iq.ctx.Limit; limit != nil {
+ if limit := _q.ctx.Limit; limit != nil {
selector.Limit(*limit)
}
return selector
@@ -1084,41 +1084,41 @@ type ItemGroupBy struct {
}
// Aggregate adds the given aggregation functions to the group-by query.
-func (igb *ItemGroupBy) Aggregate(fns ...AggregateFunc) *ItemGroupBy {
- igb.fns = append(igb.fns, fns...)
- return igb
+func (_g *ItemGroupBy) Aggregate(fns ...AggregateFunc) *ItemGroupBy {
+ _g.fns = append(_g.fns, fns...)
+ return _g
}
// Scan applies the selector query and scans the result into the given value.
-func (igb *ItemGroupBy) Scan(ctx context.Context, v any) error {
- ctx = setContextOp(ctx, igb.build.ctx, ent.OpQueryGroupBy)
- if err := igb.build.prepareQuery(ctx); err != nil {
+func (_g *ItemGroupBy) Scan(ctx context.Context, v any) error {
+ ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy)
+ if err := _g.build.prepareQuery(ctx); err != nil {
return err
}
- return scanWithInterceptors[*ItemQuery, *ItemGroupBy](ctx, igb.build, igb, igb.build.inters, v)
+ return scanWithInterceptors[*ItemQuery, *ItemGroupBy](ctx, _g.build, _g, _g.build.inters, v)
}
-func (igb *ItemGroupBy) sqlScan(ctx context.Context, root *ItemQuery, v any) error {
+func (_g *ItemGroupBy) sqlScan(ctx context.Context, root *ItemQuery, v any) error {
selector := root.sqlQuery(ctx).Select()
- aggregation := make([]string, 0, len(igb.fns))
- for _, fn := range igb.fns {
+ aggregation := make([]string, 0, len(_g.fns))
+ for _, fn := range _g.fns {
aggregation = append(aggregation, fn(selector))
}
if len(selector.SelectedColumns()) == 0 {
- columns := make([]string, 0, len(*igb.flds)+len(igb.fns))
- for _, f := range *igb.flds {
+ columns := make([]string, 0, len(*_g.flds)+len(_g.fns))
+ for _, f := range *_g.flds {
columns = append(columns, selector.C(f))
}
columns = append(columns, aggregation...)
selector.Select(columns...)
}
- selector.GroupBy(selector.Columns(*igb.flds...)...)
+ selector.GroupBy(selector.Columns(*_g.flds...)...)
if err := selector.Err(); err != nil {
return err
}
rows := &sql.Rows{}
query, args := selector.Query()
- if err := igb.build.driver.Query(ctx, query, args, rows); err != nil {
+ if err := _g.build.driver.Query(ctx, query, args, rows); err != nil {
return err
}
defer rows.Close()
@@ -1132,27 +1132,27 @@ type ItemSelect struct {
}
// Aggregate adds the given aggregation functions to the selector query.
-func (is *ItemSelect) Aggregate(fns ...AggregateFunc) *ItemSelect {
- is.fns = append(is.fns, fns...)
- return is
+func (_s *ItemSelect) Aggregate(fns ...AggregateFunc) *ItemSelect {
+ _s.fns = append(_s.fns, fns...)
+ return _s
}
// Scan applies the selector query and scans the result into the given value.
-func (is *ItemSelect) Scan(ctx context.Context, v any) error {
- ctx = setContextOp(ctx, is.ctx, ent.OpQuerySelect)
- if err := is.prepareQuery(ctx); err != nil {
+func (_s *ItemSelect) Scan(ctx context.Context, v any) error {
+ ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect)
+ if err := _s.prepareQuery(ctx); err != nil {
return err
}
- return scanWithInterceptors[*ItemQuery, *ItemSelect](ctx, is.ItemQuery, is, is.inters, v)
+ return scanWithInterceptors[*ItemQuery, *ItemSelect](ctx, _s.ItemQuery, _s, _s.inters, v)
}
-func (is *ItemSelect) sqlScan(ctx context.Context, root *ItemQuery, v any) error {
+func (_s *ItemSelect) sqlScan(ctx context.Context, root *ItemQuery, v any) error {
selector := root.sqlQuery(ctx)
- aggregation := make([]string, 0, len(is.fns))
- for _, fn := range is.fns {
+ aggregation := make([]string, 0, len(_s.fns))
+ for _, fn := range _s.fns {
aggregation = append(aggregation, fn(selector))
}
- switch n := len(*is.selector.flds); {
+ switch n := len(*_s.selector.flds); {
case n == 0 && len(aggregation) > 0:
selector.Select(aggregation...)
case n != 0 && len(aggregation) > 0:
@@ -1160,7 +1160,7 @@ func (is *ItemSelect) sqlScan(ctx context.Context, root *ItemQuery, v any) error
}
rows := &sql.Rows{}
query, args := selector.Query()
- if err := is.driver.Query(ctx, query, args, rows); err != nil {
+ if err := _s.driver.Query(ctx, query, args, rows); err != nil {
return err
}
defer rows.Close()
diff --git a/backend/internal/data/ent/item_update.go b/backend/internal/data/ent/item_update.go
index 844eaf60..1ff6c01b 100644
--- a/backend/internal/data/ent/item_update.go
+++ b/backend/internal/data/ent/item_update.go
@@ -30,692 +30,692 @@ type ItemUpdate struct {
}
// Where appends a list predicates to the ItemUpdate builder.
-func (iu *ItemUpdate) Where(ps ...predicate.Item) *ItemUpdate {
- iu.mutation.Where(ps...)
- return iu
+func (_u *ItemUpdate) Where(ps ...predicate.Item) *ItemUpdate {
+ _u.mutation.Where(ps...)
+ return _u
}
// SetUpdatedAt sets the "updated_at" field.
-func (iu *ItemUpdate) SetUpdatedAt(t time.Time) *ItemUpdate {
- iu.mutation.SetUpdatedAt(t)
- return iu
+func (_u *ItemUpdate) SetUpdatedAt(v time.Time) *ItemUpdate {
+ _u.mutation.SetUpdatedAt(v)
+ return _u
}
// SetName sets the "name" field.
-func (iu *ItemUpdate) SetName(s string) *ItemUpdate {
- iu.mutation.SetName(s)
- return iu
+func (_u *ItemUpdate) SetName(v string) *ItemUpdate {
+ _u.mutation.SetName(v)
+ return _u
}
// SetNillableName sets the "name" field if the given value is not nil.
-func (iu *ItemUpdate) SetNillableName(s *string) *ItemUpdate {
- if s != nil {
- iu.SetName(*s)
+func (_u *ItemUpdate) SetNillableName(v *string) *ItemUpdate {
+ if v != nil {
+ _u.SetName(*v)
}
- return iu
+ return _u
}
// SetDescription sets the "description" field.
-func (iu *ItemUpdate) SetDescription(s string) *ItemUpdate {
- iu.mutation.SetDescription(s)
- return iu
+func (_u *ItemUpdate) SetDescription(v string) *ItemUpdate {
+ _u.mutation.SetDescription(v)
+ return _u
}
// SetNillableDescription sets the "description" field if the given value is not nil.
-func (iu *ItemUpdate) SetNillableDescription(s *string) *ItemUpdate {
- if s != nil {
- iu.SetDescription(*s)
+func (_u *ItemUpdate) SetNillableDescription(v *string) *ItemUpdate {
+ if v != nil {
+ _u.SetDescription(*v)
}
- return iu
+ return _u
}
// ClearDescription clears the value of the "description" field.
-func (iu *ItemUpdate) ClearDescription() *ItemUpdate {
- iu.mutation.ClearDescription()
- return iu
+func (_u *ItemUpdate) ClearDescription() *ItemUpdate {
+ _u.mutation.ClearDescription()
+ return _u
}
// SetImportRef sets the "import_ref" field.
-func (iu *ItemUpdate) SetImportRef(s string) *ItemUpdate {
- iu.mutation.SetImportRef(s)
- return iu
+func (_u *ItemUpdate) SetImportRef(v string) *ItemUpdate {
+ _u.mutation.SetImportRef(v)
+ return _u
}
// SetNillableImportRef sets the "import_ref" field if the given value is not nil.
-func (iu *ItemUpdate) SetNillableImportRef(s *string) *ItemUpdate {
- if s != nil {
- iu.SetImportRef(*s)
+func (_u *ItemUpdate) SetNillableImportRef(v *string) *ItemUpdate {
+ if v != nil {
+ _u.SetImportRef(*v)
}
- return iu
+ return _u
}
// ClearImportRef clears the value of the "import_ref" field.
-func (iu *ItemUpdate) ClearImportRef() *ItemUpdate {
- iu.mutation.ClearImportRef()
- return iu
+func (_u *ItemUpdate) ClearImportRef() *ItemUpdate {
+ _u.mutation.ClearImportRef()
+ return _u
}
// SetNotes sets the "notes" field.
-func (iu *ItemUpdate) SetNotes(s string) *ItemUpdate {
- iu.mutation.SetNotes(s)
- return iu
+func (_u *ItemUpdate) SetNotes(v string) *ItemUpdate {
+ _u.mutation.SetNotes(v)
+ return _u
}
// SetNillableNotes sets the "notes" field if the given value is not nil.
-func (iu *ItemUpdate) SetNillableNotes(s *string) *ItemUpdate {
- if s != nil {
- iu.SetNotes(*s)
+func (_u *ItemUpdate) SetNillableNotes(v *string) *ItemUpdate {
+ if v != nil {
+ _u.SetNotes(*v)
}
- return iu
+ return _u
}
// ClearNotes clears the value of the "notes" field.
-func (iu *ItemUpdate) ClearNotes() *ItemUpdate {
- iu.mutation.ClearNotes()
- return iu
+func (_u *ItemUpdate) ClearNotes() *ItemUpdate {
+ _u.mutation.ClearNotes()
+ return _u
}
// SetQuantity sets the "quantity" field.
-func (iu *ItemUpdate) SetQuantity(i int) *ItemUpdate {
- iu.mutation.ResetQuantity()
- iu.mutation.SetQuantity(i)
- return iu
+func (_u *ItemUpdate) SetQuantity(v int) *ItemUpdate {
+ _u.mutation.ResetQuantity()
+ _u.mutation.SetQuantity(v)
+ return _u
}
// SetNillableQuantity sets the "quantity" field if the given value is not nil.
-func (iu *ItemUpdate) SetNillableQuantity(i *int) *ItemUpdate {
- if i != nil {
- iu.SetQuantity(*i)
+func (_u *ItemUpdate) SetNillableQuantity(v *int) *ItemUpdate {
+ if v != nil {
+ _u.SetQuantity(*v)
}
- return iu
+ return _u
}
-// AddQuantity adds i to the "quantity" field.
-func (iu *ItemUpdate) AddQuantity(i int) *ItemUpdate {
- iu.mutation.AddQuantity(i)
- return iu
+// AddQuantity adds value to the "quantity" field.
+func (_u *ItemUpdate) AddQuantity(v int) *ItemUpdate {
+ _u.mutation.AddQuantity(v)
+ return _u
}
// SetInsured sets the "insured" field.
-func (iu *ItemUpdate) SetInsured(b bool) *ItemUpdate {
- iu.mutation.SetInsured(b)
- return iu
+func (_u *ItemUpdate) SetInsured(v bool) *ItemUpdate {
+ _u.mutation.SetInsured(v)
+ return _u
}
// SetNillableInsured sets the "insured" field if the given value is not nil.
-func (iu *ItemUpdate) SetNillableInsured(b *bool) *ItemUpdate {
- if b != nil {
- iu.SetInsured(*b)
+func (_u *ItemUpdate) SetNillableInsured(v *bool) *ItemUpdate {
+ if v != nil {
+ _u.SetInsured(*v)
}
- return iu
+ return _u
}
// SetArchived sets the "archived" field.
-func (iu *ItemUpdate) SetArchived(b bool) *ItemUpdate {
- iu.mutation.SetArchived(b)
- return iu
+func (_u *ItemUpdate) SetArchived(v bool) *ItemUpdate {
+ _u.mutation.SetArchived(v)
+ return _u
}
// SetNillableArchived sets the "archived" field if the given value is not nil.
-func (iu *ItemUpdate) SetNillableArchived(b *bool) *ItemUpdate {
- if b != nil {
- iu.SetArchived(*b)
+func (_u *ItemUpdate) SetNillableArchived(v *bool) *ItemUpdate {
+ if v != nil {
+ _u.SetArchived(*v)
}
- return iu
+ return _u
}
// SetAssetID sets the "asset_id" field.
-func (iu *ItemUpdate) SetAssetID(i int) *ItemUpdate {
- iu.mutation.ResetAssetID()
- iu.mutation.SetAssetID(i)
- return iu
+func (_u *ItemUpdate) SetAssetID(v int) *ItemUpdate {
+ _u.mutation.ResetAssetID()
+ _u.mutation.SetAssetID(v)
+ return _u
}
// SetNillableAssetID sets the "asset_id" field if the given value is not nil.
-func (iu *ItemUpdate) SetNillableAssetID(i *int) *ItemUpdate {
- if i != nil {
- iu.SetAssetID(*i)
+func (_u *ItemUpdate) SetNillableAssetID(v *int) *ItemUpdate {
+ if v != nil {
+ _u.SetAssetID(*v)
}
- return iu
+ return _u
}
-// AddAssetID adds i to the "asset_id" field.
-func (iu *ItemUpdate) AddAssetID(i int) *ItemUpdate {
- iu.mutation.AddAssetID(i)
- return iu
+// AddAssetID adds value to the "asset_id" field.
+func (_u *ItemUpdate) AddAssetID(v int) *ItemUpdate {
+ _u.mutation.AddAssetID(v)
+ return _u
}
// SetSyncChildItemsLocations sets the "sync_child_items_locations" field.
-func (iu *ItemUpdate) SetSyncChildItemsLocations(b bool) *ItemUpdate {
- iu.mutation.SetSyncChildItemsLocations(b)
- return iu
+func (_u *ItemUpdate) SetSyncChildItemsLocations(v bool) *ItemUpdate {
+ _u.mutation.SetSyncChildItemsLocations(v)
+ return _u
}
// SetNillableSyncChildItemsLocations sets the "sync_child_items_locations" field if the given value is not nil.
-func (iu *ItemUpdate) SetNillableSyncChildItemsLocations(b *bool) *ItemUpdate {
- if b != nil {
- iu.SetSyncChildItemsLocations(*b)
+func (_u *ItemUpdate) SetNillableSyncChildItemsLocations(v *bool) *ItemUpdate {
+ if v != nil {
+ _u.SetSyncChildItemsLocations(*v)
}
- return iu
+ return _u
}
// SetSerialNumber sets the "serial_number" field.
-func (iu *ItemUpdate) SetSerialNumber(s string) *ItemUpdate {
- iu.mutation.SetSerialNumber(s)
- return iu
+func (_u *ItemUpdate) SetSerialNumber(v string) *ItemUpdate {
+ _u.mutation.SetSerialNumber(v)
+ return _u
}
// SetNillableSerialNumber sets the "serial_number" field if the given value is not nil.
-func (iu *ItemUpdate) SetNillableSerialNumber(s *string) *ItemUpdate {
- if s != nil {
- iu.SetSerialNumber(*s)
+func (_u *ItemUpdate) SetNillableSerialNumber(v *string) *ItemUpdate {
+ if v != nil {
+ _u.SetSerialNumber(*v)
}
- return iu
+ return _u
}
// ClearSerialNumber clears the value of the "serial_number" field.
-func (iu *ItemUpdate) ClearSerialNumber() *ItemUpdate {
- iu.mutation.ClearSerialNumber()
- return iu
+func (_u *ItemUpdate) ClearSerialNumber() *ItemUpdate {
+ _u.mutation.ClearSerialNumber()
+ return _u
}
// SetModelNumber sets the "model_number" field.
-func (iu *ItemUpdate) SetModelNumber(s string) *ItemUpdate {
- iu.mutation.SetModelNumber(s)
- return iu
+func (_u *ItemUpdate) SetModelNumber(v string) *ItemUpdate {
+ _u.mutation.SetModelNumber(v)
+ return _u
}
// SetNillableModelNumber sets the "model_number" field if the given value is not nil.
-func (iu *ItemUpdate) SetNillableModelNumber(s *string) *ItemUpdate {
- if s != nil {
- iu.SetModelNumber(*s)
+func (_u *ItemUpdate) SetNillableModelNumber(v *string) *ItemUpdate {
+ if v != nil {
+ _u.SetModelNumber(*v)
}
- return iu
+ return _u
}
// ClearModelNumber clears the value of the "model_number" field.
-func (iu *ItemUpdate) ClearModelNumber() *ItemUpdate {
- iu.mutation.ClearModelNumber()
- return iu
+func (_u *ItemUpdate) ClearModelNumber() *ItemUpdate {
+ _u.mutation.ClearModelNumber()
+ return _u
}
// SetManufacturer sets the "manufacturer" field.
-func (iu *ItemUpdate) SetManufacturer(s string) *ItemUpdate {
- iu.mutation.SetManufacturer(s)
- return iu
+func (_u *ItemUpdate) SetManufacturer(v string) *ItemUpdate {
+ _u.mutation.SetManufacturer(v)
+ return _u
}
// SetNillableManufacturer sets the "manufacturer" field if the given value is not nil.
-func (iu *ItemUpdate) SetNillableManufacturer(s *string) *ItemUpdate {
- if s != nil {
- iu.SetManufacturer(*s)
+func (_u *ItemUpdate) SetNillableManufacturer(v *string) *ItemUpdate {
+ if v != nil {
+ _u.SetManufacturer(*v)
}
- return iu
+ return _u
}
// ClearManufacturer clears the value of the "manufacturer" field.
-func (iu *ItemUpdate) ClearManufacturer() *ItemUpdate {
- iu.mutation.ClearManufacturer()
- return iu
+func (_u *ItemUpdate) ClearManufacturer() *ItemUpdate {
+ _u.mutation.ClearManufacturer()
+ return _u
}
// SetLifetimeWarranty sets the "lifetime_warranty" field.
-func (iu *ItemUpdate) SetLifetimeWarranty(b bool) *ItemUpdate {
- iu.mutation.SetLifetimeWarranty(b)
- return iu
+func (_u *ItemUpdate) SetLifetimeWarranty(v bool) *ItemUpdate {
+ _u.mutation.SetLifetimeWarranty(v)
+ return _u
}
// SetNillableLifetimeWarranty sets the "lifetime_warranty" field if the given value is not nil.
-func (iu *ItemUpdate) SetNillableLifetimeWarranty(b *bool) *ItemUpdate {
- if b != nil {
- iu.SetLifetimeWarranty(*b)
+func (_u *ItemUpdate) SetNillableLifetimeWarranty(v *bool) *ItemUpdate {
+ if v != nil {
+ _u.SetLifetimeWarranty(*v)
}
- return iu
+ return _u
}
// SetWarrantyExpires sets the "warranty_expires" field.
-func (iu *ItemUpdate) SetWarrantyExpires(t time.Time) *ItemUpdate {
- iu.mutation.SetWarrantyExpires(t)
- return iu
+func (_u *ItemUpdate) SetWarrantyExpires(v time.Time) *ItemUpdate {
+ _u.mutation.SetWarrantyExpires(v)
+ return _u
}
// SetNillableWarrantyExpires sets the "warranty_expires" field if the given value is not nil.
-func (iu *ItemUpdate) SetNillableWarrantyExpires(t *time.Time) *ItemUpdate {
- if t != nil {
- iu.SetWarrantyExpires(*t)
+func (_u *ItemUpdate) SetNillableWarrantyExpires(v *time.Time) *ItemUpdate {
+ if v != nil {
+ _u.SetWarrantyExpires(*v)
}
- return iu
+ return _u
}
// ClearWarrantyExpires clears the value of the "warranty_expires" field.
-func (iu *ItemUpdate) ClearWarrantyExpires() *ItemUpdate {
- iu.mutation.ClearWarrantyExpires()
- return iu
+func (_u *ItemUpdate) ClearWarrantyExpires() *ItemUpdate {
+ _u.mutation.ClearWarrantyExpires()
+ return _u
}
// SetWarrantyDetails sets the "warranty_details" field.
-func (iu *ItemUpdate) SetWarrantyDetails(s string) *ItemUpdate {
- iu.mutation.SetWarrantyDetails(s)
- return iu
+func (_u *ItemUpdate) SetWarrantyDetails(v string) *ItemUpdate {
+ _u.mutation.SetWarrantyDetails(v)
+ return _u
}
// SetNillableWarrantyDetails sets the "warranty_details" field if the given value is not nil.
-func (iu *ItemUpdate) SetNillableWarrantyDetails(s *string) *ItemUpdate {
- if s != nil {
- iu.SetWarrantyDetails(*s)
+func (_u *ItemUpdate) SetNillableWarrantyDetails(v *string) *ItemUpdate {
+ if v != nil {
+ _u.SetWarrantyDetails(*v)
}
- return iu
+ return _u
}
// ClearWarrantyDetails clears the value of the "warranty_details" field.
-func (iu *ItemUpdate) ClearWarrantyDetails() *ItemUpdate {
- iu.mutation.ClearWarrantyDetails()
- return iu
+func (_u *ItemUpdate) ClearWarrantyDetails() *ItemUpdate {
+ _u.mutation.ClearWarrantyDetails()
+ return _u
}
// SetPurchaseTime sets the "purchase_time" field.
-func (iu *ItemUpdate) SetPurchaseTime(t time.Time) *ItemUpdate {
- iu.mutation.SetPurchaseTime(t)
- return iu
+func (_u *ItemUpdate) SetPurchaseTime(v time.Time) *ItemUpdate {
+ _u.mutation.SetPurchaseTime(v)
+ return _u
}
// SetNillablePurchaseTime sets the "purchase_time" field if the given value is not nil.
-func (iu *ItemUpdate) SetNillablePurchaseTime(t *time.Time) *ItemUpdate {
- if t != nil {
- iu.SetPurchaseTime(*t)
+func (_u *ItemUpdate) SetNillablePurchaseTime(v *time.Time) *ItemUpdate {
+ if v != nil {
+ _u.SetPurchaseTime(*v)
}
- return iu
+ return _u
}
// ClearPurchaseTime clears the value of the "purchase_time" field.
-func (iu *ItemUpdate) ClearPurchaseTime() *ItemUpdate {
- iu.mutation.ClearPurchaseTime()
- return iu
+func (_u *ItemUpdate) ClearPurchaseTime() *ItemUpdate {
+ _u.mutation.ClearPurchaseTime()
+ return _u
}
// SetPurchaseFrom sets the "purchase_from" field.
-func (iu *ItemUpdate) SetPurchaseFrom(s string) *ItemUpdate {
- iu.mutation.SetPurchaseFrom(s)
- return iu
+func (_u *ItemUpdate) SetPurchaseFrom(v string) *ItemUpdate {
+ _u.mutation.SetPurchaseFrom(v)
+ return _u
}
// SetNillablePurchaseFrom sets the "purchase_from" field if the given value is not nil.
-func (iu *ItemUpdate) SetNillablePurchaseFrom(s *string) *ItemUpdate {
- if s != nil {
- iu.SetPurchaseFrom(*s)
+func (_u *ItemUpdate) SetNillablePurchaseFrom(v *string) *ItemUpdate {
+ if v != nil {
+ _u.SetPurchaseFrom(*v)
}
- return iu
+ return _u
}
// ClearPurchaseFrom clears the value of the "purchase_from" field.
-func (iu *ItemUpdate) ClearPurchaseFrom() *ItemUpdate {
- iu.mutation.ClearPurchaseFrom()
- return iu
+func (_u *ItemUpdate) ClearPurchaseFrom() *ItemUpdate {
+ _u.mutation.ClearPurchaseFrom()
+ return _u
}
// SetPurchasePrice sets the "purchase_price" field.
-func (iu *ItemUpdate) SetPurchasePrice(f float64) *ItemUpdate {
- iu.mutation.ResetPurchasePrice()
- iu.mutation.SetPurchasePrice(f)
- return iu
+func (_u *ItemUpdate) SetPurchasePrice(v float64) *ItemUpdate {
+ _u.mutation.ResetPurchasePrice()
+ _u.mutation.SetPurchasePrice(v)
+ return _u
}
// SetNillablePurchasePrice sets the "purchase_price" field if the given value is not nil.
-func (iu *ItemUpdate) SetNillablePurchasePrice(f *float64) *ItemUpdate {
- if f != nil {
- iu.SetPurchasePrice(*f)
+func (_u *ItemUpdate) SetNillablePurchasePrice(v *float64) *ItemUpdate {
+ if v != nil {
+ _u.SetPurchasePrice(*v)
}
- return iu
+ return _u
}
-// AddPurchasePrice adds f to the "purchase_price" field.
-func (iu *ItemUpdate) AddPurchasePrice(f float64) *ItemUpdate {
- iu.mutation.AddPurchasePrice(f)
- return iu
+// AddPurchasePrice adds value to the "purchase_price" field.
+func (_u *ItemUpdate) AddPurchasePrice(v float64) *ItemUpdate {
+ _u.mutation.AddPurchasePrice(v)
+ return _u
}
// SetSoldTime sets the "sold_time" field.
-func (iu *ItemUpdate) SetSoldTime(t time.Time) *ItemUpdate {
- iu.mutation.SetSoldTime(t)
- return iu
+func (_u *ItemUpdate) SetSoldTime(v time.Time) *ItemUpdate {
+ _u.mutation.SetSoldTime(v)
+ return _u
}
// SetNillableSoldTime sets the "sold_time" field if the given value is not nil.
-func (iu *ItemUpdate) SetNillableSoldTime(t *time.Time) *ItemUpdate {
- if t != nil {
- iu.SetSoldTime(*t)
+func (_u *ItemUpdate) SetNillableSoldTime(v *time.Time) *ItemUpdate {
+ if v != nil {
+ _u.SetSoldTime(*v)
}
- return iu
+ return _u
}
// ClearSoldTime clears the value of the "sold_time" field.
-func (iu *ItemUpdate) ClearSoldTime() *ItemUpdate {
- iu.mutation.ClearSoldTime()
- return iu
+func (_u *ItemUpdate) ClearSoldTime() *ItemUpdate {
+ _u.mutation.ClearSoldTime()
+ return _u
}
// SetSoldTo sets the "sold_to" field.
-func (iu *ItemUpdate) SetSoldTo(s string) *ItemUpdate {
- iu.mutation.SetSoldTo(s)
- return iu
+func (_u *ItemUpdate) SetSoldTo(v string) *ItemUpdate {
+ _u.mutation.SetSoldTo(v)
+ return _u
}
// SetNillableSoldTo sets the "sold_to" field if the given value is not nil.
-func (iu *ItemUpdate) SetNillableSoldTo(s *string) *ItemUpdate {
- if s != nil {
- iu.SetSoldTo(*s)
+func (_u *ItemUpdate) SetNillableSoldTo(v *string) *ItemUpdate {
+ if v != nil {
+ _u.SetSoldTo(*v)
}
- return iu
+ return _u
}
// ClearSoldTo clears the value of the "sold_to" field.
-func (iu *ItemUpdate) ClearSoldTo() *ItemUpdate {
- iu.mutation.ClearSoldTo()
- return iu
+func (_u *ItemUpdate) ClearSoldTo() *ItemUpdate {
+ _u.mutation.ClearSoldTo()
+ return _u
}
// SetSoldPrice sets the "sold_price" field.
-func (iu *ItemUpdate) SetSoldPrice(f float64) *ItemUpdate {
- iu.mutation.ResetSoldPrice()
- iu.mutation.SetSoldPrice(f)
- return iu
+func (_u *ItemUpdate) SetSoldPrice(v float64) *ItemUpdate {
+ _u.mutation.ResetSoldPrice()
+ _u.mutation.SetSoldPrice(v)
+ return _u
}
// SetNillableSoldPrice sets the "sold_price" field if the given value is not nil.
-func (iu *ItemUpdate) SetNillableSoldPrice(f *float64) *ItemUpdate {
- if f != nil {
- iu.SetSoldPrice(*f)
+func (_u *ItemUpdate) SetNillableSoldPrice(v *float64) *ItemUpdate {
+ if v != nil {
+ _u.SetSoldPrice(*v)
}
- return iu
+ return _u
}
-// AddSoldPrice adds f to the "sold_price" field.
-func (iu *ItemUpdate) AddSoldPrice(f float64) *ItemUpdate {
- iu.mutation.AddSoldPrice(f)
- return iu
+// AddSoldPrice adds value to the "sold_price" field.
+func (_u *ItemUpdate) AddSoldPrice(v float64) *ItemUpdate {
+ _u.mutation.AddSoldPrice(v)
+ return _u
}
// SetSoldNotes sets the "sold_notes" field.
-func (iu *ItemUpdate) SetSoldNotes(s string) *ItemUpdate {
- iu.mutation.SetSoldNotes(s)
- return iu
+func (_u *ItemUpdate) SetSoldNotes(v string) *ItemUpdate {
+ _u.mutation.SetSoldNotes(v)
+ return _u
}
// SetNillableSoldNotes sets the "sold_notes" field if the given value is not nil.
-func (iu *ItemUpdate) SetNillableSoldNotes(s *string) *ItemUpdate {
- if s != nil {
- iu.SetSoldNotes(*s)
+func (_u *ItemUpdate) SetNillableSoldNotes(v *string) *ItemUpdate {
+ if v != nil {
+ _u.SetSoldNotes(*v)
}
- return iu
+ return _u
}
// ClearSoldNotes clears the value of the "sold_notes" field.
-func (iu *ItemUpdate) ClearSoldNotes() *ItemUpdate {
- iu.mutation.ClearSoldNotes()
- return iu
+func (_u *ItemUpdate) ClearSoldNotes() *ItemUpdate {
+ _u.mutation.ClearSoldNotes()
+ return _u
}
// SetGroupID sets the "group" edge to the Group entity by ID.
-func (iu *ItemUpdate) SetGroupID(id uuid.UUID) *ItemUpdate {
- iu.mutation.SetGroupID(id)
- return iu
+func (_u *ItemUpdate) SetGroupID(id uuid.UUID) *ItemUpdate {
+ _u.mutation.SetGroupID(id)
+ return _u
}
// SetGroup sets the "group" edge to the Group entity.
-func (iu *ItemUpdate) SetGroup(g *Group) *ItemUpdate {
- return iu.SetGroupID(g.ID)
+func (_u *ItemUpdate) SetGroup(v *Group) *ItemUpdate {
+ return _u.SetGroupID(v.ID)
}
// SetParentID sets the "parent" edge to the Item entity by ID.
-func (iu *ItemUpdate) SetParentID(id uuid.UUID) *ItemUpdate {
- iu.mutation.SetParentID(id)
- return iu
+func (_u *ItemUpdate) SetParentID(id uuid.UUID) *ItemUpdate {
+ _u.mutation.SetParentID(id)
+ return _u
}
// SetNillableParentID sets the "parent" edge to the Item entity by ID if the given value is not nil.
-func (iu *ItemUpdate) SetNillableParentID(id *uuid.UUID) *ItemUpdate {
+func (_u *ItemUpdate) SetNillableParentID(id *uuid.UUID) *ItemUpdate {
if id != nil {
- iu = iu.SetParentID(*id)
+ _u = _u.SetParentID(*id)
}
- return iu
+ return _u
}
// SetParent sets the "parent" edge to the Item entity.
-func (iu *ItemUpdate) SetParent(i *Item) *ItemUpdate {
- return iu.SetParentID(i.ID)
+func (_u *ItemUpdate) SetParent(v *Item) *ItemUpdate {
+ return _u.SetParentID(v.ID)
}
// AddChildIDs adds the "children" edge to the Item entity by IDs.
-func (iu *ItemUpdate) AddChildIDs(ids ...uuid.UUID) *ItemUpdate {
- iu.mutation.AddChildIDs(ids...)
- return iu
+func (_u *ItemUpdate) AddChildIDs(ids ...uuid.UUID) *ItemUpdate {
+ _u.mutation.AddChildIDs(ids...)
+ return _u
}
// AddChildren adds the "children" edges to the Item entity.
-func (iu *ItemUpdate) AddChildren(i ...*Item) *ItemUpdate {
- ids := make([]uuid.UUID, len(i))
- for j := range i {
- ids[j] = i[j].ID
+func (_u *ItemUpdate) AddChildren(v ...*Item) *ItemUpdate {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return iu.AddChildIDs(ids...)
+ return _u.AddChildIDs(ids...)
}
// AddLabelIDs adds the "label" edge to the Label entity by IDs.
-func (iu *ItemUpdate) AddLabelIDs(ids ...uuid.UUID) *ItemUpdate {
- iu.mutation.AddLabelIDs(ids...)
- return iu
+func (_u *ItemUpdate) AddLabelIDs(ids ...uuid.UUID) *ItemUpdate {
+ _u.mutation.AddLabelIDs(ids...)
+ return _u
}
// AddLabel adds the "label" edges to the Label entity.
-func (iu *ItemUpdate) AddLabel(l ...*Label) *ItemUpdate {
- ids := make([]uuid.UUID, len(l))
- for i := range l {
- ids[i] = l[i].ID
+func (_u *ItemUpdate) AddLabel(v ...*Label) *ItemUpdate {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return iu.AddLabelIDs(ids...)
+ return _u.AddLabelIDs(ids...)
}
// SetLocationID sets the "location" edge to the Location entity by ID.
-func (iu *ItemUpdate) SetLocationID(id uuid.UUID) *ItemUpdate {
- iu.mutation.SetLocationID(id)
- return iu
+func (_u *ItemUpdate) SetLocationID(id uuid.UUID) *ItemUpdate {
+ _u.mutation.SetLocationID(id)
+ return _u
}
// SetNillableLocationID sets the "location" edge to the Location entity by ID if the given value is not nil.
-func (iu *ItemUpdate) SetNillableLocationID(id *uuid.UUID) *ItemUpdate {
+func (_u *ItemUpdate) SetNillableLocationID(id *uuid.UUID) *ItemUpdate {
if id != nil {
- iu = iu.SetLocationID(*id)
+ _u = _u.SetLocationID(*id)
}
- return iu
+ return _u
}
// SetLocation sets the "location" edge to the Location entity.
-func (iu *ItemUpdate) SetLocation(l *Location) *ItemUpdate {
- return iu.SetLocationID(l.ID)
+func (_u *ItemUpdate) SetLocation(v *Location) *ItemUpdate {
+ return _u.SetLocationID(v.ID)
}
// AddFieldIDs adds the "fields" edge to the ItemField entity by IDs.
-func (iu *ItemUpdate) AddFieldIDs(ids ...uuid.UUID) *ItemUpdate {
- iu.mutation.AddFieldIDs(ids...)
- return iu
+func (_u *ItemUpdate) AddFieldIDs(ids ...uuid.UUID) *ItemUpdate {
+ _u.mutation.AddFieldIDs(ids...)
+ return _u
}
// AddFields adds the "fields" edges to the ItemField entity.
-func (iu *ItemUpdate) AddFields(i ...*ItemField) *ItemUpdate {
- ids := make([]uuid.UUID, len(i))
- for j := range i {
- ids[j] = i[j].ID
+func (_u *ItemUpdate) AddFields(v ...*ItemField) *ItemUpdate {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return iu.AddFieldIDs(ids...)
+ return _u.AddFieldIDs(ids...)
}
// AddMaintenanceEntryIDs adds the "maintenance_entries" edge to the MaintenanceEntry entity by IDs.
-func (iu *ItemUpdate) AddMaintenanceEntryIDs(ids ...uuid.UUID) *ItemUpdate {
- iu.mutation.AddMaintenanceEntryIDs(ids...)
- return iu
+func (_u *ItemUpdate) AddMaintenanceEntryIDs(ids ...uuid.UUID) *ItemUpdate {
+ _u.mutation.AddMaintenanceEntryIDs(ids...)
+ return _u
}
// AddMaintenanceEntries adds the "maintenance_entries" edges to the MaintenanceEntry entity.
-func (iu *ItemUpdate) AddMaintenanceEntries(m ...*MaintenanceEntry) *ItemUpdate {
- ids := make([]uuid.UUID, len(m))
- for i := range m {
- ids[i] = m[i].ID
+func (_u *ItemUpdate) AddMaintenanceEntries(v ...*MaintenanceEntry) *ItemUpdate {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return iu.AddMaintenanceEntryIDs(ids...)
+ return _u.AddMaintenanceEntryIDs(ids...)
}
// AddAttachmentIDs adds the "attachments" edge to the Attachment entity by IDs.
-func (iu *ItemUpdate) AddAttachmentIDs(ids ...uuid.UUID) *ItemUpdate {
- iu.mutation.AddAttachmentIDs(ids...)
- return iu
+func (_u *ItemUpdate) AddAttachmentIDs(ids ...uuid.UUID) *ItemUpdate {
+ _u.mutation.AddAttachmentIDs(ids...)
+ return _u
}
// AddAttachments adds the "attachments" edges to the Attachment entity.
-func (iu *ItemUpdate) AddAttachments(a ...*Attachment) *ItemUpdate {
- ids := make([]uuid.UUID, len(a))
- for i := range a {
- ids[i] = a[i].ID
+func (_u *ItemUpdate) AddAttachments(v ...*Attachment) *ItemUpdate {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return iu.AddAttachmentIDs(ids...)
+ return _u.AddAttachmentIDs(ids...)
}
// Mutation returns the ItemMutation object of the builder.
-func (iu *ItemUpdate) Mutation() *ItemMutation {
- return iu.mutation
+func (_u *ItemUpdate) Mutation() *ItemMutation {
+ return _u.mutation
}
// ClearGroup clears the "group" edge to the Group entity.
-func (iu *ItemUpdate) ClearGroup() *ItemUpdate {
- iu.mutation.ClearGroup()
- return iu
+func (_u *ItemUpdate) ClearGroup() *ItemUpdate {
+ _u.mutation.ClearGroup()
+ return _u
}
// ClearParent clears the "parent" edge to the Item entity.
-func (iu *ItemUpdate) ClearParent() *ItemUpdate {
- iu.mutation.ClearParent()
- return iu
+func (_u *ItemUpdate) ClearParent() *ItemUpdate {
+ _u.mutation.ClearParent()
+ return _u
}
// ClearChildren clears all "children" edges to the Item entity.
-func (iu *ItemUpdate) ClearChildren() *ItemUpdate {
- iu.mutation.ClearChildren()
- return iu
+func (_u *ItemUpdate) ClearChildren() *ItemUpdate {
+ _u.mutation.ClearChildren()
+ return _u
}
// RemoveChildIDs removes the "children" edge to Item entities by IDs.
-func (iu *ItemUpdate) RemoveChildIDs(ids ...uuid.UUID) *ItemUpdate {
- iu.mutation.RemoveChildIDs(ids...)
- return iu
+func (_u *ItemUpdate) RemoveChildIDs(ids ...uuid.UUID) *ItemUpdate {
+ _u.mutation.RemoveChildIDs(ids...)
+ return _u
}
// RemoveChildren removes "children" edges to Item entities.
-func (iu *ItemUpdate) RemoveChildren(i ...*Item) *ItemUpdate {
- ids := make([]uuid.UUID, len(i))
- for j := range i {
- ids[j] = i[j].ID
+func (_u *ItemUpdate) RemoveChildren(v ...*Item) *ItemUpdate {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return iu.RemoveChildIDs(ids...)
+ return _u.RemoveChildIDs(ids...)
}
// ClearLabel clears all "label" edges to the Label entity.
-func (iu *ItemUpdate) ClearLabel() *ItemUpdate {
- iu.mutation.ClearLabel()
- return iu
+func (_u *ItemUpdate) ClearLabel() *ItemUpdate {
+ _u.mutation.ClearLabel()
+ return _u
}
// RemoveLabelIDs removes the "label" edge to Label entities by IDs.
-func (iu *ItemUpdate) RemoveLabelIDs(ids ...uuid.UUID) *ItemUpdate {
- iu.mutation.RemoveLabelIDs(ids...)
- return iu
+func (_u *ItemUpdate) RemoveLabelIDs(ids ...uuid.UUID) *ItemUpdate {
+ _u.mutation.RemoveLabelIDs(ids...)
+ return _u
}
// RemoveLabel removes "label" edges to Label entities.
-func (iu *ItemUpdate) RemoveLabel(l ...*Label) *ItemUpdate {
- ids := make([]uuid.UUID, len(l))
- for i := range l {
- ids[i] = l[i].ID
+func (_u *ItemUpdate) RemoveLabel(v ...*Label) *ItemUpdate {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return iu.RemoveLabelIDs(ids...)
+ return _u.RemoveLabelIDs(ids...)
}
// ClearLocation clears the "location" edge to the Location entity.
-func (iu *ItemUpdate) ClearLocation() *ItemUpdate {
- iu.mutation.ClearLocation()
- return iu
+func (_u *ItemUpdate) ClearLocation() *ItemUpdate {
+ _u.mutation.ClearLocation()
+ return _u
}
// ClearFields clears all "fields" edges to the ItemField entity.
-func (iu *ItemUpdate) ClearFields() *ItemUpdate {
- iu.mutation.ClearFields()
- return iu
+func (_u *ItemUpdate) ClearFields() *ItemUpdate {
+ _u.mutation.ClearFields()
+ return _u
}
// RemoveFieldIDs removes the "fields" edge to ItemField entities by IDs.
-func (iu *ItemUpdate) RemoveFieldIDs(ids ...uuid.UUID) *ItemUpdate {
- iu.mutation.RemoveFieldIDs(ids...)
- return iu
+func (_u *ItemUpdate) RemoveFieldIDs(ids ...uuid.UUID) *ItemUpdate {
+ _u.mutation.RemoveFieldIDs(ids...)
+ return _u
}
// RemoveFields removes "fields" edges to ItemField entities.
-func (iu *ItemUpdate) RemoveFields(i ...*ItemField) *ItemUpdate {
- ids := make([]uuid.UUID, len(i))
- for j := range i {
- ids[j] = i[j].ID
+func (_u *ItemUpdate) RemoveFields(v ...*ItemField) *ItemUpdate {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return iu.RemoveFieldIDs(ids...)
+ return _u.RemoveFieldIDs(ids...)
}
// ClearMaintenanceEntries clears all "maintenance_entries" edges to the MaintenanceEntry entity.
-func (iu *ItemUpdate) ClearMaintenanceEntries() *ItemUpdate {
- iu.mutation.ClearMaintenanceEntries()
- return iu
+func (_u *ItemUpdate) ClearMaintenanceEntries() *ItemUpdate {
+ _u.mutation.ClearMaintenanceEntries()
+ return _u
}
// RemoveMaintenanceEntryIDs removes the "maintenance_entries" edge to MaintenanceEntry entities by IDs.
-func (iu *ItemUpdate) RemoveMaintenanceEntryIDs(ids ...uuid.UUID) *ItemUpdate {
- iu.mutation.RemoveMaintenanceEntryIDs(ids...)
- return iu
+func (_u *ItemUpdate) RemoveMaintenanceEntryIDs(ids ...uuid.UUID) *ItemUpdate {
+ _u.mutation.RemoveMaintenanceEntryIDs(ids...)
+ return _u
}
// RemoveMaintenanceEntries removes "maintenance_entries" edges to MaintenanceEntry entities.
-func (iu *ItemUpdate) RemoveMaintenanceEntries(m ...*MaintenanceEntry) *ItemUpdate {
- ids := make([]uuid.UUID, len(m))
- for i := range m {
- ids[i] = m[i].ID
+func (_u *ItemUpdate) RemoveMaintenanceEntries(v ...*MaintenanceEntry) *ItemUpdate {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return iu.RemoveMaintenanceEntryIDs(ids...)
+ return _u.RemoveMaintenanceEntryIDs(ids...)
}
// ClearAttachments clears all "attachments" edges to the Attachment entity.
-func (iu *ItemUpdate) ClearAttachments() *ItemUpdate {
- iu.mutation.ClearAttachments()
- return iu
+func (_u *ItemUpdate) ClearAttachments() *ItemUpdate {
+ _u.mutation.ClearAttachments()
+ return _u
}
// RemoveAttachmentIDs removes the "attachments" edge to Attachment entities by IDs.
-func (iu *ItemUpdate) RemoveAttachmentIDs(ids ...uuid.UUID) *ItemUpdate {
- iu.mutation.RemoveAttachmentIDs(ids...)
- return iu
+func (_u *ItemUpdate) RemoveAttachmentIDs(ids ...uuid.UUID) *ItemUpdate {
+ _u.mutation.RemoveAttachmentIDs(ids...)
+ return _u
}
// RemoveAttachments removes "attachments" edges to Attachment entities.
-func (iu *ItemUpdate) RemoveAttachments(a ...*Attachment) *ItemUpdate {
- ids := make([]uuid.UUID, len(a))
- for i := range a {
- ids[i] = a[i].ID
+func (_u *ItemUpdate) RemoveAttachments(v ...*Attachment) *ItemUpdate {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return iu.RemoveAttachmentIDs(ids...)
+ return _u.RemoveAttachmentIDs(ids...)
}
// Save executes the query and returns the number of nodes affected by the update operation.
-func (iu *ItemUpdate) Save(ctx context.Context) (int, error) {
- iu.defaults()
- return withHooks(ctx, iu.sqlSave, iu.mutation, iu.hooks)
+func (_u *ItemUpdate) Save(ctx context.Context) (int, error) {
+ _u.defaults()
+ return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
}
// SaveX is like Save, but panics if an error occurs.
-func (iu *ItemUpdate) SaveX(ctx context.Context) int {
- affected, err := iu.Save(ctx)
+func (_u *ItemUpdate) SaveX(ctx context.Context) int {
+ affected, err := _u.Save(ctx)
if err != nil {
panic(err)
}
@@ -723,212 +723,212 @@ func (iu *ItemUpdate) SaveX(ctx context.Context) int {
}
// Exec executes the query.
-func (iu *ItemUpdate) Exec(ctx context.Context) error {
- _, err := iu.Save(ctx)
+func (_u *ItemUpdate) Exec(ctx context.Context) error {
+ _, err := _u.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
-func (iu *ItemUpdate) ExecX(ctx context.Context) {
- if err := iu.Exec(ctx); err != nil {
+func (_u *ItemUpdate) ExecX(ctx context.Context) {
+ if err := _u.Exec(ctx); err != nil {
panic(err)
}
}
// defaults sets the default values of the builder before save.
-func (iu *ItemUpdate) defaults() {
- if _, ok := iu.mutation.UpdatedAt(); !ok {
+func (_u *ItemUpdate) defaults() {
+ if _, ok := _u.mutation.UpdatedAt(); !ok {
v := item.UpdateDefaultUpdatedAt()
- iu.mutation.SetUpdatedAt(v)
+ _u.mutation.SetUpdatedAt(v)
}
}
// check runs all checks and user-defined validators on the builder.
-func (iu *ItemUpdate) check() error {
- if v, ok := iu.mutation.Name(); ok {
+func (_u *ItemUpdate) check() error {
+ if v, ok := _u.mutation.Name(); ok {
if err := item.NameValidator(v); err != nil {
return &ValidationError{Name: "name", err: fmt.Errorf(`ent: validator failed for field "Item.name": %w`, err)}
}
}
- if v, ok := iu.mutation.Description(); ok {
+ if v, ok := _u.mutation.Description(); ok {
if err := item.DescriptionValidator(v); err != nil {
return &ValidationError{Name: "description", err: fmt.Errorf(`ent: validator failed for field "Item.description": %w`, err)}
}
}
- if v, ok := iu.mutation.ImportRef(); ok {
+ if v, ok := _u.mutation.ImportRef(); ok {
if err := item.ImportRefValidator(v); err != nil {
return &ValidationError{Name: "import_ref", err: fmt.Errorf(`ent: validator failed for field "Item.import_ref": %w`, err)}
}
}
- if v, ok := iu.mutation.Notes(); ok {
+ if v, ok := _u.mutation.Notes(); ok {
if err := item.NotesValidator(v); err != nil {
return &ValidationError{Name: "notes", err: fmt.Errorf(`ent: validator failed for field "Item.notes": %w`, err)}
}
}
- if v, ok := iu.mutation.SerialNumber(); ok {
+ if v, ok := _u.mutation.SerialNumber(); ok {
if err := item.SerialNumberValidator(v); err != nil {
return &ValidationError{Name: "serial_number", err: fmt.Errorf(`ent: validator failed for field "Item.serial_number": %w`, err)}
}
}
- if v, ok := iu.mutation.ModelNumber(); ok {
+ if v, ok := _u.mutation.ModelNumber(); ok {
if err := item.ModelNumberValidator(v); err != nil {
return &ValidationError{Name: "model_number", err: fmt.Errorf(`ent: validator failed for field "Item.model_number": %w`, err)}
}
}
- if v, ok := iu.mutation.Manufacturer(); ok {
+ if v, ok := _u.mutation.Manufacturer(); ok {
if err := item.ManufacturerValidator(v); err != nil {
return &ValidationError{Name: "manufacturer", err: fmt.Errorf(`ent: validator failed for field "Item.manufacturer": %w`, err)}
}
}
- if v, ok := iu.mutation.WarrantyDetails(); ok {
+ if v, ok := _u.mutation.WarrantyDetails(); ok {
if err := item.WarrantyDetailsValidator(v); err != nil {
return &ValidationError{Name: "warranty_details", err: fmt.Errorf(`ent: validator failed for field "Item.warranty_details": %w`, err)}
}
}
- if v, ok := iu.mutation.SoldNotes(); ok {
+ if v, ok := _u.mutation.SoldNotes(); ok {
if err := item.SoldNotesValidator(v); err != nil {
return &ValidationError{Name: "sold_notes", err: fmt.Errorf(`ent: validator failed for field "Item.sold_notes": %w`, err)}
}
}
- if iu.mutation.GroupCleared() && len(iu.mutation.GroupIDs()) > 0 {
+ if _u.mutation.GroupCleared() && len(_u.mutation.GroupIDs()) > 0 {
return errors.New(`ent: clearing a required unique edge "Item.group"`)
}
return nil
}
-func (iu *ItemUpdate) sqlSave(ctx context.Context) (n int, err error) {
- if err := iu.check(); err != nil {
- return n, err
+func (_u *ItemUpdate) sqlSave(ctx context.Context) (_node int, err error) {
+ if err := _u.check(); err != nil {
+ return _node, err
}
_spec := sqlgraph.NewUpdateSpec(item.Table, item.Columns, sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID))
- if ps := iu.mutation.predicates; len(ps) > 0 {
+ if ps := _u.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
- if value, ok := iu.mutation.UpdatedAt(); ok {
+ if value, ok := _u.mutation.UpdatedAt(); ok {
_spec.SetField(item.FieldUpdatedAt, field.TypeTime, value)
}
- if value, ok := iu.mutation.Name(); ok {
+ if value, ok := _u.mutation.Name(); ok {
_spec.SetField(item.FieldName, field.TypeString, value)
}
- if value, ok := iu.mutation.Description(); ok {
+ if value, ok := _u.mutation.Description(); ok {
_spec.SetField(item.FieldDescription, field.TypeString, value)
}
- if iu.mutation.DescriptionCleared() {
+ if _u.mutation.DescriptionCleared() {
_spec.ClearField(item.FieldDescription, field.TypeString)
}
- if value, ok := iu.mutation.ImportRef(); ok {
+ if value, ok := _u.mutation.ImportRef(); ok {
_spec.SetField(item.FieldImportRef, field.TypeString, value)
}
- if iu.mutation.ImportRefCleared() {
+ if _u.mutation.ImportRefCleared() {
_spec.ClearField(item.FieldImportRef, field.TypeString)
}
- if value, ok := iu.mutation.Notes(); ok {
+ if value, ok := _u.mutation.Notes(); ok {
_spec.SetField(item.FieldNotes, field.TypeString, value)
}
- if iu.mutation.NotesCleared() {
+ if _u.mutation.NotesCleared() {
_spec.ClearField(item.FieldNotes, field.TypeString)
}
- if value, ok := iu.mutation.Quantity(); ok {
+ if value, ok := _u.mutation.Quantity(); ok {
_spec.SetField(item.FieldQuantity, field.TypeInt, value)
}
- if value, ok := iu.mutation.AddedQuantity(); ok {
+ if value, ok := _u.mutation.AddedQuantity(); ok {
_spec.AddField(item.FieldQuantity, field.TypeInt, value)
}
- if value, ok := iu.mutation.Insured(); ok {
+ if value, ok := _u.mutation.Insured(); ok {
_spec.SetField(item.FieldInsured, field.TypeBool, value)
}
- if value, ok := iu.mutation.Archived(); ok {
+ if value, ok := _u.mutation.Archived(); ok {
_spec.SetField(item.FieldArchived, field.TypeBool, value)
}
- if value, ok := iu.mutation.AssetID(); ok {
+ if value, ok := _u.mutation.AssetID(); ok {
_spec.SetField(item.FieldAssetID, field.TypeInt, value)
}
- if value, ok := iu.mutation.AddedAssetID(); ok {
+ if value, ok := _u.mutation.AddedAssetID(); ok {
_spec.AddField(item.FieldAssetID, field.TypeInt, value)
}
- if value, ok := iu.mutation.SyncChildItemsLocations(); ok {
+ if value, ok := _u.mutation.SyncChildItemsLocations(); ok {
_spec.SetField(item.FieldSyncChildItemsLocations, field.TypeBool, value)
}
- if value, ok := iu.mutation.SerialNumber(); ok {
+ if value, ok := _u.mutation.SerialNumber(); ok {
_spec.SetField(item.FieldSerialNumber, field.TypeString, value)
}
- if iu.mutation.SerialNumberCleared() {
+ if _u.mutation.SerialNumberCleared() {
_spec.ClearField(item.FieldSerialNumber, field.TypeString)
}
- if value, ok := iu.mutation.ModelNumber(); ok {
+ if value, ok := _u.mutation.ModelNumber(); ok {
_spec.SetField(item.FieldModelNumber, field.TypeString, value)
}
- if iu.mutation.ModelNumberCleared() {
+ if _u.mutation.ModelNumberCleared() {
_spec.ClearField(item.FieldModelNumber, field.TypeString)
}
- if value, ok := iu.mutation.Manufacturer(); ok {
+ if value, ok := _u.mutation.Manufacturer(); ok {
_spec.SetField(item.FieldManufacturer, field.TypeString, value)
}
- if iu.mutation.ManufacturerCleared() {
+ if _u.mutation.ManufacturerCleared() {
_spec.ClearField(item.FieldManufacturer, field.TypeString)
}
- if value, ok := iu.mutation.LifetimeWarranty(); ok {
+ if value, ok := _u.mutation.LifetimeWarranty(); ok {
_spec.SetField(item.FieldLifetimeWarranty, field.TypeBool, value)
}
- if value, ok := iu.mutation.WarrantyExpires(); ok {
+ if value, ok := _u.mutation.WarrantyExpires(); ok {
_spec.SetField(item.FieldWarrantyExpires, field.TypeTime, value)
}
- if iu.mutation.WarrantyExpiresCleared() {
+ if _u.mutation.WarrantyExpiresCleared() {
_spec.ClearField(item.FieldWarrantyExpires, field.TypeTime)
}
- if value, ok := iu.mutation.WarrantyDetails(); ok {
+ if value, ok := _u.mutation.WarrantyDetails(); ok {
_spec.SetField(item.FieldWarrantyDetails, field.TypeString, value)
}
- if iu.mutation.WarrantyDetailsCleared() {
+ if _u.mutation.WarrantyDetailsCleared() {
_spec.ClearField(item.FieldWarrantyDetails, field.TypeString)
}
- if value, ok := iu.mutation.PurchaseTime(); ok {
+ if value, ok := _u.mutation.PurchaseTime(); ok {
_spec.SetField(item.FieldPurchaseTime, field.TypeTime, value)
}
- if iu.mutation.PurchaseTimeCleared() {
+ if _u.mutation.PurchaseTimeCleared() {
_spec.ClearField(item.FieldPurchaseTime, field.TypeTime)
}
- if value, ok := iu.mutation.PurchaseFrom(); ok {
+ if value, ok := _u.mutation.PurchaseFrom(); ok {
_spec.SetField(item.FieldPurchaseFrom, field.TypeString, value)
}
- if iu.mutation.PurchaseFromCleared() {
+ if _u.mutation.PurchaseFromCleared() {
_spec.ClearField(item.FieldPurchaseFrom, field.TypeString)
}
- if value, ok := iu.mutation.PurchasePrice(); ok {
+ if value, ok := _u.mutation.PurchasePrice(); ok {
_spec.SetField(item.FieldPurchasePrice, field.TypeFloat64, value)
}
- if value, ok := iu.mutation.AddedPurchasePrice(); ok {
+ if value, ok := _u.mutation.AddedPurchasePrice(); ok {
_spec.AddField(item.FieldPurchasePrice, field.TypeFloat64, value)
}
- if value, ok := iu.mutation.SoldTime(); ok {
+ if value, ok := _u.mutation.SoldTime(); ok {
_spec.SetField(item.FieldSoldTime, field.TypeTime, value)
}
- if iu.mutation.SoldTimeCleared() {
+ if _u.mutation.SoldTimeCleared() {
_spec.ClearField(item.FieldSoldTime, field.TypeTime)
}
- if value, ok := iu.mutation.SoldTo(); ok {
+ if value, ok := _u.mutation.SoldTo(); ok {
_spec.SetField(item.FieldSoldTo, field.TypeString, value)
}
- if iu.mutation.SoldToCleared() {
+ if _u.mutation.SoldToCleared() {
_spec.ClearField(item.FieldSoldTo, field.TypeString)
}
- if value, ok := iu.mutation.SoldPrice(); ok {
+ if value, ok := _u.mutation.SoldPrice(); ok {
_spec.SetField(item.FieldSoldPrice, field.TypeFloat64, value)
}
- if value, ok := iu.mutation.AddedSoldPrice(); ok {
+ if value, ok := _u.mutation.AddedSoldPrice(); ok {
_spec.AddField(item.FieldSoldPrice, field.TypeFloat64, value)
}
- if value, ok := iu.mutation.SoldNotes(); ok {
+ if value, ok := _u.mutation.SoldNotes(); ok {
_spec.SetField(item.FieldSoldNotes, field.TypeString, value)
}
- if iu.mutation.SoldNotesCleared() {
+ if _u.mutation.SoldNotesCleared() {
_spec.ClearField(item.FieldSoldNotes, field.TypeString)
}
- if iu.mutation.GroupCleared() {
+ if _u.mutation.GroupCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -941,7 +941,7 @@ func (iu *ItemUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := iu.mutation.GroupIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.GroupIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -957,7 +957,7 @@ func (iu *ItemUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- if iu.mutation.ParentCleared() {
+ if _u.mutation.ParentCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -970,7 +970,7 @@ func (iu *ItemUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := iu.mutation.ParentIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.ParentIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -986,7 +986,7 @@ func (iu *ItemUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- if iu.mutation.ChildrenCleared() {
+ if _u.mutation.ChildrenCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -999,7 +999,7 @@ func (iu *ItemUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := iu.mutation.RemovedChildrenIDs(); len(nodes) > 0 && !iu.mutation.ChildrenCleared() {
+ if nodes := _u.mutation.RemovedChildrenIDs(); len(nodes) > 0 && !_u.mutation.ChildrenCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -1015,7 +1015,7 @@ func (iu *ItemUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := iu.mutation.ChildrenIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.ChildrenIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -1031,7 +1031,7 @@ func (iu *ItemUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- if iu.mutation.LabelCleared() {
+ if _u.mutation.LabelCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2M,
Inverse: true,
@@ -1044,7 +1044,7 @@ func (iu *ItemUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := iu.mutation.RemovedLabelIDs(); len(nodes) > 0 && !iu.mutation.LabelCleared() {
+ if nodes := _u.mutation.RemovedLabelIDs(); len(nodes) > 0 && !_u.mutation.LabelCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2M,
Inverse: true,
@@ -1060,7 +1060,7 @@ func (iu *ItemUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := iu.mutation.LabelIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.LabelIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2M,
Inverse: true,
@@ -1076,7 +1076,7 @@ func (iu *ItemUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- if iu.mutation.LocationCleared() {
+ if _u.mutation.LocationCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -1089,7 +1089,7 @@ func (iu *ItemUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := iu.mutation.LocationIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.LocationIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -1105,7 +1105,7 @@ func (iu *ItemUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- if iu.mutation.FieldsCleared() {
+ if _u.mutation.FieldsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -1118,7 +1118,7 @@ func (iu *ItemUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := iu.mutation.RemovedFieldsIDs(); len(nodes) > 0 && !iu.mutation.FieldsCleared() {
+ if nodes := _u.mutation.RemovedFieldsIDs(); len(nodes) > 0 && !_u.mutation.FieldsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -1134,7 +1134,7 @@ func (iu *ItemUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := iu.mutation.FieldsIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.FieldsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -1150,7 +1150,7 @@ func (iu *ItemUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- if iu.mutation.MaintenanceEntriesCleared() {
+ if _u.mutation.MaintenanceEntriesCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -1163,7 +1163,7 @@ func (iu *ItemUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := iu.mutation.RemovedMaintenanceEntriesIDs(); len(nodes) > 0 && !iu.mutation.MaintenanceEntriesCleared() {
+ if nodes := _u.mutation.RemovedMaintenanceEntriesIDs(); len(nodes) > 0 && !_u.mutation.MaintenanceEntriesCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -1179,7 +1179,7 @@ func (iu *ItemUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := iu.mutation.MaintenanceEntriesIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.MaintenanceEntriesIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -1195,7 +1195,7 @@ func (iu *ItemUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- if iu.mutation.AttachmentsCleared() {
+ if _u.mutation.AttachmentsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -1208,7 +1208,7 @@ func (iu *ItemUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := iu.mutation.RemovedAttachmentsIDs(); len(nodes) > 0 && !iu.mutation.AttachmentsCleared() {
+ if nodes := _u.mutation.RemovedAttachmentsIDs(); len(nodes) > 0 && !_u.mutation.AttachmentsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -1224,7 +1224,7 @@ func (iu *ItemUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := iu.mutation.AttachmentsIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.AttachmentsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -1240,7 +1240,7 @@ func (iu *ItemUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- if n, err = sqlgraph.UpdateNodes(ctx, iu.driver, _spec); err != nil {
+ if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil {
if _, ok := err.(*sqlgraph.NotFoundError); ok {
err = &NotFoundError{item.Label}
} else if sqlgraph.IsConstraintError(err) {
@@ -1248,8 +1248,8 @@ func (iu *ItemUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
return 0, err
}
- iu.mutation.done = true
- return n, nil
+ _u.mutation.done = true
+ return _node, nil
}
// ItemUpdateOne is the builder for updating a single Item entity.
@@ -1261,699 +1261,699 @@ type ItemUpdateOne struct {
}
// SetUpdatedAt sets the "updated_at" field.
-func (iuo *ItemUpdateOne) SetUpdatedAt(t time.Time) *ItemUpdateOne {
- iuo.mutation.SetUpdatedAt(t)
- return iuo
+func (_u *ItemUpdateOne) SetUpdatedAt(v time.Time) *ItemUpdateOne {
+ _u.mutation.SetUpdatedAt(v)
+ return _u
}
// SetName sets the "name" field.
-func (iuo *ItemUpdateOne) SetName(s string) *ItemUpdateOne {
- iuo.mutation.SetName(s)
- return iuo
+func (_u *ItemUpdateOne) SetName(v string) *ItemUpdateOne {
+ _u.mutation.SetName(v)
+ return _u
}
// SetNillableName sets the "name" field if the given value is not nil.
-func (iuo *ItemUpdateOne) SetNillableName(s *string) *ItemUpdateOne {
- if s != nil {
- iuo.SetName(*s)
+func (_u *ItemUpdateOne) SetNillableName(v *string) *ItemUpdateOne {
+ if v != nil {
+ _u.SetName(*v)
}
- return iuo
+ return _u
}
// SetDescription sets the "description" field.
-func (iuo *ItemUpdateOne) SetDescription(s string) *ItemUpdateOne {
- iuo.mutation.SetDescription(s)
- return iuo
+func (_u *ItemUpdateOne) SetDescription(v string) *ItemUpdateOne {
+ _u.mutation.SetDescription(v)
+ return _u
}
// SetNillableDescription sets the "description" field if the given value is not nil.
-func (iuo *ItemUpdateOne) SetNillableDescription(s *string) *ItemUpdateOne {
- if s != nil {
- iuo.SetDescription(*s)
+func (_u *ItemUpdateOne) SetNillableDescription(v *string) *ItemUpdateOne {
+ if v != nil {
+ _u.SetDescription(*v)
}
- return iuo
+ return _u
}
// ClearDescription clears the value of the "description" field.
-func (iuo *ItemUpdateOne) ClearDescription() *ItemUpdateOne {
- iuo.mutation.ClearDescription()
- return iuo
+func (_u *ItemUpdateOne) ClearDescription() *ItemUpdateOne {
+ _u.mutation.ClearDescription()
+ return _u
}
// SetImportRef sets the "import_ref" field.
-func (iuo *ItemUpdateOne) SetImportRef(s string) *ItemUpdateOne {
- iuo.mutation.SetImportRef(s)
- return iuo
+func (_u *ItemUpdateOne) SetImportRef(v string) *ItemUpdateOne {
+ _u.mutation.SetImportRef(v)
+ return _u
}
// SetNillableImportRef sets the "import_ref" field if the given value is not nil.
-func (iuo *ItemUpdateOne) SetNillableImportRef(s *string) *ItemUpdateOne {
- if s != nil {
- iuo.SetImportRef(*s)
+func (_u *ItemUpdateOne) SetNillableImportRef(v *string) *ItemUpdateOne {
+ if v != nil {
+ _u.SetImportRef(*v)
}
- return iuo
+ return _u
}
// ClearImportRef clears the value of the "import_ref" field.
-func (iuo *ItemUpdateOne) ClearImportRef() *ItemUpdateOne {
- iuo.mutation.ClearImportRef()
- return iuo
+func (_u *ItemUpdateOne) ClearImportRef() *ItemUpdateOne {
+ _u.mutation.ClearImportRef()
+ return _u
}
// SetNotes sets the "notes" field.
-func (iuo *ItemUpdateOne) SetNotes(s string) *ItemUpdateOne {
- iuo.mutation.SetNotes(s)
- return iuo
+func (_u *ItemUpdateOne) SetNotes(v string) *ItemUpdateOne {
+ _u.mutation.SetNotes(v)
+ return _u
}
// SetNillableNotes sets the "notes" field if the given value is not nil.
-func (iuo *ItemUpdateOne) SetNillableNotes(s *string) *ItemUpdateOne {
- if s != nil {
- iuo.SetNotes(*s)
+func (_u *ItemUpdateOne) SetNillableNotes(v *string) *ItemUpdateOne {
+ if v != nil {
+ _u.SetNotes(*v)
}
- return iuo
+ return _u
}
// ClearNotes clears the value of the "notes" field.
-func (iuo *ItemUpdateOne) ClearNotes() *ItemUpdateOne {
- iuo.mutation.ClearNotes()
- return iuo
+func (_u *ItemUpdateOne) ClearNotes() *ItemUpdateOne {
+ _u.mutation.ClearNotes()
+ return _u
}
// SetQuantity sets the "quantity" field.
-func (iuo *ItemUpdateOne) SetQuantity(i int) *ItemUpdateOne {
- iuo.mutation.ResetQuantity()
- iuo.mutation.SetQuantity(i)
- return iuo
+func (_u *ItemUpdateOne) SetQuantity(v int) *ItemUpdateOne {
+ _u.mutation.ResetQuantity()
+ _u.mutation.SetQuantity(v)
+ return _u
}
// SetNillableQuantity sets the "quantity" field if the given value is not nil.
-func (iuo *ItemUpdateOne) SetNillableQuantity(i *int) *ItemUpdateOne {
- if i != nil {
- iuo.SetQuantity(*i)
+func (_u *ItemUpdateOne) SetNillableQuantity(v *int) *ItemUpdateOne {
+ if v != nil {
+ _u.SetQuantity(*v)
}
- return iuo
+ return _u
}
-// AddQuantity adds i to the "quantity" field.
-func (iuo *ItemUpdateOne) AddQuantity(i int) *ItemUpdateOne {
- iuo.mutation.AddQuantity(i)
- return iuo
+// AddQuantity adds value to the "quantity" field.
+func (_u *ItemUpdateOne) AddQuantity(v int) *ItemUpdateOne {
+ _u.mutation.AddQuantity(v)
+ return _u
}
// SetInsured sets the "insured" field.
-func (iuo *ItemUpdateOne) SetInsured(b bool) *ItemUpdateOne {
- iuo.mutation.SetInsured(b)
- return iuo
+func (_u *ItemUpdateOne) SetInsured(v bool) *ItemUpdateOne {
+ _u.mutation.SetInsured(v)
+ return _u
}
// SetNillableInsured sets the "insured" field if the given value is not nil.
-func (iuo *ItemUpdateOne) SetNillableInsured(b *bool) *ItemUpdateOne {
- if b != nil {
- iuo.SetInsured(*b)
+func (_u *ItemUpdateOne) SetNillableInsured(v *bool) *ItemUpdateOne {
+ if v != nil {
+ _u.SetInsured(*v)
}
- return iuo
+ return _u
}
// SetArchived sets the "archived" field.
-func (iuo *ItemUpdateOne) SetArchived(b bool) *ItemUpdateOne {
- iuo.mutation.SetArchived(b)
- return iuo
+func (_u *ItemUpdateOne) SetArchived(v bool) *ItemUpdateOne {
+ _u.mutation.SetArchived(v)
+ return _u
}
// SetNillableArchived sets the "archived" field if the given value is not nil.
-func (iuo *ItemUpdateOne) SetNillableArchived(b *bool) *ItemUpdateOne {
- if b != nil {
- iuo.SetArchived(*b)
+func (_u *ItemUpdateOne) SetNillableArchived(v *bool) *ItemUpdateOne {
+ if v != nil {
+ _u.SetArchived(*v)
}
- return iuo
+ return _u
}
// SetAssetID sets the "asset_id" field.
-func (iuo *ItemUpdateOne) SetAssetID(i int) *ItemUpdateOne {
- iuo.mutation.ResetAssetID()
- iuo.mutation.SetAssetID(i)
- return iuo
+func (_u *ItemUpdateOne) SetAssetID(v int) *ItemUpdateOne {
+ _u.mutation.ResetAssetID()
+ _u.mutation.SetAssetID(v)
+ return _u
}
// SetNillableAssetID sets the "asset_id" field if the given value is not nil.
-func (iuo *ItemUpdateOne) SetNillableAssetID(i *int) *ItemUpdateOne {
- if i != nil {
- iuo.SetAssetID(*i)
+func (_u *ItemUpdateOne) SetNillableAssetID(v *int) *ItemUpdateOne {
+ if v != nil {
+ _u.SetAssetID(*v)
}
- return iuo
+ return _u
}
-// AddAssetID adds i to the "asset_id" field.
-func (iuo *ItemUpdateOne) AddAssetID(i int) *ItemUpdateOne {
- iuo.mutation.AddAssetID(i)
- return iuo
+// AddAssetID adds value to the "asset_id" field.
+func (_u *ItemUpdateOne) AddAssetID(v int) *ItemUpdateOne {
+ _u.mutation.AddAssetID(v)
+ return _u
}
// SetSyncChildItemsLocations sets the "sync_child_items_locations" field.
-func (iuo *ItemUpdateOne) SetSyncChildItemsLocations(b bool) *ItemUpdateOne {
- iuo.mutation.SetSyncChildItemsLocations(b)
- return iuo
+func (_u *ItemUpdateOne) SetSyncChildItemsLocations(v bool) *ItemUpdateOne {
+ _u.mutation.SetSyncChildItemsLocations(v)
+ return _u
}
// SetNillableSyncChildItemsLocations sets the "sync_child_items_locations" field if the given value is not nil.
-func (iuo *ItemUpdateOne) SetNillableSyncChildItemsLocations(b *bool) *ItemUpdateOne {
- if b != nil {
- iuo.SetSyncChildItemsLocations(*b)
+func (_u *ItemUpdateOne) SetNillableSyncChildItemsLocations(v *bool) *ItemUpdateOne {
+ if v != nil {
+ _u.SetSyncChildItemsLocations(*v)
}
- return iuo
+ return _u
}
// SetSerialNumber sets the "serial_number" field.
-func (iuo *ItemUpdateOne) SetSerialNumber(s string) *ItemUpdateOne {
- iuo.mutation.SetSerialNumber(s)
- return iuo
+func (_u *ItemUpdateOne) SetSerialNumber(v string) *ItemUpdateOne {
+ _u.mutation.SetSerialNumber(v)
+ return _u
}
// SetNillableSerialNumber sets the "serial_number" field if the given value is not nil.
-func (iuo *ItemUpdateOne) SetNillableSerialNumber(s *string) *ItemUpdateOne {
- if s != nil {
- iuo.SetSerialNumber(*s)
+func (_u *ItemUpdateOne) SetNillableSerialNumber(v *string) *ItemUpdateOne {
+ if v != nil {
+ _u.SetSerialNumber(*v)
}
- return iuo
+ return _u
}
// ClearSerialNumber clears the value of the "serial_number" field.
-func (iuo *ItemUpdateOne) ClearSerialNumber() *ItemUpdateOne {
- iuo.mutation.ClearSerialNumber()
- return iuo
+func (_u *ItemUpdateOne) ClearSerialNumber() *ItemUpdateOne {
+ _u.mutation.ClearSerialNumber()
+ return _u
}
// SetModelNumber sets the "model_number" field.
-func (iuo *ItemUpdateOne) SetModelNumber(s string) *ItemUpdateOne {
- iuo.mutation.SetModelNumber(s)
- return iuo
+func (_u *ItemUpdateOne) SetModelNumber(v string) *ItemUpdateOne {
+ _u.mutation.SetModelNumber(v)
+ return _u
}
// SetNillableModelNumber sets the "model_number" field if the given value is not nil.
-func (iuo *ItemUpdateOne) SetNillableModelNumber(s *string) *ItemUpdateOne {
- if s != nil {
- iuo.SetModelNumber(*s)
+func (_u *ItemUpdateOne) SetNillableModelNumber(v *string) *ItemUpdateOne {
+ if v != nil {
+ _u.SetModelNumber(*v)
}
- return iuo
+ return _u
}
// ClearModelNumber clears the value of the "model_number" field.
-func (iuo *ItemUpdateOne) ClearModelNumber() *ItemUpdateOne {
- iuo.mutation.ClearModelNumber()
- return iuo
+func (_u *ItemUpdateOne) ClearModelNumber() *ItemUpdateOne {
+ _u.mutation.ClearModelNumber()
+ return _u
}
// SetManufacturer sets the "manufacturer" field.
-func (iuo *ItemUpdateOne) SetManufacturer(s string) *ItemUpdateOne {
- iuo.mutation.SetManufacturer(s)
- return iuo
+func (_u *ItemUpdateOne) SetManufacturer(v string) *ItemUpdateOne {
+ _u.mutation.SetManufacturer(v)
+ return _u
}
// SetNillableManufacturer sets the "manufacturer" field if the given value is not nil.
-func (iuo *ItemUpdateOne) SetNillableManufacturer(s *string) *ItemUpdateOne {
- if s != nil {
- iuo.SetManufacturer(*s)
+func (_u *ItemUpdateOne) SetNillableManufacturer(v *string) *ItemUpdateOne {
+ if v != nil {
+ _u.SetManufacturer(*v)
}
- return iuo
+ return _u
}
// ClearManufacturer clears the value of the "manufacturer" field.
-func (iuo *ItemUpdateOne) ClearManufacturer() *ItemUpdateOne {
- iuo.mutation.ClearManufacturer()
- return iuo
+func (_u *ItemUpdateOne) ClearManufacturer() *ItemUpdateOne {
+ _u.mutation.ClearManufacturer()
+ return _u
}
// SetLifetimeWarranty sets the "lifetime_warranty" field.
-func (iuo *ItemUpdateOne) SetLifetimeWarranty(b bool) *ItemUpdateOne {
- iuo.mutation.SetLifetimeWarranty(b)
- return iuo
+func (_u *ItemUpdateOne) SetLifetimeWarranty(v bool) *ItemUpdateOne {
+ _u.mutation.SetLifetimeWarranty(v)
+ return _u
}
// SetNillableLifetimeWarranty sets the "lifetime_warranty" field if the given value is not nil.
-func (iuo *ItemUpdateOne) SetNillableLifetimeWarranty(b *bool) *ItemUpdateOne {
- if b != nil {
- iuo.SetLifetimeWarranty(*b)
+func (_u *ItemUpdateOne) SetNillableLifetimeWarranty(v *bool) *ItemUpdateOne {
+ if v != nil {
+ _u.SetLifetimeWarranty(*v)
}
- return iuo
+ return _u
}
// SetWarrantyExpires sets the "warranty_expires" field.
-func (iuo *ItemUpdateOne) SetWarrantyExpires(t time.Time) *ItemUpdateOne {
- iuo.mutation.SetWarrantyExpires(t)
- return iuo
+func (_u *ItemUpdateOne) SetWarrantyExpires(v time.Time) *ItemUpdateOne {
+ _u.mutation.SetWarrantyExpires(v)
+ return _u
}
// SetNillableWarrantyExpires sets the "warranty_expires" field if the given value is not nil.
-func (iuo *ItemUpdateOne) SetNillableWarrantyExpires(t *time.Time) *ItemUpdateOne {
- if t != nil {
- iuo.SetWarrantyExpires(*t)
+func (_u *ItemUpdateOne) SetNillableWarrantyExpires(v *time.Time) *ItemUpdateOne {
+ if v != nil {
+ _u.SetWarrantyExpires(*v)
}
- return iuo
+ return _u
}
// ClearWarrantyExpires clears the value of the "warranty_expires" field.
-func (iuo *ItemUpdateOne) ClearWarrantyExpires() *ItemUpdateOne {
- iuo.mutation.ClearWarrantyExpires()
- return iuo
+func (_u *ItemUpdateOne) ClearWarrantyExpires() *ItemUpdateOne {
+ _u.mutation.ClearWarrantyExpires()
+ return _u
}
// SetWarrantyDetails sets the "warranty_details" field.
-func (iuo *ItemUpdateOne) SetWarrantyDetails(s string) *ItemUpdateOne {
- iuo.mutation.SetWarrantyDetails(s)
- return iuo
+func (_u *ItemUpdateOne) SetWarrantyDetails(v string) *ItemUpdateOne {
+ _u.mutation.SetWarrantyDetails(v)
+ return _u
}
// SetNillableWarrantyDetails sets the "warranty_details" field if the given value is not nil.
-func (iuo *ItemUpdateOne) SetNillableWarrantyDetails(s *string) *ItemUpdateOne {
- if s != nil {
- iuo.SetWarrantyDetails(*s)
+func (_u *ItemUpdateOne) SetNillableWarrantyDetails(v *string) *ItemUpdateOne {
+ if v != nil {
+ _u.SetWarrantyDetails(*v)
}
- return iuo
+ return _u
}
// ClearWarrantyDetails clears the value of the "warranty_details" field.
-func (iuo *ItemUpdateOne) ClearWarrantyDetails() *ItemUpdateOne {
- iuo.mutation.ClearWarrantyDetails()
- return iuo
+func (_u *ItemUpdateOne) ClearWarrantyDetails() *ItemUpdateOne {
+ _u.mutation.ClearWarrantyDetails()
+ return _u
}
// SetPurchaseTime sets the "purchase_time" field.
-func (iuo *ItemUpdateOne) SetPurchaseTime(t time.Time) *ItemUpdateOne {
- iuo.mutation.SetPurchaseTime(t)
- return iuo
+func (_u *ItemUpdateOne) SetPurchaseTime(v time.Time) *ItemUpdateOne {
+ _u.mutation.SetPurchaseTime(v)
+ return _u
}
// SetNillablePurchaseTime sets the "purchase_time" field if the given value is not nil.
-func (iuo *ItemUpdateOne) SetNillablePurchaseTime(t *time.Time) *ItemUpdateOne {
- if t != nil {
- iuo.SetPurchaseTime(*t)
+func (_u *ItemUpdateOne) SetNillablePurchaseTime(v *time.Time) *ItemUpdateOne {
+ if v != nil {
+ _u.SetPurchaseTime(*v)
}
- return iuo
+ return _u
}
// ClearPurchaseTime clears the value of the "purchase_time" field.
-func (iuo *ItemUpdateOne) ClearPurchaseTime() *ItemUpdateOne {
- iuo.mutation.ClearPurchaseTime()
- return iuo
+func (_u *ItemUpdateOne) ClearPurchaseTime() *ItemUpdateOne {
+ _u.mutation.ClearPurchaseTime()
+ return _u
}
// SetPurchaseFrom sets the "purchase_from" field.
-func (iuo *ItemUpdateOne) SetPurchaseFrom(s string) *ItemUpdateOne {
- iuo.mutation.SetPurchaseFrom(s)
- return iuo
+func (_u *ItemUpdateOne) SetPurchaseFrom(v string) *ItemUpdateOne {
+ _u.mutation.SetPurchaseFrom(v)
+ return _u
}
// SetNillablePurchaseFrom sets the "purchase_from" field if the given value is not nil.
-func (iuo *ItemUpdateOne) SetNillablePurchaseFrom(s *string) *ItemUpdateOne {
- if s != nil {
- iuo.SetPurchaseFrom(*s)
+func (_u *ItemUpdateOne) SetNillablePurchaseFrom(v *string) *ItemUpdateOne {
+ if v != nil {
+ _u.SetPurchaseFrom(*v)
}
- return iuo
+ return _u
}
// ClearPurchaseFrom clears the value of the "purchase_from" field.
-func (iuo *ItemUpdateOne) ClearPurchaseFrom() *ItemUpdateOne {
- iuo.mutation.ClearPurchaseFrom()
- return iuo
+func (_u *ItemUpdateOne) ClearPurchaseFrom() *ItemUpdateOne {
+ _u.mutation.ClearPurchaseFrom()
+ return _u
}
// SetPurchasePrice sets the "purchase_price" field.
-func (iuo *ItemUpdateOne) SetPurchasePrice(f float64) *ItemUpdateOne {
- iuo.mutation.ResetPurchasePrice()
- iuo.mutation.SetPurchasePrice(f)
- return iuo
+func (_u *ItemUpdateOne) SetPurchasePrice(v float64) *ItemUpdateOne {
+ _u.mutation.ResetPurchasePrice()
+ _u.mutation.SetPurchasePrice(v)
+ return _u
}
// SetNillablePurchasePrice sets the "purchase_price" field if the given value is not nil.
-func (iuo *ItemUpdateOne) SetNillablePurchasePrice(f *float64) *ItemUpdateOne {
- if f != nil {
- iuo.SetPurchasePrice(*f)
+func (_u *ItemUpdateOne) SetNillablePurchasePrice(v *float64) *ItemUpdateOne {
+ if v != nil {
+ _u.SetPurchasePrice(*v)
}
- return iuo
+ return _u
}
-// AddPurchasePrice adds f to the "purchase_price" field.
-func (iuo *ItemUpdateOne) AddPurchasePrice(f float64) *ItemUpdateOne {
- iuo.mutation.AddPurchasePrice(f)
- return iuo
+// AddPurchasePrice adds value to the "purchase_price" field.
+func (_u *ItemUpdateOne) AddPurchasePrice(v float64) *ItemUpdateOne {
+ _u.mutation.AddPurchasePrice(v)
+ return _u
}
// SetSoldTime sets the "sold_time" field.
-func (iuo *ItemUpdateOne) SetSoldTime(t time.Time) *ItemUpdateOne {
- iuo.mutation.SetSoldTime(t)
- return iuo
+func (_u *ItemUpdateOne) SetSoldTime(v time.Time) *ItemUpdateOne {
+ _u.mutation.SetSoldTime(v)
+ return _u
}
// SetNillableSoldTime sets the "sold_time" field if the given value is not nil.
-func (iuo *ItemUpdateOne) SetNillableSoldTime(t *time.Time) *ItemUpdateOne {
- if t != nil {
- iuo.SetSoldTime(*t)
+func (_u *ItemUpdateOne) SetNillableSoldTime(v *time.Time) *ItemUpdateOne {
+ if v != nil {
+ _u.SetSoldTime(*v)
}
- return iuo
+ return _u
}
// ClearSoldTime clears the value of the "sold_time" field.
-func (iuo *ItemUpdateOne) ClearSoldTime() *ItemUpdateOne {
- iuo.mutation.ClearSoldTime()
- return iuo
+func (_u *ItemUpdateOne) ClearSoldTime() *ItemUpdateOne {
+ _u.mutation.ClearSoldTime()
+ return _u
}
// SetSoldTo sets the "sold_to" field.
-func (iuo *ItemUpdateOne) SetSoldTo(s string) *ItemUpdateOne {
- iuo.mutation.SetSoldTo(s)
- return iuo
+func (_u *ItemUpdateOne) SetSoldTo(v string) *ItemUpdateOne {
+ _u.mutation.SetSoldTo(v)
+ return _u
}
// SetNillableSoldTo sets the "sold_to" field if the given value is not nil.
-func (iuo *ItemUpdateOne) SetNillableSoldTo(s *string) *ItemUpdateOne {
- if s != nil {
- iuo.SetSoldTo(*s)
+func (_u *ItemUpdateOne) SetNillableSoldTo(v *string) *ItemUpdateOne {
+ if v != nil {
+ _u.SetSoldTo(*v)
}
- return iuo
+ return _u
}
// ClearSoldTo clears the value of the "sold_to" field.
-func (iuo *ItemUpdateOne) ClearSoldTo() *ItemUpdateOne {
- iuo.mutation.ClearSoldTo()
- return iuo
+func (_u *ItemUpdateOne) ClearSoldTo() *ItemUpdateOne {
+ _u.mutation.ClearSoldTo()
+ return _u
}
// SetSoldPrice sets the "sold_price" field.
-func (iuo *ItemUpdateOne) SetSoldPrice(f float64) *ItemUpdateOne {
- iuo.mutation.ResetSoldPrice()
- iuo.mutation.SetSoldPrice(f)
- return iuo
+func (_u *ItemUpdateOne) SetSoldPrice(v float64) *ItemUpdateOne {
+ _u.mutation.ResetSoldPrice()
+ _u.mutation.SetSoldPrice(v)
+ return _u
}
// SetNillableSoldPrice sets the "sold_price" field if the given value is not nil.
-func (iuo *ItemUpdateOne) SetNillableSoldPrice(f *float64) *ItemUpdateOne {
- if f != nil {
- iuo.SetSoldPrice(*f)
+func (_u *ItemUpdateOne) SetNillableSoldPrice(v *float64) *ItemUpdateOne {
+ if v != nil {
+ _u.SetSoldPrice(*v)
}
- return iuo
+ return _u
}
-// AddSoldPrice adds f to the "sold_price" field.
-func (iuo *ItemUpdateOne) AddSoldPrice(f float64) *ItemUpdateOne {
- iuo.mutation.AddSoldPrice(f)
- return iuo
+// AddSoldPrice adds value to the "sold_price" field.
+func (_u *ItemUpdateOne) AddSoldPrice(v float64) *ItemUpdateOne {
+ _u.mutation.AddSoldPrice(v)
+ return _u
}
// SetSoldNotes sets the "sold_notes" field.
-func (iuo *ItemUpdateOne) SetSoldNotes(s string) *ItemUpdateOne {
- iuo.mutation.SetSoldNotes(s)
- return iuo
+func (_u *ItemUpdateOne) SetSoldNotes(v string) *ItemUpdateOne {
+ _u.mutation.SetSoldNotes(v)
+ return _u
}
// SetNillableSoldNotes sets the "sold_notes" field if the given value is not nil.
-func (iuo *ItemUpdateOne) SetNillableSoldNotes(s *string) *ItemUpdateOne {
- if s != nil {
- iuo.SetSoldNotes(*s)
+func (_u *ItemUpdateOne) SetNillableSoldNotes(v *string) *ItemUpdateOne {
+ if v != nil {
+ _u.SetSoldNotes(*v)
}
- return iuo
+ return _u
}
// ClearSoldNotes clears the value of the "sold_notes" field.
-func (iuo *ItemUpdateOne) ClearSoldNotes() *ItemUpdateOne {
- iuo.mutation.ClearSoldNotes()
- return iuo
+func (_u *ItemUpdateOne) ClearSoldNotes() *ItemUpdateOne {
+ _u.mutation.ClearSoldNotes()
+ return _u
}
// SetGroupID sets the "group" edge to the Group entity by ID.
-func (iuo *ItemUpdateOne) SetGroupID(id uuid.UUID) *ItemUpdateOne {
- iuo.mutation.SetGroupID(id)
- return iuo
+func (_u *ItemUpdateOne) SetGroupID(id uuid.UUID) *ItemUpdateOne {
+ _u.mutation.SetGroupID(id)
+ return _u
}
// SetGroup sets the "group" edge to the Group entity.
-func (iuo *ItemUpdateOne) SetGroup(g *Group) *ItemUpdateOne {
- return iuo.SetGroupID(g.ID)
+func (_u *ItemUpdateOne) SetGroup(v *Group) *ItemUpdateOne {
+ return _u.SetGroupID(v.ID)
}
// SetParentID sets the "parent" edge to the Item entity by ID.
-func (iuo *ItemUpdateOne) SetParentID(id uuid.UUID) *ItemUpdateOne {
- iuo.mutation.SetParentID(id)
- return iuo
+func (_u *ItemUpdateOne) SetParentID(id uuid.UUID) *ItemUpdateOne {
+ _u.mutation.SetParentID(id)
+ return _u
}
// SetNillableParentID sets the "parent" edge to the Item entity by ID if the given value is not nil.
-func (iuo *ItemUpdateOne) SetNillableParentID(id *uuid.UUID) *ItemUpdateOne {
+func (_u *ItemUpdateOne) SetNillableParentID(id *uuid.UUID) *ItemUpdateOne {
if id != nil {
- iuo = iuo.SetParentID(*id)
+ _u = _u.SetParentID(*id)
}
- return iuo
+ return _u
}
// SetParent sets the "parent" edge to the Item entity.
-func (iuo *ItemUpdateOne) SetParent(i *Item) *ItemUpdateOne {
- return iuo.SetParentID(i.ID)
+func (_u *ItemUpdateOne) SetParent(v *Item) *ItemUpdateOne {
+ return _u.SetParentID(v.ID)
}
// AddChildIDs adds the "children" edge to the Item entity by IDs.
-func (iuo *ItemUpdateOne) AddChildIDs(ids ...uuid.UUID) *ItemUpdateOne {
- iuo.mutation.AddChildIDs(ids...)
- return iuo
+func (_u *ItemUpdateOne) AddChildIDs(ids ...uuid.UUID) *ItemUpdateOne {
+ _u.mutation.AddChildIDs(ids...)
+ return _u
}
// AddChildren adds the "children" edges to the Item entity.
-func (iuo *ItemUpdateOne) AddChildren(i ...*Item) *ItemUpdateOne {
- ids := make([]uuid.UUID, len(i))
- for j := range i {
- ids[j] = i[j].ID
+func (_u *ItemUpdateOne) AddChildren(v ...*Item) *ItemUpdateOne {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return iuo.AddChildIDs(ids...)
+ return _u.AddChildIDs(ids...)
}
// AddLabelIDs adds the "label" edge to the Label entity by IDs.
-func (iuo *ItemUpdateOne) AddLabelIDs(ids ...uuid.UUID) *ItemUpdateOne {
- iuo.mutation.AddLabelIDs(ids...)
- return iuo
+func (_u *ItemUpdateOne) AddLabelIDs(ids ...uuid.UUID) *ItemUpdateOne {
+ _u.mutation.AddLabelIDs(ids...)
+ return _u
}
// AddLabel adds the "label" edges to the Label entity.
-func (iuo *ItemUpdateOne) AddLabel(l ...*Label) *ItemUpdateOne {
- ids := make([]uuid.UUID, len(l))
- for i := range l {
- ids[i] = l[i].ID
+func (_u *ItemUpdateOne) AddLabel(v ...*Label) *ItemUpdateOne {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return iuo.AddLabelIDs(ids...)
+ return _u.AddLabelIDs(ids...)
}
// SetLocationID sets the "location" edge to the Location entity by ID.
-func (iuo *ItemUpdateOne) SetLocationID(id uuid.UUID) *ItemUpdateOne {
- iuo.mutation.SetLocationID(id)
- return iuo
+func (_u *ItemUpdateOne) SetLocationID(id uuid.UUID) *ItemUpdateOne {
+ _u.mutation.SetLocationID(id)
+ return _u
}
// SetNillableLocationID sets the "location" edge to the Location entity by ID if the given value is not nil.
-func (iuo *ItemUpdateOne) SetNillableLocationID(id *uuid.UUID) *ItemUpdateOne {
+func (_u *ItemUpdateOne) SetNillableLocationID(id *uuid.UUID) *ItemUpdateOne {
if id != nil {
- iuo = iuo.SetLocationID(*id)
+ _u = _u.SetLocationID(*id)
}
- return iuo
+ return _u
}
// SetLocation sets the "location" edge to the Location entity.
-func (iuo *ItemUpdateOne) SetLocation(l *Location) *ItemUpdateOne {
- return iuo.SetLocationID(l.ID)
+func (_u *ItemUpdateOne) SetLocation(v *Location) *ItemUpdateOne {
+ return _u.SetLocationID(v.ID)
}
// AddFieldIDs adds the "fields" edge to the ItemField entity by IDs.
-func (iuo *ItemUpdateOne) AddFieldIDs(ids ...uuid.UUID) *ItemUpdateOne {
- iuo.mutation.AddFieldIDs(ids...)
- return iuo
+func (_u *ItemUpdateOne) AddFieldIDs(ids ...uuid.UUID) *ItemUpdateOne {
+ _u.mutation.AddFieldIDs(ids...)
+ return _u
}
// AddFields adds the "fields" edges to the ItemField entity.
-func (iuo *ItemUpdateOne) AddFields(i ...*ItemField) *ItemUpdateOne {
- ids := make([]uuid.UUID, len(i))
- for j := range i {
- ids[j] = i[j].ID
+func (_u *ItemUpdateOne) AddFields(v ...*ItemField) *ItemUpdateOne {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return iuo.AddFieldIDs(ids...)
+ return _u.AddFieldIDs(ids...)
}
// AddMaintenanceEntryIDs adds the "maintenance_entries" edge to the MaintenanceEntry entity by IDs.
-func (iuo *ItemUpdateOne) AddMaintenanceEntryIDs(ids ...uuid.UUID) *ItemUpdateOne {
- iuo.mutation.AddMaintenanceEntryIDs(ids...)
- return iuo
+func (_u *ItemUpdateOne) AddMaintenanceEntryIDs(ids ...uuid.UUID) *ItemUpdateOne {
+ _u.mutation.AddMaintenanceEntryIDs(ids...)
+ return _u
}
// AddMaintenanceEntries adds the "maintenance_entries" edges to the MaintenanceEntry entity.
-func (iuo *ItemUpdateOne) AddMaintenanceEntries(m ...*MaintenanceEntry) *ItemUpdateOne {
- ids := make([]uuid.UUID, len(m))
- for i := range m {
- ids[i] = m[i].ID
+func (_u *ItemUpdateOne) AddMaintenanceEntries(v ...*MaintenanceEntry) *ItemUpdateOne {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return iuo.AddMaintenanceEntryIDs(ids...)
+ return _u.AddMaintenanceEntryIDs(ids...)
}
// AddAttachmentIDs adds the "attachments" edge to the Attachment entity by IDs.
-func (iuo *ItemUpdateOne) AddAttachmentIDs(ids ...uuid.UUID) *ItemUpdateOne {
- iuo.mutation.AddAttachmentIDs(ids...)
- return iuo
+func (_u *ItemUpdateOne) AddAttachmentIDs(ids ...uuid.UUID) *ItemUpdateOne {
+ _u.mutation.AddAttachmentIDs(ids...)
+ return _u
}
// AddAttachments adds the "attachments" edges to the Attachment entity.
-func (iuo *ItemUpdateOne) AddAttachments(a ...*Attachment) *ItemUpdateOne {
- ids := make([]uuid.UUID, len(a))
- for i := range a {
- ids[i] = a[i].ID
+func (_u *ItemUpdateOne) AddAttachments(v ...*Attachment) *ItemUpdateOne {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return iuo.AddAttachmentIDs(ids...)
+ return _u.AddAttachmentIDs(ids...)
}
// Mutation returns the ItemMutation object of the builder.
-func (iuo *ItemUpdateOne) Mutation() *ItemMutation {
- return iuo.mutation
+func (_u *ItemUpdateOne) Mutation() *ItemMutation {
+ return _u.mutation
}
// ClearGroup clears the "group" edge to the Group entity.
-func (iuo *ItemUpdateOne) ClearGroup() *ItemUpdateOne {
- iuo.mutation.ClearGroup()
- return iuo
+func (_u *ItemUpdateOne) ClearGroup() *ItemUpdateOne {
+ _u.mutation.ClearGroup()
+ return _u
}
// ClearParent clears the "parent" edge to the Item entity.
-func (iuo *ItemUpdateOne) ClearParent() *ItemUpdateOne {
- iuo.mutation.ClearParent()
- return iuo
+func (_u *ItemUpdateOne) ClearParent() *ItemUpdateOne {
+ _u.mutation.ClearParent()
+ return _u
}
// ClearChildren clears all "children" edges to the Item entity.
-func (iuo *ItemUpdateOne) ClearChildren() *ItemUpdateOne {
- iuo.mutation.ClearChildren()
- return iuo
+func (_u *ItemUpdateOne) ClearChildren() *ItemUpdateOne {
+ _u.mutation.ClearChildren()
+ return _u
}
// RemoveChildIDs removes the "children" edge to Item entities by IDs.
-func (iuo *ItemUpdateOne) RemoveChildIDs(ids ...uuid.UUID) *ItemUpdateOne {
- iuo.mutation.RemoveChildIDs(ids...)
- return iuo
+func (_u *ItemUpdateOne) RemoveChildIDs(ids ...uuid.UUID) *ItemUpdateOne {
+ _u.mutation.RemoveChildIDs(ids...)
+ return _u
}
// RemoveChildren removes "children" edges to Item entities.
-func (iuo *ItemUpdateOne) RemoveChildren(i ...*Item) *ItemUpdateOne {
- ids := make([]uuid.UUID, len(i))
- for j := range i {
- ids[j] = i[j].ID
+func (_u *ItemUpdateOne) RemoveChildren(v ...*Item) *ItemUpdateOne {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return iuo.RemoveChildIDs(ids...)
+ return _u.RemoveChildIDs(ids...)
}
// ClearLabel clears all "label" edges to the Label entity.
-func (iuo *ItemUpdateOne) ClearLabel() *ItemUpdateOne {
- iuo.mutation.ClearLabel()
- return iuo
+func (_u *ItemUpdateOne) ClearLabel() *ItemUpdateOne {
+ _u.mutation.ClearLabel()
+ return _u
}
// RemoveLabelIDs removes the "label" edge to Label entities by IDs.
-func (iuo *ItemUpdateOne) RemoveLabelIDs(ids ...uuid.UUID) *ItemUpdateOne {
- iuo.mutation.RemoveLabelIDs(ids...)
- return iuo
+func (_u *ItemUpdateOne) RemoveLabelIDs(ids ...uuid.UUID) *ItemUpdateOne {
+ _u.mutation.RemoveLabelIDs(ids...)
+ return _u
}
// RemoveLabel removes "label" edges to Label entities.
-func (iuo *ItemUpdateOne) RemoveLabel(l ...*Label) *ItemUpdateOne {
- ids := make([]uuid.UUID, len(l))
- for i := range l {
- ids[i] = l[i].ID
+func (_u *ItemUpdateOne) RemoveLabel(v ...*Label) *ItemUpdateOne {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return iuo.RemoveLabelIDs(ids...)
+ return _u.RemoveLabelIDs(ids...)
}
// ClearLocation clears the "location" edge to the Location entity.
-func (iuo *ItemUpdateOne) ClearLocation() *ItemUpdateOne {
- iuo.mutation.ClearLocation()
- return iuo
+func (_u *ItemUpdateOne) ClearLocation() *ItemUpdateOne {
+ _u.mutation.ClearLocation()
+ return _u
}
// ClearFields clears all "fields" edges to the ItemField entity.
-func (iuo *ItemUpdateOne) ClearFields() *ItemUpdateOne {
- iuo.mutation.ClearFields()
- return iuo
+func (_u *ItemUpdateOne) ClearFields() *ItemUpdateOne {
+ _u.mutation.ClearFields()
+ return _u
}
// RemoveFieldIDs removes the "fields" edge to ItemField entities by IDs.
-func (iuo *ItemUpdateOne) RemoveFieldIDs(ids ...uuid.UUID) *ItemUpdateOne {
- iuo.mutation.RemoveFieldIDs(ids...)
- return iuo
+func (_u *ItemUpdateOne) RemoveFieldIDs(ids ...uuid.UUID) *ItemUpdateOne {
+ _u.mutation.RemoveFieldIDs(ids...)
+ return _u
}
// RemoveFields removes "fields" edges to ItemField entities.
-func (iuo *ItemUpdateOne) RemoveFields(i ...*ItemField) *ItemUpdateOne {
- ids := make([]uuid.UUID, len(i))
- for j := range i {
- ids[j] = i[j].ID
+func (_u *ItemUpdateOne) RemoveFields(v ...*ItemField) *ItemUpdateOne {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return iuo.RemoveFieldIDs(ids...)
+ return _u.RemoveFieldIDs(ids...)
}
// ClearMaintenanceEntries clears all "maintenance_entries" edges to the MaintenanceEntry entity.
-func (iuo *ItemUpdateOne) ClearMaintenanceEntries() *ItemUpdateOne {
- iuo.mutation.ClearMaintenanceEntries()
- return iuo
+func (_u *ItemUpdateOne) ClearMaintenanceEntries() *ItemUpdateOne {
+ _u.mutation.ClearMaintenanceEntries()
+ return _u
}
// RemoveMaintenanceEntryIDs removes the "maintenance_entries" edge to MaintenanceEntry entities by IDs.
-func (iuo *ItemUpdateOne) RemoveMaintenanceEntryIDs(ids ...uuid.UUID) *ItemUpdateOne {
- iuo.mutation.RemoveMaintenanceEntryIDs(ids...)
- return iuo
+func (_u *ItemUpdateOne) RemoveMaintenanceEntryIDs(ids ...uuid.UUID) *ItemUpdateOne {
+ _u.mutation.RemoveMaintenanceEntryIDs(ids...)
+ return _u
}
// RemoveMaintenanceEntries removes "maintenance_entries" edges to MaintenanceEntry entities.
-func (iuo *ItemUpdateOne) RemoveMaintenanceEntries(m ...*MaintenanceEntry) *ItemUpdateOne {
- ids := make([]uuid.UUID, len(m))
- for i := range m {
- ids[i] = m[i].ID
+func (_u *ItemUpdateOne) RemoveMaintenanceEntries(v ...*MaintenanceEntry) *ItemUpdateOne {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return iuo.RemoveMaintenanceEntryIDs(ids...)
+ return _u.RemoveMaintenanceEntryIDs(ids...)
}
// ClearAttachments clears all "attachments" edges to the Attachment entity.
-func (iuo *ItemUpdateOne) ClearAttachments() *ItemUpdateOne {
- iuo.mutation.ClearAttachments()
- return iuo
+func (_u *ItemUpdateOne) ClearAttachments() *ItemUpdateOne {
+ _u.mutation.ClearAttachments()
+ return _u
}
// RemoveAttachmentIDs removes the "attachments" edge to Attachment entities by IDs.
-func (iuo *ItemUpdateOne) RemoveAttachmentIDs(ids ...uuid.UUID) *ItemUpdateOne {
- iuo.mutation.RemoveAttachmentIDs(ids...)
- return iuo
+func (_u *ItemUpdateOne) RemoveAttachmentIDs(ids ...uuid.UUID) *ItemUpdateOne {
+ _u.mutation.RemoveAttachmentIDs(ids...)
+ return _u
}
// RemoveAttachments removes "attachments" edges to Attachment entities.
-func (iuo *ItemUpdateOne) RemoveAttachments(a ...*Attachment) *ItemUpdateOne {
- ids := make([]uuid.UUID, len(a))
- for i := range a {
- ids[i] = a[i].ID
+func (_u *ItemUpdateOne) RemoveAttachments(v ...*Attachment) *ItemUpdateOne {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return iuo.RemoveAttachmentIDs(ids...)
+ return _u.RemoveAttachmentIDs(ids...)
}
// Where appends a list predicates to the ItemUpdate builder.
-func (iuo *ItemUpdateOne) Where(ps ...predicate.Item) *ItemUpdateOne {
- iuo.mutation.Where(ps...)
- return iuo
+func (_u *ItemUpdateOne) Where(ps ...predicate.Item) *ItemUpdateOne {
+ _u.mutation.Where(ps...)
+ return _u
}
// Select allows selecting one or more fields (columns) of the returned entity.
// The default is selecting all fields defined in the entity schema.
-func (iuo *ItemUpdateOne) Select(field string, fields ...string) *ItemUpdateOne {
- iuo.fields = append([]string{field}, fields...)
- return iuo
+func (_u *ItemUpdateOne) Select(field string, fields ...string) *ItemUpdateOne {
+ _u.fields = append([]string{field}, fields...)
+ return _u
}
// Save executes the query and returns the updated Item entity.
-func (iuo *ItemUpdateOne) Save(ctx context.Context) (*Item, error) {
- iuo.defaults()
- return withHooks(ctx, iuo.sqlSave, iuo.mutation, iuo.hooks)
+func (_u *ItemUpdateOne) Save(ctx context.Context) (*Item, error) {
+ _u.defaults()
+ return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
}
// SaveX is like Save, but panics if an error occurs.
-func (iuo *ItemUpdateOne) SaveX(ctx context.Context) *Item {
- node, err := iuo.Save(ctx)
+func (_u *ItemUpdateOne) SaveX(ctx context.Context) *Item {
+ node, err := _u.Save(ctx)
if err != nil {
panic(err)
}
@@ -1961,90 +1961,90 @@ func (iuo *ItemUpdateOne) SaveX(ctx context.Context) *Item {
}
// Exec executes the query on the entity.
-func (iuo *ItemUpdateOne) Exec(ctx context.Context) error {
- _, err := iuo.Save(ctx)
+func (_u *ItemUpdateOne) Exec(ctx context.Context) error {
+ _, err := _u.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
-func (iuo *ItemUpdateOne) ExecX(ctx context.Context) {
- if err := iuo.Exec(ctx); err != nil {
+func (_u *ItemUpdateOne) ExecX(ctx context.Context) {
+ if err := _u.Exec(ctx); err != nil {
panic(err)
}
}
// defaults sets the default values of the builder before save.
-func (iuo *ItemUpdateOne) defaults() {
- if _, ok := iuo.mutation.UpdatedAt(); !ok {
+func (_u *ItemUpdateOne) defaults() {
+ if _, ok := _u.mutation.UpdatedAt(); !ok {
v := item.UpdateDefaultUpdatedAt()
- iuo.mutation.SetUpdatedAt(v)
+ _u.mutation.SetUpdatedAt(v)
}
}
// check runs all checks and user-defined validators on the builder.
-func (iuo *ItemUpdateOne) check() error {
- if v, ok := iuo.mutation.Name(); ok {
+func (_u *ItemUpdateOne) check() error {
+ if v, ok := _u.mutation.Name(); ok {
if err := item.NameValidator(v); err != nil {
return &ValidationError{Name: "name", err: fmt.Errorf(`ent: validator failed for field "Item.name": %w`, err)}
}
}
- if v, ok := iuo.mutation.Description(); ok {
+ if v, ok := _u.mutation.Description(); ok {
if err := item.DescriptionValidator(v); err != nil {
return &ValidationError{Name: "description", err: fmt.Errorf(`ent: validator failed for field "Item.description": %w`, err)}
}
}
- if v, ok := iuo.mutation.ImportRef(); ok {
+ if v, ok := _u.mutation.ImportRef(); ok {
if err := item.ImportRefValidator(v); err != nil {
return &ValidationError{Name: "import_ref", err: fmt.Errorf(`ent: validator failed for field "Item.import_ref": %w`, err)}
}
}
- if v, ok := iuo.mutation.Notes(); ok {
+ if v, ok := _u.mutation.Notes(); ok {
if err := item.NotesValidator(v); err != nil {
return &ValidationError{Name: "notes", err: fmt.Errorf(`ent: validator failed for field "Item.notes": %w`, err)}
}
}
- if v, ok := iuo.mutation.SerialNumber(); ok {
+ if v, ok := _u.mutation.SerialNumber(); ok {
if err := item.SerialNumberValidator(v); err != nil {
return &ValidationError{Name: "serial_number", err: fmt.Errorf(`ent: validator failed for field "Item.serial_number": %w`, err)}
}
}
- if v, ok := iuo.mutation.ModelNumber(); ok {
+ if v, ok := _u.mutation.ModelNumber(); ok {
if err := item.ModelNumberValidator(v); err != nil {
return &ValidationError{Name: "model_number", err: fmt.Errorf(`ent: validator failed for field "Item.model_number": %w`, err)}
}
}
- if v, ok := iuo.mutation.Manufacturer(); ok {
+ if v, ok := _u.mutation.Manufacturer(); ok {
if err := item.ManufacturerValidator(v); err != nil {
return &ValidationError{Name: "manufacturer", err: fmt.Errorf(`ent: validator failed for field "Item.manufacturer": %w`, err)}
}
}
- if v, ok := iuo.mutation.WarrantyDetails(); ok {
+ if v, ok := _u.mutation.WarrantyDetails(); ok {
if err := item.WarrantyDetailsValidator(v); err != nil {
return &ValidationError{Name: "warranty_details", err: fmt.Errorf(`ent: validator failed for field "Item.warranty_details": %w`, err)}
}
}
- if v, ok := iuo.mutation.SoldNotes(); ok {
+ if v, ok := _u.mutation.SoldNotes(); ok {
if err := item.SoldNotesValidator(v); err != nil {
return &ValidationError{Name: "sold_notes", err: fmt.Errorf(`ent: validator failed for field "Item.sold_notes": %w`, err)}
}
}
- if iuo.mutation.GroupCleared() && len(iuo.mutation.GroupIDs()) > 0 {
+ if _u.mutation.GroupCleared() && len(_u.mutation.GroupIDs()) > 0 {
return errors.New(`ent: clearing a required unique edge "Item.group"`)
}
return nil
}
-func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (_node *Item, err error) {
- if err := iuo.check(); err != nil {
+func (_u *ItemUpdateOne) sqlSave(ctx context.Context) (_node *Item, err error) {
+ if err := _u.check(); err != nil {
return _node, err
}
_spec := sqlgraph.NewUpdateSpec(item.Table, item.Columns, sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID))
- id, ok := iuo.mutation.ID()
+ id, ok := _u.mutation.ID()
if !ok {
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Item.id" for update`)}
}
_spec.Node.ID.Value = id
- if fields := iuo.fields; len(fields) > 0 {
+ if fields := _u.fields; len(fields) > 0 {
_spec.Node.Columns = make([]string, 0, len(fields))
_spec.Node.Columns = append(_spec.Node.Columns, item.FieldID)
for _, f := range fields {
@@ -2056,134 +2056,134 @@ func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (_node *Item, err error)
}
}
}
- if ps := iuo.mutation.predicates; len(ps) > 0 {
+ if ps := _u.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
- if value, ok := iuo.mutation.UpdatedAt(); ok {
+ if value, ok := _u.mutation.UpdatedAt(); ok {
_spec.SetField(item.FieldUpdatedAt, field.TypeTime, value)
}
- if value, ok := iuo.mutation.Name(); ok {
+ if value, ok := _u.mutation.Name(); ok {
_spec.SetField(item.FieldName, field.TypeString, value)
}
- if value, ok := iuo.mutation.Description(); ok {
+ if value, ok := _u.mutation.Description(); ok {
_spec.SetField(item.FieldDescription, field.TypeString, value)
}
- if iuo.mutation.DescriptionCleared() {
+ if _u.mutation.DescriptionCleared() {
_spec.ClearField(item.FieldDescription, field.TypeString)
}
- if value, ok := iuo.mutation.ImportRef(); ok {
+ if value, ok := _u.mutation.ImportRef(); ok {
_spec.SetField(item.FieldImportRef, field.TypeString, value)
}
- if iuo.mutation.ImportRefCleared() {
+ if _u.mutation.ImportRefCleared() {
_spec.ClearField(item.FieldImportRef, field.TypeString)
}
- if value, ok := iuo.mutation.Notes(); ok {
+ if value, ok := _u.mutation.Notes(); ok {
_spec.SetField(item.FieldNotes, field.TypeString, value)
}
- if iuo.mutation.NotesCleared() {
+ if _u.mutation.NotesCleared() {
_spec.ClearField(item.FieldNotes, field.TypeString)
}
- if value, ok := iuo.mutation.Quantity(); ok {
+ if value, ok := _u.mutation.Quantity(); ok {
_spec.SetField(item.FieldQuantity, field.TypeInt, value)
}
- if value, ok := iuo.mutation.AddedQuantity(); ok {
+ if value, ok := _u.mutation.AddedQuantity(); ok {
_spec.AddField(item.FieldQuantity, field.TypeInt, value)
}
- if value, ok := iuo.mutation.Insured(); ok {
+ if value, ok := _u.mutation.Insured(); ok {
_spec.SetField(item.FieldInsured, field.TypeBool, value)
}
- if value, ok := iuo.mutation.Archived(); ok {
+ if value, ok := _u.mutation.Archived(); ok {
_spec.SetField(item.FieldArchived, field.TypeBool, value)
}
- if value, ok := iuo.mutation.AssetID(); ok {
+ if value, ok := _u.mutation.AssetID(); ok {
_spec.SetField(item.FieldAssetID, field.TypeInt, value)
}
- if value, ok := iuo.mutation.AddedAssetID(); ok {
+ if value, ok := _u.mutation.AddedAssetID(); ok {
_spec.AddField(item.FieldAssetID, field.TypeInt, value)
}
- if value, ok := iuo.mutation.SyncChildItemsLocations(); ok {
+ if value, ok := _u.mutation.SyncChildItemsLocations(); ok {
_spec.SetField(item.FieldSyncChildItemsLocations, field.TypeBool, value)
}
- if value, ok := iuo.mutation.SerialNumber(); ok {
+ if value, ok := _u.mutation.SerialNumber(); ok {
_spec.SetField(item.FieldSerialNumber, field.TypeString, value)
}
- if iuo.mutation.SerialNumberCleared() {
+ if _u.mutation.SerialNumberCleared() {
_spec.ClearField(item.FieldSerialNumber, field.TypeString)
}
- if value, ok := iuo.mutation.ModelNumber(); ok {
+ if value, ok := _u.mutation.ModelNumber(); ok {
_spec.SetField(item.FieldModelNumber, field.TypeString, value)
}
- if iuo.mutation.ModelNumberCleared() {
+ if _u.mutation.ModelNumberCleared() {
_spec.ClearField(item.FieldModelNumber, field.TypeString)
}
- if value, ok := iuo.mutation.Manufacturer(); ok {
+ if value, ok := _u.mutation.Manufacturer(); ok {
_spec.SetField(item.FieldManufacturer, field.TypeString, value)
}
- if iuo.mutation.ManufacturerCleared() {
+ if _u.mutation.ManufacturerCleared() {
_spec.ClearField(item.FieldManufacturer, field.TypeString)
}
- if value, ok := iuo.mutation.LifetimeWarranty(); ok {
+ if value, ok := _u.mutation.LifetimeWarranty(); ok {
_spec.SetField(item.FieldLifetimeWarranty, field.TypeBool, value)
}
- if value, ok := iuo.mutation.WarrantyExpires(); ok {
+ if value, ok := _u.mutation.WarrantyExpires(); ok {
_spec.SetField(item.FieldWarrantyExpires, field.TypeTime, value)
}
- if iuo.mutation.WarrantyExpiresCleared() {
+ if _u.mutation.WarrantyExpiresCleared() {
_spec.ClearField(item.FieldWarrantyExpires, field.TypeTime)
}
- if value, ok := iuo.mutation.WarrantyDetails(); ok {
+ if value, ok := _u.mutation.WarrantyDetails(); ok {
_spec.SetField(item.FieldWarrantyDetails, field.TypeString, value)
}
- if iuo.mutation.WarrantyDetailsCleared() {
+ if _u.mutation.WarrantyDetailsCleared() {
_spec.ClearField(item.FieldWarrantyDetails, field.TypeString)
}
- if value, ok := iuo.mutation.PurchaseTime(); ok {
+ if value, ok := _u.mutation.PurchaseTime(); ok {
_spec.SetField(item.FieldPurchaseTime, field.TypeTime, value)
}
- if iuo.mutation.PurchaseTimeCleared() {
+ if _u.mutation.PurchaseTimeCleared() {
_spec.ClearField(item.FieldPurchaseTime, field.TypeTime)
}
- if value, ok := iuo.mutation.PurchaseFrom(); ok {
+ if value, ok := _u.mutation.PurchaseFrom(); ok {
_spec.SetField(item.FieldPurchaseFrom, field.TypeString, value)
}
- if iuo.mutation.PurchaseFromCleared() {
+ if _u.mutation.PurchaseFromCleared() {
_spec.ClearField(item.FieldPurchaseFrom, field.TypeString)
}
- if value, ok := iuo.mutation.PurchasePrice(); ok {
+ if value, ok := _u.mutation.PurchasePrice(); ok {
_spec.SetField(item.FieldPurchasePrice, field.TypeFloat64, value)
}
- if value, ok := iuo.mutation.AddedPurchasePrice(); ok {
+ if value, ok := _u.mutation.AddedPurchasePrice(); ok {
_spec.AddField(item.FieldPurchasePrice, field.TypeFloat64, value)
}
- if value, ok := iuo.mutation.SoldTime(); ok {
+ if value, ok := _u.mutation.SoldTime(); ok {
_spec.SetField(item.FieldSoldTime, field.TypeTime, value)
}
- if iuo.mutation.SoldTimeCleared() {
+ if _u.mutation.SoldTimeCleared() {
_spec.ClearField(item.FieldSoldTime, field.TypeTime)
}
- if value, ok := iuo.mutation.SoldTo(); ok {
+ if value, ok := _u.mutation.SoldTo(); ok {
_spec.SetField(item.FieldSoldTo, field.TypeString, value)
}
- if iuo.mutation.SoldToCleared() {
+ if _u.mutation.SoldToCleared() {
_spec.ClearField(item.FieldSoldTo, field.TypeString)
}
- if value, ok := iuo.mutation.SoldPrice(); ok {
+ if value, ok := _u.mutation.SoldPrice(); ok {
_spec.SetField(item.FieldSoldPrice, field.TypeFloat64, value)
}
- if value, ok := iuo.mutation.AddedSoldPrice(); ok {
+ if value, ok := _u.mutation.AddedSoldPrice(); ok {
_spec.AddField(item.FieldSoldPrice, field.TypeFloat64, value)
}
- if value, ok := iuo.mutation.SoldNotes(); ok {
+ if value, ok := _u.mutation.SoldNotes(); ok {
_spec.SetField(item.FieldSoldNotes, field.TypeString, value)
}
- if iuo.mutation.SoldNotesCleared() {
+ if _u.mutation.SoldNotesCleared() {
_spec.ClearField(item.FieldSoldNotes, field.TypeString)
}
- if iuo.mutation.GroupCleared() {
+ if _u.mutation.GroupCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -2196,7 +2196,7 @@ func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (_node *Item, err error)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := iuo.mutation.GroupIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.GroupIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -2212,7 +2212,7 @@ func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (_node *Item, err error)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- if iuo.mutation.ParentCleared() {
+ if _u.mutation.ParentCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -2225,7 +2225,7 @@ func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (_node *Item, err error)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := iuo.mutation.ParentIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.ParentIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -2241,7 +2241,7 @@ func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (_node *Item, err error)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- if iuo.mutation.ChildrenCleared() {
+ if _u.mutation.ChildrenCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -2254,7 +2254,7 @@ func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (_node *Item, err error)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := iuo.mutation.RemovedChildrenIDs(); len(nodes) > 0 && !iuo.mutation.ChildrenCleared() {
+ if nodes := _u.mutation.RemovedChildrenIDs(); len(nodes) > 0 && !_u.mutation.ChildrenCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -2270,7 +2270,7 @@ func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (_node *Item, err error)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := iuo.mutation.ChildrenIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.ChildrenIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -2286,7 +2286,7 @@ func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (_node *Item, err error)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- if iuo.mutation.LabelCleared() {
+ if _u.mutation.LabelCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2M,
Inverse: true,
@@ -2299,7 +2299,7 @@ func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (_node *Item, err error)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := iuo.mutation.RemovedLabelIDs(); len(nodes) > 0 && !iuo.mutation.LabelCleared() {
+ if nodes := _u.mutation.RemovedLabelIDs(); len(nodes) > 0 && !_u.mutation.LabelCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2M,
Inverse: true,
@@ -2315,7 +2315,7 @@ func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (_node *Item, err error)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := iuo.mutation.LabelIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.LabelIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2M,
Inverse: true,
@@ -2331,7 +2331,7 @@ func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (_node *Item, err error)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- if iuo.mutation.LocationCleared() {
+ if _u.mutation.LocationCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -2344,7 +2344,7 @@ func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (_node *Item, err error)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := iuo.mutation.LocationIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.LocationIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -2360,7 +2360,7 @@ func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (_node *Item, err error)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- if iuo.mutation.FieldsCleared() {
+ if _u.mutation.FieldsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -2373,7 +2373,7 @@ func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (_node *Item, err error)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := iuo.mutation.RemovedFieldsIDs(); len(nodes) > 0 && !iuo.mutation.FieldsCleared() {
+ if nodes := _u.mutation.RemovedFieldsIDs(); len(nodes) > 0 && !_u.mutation.FieldsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -2389,7 +2389,7 @@ func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (_node *Item, err error)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := iuo.mutation.FieldsIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.FieldsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -2405,7 +2405,7 @@ func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (_node *Item, err error)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- if iuo.mutation.MaintenanceEntriesCleared() {
+ if _u.mutation.MaintenanceEntriesCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -2418,7 +2418,7 @@ func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (_node *Item, err error)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := iuo.mutation.RemovedMaintenanceEntriesIDs(); len(nodes) > 0 && !iuo.mutation.MaintenanceEntriesCleared() {
+ if nodes := _u.mutation.RemovedMaintenanceEntriesIDs(); len(nodes) > 0 && !_u.mutation.MaintenanceEntriesCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -2434,7 +2434,7 @@ func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (_node *Item, err error)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := iuo.mutation.MaintenanceEntriesIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.MaintenanceEntriesIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -2450,7 +2450,7 @@ func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (_node *Item, err error)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- if iuo.mutation.AttachmentsCleared() {
+ if _u.mutation.AttachmentsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -2463,7 +2463,7 @@ func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (_node *Item, err error)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := iuo.mutation.RemovedAttachmentsIDs(); len(nodes) > 0 && !iuo.mutation.AttachmentsCleared() {
+ if nodes := _u.mutation.RemovedAttachmentsIDs(); len(nodes) > 0 && !_u.mutation.AttachmentsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -2479,7 +2479,7 @@ func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (_node *Item, err error)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := iuo.mutation.AttachmentsIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.AttachmentsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -2495,10 +2495,10 @@ func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (_node *Item, err error)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- _node = &Item{config: iuo.config}
+ _node = &Item{config: _u.config}
_spec.Assign = _node.assignValues
_spec.ScanValues = _node.scanValues
- if err = sqlgraph.UpdateNode(ctx, iuo.driver, _spec); err != nil {
+ if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil {
if _, ok := err.(*sqlgraph.NotFoundError); ok {
err = &NotFoundError{item.Label}
} else if sqlgraph.IsConstraintError(err) {
@@ -2506,6 +2506,6 @@ func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (_node *Item, err error)
}
return nil, err
}
- iuo.mutation.done = true
+ _u.mutation.done = true
return _node, nil
}
diff --git a/backend/internal/data/ent/itemfield.go b/backend/internal/data/ent/itemfield.go
index f29dcc0d..72342ef1 100644
--- a/backend/internal/data/ent/itemfield.go
+++ b/backend/internal/data/ent/itemfield.go
@@ -90,7 +90,7 @@ func (*ItemField) scanValues(columns []string) ([]any, error) {
// assignValues assigns the values that were returned from sql.Rows (after scanning)
// to the ItemField fields.
-func (_if *ItemField) assignValues(columns []string, values []any) error {
+func (_m *ItemField) assignValues(columns []string, values []any) error {
if m, n := len(values), len(columns); m < n {
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
}
@@ -100,71 +100,71 @@ func (_if *ItemField) assignValues(columns []string, values []any) error {
if value, ok := values[i].(*uuid.UUID); !ok {
return fmt.Errorf("unexpected type %T for field id", values[i])
} else if value != nil {
- _if.ID = *value
+ _m.ID = *value
}
case itemfield.FieldCreatedAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field created_at", values[i])
} else if value.Valid {
- _if.CreatedAt = value.Time
+ _m.CreatedAt = value.Time
}
case itemfield.FieldUpdatedAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field updated_at", values[i])
} else if value.Valid {
- _if.UpdatedAt = value.Time
+ _m.UpdatedAt = value.Time
}
case itemfield.FieldName:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field name", values[i])
} else if value.Valid {
- _if.Name = value.String
+ _m.Name = value.String
}
case itemfield.FieldDescription:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field description", values[i])
} else if value.Valid {
- _if.Description = value.String
+ _m.Description = value.String
}
case itemfield.FieldType:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field type", values[i])
} else if value.Valid {
- _if.Type = itemfield.Type(value.String)
+ _m.Type = itemfield.Type(value.String)
}
case itemfield.FieldTextValue:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field text_value", values[i])
} else if value.Valid {
- _if.TextValue = value.String
+ _m.TextValue = value.String
}
case itemfield.FieldNumberValue:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field number_value", values[i])
} else if value.Valid {
- _if.NumberValue = int(value.Int64)
+ _m.NumberValue = int(value.Int64)
}
case itemfield.FieldBooleanValue:
if value, ok := values[i].(*sql.NullBool); !ok {
return fmt.Errorf("unexpected type %T for field boolean_value", values[i])
} else if value.Valid {
- _if.BooleanValue = value.Bool
+ _m.BooleanValue = value.Bool
}
case itemfield.FieldTimeValue:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field time_value", values[i])
} else if value.Valid {
- _if.TimeValue = value.Time
+ _m.TimeValue = value.Time
}
case itemfield.ForeignKeys[0]:
if value, ok := values[i].(*sql.NullScanner); !ok {
return fmt.Errorf("unexpected type %T for field item_fields", values[i])
} else if value.Valid {
- _if.item_fields = new(uuid.UUID)
- *_if.item_fields = *value.S.(*uuid.UUID)
+ _m.item_fields = new(uuid.UUID)
+ *_m.item_fields = *value.S.(*uuid.UUID)
}
default:
- _if.selectValues.Set(columns[i], values[i])
+ _m.selectValues.Set(columns[i], values[i])
}
}
return nil
@@ -172,64 +172,64 @@ func (_if *ItemField) assignValues(columns []string, values []any) error {
// Value returns the ent.Value that was dynamically selected and assigned to the ItemField.
// This includes values selected through modifiers, order, etc.
-func (_if *ItemField) Value(name string) (ent.Value, error) {
- return _if.selectValues.Get(name)
+func (_m *ItemField) Value(name string) (ent.Value, error) {
+ return _m.selectValues.Get(name)
}
// QueryItem queries the "item" edge of the ItemField entity.
-func (_if *ItemField) QueryItem() *ItemQuery {
- return NewItemFieldClient(_if.config).QueryItem(_if)
+func (_m *ItemField) QueryItem() *ItemQuery {
+ return NewItemFieldClient(_m.config).QueryItem(_m)
}
// Update returns a builder for updating this ItemField.
// Note that you need to call ItemField.Unwrap() before calling this method if this ItemField
// was returned from a transaction, and the transaction was committed or rolled back.
-func (_if *ItemField) Update() *ItemFieldUpdateOne {
- return NewItemFieldClient(_if.config).UpdateOne(_if)
+func (_m *ItemField) Update() *ItemFieldUpdateOne {
+ return NewItemFieldClient(_m.config).UpdateOne(_m)
}
// Unwrap unwraps the ItemField 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 (_if *ItemField) Unwrap() *ItemField {
- _tx, ok := _if.config.driver.(*txDriver)
+func (_m *ItemField) Unwrap() *ItemField {
+ _tx, ok := _m.config.driver.(*txDriver)
if !ok {
panic("ent: ItemField is not a transactional entity")
}
- _if.config.driver = _tx.drv
- return _if
+ _m.config.driver = _tx.drv
+ return _m
}
// String implements the fmt.Stringer.
-func (_if *ItemField) String() string {
+func (_m *ItemField) String() string {
var builder strings.Builder
builder.WriteString("ItemField(")
- builder.WriteString(fmt.Sprintf("id=%v, ", _if.ID))
+ builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
builder.WriteString("created_at=")
- builder.WriteString(_if.CreatedAt.Format(time.ANSIC))
+ builder.WriteString(_m.CreatedAt.Format(time.ANSIC))
builder.WriteString(", ")
builder.WriteString("updated_at=")
- builder.WriteString(_if.UpdatedAt.Format(time.ANSIC))
+ builder.WriteString(_m.UpdatedAt.Format(time.ANSIC))
builder.WriteString(", ")
builder.WriteString("name=")
- builder.WriteString(_if.Name)
+ builder.WriteString(_m.Name)
builder.WriteString(", ")
builder.WriteString("description=")
- builder.WriteString(_if.Description)
+ builder.WriteString(_m.Description)
builder.WriteString(", ")
builder.WriteString("type=")
- builder.WriteString(fmt.Sprintf("%v", _if.Type))
+ builder.WriteString(fmt.Sprintf("%v", _m.Type))
builder.WriteString(", ")
builder.WriteString("text_value=")
- builder.WriteString(_if.TextValue)
+ builder.WriteString(_m.TextValue)
builder.WriteString(", ")
builder.WriteString("number_value=")
- builder.WriteString(fmt.Sprintf("%v", _if.NumberValue))
+ builder.WriteString(fmt.Sprintf("%v", _m.NumberValue))
builder.WriteString(", ")
builder.WriteString("boolean_value=")
- builder.WriteString(fmt.Sprintf("%v", _if.BooleanValue))
+ builder.WriteString(fmt.Sprintf("%v", _m.BooleanValue))
builder.WriteString(", ")
builder.WriteString("time_value=")
- builder.WriteString(_if.TimeValue.Format(time.ANSIC))
+ builder.WriteString(_m.TimeValue.Format(time.ANSIC))
builder.WriteByte(')')
return builder.String()
}
diff --git a/backend/internal/data/ent/itemfield_create.go b/backend/internal/data/ent/itemfield_create.go
index d84d719f..1daf082b 100644
--- a/backend/internal/data/ent/itemfield_create.go
+++ b/backend/internal/data/ent/itemfield_create.go
@@ -23,162 +23,162 @@ type ItemFieldCreate struct {
}
// SetCreatedAt sets the "created_at" field.
-func (ifc *ItemFieldCreate) SetCreatedAt(t time.Time) *ItemFieldCreate {
- ifc.mutation.SetCreatedAt(t)
- return ifc
+func (_c *ItemFieldCreate) SetCreatedAt(v time.Time) *ItemFieldCreate {
+ _c.mutation.SetCreatedAt(v)
+ return _c
}
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
-func (ifc *ItemFieldCreate) SetNillableCreatedAt(t *time.Time) *ItemFieldCreate {
- if t != nil {
- ifc.SetCreatedAt(*t)
+func (_c *ItemFieldCreate) SetNillableCreatedAt(v *time.Time) *ItemFieldCreate {
+ if v != nil {
+ _c.SetCreatedAt(*v)
}
- return ifc
+ return _c
}
// SetUpdatedAt sets the "updated_at" field.
-func (ifc *ItemFieldCreate) SetUpdatedAt(t time.Time) *ItemFieldCreate {
- ifc.mutation.SetUpdatedAt(t)
- return ifc
+func (_c *ItemFieldCreate) SetUpdatedAt(v time.Time) *ItemFieldCreate {
+ _c.mutation.SetUpdatedAt(v)
+ return _c
}
// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
-func (ifc *ItemFieldCreate) SetNillableUpdatedAt(t *time.Time) *ItemFieldCreate {
- if t != nil {
- ifc.SetUpdatedAt(*t)
+func (_c *ItemFieldCreate) SetNillableUpdatedAt(v *time.Time) *ItemFieldCreate {
+ if v != nil {
+ _c.SetUpdatedAt(*v)
}
- return ifc
+ return _c
}
// SetName sets the "name" field.
-func (ifc *ItemFieldCreate) SetName(s string) *ItemFieldCreate {
- ifc.mutation.SetName(s)
- return ifc
+func (_c *ItemFieldCreate) SetName(v string) *ItemFieldCreate {
+ _c.mutation.SetName(v)
+ return _c
}
// SetDescription sets the "description" field.
-func (ifc *ItemFieldCreate) SetDescription(s string) *ItemFieldCreate {
- ifc.mutation.SetDescription(s)
- return ifc
+func (_c *ItemFieldCreate) SetDescription(v string) *ItemFieldCreate {
+ _c.mutation.SetDescription(v)
+ return _c
}
// SetNillableDescription sets the "description" field if the given value is not nil.
-func (ifc *ItemFieldCreate) SetNillableDescription(s *string) *ItemFieldCreate {
- if s != nil {
- ifc.SetDescription(*s)
+func (_c *ItemFieldCreate) SetNillableDescription(v *string) *ItemFieldCreate {
+ if v != nil {
+ _c.SetDescription(*v)
}
- return ifc
+ return _c
}
// SetType sets the "type" field.
-func (ifc *ItemFieldCreate) SetType(i itemfield.Type) *ItemFieldCreate {
- ifc.mutation.SetType(i)
- return ifc
+func (_c *ItemFieldCreate) SetType(v itemfield.Type) *ItemFieldCreate {
+ _c.mutation.SetType(v)
+ return _c
}
// SetTextValue sets the "text_value" field.
-func (ifc *ItemFieldCreate) SetTextValue(s string) *ItemFieldCreate {
- ifc.mutation.SetTextValue(s)
- return ifc
+func (_c *ItemFieldCreate) SetTextValue(v string) *ItemFieldCreate {
+ _c.mutation.SetTextValue(v)
+ return _c
}
// SetNillableTextValue sets the "text_value" field if the given value is not nil.
-func (ifc *ItemFieldCreate) SetNillableTextValue(s *string) *ItemFieldCreate {
- if s != nil {
- ifc.SetTextValue(*s)
+func (_c *ItemFieldCreate) SetNillableTextValue(v *string) *ItemFieldCreate {
+ if v != nil {
+ _c.SetTextValue(*v)
}
- return ifc
+ return _c
}
// SetNumberValue sets the "number_value" field.
-func (ifc *ItemFieldCreate) SetNumberValue(i int) *ItemFieldCreate {
- ifc.mutation.SetNumberValue(i)
- return ifc
+func (_c *ItemFieldCreate) SetNumberValue(v int) *ItemFieldCreate {
+ _c.mutation.SetNumberValue(v)
+ return _c
}
// SetNillableNumberValue sets the "number_value" field if the given value is not nil.
-func (ifc *ItemFieldCreate) SetNillableNumberValue(i *int) *ItemFieldCreate {
- if i != nil {
- ifc.SetNumberValue(*i)
+func (_c *ItemFieldCreate) SetNillableNumberValue(v *int) *ItemFieldCreate {
+ if v != nil {
+ _c.SetNumberValue(*v)
}
- return ifc
+ return _c
}
// SetBooleanValue sets the "boolean_value" field.
-func (ifc *ItemFieldCreate) SetBooleanValue(b bool) *ItemFieldCreate {
- ifc.mutation.SetBooleanValue(b)
- return ifc
+func (_c *ItemFieldCreate) SetBooleanValue(v bool) *ItemFieldCreate {
+ _c.mutation.SetBooleanValue(v)
+ return _c
}
// SetNillableBooleanValue sets the "boolean_value" field if the given value is not nil.
-func (ifc *ItemFieldCreate) SetNillableBooleanValue(b *bool) *ItemFieldCreate {
- if b != nil {
- ifc.SetBooleanValue(*b)
+func (_c *ItemFieldCreate) SetNillableBooleanValue(v *bool) *ItemFieldCreate {
+ if v != nil {
+ _c.SetBooleanValue(*v)
}
- return ifc
+ return _c
}
// SetTimeValue sets the "time_value" field.
-func (ifc *ItemFieldCreate) SetTimeValue(t time.Time) *ItemFieldCreate {
- ifc.mutation.SetTimeValue(t)
- return ifc
+func (_c *ItemFieldCreate) SetTimeValue(v time.Time) *ItemFieldCreate {
+ _c.mutation.SetTimeValue(v)
+ return _c
}
// SetNillableTimeValue sets the "time_value" field if the given value is not nil.
-func (ifc *ItemFieldCreate) SetNillableTimeValue(t *time.Time) *ItemFieldCreate {
- if t != nil {
- ifc.SetTimeValue(*t)
+func (_c *ItemFieldCreate) SetNillableTimeValue(v *time.Time) *ItemFieldCreate {
+ if v != nil {
+ _c.SetTimeValue(*v)
}
- return ifc
+ return _c
}
// SetID sets the "id" field.
-func (ifc *ItemFieldCreate) SetID(u uuid.UUID) *ItemFieldCreate {
- ifc.mutation.SetID(u)
- return ifc
+func (_c *ItemFieldCreate) SetID(v uuid.UUID) *ItemFieldCreate {
+ _c.mutation.SetID(v)
+ return _c
}
// SetNillableID sets the "id" field if the given value is not nil.
-func (ifc *ItemFieldCreate) SetNillableID(u *uuid.UUID) *ItemFieldCreate {
- if u != nil {
- ifc.SetID(*u)
+func (_c *ItemFieldCreate) SetNillableID(v *uuid.UUID) *ItemFieldCreate {
+ if v != nil {
+ _c.SetID(*v)
}
- return ifc
+ return _c
}
// SetItemID sets the "item" edge to the Item entity by ID.
-func (ifc *ItemFieldCreate) SetItemID(id uuid.UUID) *ItemFieldCreate {
- ifc.mutation.SetItemID(id)
- return ifc
+func (_c *ItemFieldCreate) SetItemID(id uuid.UUID) *ItemFieldCreate {
+ _c.mutation.SetItemID(id)
+ return _c
}
// SetNillableItemID sets the "item" edge to the Item entity by ID if the given value is not nil.
-func (ifc *ItemFieldCreate) SetNillableItemID(id *uuid.UUID) *ItemFieldCreate {
+func (_c *ItemFieldCreate) SetNillableItemID(id *uuid.UUID) *ItemFieldCreate {
if id != nil {
- ifc = ifc.SetItemID(*id)
+ _c = _c.SetItemID(*id)
}
- return ifc
+ return _c
}
// SetItem sets the "item" edge to the Item entity.
-func (ifc *ItemFieldCreate) SetItem(i *Item) *ItemFieldCreate {
- return ifc.SetItemID(i.ID)
+func (_c *ItemFieldCreate) SetItem(v *Item) *ItemFieldCreate {
+ return _c.SetItemID(v.ID)
}
// Mutation returns the ItemFieldMutation object of the builder.
-func (ifc *ItemFieldCreate) Mutation() *ItemFieldMutation {
- return ifc.mutation
+func (_c *ItemFieldCreate) Mutation() *ItemFieldMutation {
+ return _c.mutation
}
// Save creates the ItemField in the database.
-func (ifc *ItemFieldCreate) Save(ctx context.Context) (*ItemField, error) {
- ifc.defaults()
- return withHooks(ctx, ifc.sqlSave, ifc.mutation, ifc.hooks)
+func (_c *ItemFieldCreate) Save(ctx context.Context) (*ItemField, error) {
+ _c.defaults()
+ return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
}
// SaveX calls Save and panics if Save returns an error.
-func (ifc *ItemFieldCreate) SaveX(ctx context.Context) *ItemField {
- v, err := ifc.Save(ctx)
+func (_c *ItemFieldCreate) SaveX(ctx context.Context) *ItemField {
+ v, err := _c.Save(ctx)
if err != nil {
panic(err)
}
@@ -186,91 +186,91 @@ func (ifc *ItemFieldCreate) SaveX(ctx context.Context) *ItemField {
}
// Exec executes the query.
-func (ifc *ItemFieldCreate) Exec(ctx context.Context) error {
- _, err := ifc.Save(ctx)
+func (_c *ItemFieldCreate) Exec(ctx context.Context) error {
+ _, err := _c.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
-func (ifc *ItemFieldCreate) ExecX(ctx context.Context) {
- if err := ifc.Exec(ctx); err != nil {
+func (_c *ItemFieldCreate) ExecX(ctx context.Context) {
+ if err := _c.Exec(ctx); err != nil {
panic(err)
}
}
// defaults sets the default values of the builder before save.
-func (ifc *ItemFieldCreate) defaults() {
- if _, ok := ifc.mutation.CreatedAt(); !ok {
+func (_c *ItemFieldCreate) defaults() {
+ if _, ok := _c.mutation.CreatedAt(); !ok {
v := itemfield.DefaultCreatedAt()
- ifc.mutation.SetCreatedAt(v)
+ _c.mutation.SetCreatedAt(v)
}
- if _, ok := ifc.mutation.UpdatedAt(); !ok {
+ if _, ok := _c.mutation.UpdatedAt(); !ok {
v := itemfield.DefaultUpdatedAt()
- ifc.mutation.SetUpdatedAt(v)
+ _c.mutation.SetUpdatedAt(v)
}
- if _, ok := ifc.mutation.BooleanValue(); !ok {
+ if _, ok := _c.mutation.BooleanValue(); !ok {
v := itemfield.DefaultBooleanValue
- ifc.mutation.SetBooleanValue(v)
+ _c.mutation.SetBooleanValue(v)
}
- if _, ok := ifc.mutation.TimeValue(); !ok {
+ if _, ok := _c.mutation.TimeValue(); !ok {
v := itemfield.DefaultTimeValue()
- ifc.mutation.SetTimeValue(v)
+ _c.mutation.SetTimeValue(v)
}
- if _, ok := ifc.mutation.ID(); !ok {
+ if _, ok := _c.mutation.ID(); !ok {
v := itemfield.DefaultID()
- ifc.mutation.SetID(v)
+ _c.mutation.SetID(v)
}
}
// check runs all checks and user-defined validators on the builder.
-func (ifc *ItemFieldCreate) check() error {
- if _, ok := ifc.mutation.CreatedAt(); !ok {
+func (_c *ItemFieldCreate) check() error {
+ if _, ok := _c.mutation.CreatedAt(); !ok {
return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "ItemField.created_at"`)}
}
- if _, ok := ifc.mutation.UpdatedAt(); !ok {
+ if _, ok := _c.mutation.UpdatedAt(); !ok {
return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "ItemField.updated_at"`)}
}
- if _, ok := ifc.mutation.Name(); !ok {
+ if _, ok := _c.mutation.Name(); !ok {
return &ValidationError{Name: "name", err: errors.New(`ent: missing required field "ItemField.name"`)}
}
- if v, ok := ifc.mutation.Name(); ok {
+ if v, ok := _c.mutation.Name(); ok {
if err := itemfield.NameValidator(v); err != nil {
return &ValidationError{Name: "name", err: fmt.Errorf(`ent: validator failed for field "ItemField.name": %w`, err)}
}
}
- if v, ok := ifc.mutation.Description(); ok {
+ if v, ok := _c.mutation.Description(); ok {
if err := itemfield.DescriptionValidator(v); err != nil {
return &ValidationError{Name: "description", err: fmt.Errorf(`ent: validator failed for field "ItemField.description": %w`, err)}
}
}
- if _, ok := ifc.mutation.GetType(); !ok {
+ if _, ok := _c.mutation.GetType(); !ok {
return &ValidationError{Name: "type", err: errors.New(`ent: missing required field "ItemField.type"`)}
}
- if v, ok := ifc.mutation.GetType(); ok {
+ if v, ok := _c.mutation.GetType(); ok {
if err := itemfield.TypeValidator(v); err != nil {
return &ValidationError{Name: "type", err: fmt.Errorf(`ent: validator failed for field "ItemField.type": %w`, err)}
}
}
- if v, ok := ifc.mutation.TextValue(); ok {
+ if v, ok := _c.mutation.TextValue(); ok {
if err := itemfield.TextValueValidator(v); err != nil {
return &ValidationError{Name: "text_value", err: fmt.Errorf(`ent: validator failed for field "ItemField.text_value": %w`, err)}
}
}
- if _, ok := ifc.mutation.BooleanValue(); !ok {
+ if _, ok := _c.mutation.BooleanValue(); !ok {
return &ValidationError{Name: "boolean_value", err: errors.New(`ent: missing required field "ItemField.boolean_value"`)}
}
- if _, ok := ifc.mutation.TimeValue(); !ok {
+ if _, ok := _c.mutation.TimeValue(); !ok {
return &ValidationError{Name: "time_value", err: errors.New(`ent: missing required field "ItemField.time_value"`)}
}
return nil
}
-func (ifc *ItemFieldCreate) sqlSave(ctx context.Context) (*ItemField, error) {
- if err := ifc.check(); err != nil {
+func (_c *ItemFieldCreate) sqlSave(ctx context.Context) (*ItemField, error) {
+ if err := _c.check(); err != nil {
return nil, err
}
- _node, _spec := ifc.createSpec()
- if err := sqlgraph.CreateNode(ctx, ifc.driver, _spec); err != nil {
+ _node, _spec := _c.createSpec()
+ if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil {
if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
@@ -283,57 +283,57 @@ func (ifc *ItemFieldCreate) sqlSave(ctx context.Context) (*ItemField, error) {
return nil, err
}
}
- ifc.mutation.id = &_node.ID
- ifc.mutation.done = true
+ _c.mutation.id = &_node.ID
+ _c.mutation.done = true
return _node, nil
}
-func (ifc *ItemFieldCreate) createSpec() (*ItemField, *sqlgraph.CreateSpec) {
+func (_c *ItemFieldCreate) createSpec() (*ItemField, *sqlgraph.CreateSpec) {
var (
- _node = &ItemField{config: ifc.config}
+ _node = &ItemField{config: _c.config}
_spec = sqlgraph.NewCreateSpec(itemfield.Table, sqlgraph.NewFieldSpec(itemfield.FieldID, field.TypeUUID))
)
- if id, ok := ifc.mutation.ID(); ok {
+ if id, ok := _c.mutation.ID(); ok {
_node.ID = id
_spec.ID.Value = &id
}
- if value, ok := ifc.mutation.CreatedAt(); ok {
+ if value, ok := _c.mutation.CreatedAt(); ok {
_spec.SetField(itemfield.FieldCreatedAt, field.TypeTime, value)
_node.CreatedAt = value
}
- if value, ok := ifc.mutation.UpdatedAt(); ok {
+ if value, ok := _c.mutation.UpdatedAt(); ok {
_spec.SetField(itemfield.FieldUpdatedAt, field.TypeTime, value)
_node.UpdatedAt = value
}
- if value, ok := ifc.mutation.Name(); ok {
+ if value, ok := _c.mutation.Name(); ok {
_spec.SetField(itemfield.FieldName, field.TypeString, value)
_node.Name = value
}
- if value, ok := ifc.mutation.Description(); ok {
+ if value, ok := _c.mutation.Description(); ok {
_spec.SetField(itemfield.FieldDescription, field.TypeString, value)
_node.Description = value
}
- if value, ok := ifc.mutation.GetType(); ok {
+ if value, ok := _c.mutation.GetType(); ok {
_spec.SetField(itemfield.FieldType, field.TypeEnum, value)
_node.Type = value
}
- if value, ok := ifc.mutation.TextValue(); ok {
+ if value, ok := _c.mutation.TextValue(); ok {
_spec.SetField(itemfield.FieldTextValue, field.TypeString, value)
_node.TextValue = value
}
- if value, ok := ifc.mutation.NumberValue(); ok {
+ if value, ok := _c.mutation.NumberValue(); ok {
_spec.SetField(itemfield.FieldNumberValue, field.TypeInt, value)
_node.NumberValue = value
}
- if value, ok := ifc.mutation.BooleanValue(); ok {
+ if value, ok := _c.mutation.BooleanValue(); ok {
_spec.SetField(itemfield.FieldBooleanValue, field.TypeBool, value)
_node.BooleanValue = value
}
- if value, ok := ifc.mutation.TimeValue(); ok {
+ if value, ok := _c.mutation.TimeValue(); ok {
_spec.SetField(itemfield.FieldTimeValue, field.TypeTime, value)
_node.TimeValue = value
}
- if nodes := ifc.mutation.ItemIDs(); len(nodes) > 0 {
+ if nodes := _c.mutation.ItemIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -361,16 +361,16 @@ type ItemFieldCreateBulk struct {
}
// Save creates the ItemField entities in the database.
-func (ifcb *ItemFieldCreateBulk) Save(ctx context.Context) ([]*ItemField, error) {
- if ifcb.err != nil {
- return nil, ifcb.err
- }
- specs := make([]*sqlgraph.CreateSpec, len(ifcb.builders))
- nodes := make([]*ItemField, len(ifcb.builders))
- mutators := make([]Mutator, len(ifcb.builders))
- for i := range ifcb.builders {
+func (_c *ItemFieldCreateBulk) Save(ctx context.Context) ([]*ItemField, error) {
+ if _c.err != nil {
+ return nil, _c.err
+ }
+ specs := make([]*sqlgraph.CreateSpec, len(_c.builders))
+ nodes := make([]*ItemField, len(_c.builders))
+ mutators := make([]Mutator, len(_c.builders))
+ for i := range _c.builders {
func(i int, root context.Context) {
- builder := ifcb.builders[i]
+ builder := _c.builders[i]
builder.defaults()
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
mutation, ok := m.(*ItemFieldMutation)
@@ -384,11 +384,11 @@ func (ifcb *ItemFieldCreateBulk) Save(ctx context.Context) ([]*ItemField, error)
var err error
nodes[i], specs[i] = builder.createSpec()
if i < len(mutators)-1 {
- _, err = mutators[i+1].Mutate(root, ifcb.builders[i+1].mutation)
+ _, err = mutators[i+1].Mutate(root, _c.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, ifcb.driver, spec); err != nil {
+ if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil {
if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
@@ -408,7 +408,7 @@ func (ifcb *ItemFieldCreateBulk) Save(ctx context.Context) ([]*ItemField, error)
}(i, ctx)
}
if len(mutators) > 0 {
- if _, err := mutators[0].Mutate(ctx, ifcb.builders[0].mutation); err != nil {
+ if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil {
return nil, err
}
}
@@ -416,8 +416,8 @@ func (ifcb *ItemFieldCreateBulk) Save(ctx context.Context) ([]*ItemField, error)
}
// SaveX is like Save, but panics if an error occurs.
-func (ifcb *ItemFieldCreateBulk) SaveX(ctx context.Context) []*ItemField {
- v, err := ifcb.Save(ctx)
+func (_c *ItemFieldCreateBulk) SaveX(ctx context.Context) []*ItemField {
+ v, err := _c.Save(ctx)
if err != nil {
panic(err)
}
@@ -425,14 +425,14 @@ func (ifcb *ItemFieldCreateBulk) SaveX(ctx context.Context) []*ItemField {
}
// Exec executes the query.
-func (ifcb *ItemFieldCreateBulk) Exec(ctx context.Context) error {
- _, err := ifcb.Save(ctx)
+func (_c *ItemFieldCreateBulk) Exec(ctx context.Context) error {
+ _, err := _c.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
-func (ifcb *ItemFieldCreateBulk) ExecX(ctx context.Context) {
- if err := ifcb.Exec(ctx); err != nil {
+func (_c *ItemFieldCreateBulk) ExecX(ctx context.Context) {
+ if err := _c.Exec(ctx); err != nil {
panic(err)
}
}
diff --git a/backend/internal/data/ent/itemfield_delete.go b/backend/internal/data/ent/itemfield_delete.go
index 925eaba1..048cb13d 100644
--- a/backend/internal/data/ent/itemfield_delete.go
+++ b/backend/internal/data/ent/itemfield_delete.go
@@ -20,56 +20,56 @@ type ItemFieldDelete struct {
}
// Where appends a list predicates to the ItemFieldDelete builder.
-func (ifd *ItemFieldDelete) Where(ps ...predicate.ItemField) *ItemFieldDelete {
- ifd.mutation.Where(ps...)
- return ifd
+func (_d *ItemFieldDelete) Where(ps ...predicate.ItemField) *ItemFieldDelete {
+ _d.mutation.Where(ps...)
+ return _d
}
// Exec executes the deletion query and returns how many vertices were deleted.
-func (ifd *ItemFieldDelete) Exec(ctx context.Context) (int, error) {
- return withHooks(ctx, ifd.sqlExec, ifd.mutation, ifd.hooks)
+func (_d *ItemFieldDelete) Exec(ctx context.Context) (int, error) {
+ return withHooks(ctx, _d.sqlExec, _d.mutation, _d.hooks)
}
// ExecX is like Exec, but panics if an error occurs.
-func (ifd *ItemFieldDelete) ExecX(ctx context.Context) int {
- n, err := ifd.Exec(ctx)
+func (_d *ItemFieldDelete) ExecX(ctx context.Context) int {
+ n, err := _d.Exec(ctx)
if err != nil {
panic(err)
}
return n
}
-func (ifd *ItemFieldDelete) sqlExec(ctx context.Context) (int, error) {
+func (_d *ItemFieldDelete) sqlExec(ctx context.Context) (int, error) {
_spec := sqlgraph.NewDeleteSpec(itemfield.Table, sqlgraph.NewFieldSpec(itemfield.FieldID, field.TypeUUID))
- if ps := ifd.mutation.predicates; len(ps) > 0 {
+ if ps := _d.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
- affected, err := sqlgraph.DeleteNodes(ctx, ifd.driver, _spec)
+ affected, err := sqlgraph.DeleteNodes(ctx, _d.driver, _spec)
if err != nil && sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
- ifd.mutation.done = true
+ _d.mutation.done = true
return affected, err
}
// ItemFieldDeleteOne is the builder for deleting a single ItemField entity.
type ItemFieldDeleteOne struct {
- ifd *ItemFieldDelete
+ _d *ItemFieldDelete
}
// Where appends a list predicates to the ItemFieldDelete builder.
-func (ifdo *ItemFieldDeleteOne) Where(ps ...predicate.ItemField) *ItemFieldDeleteOne {
- ifdo.ifd.mutation.Where(ps...)
- return ifdo
+func (_d *ItemFieldDeleteOne) Where(ps ...predicate.ItemField) *ItemFieldDeleteOne {
+ _d._d.mutation.Where(ps...)
+ return _d
}
// Exec executes the deletion query.
-func (ifdo *ItemFieldDeleteOne) Exec(ctx context.Context) error {
- n, err := ifdo.ifd.Exec(ctx)
+func (_d *ItemFieldDeleteOne) Exec(ctx context.Context) error {
+ n, err := _d._d.Exec(ctx)
switch {
case err != nil:
return err
@@ -81,8 +81,8 @@ func (ifdo *ItemFieldDeleteOne) Exec(ctx context.Context) error {
}
// ExecX is like Exec, but panics if an error occurs.
-func (ifdo *ItemFieldDeleteOne) ExecX(ctx context.Context) {
- if err := ifdo.Exec(ctx); err != nil {
+func (_d *ItemFieldDeleteOne) ExecX(ctx context.Context) {
+ if err := _d.Exec(ctx); err != nil {
panic(err)
}
}
diff --git a/backend/internal/data/ent/itemfield_query.go b/backend/internal/data/ent/itemfield_query.go
index a11a1840..39a85914 100644
--- a/backend/internal/data/ent/itemfield_query.go
+++ b/backend/internal/data/ent/itemfield_query.go
@@ -32,44 +32,44 @@ type ItemFieldQuery struct {
}
// Where adds a new predicate for the ItemFieldQuery builder.
-func (ifq *ItemFieldQuery) Where(ps ...predicate.ItemField) *ItemFieldQuery {
- ifq.predicates = append(ifq.predicates, ps...)
- return ifq
+func (_q *ItemFieldQuery) Where(ps ...predicate.ItemField) *ItemFieldQuery {
+ _q.predicates = append(_q.predicates, ps...)
+ return _q
}
// Limit the number of records to be returned by this query.
-func (ifq *ItemFieldQuery) Limit(limit int) *ItemFieldQuery {
- ifq.ctx.Limit = &limit
- return ifq
+func (_q *ItemFieldQuery) Limit(limit int) *ItemFieldQuery {
+ _q.ctx.Limit = &limit
+ return _q
}
// Offset to start from.
-func (ifq *ItemFieldQuery) Offset(offset int) *ItemFieldQuery {
- ifq.ctx.Offset = &offset
- return ifq
+func (_q *ItemFieldQuery) Offset(offset int) *ItemFieldQuery {
+ _q.ctx.Offset = &offset
+ return _q
}
// Unique configures the query builder to filter duplicate records on query.
// By default, unique is set to true, and can be disabled using this method.
-func (ifq *ItemFieldQuery) Unique(unique bool) *ItemFieldQuery {
- ifq.ctx.Unique = &unique
- return ifq
+func (_q *ItemFieldQuery) Unique(unique bool) *ItemFieldQuery {
+ _q.ctx.Unique = &unique
+ return _q
}
// Order specifies how the records should be ordered.
-func (ifq *ItemFieldQuery) Order(o ...itemfield.OrderOption) *ItemFieldQuery {
- ifq.order = append(ifq.order, o...)
- return ifq
+func (_q *ItemFieldQuery) Order(o ...itemfield.OrderOption) *ItemFieldQuery {
+ _q.order = append(_q.order, o...)
+ return _q
}
// QueryItem chains the current query on the "item" edge.
-func (ifq *ItemFieldQuery) QueryItem() *ItemQuery {
- query := (&ItemClient{config: ifq.config}).Query()
+func (_q *ItemFieldQuery) QueryItem() *ItemQuery {
+ query := (&ItemClient{config: _q.config}).Query()
query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
- if err := ifq.prepareQuery(ctx); err != nil {
+ if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
- selector := ifq.sqlQuery(ctx)
+ selector := _q.sqlQuery(ctx)
if err := selector.Err(); err != nil {
return nil, err
}
@@ -78,7 +78,7 @@ func (ifq *ItemFieldQuery) QueryItem() *ItemQuery {
sqlgraph.To(item.Table, item.FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, itemfield.ItemTable, itemfield.ItemColumn),
)
- fromU = sqlgraph.SetNeighbors(ifq.driver.Dialect(), step)
+ fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step)
return fromU, nil
}
return query
@@ -86,8 +86,8 @@ func (ifq *ItemFieldQuery) QueryItem() *ItemQuery {
// First returns the first ItemField entity from the query.
// Returns a *NotFoundError when no ItemField was found.
-func (ifq *ItemFieldQuery) First(ctx context.Context) (*ItemField, error) {
- nodes, err := ifq.Limit(1).All(setContextOp(ctx, ifq.ctx, ent.OpQueryFirst))
+func (_q *ItemFieldQuery) First(ctx context.Context) (*ItemField, error) {
+ nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst))
if err != nil {
return nil, err
}
@@ -98,8 +98,8 @@ func (ifq *ItemFieldQuery) First(ctx context.Context) (*ItemField, error) {
}
// FirstX is like First, but panics if an error occurs.
-func (ifq *ItemFieldQuery) FirstX(ctx context.Context) *ItemField {
- node, err := ifq.First(ctx)
+func (_q *ItemFieldQuery) FirstX(ctx context.Context) *ItemField {
+ node, err := _q.First(ctx)
if err != nil && !IsNotFound(err) {
panic(err)
}
@@ -108,9 +108,9 @@ func (ifq *ItemFieldQuery) FirstX(ctx context.Context) *ItemField {
// FirstID returns the first ItemField ID from the query.
// Returns a *NotFoundError when no ItemField ID was found.
-func (ifq *ItemFieldQuery) FirstID(ctx context.Context) (id uuid.UUID, err error) {
+func (_q *ItemFieldQuery) FirstID(ctx context.Context) (id uuid.UUID, err error) {
var ids []uuid.UUID
- if ids, err = ifq.Limit(1).IDs(setContextOp(ctx, ifq.ctx, ent.OpQueryFirstID)); err != nil {
+ if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil {
return
}
if len(ids) == 0 {
@@ -121,8 +121,8 @@ func (ifq *ItemFieldQuery) FirstID(ctx context.Context) (id uuid.UUID, err error
}
// FirstIDX is like FirstID, but panics if an error occurs.
-func (ifq *ItemFieldQuery) FirstIDX(ctx context.Context) uuid.UUID {
- id, err := ifq.FirstID(ctx)
+func (_q *ItemFieldQuery) FirstIDX(ctx context.Context) uuid.UUID {
+ id, err := _q.FirstID(ctx)
if err != nil && !IsNotFound(err) {
panic(err)
}
@@ -132,8 +132,8 @@ func (ifq *ItemFieldQuery) FirstIDX(ctx context.Context) uuid.UUID {
// Only returns a single ItemField entity found by the query, ensuring it only returns one.
// Returns a *NotSingularError when more than one ItemField entity is found.
// Returns a *NotFoundError when no ItemField entities are found.
-func (ifq *ItemFieldQuery) Only(ctx context.Context) (*ItemField, error) {
- nodes, err := ifq.Limit(2).All(setContextOp(ctx, ifq.ctx, ent.OpQueryOnly))
+func (_q *ItemFieldQuery) Only(ctx context.Context) (*ItemField, error) {
+ nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly))
if err != nil {
return nil, err
}
@@ -148,8 +148,8 @@ func (ifq *ItemFieldQuery) Only(ctx context.Context) (*ItemField, error) {
}
// OnlyX is like Only, but panics if an error occurs.
-func (ifq *ItemFieldQuery) OnlyX(ctx context.Context) *ItemField {
- node, err := ifq.Only(ctx)
+func (_q *ItemFieldQuery) OnlyX(ctx context.Context) *ItemField {
+ node, err := _q.Only(ctx)
if err != nil {
panic(err)
}
@@ -159,9 +159,9 @@ func (ifq *ItemFieldQuery) OnlyX(ctx context.Context) *ItemField {
// OnlyID is like Only, but returns the only ItemField ID in the query.
// Returns a *NotSingularError when more than one ItemField ID is found.
// Returns a *NotFoundError when no entities are found.
-func (ifq *ItemFieldQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error) {
+func (_q *ItemFieldQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error) {
var ids []uuid.UUID
- if ids, err = ifq.Limit(2).IDs(setContextOp(ctx, ifq.ctx, ent.OpQueryOnlyID)); err != nil {
+ if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil {
return
}
switch len(ids) {
@@ -176,8 +176,8 @@ func (ifq *ItemFieldQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)
}
// OnlyIDX is like OnlyID, but panics if an error occurs.
-func (ifq *ItemFieldQuery) OnlyIDX(ctx context.Context) uuid.UUID {
- id, err := ifq.OnlyID(ctx)
+func (_q *ItemFieldQuery) OnlyIDX(ctx context.Context) uuid.UUID {
+ id, err := _q.OnlyID(ctx)
if err != nil {
panic(err)
}
@@ -185,18 +185,18 @@ func (ifq *ItemFieldQuery) OnlyIDX(ctx context.Context) uuid.UUID {
}
// All executes the query and returns a list of ItemFields.
-func (ifq *ItemFieldQuery) All(ctx context.Context) ([]*ItemField, error) {
- ctx = setContextOp(ctx, ifq.ctx, ent.OpQueryAll)
- if err := ifq.prepareQuery(ctx); err != nil {
+func (_q *ItemFieldQuery) All(ctx context.Context) ([]*ItemField, error) {
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll)
+ if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
qr := querierAll[[]*ItemField, *ItemFieldQuery]()
- return withInterceptors[[]*ItemField](ctx, ifq, qr, ifq.inters)
+ return withInterceptors[[]*ItemField](ctx, _q, qr, _q.inters)
}
// AllX is like All, but panics if an error occurs.
-func (ifq *ItemFieldQuery) AllX(ctx context.Context) []*ItemField {
- nodes, err := ifq.All(ctx)
+func (_q *ItemFieldQuery) AllX(ctx context.Context) []*ItemField {
+ nodes, err := _q.All(ctx)
if err != nil {
panic(err)
}
@@ -204,20 +204,20 @@ func (ifq *ItemFieldQuery) AllX(ctx context.Context) []*ItemField {
}
// IDs executes the query and returns a list of ItemField IDs.
-func (ifq *ItemFieldQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error) {
- if ifq.ctx.Unique == nil && ifq.path != nil {
- ifq.Unique(true)
+func (_q *ItemFieldQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error) {
+ if _q.ctx.Unique == nil && _q.path != nil {
+ _q.Unique(true)
}
- ctx = setContextOp(ctx, ifq.ctx, ent.OpQueryIDs)
- if err = ifq.Select(itemfield.FieldID).Scan(ctx, &ids); err != nil {
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs)
+ if err = _q.Select(itemfield.FieldID).Scan(ctx, &ids); err != nil {
return nil, err
}
return ids, nil
}
// IDsX is like IDs, but panics if an error occurs.
-func (ifq *ItemFieldQuery) IDsX(ctx context.Context) []uuid.UUID {
- ids, err := ifq.IDs(ctx)
+func (_q *ItemFieldQuery) IDsX(ctx context.Context) []uuid.UUID {
+ ids, err := _q.IDs(ctx)
if err != nil {
panic(err)
}
@@ -225,17 +225,17 @@ func (ifq *ItemFieldQuery) IDsX(ctx context.Context) []uuid.UUID {
}
// Count returns the count of the given query.
-func (ifq *ItemFieldQuery) Count(ctx context.Context) (int, error) {
- ctx = setContextOp(ctx, ifq.ctx, ent.OpQueryCount)
- if err := ifq.prepareQuery(ctx); err != nil {
+func (_q *ItemFieldQuery) Count(ctx context.Context) (int, error) {
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryCount)
+ if err := _q.prepareQuery(ctx); err != nil {
return 0, err
}
- return withInterceptors[int](ctx, ifq, querierCount[*ItemFieldQuery](), ifq.inters)
+ return withInterceptors[int](ctx, _q, querierCount[*ItemFieldQuery](), _q.inters)
}
// CountX is like Count, but panics if an error occurs.
-func (ifq *ItemFieldQuery) CountX(ctx context.Context) int {
- count, err := ifq.Count(ctx)
+func (_q *ItemFieldQuery) CountX(ctx context.Context) int {
+ count, err := _q.Count(ctx)
if err != nil {
panic(err)
}
@@ -243,9 +243,9 @@ func (ifq *ItemFieldQuery) CountX(ctx context.Context) int {
}
// Exist returns true if the query has elements in the graph.
-func (ifq *ItemFieldQuery) Exist(ctx context.Context) (bool, error) {
- ctx = setContextOp(ctx, ifq.ctx, ent.OpQueryExist)
- switch _, err := ifq.FirstID(ctx); {
+func (_q *ItemFieldQuery) Exist(ctx context.Context) (bool, error) {
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryExist)
+ switch _, err := _q.FirstID(ctx); {
case IsNotFound(err):
return false, nil
case err != nil:
@@ -256,8 +256,8 @@ func (ifq *ItemFieldQuery) Exist(ctx context.Context) (bool, error) {
}
// ExistX is like Exist, but panics if an error occurs.
-func (ifq *ItemFieldQuery) ExistX(ctx context.Context) bool {
- exist, err := ifq.Exist(ctx)
+func (_q *ItemFieldQuery) ExistX(ctx context.Context) bool {
+ exist, err := _q.Exist(ctx)
if err != nil {
panic(err)
}
@@ -266,32 +266,32 @@ func (ifq *ItemFieldQuery) ExistX(ctx context.Context) bool {
// Clone returns a duplicate of the ItemFieldQuery builder, including all associated steps. It can be
// used to prepare common query builders and use them differently after the clone is made.
-func (ifq *ItemFieldQuery) Clone() *ItemFieldQuery {
- if ifq == nil {
+func (_q *ItemFieldQuery) Clone() *ItemFieldQuery {
+ if _q == nil {
return nil
}
return &ItemFieldQuery{
- config: ifq.config,
- ctx: ifq.ctx.Clone(),
- order: append([]itemfield.OrderOption{}, ifq.order...),
- inters: append([]Interceptor{}, ifq.inters...),
- predicates: append([]predicate.ItemField{}, ifq.predicates...),
- withItem: ifq.withItem.Clone(),
+ config: _q.config,
+ ctx: _q.ctx.Clone(),
+ order: append([]itemfield.OrderOption{}, _q.order...),
+ inters: append([]Interceptor{}, _q.inters...),
+ predicates: append([]predicate.ItemField{}, _q.predicates...),
+ withItem: _q.withItem.Clone(),
// clone intermediate query.
- sql: ifq.sql.Clone(),
- path: ifq.path,
+ sql: _q.sql.Clone(),
+ path: _q.path,
}
}
// WithItem tells the query-builder to eager-load the nodes that are connected to
// the "item" edge. The optional arguments are used to configure the query builder of the edge.
-func (ifq *ItemFieldQuery) WithItem(opts ...func(*ItemQuery)) *ItemFieldQuery {
- query := (&ItemClient{config: ifq.config}).Query()
+func (_q *ItemFieldQuery) WithItem(opts ...func(*ItemQuery)) *ItemFieldQuery {
+ query := (&ItemClient{config: _q.config}).Query()
for _, opt := range opts {
opt(query)
}
- ifq.withItem = query
- return ifq
+ _q.withItem = query
+ return _q
}
// GroupBy is used to group vertices by one or more fields/columns.
@@ -308,10 +308,10 @@ func (ifq *ItemFieldQuery) WithItem(opts ...func(*ItemQuery)) *ItemFieldQuery {
// GroupBy(itemfield.FieldCreatedAt).
// Aggregate(ent.Count()).
// Scan(ctx, &v)
-func (ifq *ItemFieldQuery) GroupBy(field string, fields ...string) *ItemFieldGroupBy {
- ifq.ctx.Fields = append([]string{field}, fields...)
- grbuild := &ItemFieldGroupBy{build: ifq}
- grbuild.flds = &ifq.ctx.Fields
+func (_q *ItemFieldQuery) GroupBy(field string, fields ...string) *ItemFieldGroupBy {
+ _q.ctx.Fields = append([]string{field}, fields...)
+ grbuild := &ItemFieldGroupBy{build: _q}
+ grbuild.flds = &_q.ctx.Fields
grbuild.label = itemfield.Label
grbuild.scan = grbuild.Scan
return grbuild
@@ -329,55 +329,55 @@ func (ifq *ItemFieldQuery) GroupBy(field string, fields ...string) *ItemFieldGro
// client.ItemField.Query().
// Select(itemfield.FieldCreatedAt).
// Scan(ctx, &v)
-func (ifq *ItemFieldQuery) Select(fields ...string) *ItemFieldSelect {
- ifq.ctx.Fields = append(ifq.ctx.Fields, fields...)
- sbuild := &ItemFieldSelect{ItemFieldQuery: ifq}
+func (_q *ItemFieldQuery) Select(fields ...string) *ItemFieldSelect {
+ _q.ctx.Fields = append(_q.ctx.Fields, fields...)
+ sbuild := &ItemFieldSelect{ItemFieldQuery: _q}
sbuild.label = itemfield.Label
- sbuild.flds, sbuild.scan = &ifq.ctx.Fields, sbuild.Scan
+ sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan
return sbuild
}
// Aggregate returns a ItemFieldSelect configured with the given aggregations.
-func (ifq *ItemFieldQuery) Aggregate(fns ...AggregateFunc) *ItemFieldSelect {
- return ifq.Select().Aggregate(fns...)
+func (_q *ItemFieldQuery) Aggregate(fns ...AggregateFunc) *ItemFieldSelect {
+ return _q.Select().Aggregate(fns...)
}
-func (ifq *ItemFieldQuery) prepareQuery(ctx context.Context) error {
- for _, inter := range ifq.inters {
+func (_q *ItemFieldQuery) prepareQuery(ctx context.Context) error {
+ for _, inter := range _q.inters {
if inter == nil {
return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)")
}
if trv, ok := inter.(Traverser); ok {
- if err := trv.Traverse(ctx, ifq); err != nil {
+ if err := trv.Traverse(ctx, _q); err != nil {
return err
}
}
}
- for _, f := range ifq.ctx.Fields {
+ for _, f := range _q.ctx.Fields {
if !itemfield.ValidColumn(f) {
return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
}
}
- if ifq.path != nil {
- prev, err := ifq.path(ctx)
+ if _q.path != nil {
+ prev, err := _q.path(ctx)
if err != nil {
return err
}
- ifq.sql = prev
+ _q.sql = prev
}
return nil
}
-func (ifq *ItemFieldQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*ItemField, error) {
+func (_q *ItemFieldQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*ItemField, error) {
var (
nodes = []*ItemField{}
- withFKs = ifq.withFKs
- _spec = ifq.querySpec()
+ withFKs = _q.withFKs
+ _spec = _q.querySpec()
loadedTypes = [1]bool{
- ifq.withItem != nil,
+ _q.withItem != nil,
}
)
- if ifq.withItem != nil {
+ if _q.withItem != nil {
withFKs = true
}
if withFKs {
@@ -387,7 +387,7 @@ func (ifq *ItemFieldQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*I
return (*ItemField).scanValues(nil, columns)
}
_spec.Assign = func(columns []string, values []any) error {
- node := &ItemField{config: ifq.config}
+ node := &ItemField{config: _q.config}
nodes = append(nodes, node)
node.Edges.loadedTypes = loadedTypes
return node.assignValues(columns, values)
@@ -395,14 +395,14 @@ func (ifq *ItemFieldQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*I
for i := range hooks {
hooks[i](ctx, _spec)
}
- if err := sqlgraph.QueryNodes(ctx, ifq.driver, _spec); err != nil {
+ if err := sqlgraph.QueryNodes(ctx, _q.driver, _spec); err != nil {
return nil, err
}
if len(nodes) == 0 {
return nodes, nil
}
- if query := ifq.withItem; query != nil {
- if err := ifq.loadItem(ctx, query, nodes, nil,
+ if query := _q.withItem; query != nil {
+ if err := _q.loadItem(ctx, query, nodes, nil,
func(n *ItemField, e *Item) { n.Edges.Item = e }); err != nil {
return nil, err
}
@@ -410,7 +410,7 @@ func (ifq *ItemFieldQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*I
return nodes, nil
}
-func (ifq *ItemFieldQuery) loadItem(ctx context.Context, query *ItemQuery, nodes []*ItemField, init func(*ItemField), assign func(*ItemField, *Item)) error {
+func (_q *ItemFieldQuery) loadItem(ctx context.Context, query *ItemQuery, nodes []*ItemField, init func(*ItemField), assign func(*ItemField, *Item)) error {
ids := make([]uuid.UUID, 0, len(nodes))
nodeids := make(map[uuid.UUID][]*ItemField)
for i := range nodes {
@@ -443,24 +443,24 @@ func (ifq *ItemFieldQuery) loadItem(ctx context.Context, query *ItemQuery, nodes
return nil
}
-func (ifq *ItemFieldQuery) sqlCount(ctx context.Context) (int, error) {
- _spec := ifq.querySpec()
- _spec.Node.Columns = ifq.ctx.Fields
- if len(ifq.ctx.Fields) > 0 {
- _spec.Unique = ifq.ctx.Unique != nil && *ifq.ctx.Unique
+func (_q *ItemFieldQuery) sqlCount(ctx context.Context) (int, error) {
+ _spec := _q.querySpec()
+ _spec.Node.Columns = _q.ctx.Fields
+ if len(_q.ctx.Fields) > 0 {
+ _spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique
}
- return sqlgraph.CountNodes(ctx, ifq.driver, _spec)
+ return sqlgraph.CountNodes(ctx, _q.driver, _spec)
}
-func (ifq *ItemFieldQuery) querySpec() *sqlgraph.QuerySpec {
+func (_q *ItemFieldQuery) querySpec() *sqlgraph.QuerySpec {
_spec := sqlgraph.NewQuerySpec(itemfield.Table, itemfield.Columns, sqlgraph.NewFieldSpec(itemfield.FieldID, field.TypeUUID))
- _spec.From = ifq.sql
- if unique := ifq.ctx.Unique; unique != nil {
+ _spec.From = _q.sql
+ if unique := _q.ctx.Unique; unique != nil {
_spec.Unique = *unique
- } else if ifq.path != nil {
+ } else if _q.path != nil {
_spec.Unique = true
}
- if fields := ifq.ctx.Fields; len(fields) > 0 {
+ if fields := _q.ctx.Fields; len(fields) > 0 {
_spec.Node.Columns = make([]string, 0, len(fields))
_spec.Node.Columns = append(_spec.Node.Columns, itemfield.FieldID)
for i := range fields {
@@ -469,20 +469,20 @@ func (ifq *ItemFieldQuery) querySpec() *sqlgraph.QuerySpec {
}
}
}
- if ps := ifq.predicates; len(ps) > 0 {
+ if ps := _q.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
- if limit := ifq.ctx.Limit; limit != nil {
+ if limit := _q.ctx.Limit; limit != nil {
_spec.Limit = *limit
}
- if offset := ifq.ctx.Offset; offset != nil {
+ if offset := _q.ctx.Offset; offset != nil {
_spec.Offset = *offset
}
- if ps := ifq.order; len(ps) > 0 {
+ if ps := _q.order; len(ps) > 0 {
_spec.Order = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
@@ -492,33 +492,33 @@ func (ifq *ItemFieldQuery) querySpec() *sqlgraph.QuerySpec {
return _spec
}
-func (ifq *ItemFieldQuery) sqlQuery(ctx context.Context) *sql.Selector {
- builder := sql.Dialect(ifq.driver.Dialect())
+func (_q *ItemFieldQuery) sqlQuery(ctx context.Context) *sql.Selector {
+ builder := sql.Dialect(_q.driver.Dialect())
t1 := builder.Table(itemfield.Table)
- columns := ifq.ctx.Fields
+ columns := _q.ctx.Fields
if len(columns) == 0 {
columns = itemfield.Columns
}
selector := builder.Select(t1.Columns(columns...)...).From(t1)
- if ifq.sql != nil {
- selector = ifq.sql
+ if _q.sql != nil {
+ selector = _q.sql
selector.Select(selector.Columns(columns...)...)
}
- if ifq.ctx.Unique != nil && *ifq.ctx.Unique {
+ if _q.ctx.Unique != nil && *_q.ctx.Unique {
selector.Distinct()
}
- for _, p := range ifq.predicates {
+ for _, p := range _q.predicates {
p(selector)
}
- for _, p := range ifq.order {
+ for _, p := range _q.order {
p(selector)
}
- if offset := ifq.ctx.Offset; offset != nil {
+ if offset := _q.ctx.Offset; offset != nil {
// limit is mandatory for offset clause. We start
// with default value, and override it below if needed.
selector.Offset(*offset).Limit(math.MaxInt32)
}
- if limit := ifq.ctx.Limit; limit != nil {
+ if limit := _q.ctx.Limit; limit != nil {
selector.Limit(*limit)
}
return selector
@@ -531,41 +531,41 @@ type ItemFieldGroupBy struct {
}
// Aggregate adds the given aggregation functions to the group-by query.
-func (ifgb *ItemFieldGroupBy) Aggregate(fns ...AggregateFunc) *ItemFieldGroupBy {
- ifgb.fns = append(ifgb.fns, fns...)
- return ifgb
+func (_g *ItemFieldGroupBy) Aggregate(fns ...AggregateFunc) *ItemFieldGroupBy {
+ _g.fns = append(_g.fns, fns...)
+ return _g
}
// Scan applies the selector query and scans the result into the given value.
-func (ifgb *ItemFieldGroupBy) Scan(ctx context.Context, v any) error {
- ctx = setContextOp(ctx, ifgb.build.ctx, ent.OpQueryGroupBy)
- if err := ifgb.build.prepareQuery(ctx); err != nil {
+func (_g *ItemFieldGroupBy) Scan(ctx context.Context, v any) error {
+ ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy)
+ if err := _g.build.prepareQuery(ctx); err != nil {
return err
}
- return scanWithInterceptors[*ItemFieldQuery, *ItemFieldGroupBy](ctx, ifgb.build, ifgb, ifgb.build.inters, v)
+ return scanWithInterceptors[*ItemFieldQuery, *ItemFieldGroupBy](ctx, _g.build, _g, _g.build.inters, v)
}
-func (ifgb *ItemFieldGroupBy) sqlScan(ctx context.Context, root *ItemFieldQuery, v any) error {
+func (_g *ItemFieldGroupBy) sqlScan(ctx context.Context, root *ItemFieldQuery, v any) error {
selector := root.sqlQuery(ctx).Select()
- aggregation := make([]string, 0, len(ifgb.fns))
- for _, fn := range ifgb.fns {
+ aggregation := make([]string, 0, len(_g.fns))
+ for _, fn := range _g.fns {
aggregation = append(aggregation, fn(selector))
}
if len(selector.SelectedColumns()) == 0 {
- columns := make([]string, 0, len(*ifgb.flds)+len(ifgb.fns))
- for _, f := range *ifgb.flds {
+ columns := make([]string, 0, len(*_g.flds)+len(_g.fns))
+ for _, f := range *_g.flds {
columns = append(columns, selector.C(f))
}
columns = append(columns, aggregation...)
selector.Select(columns...)
}
- selector.GroupBy(selector.Columns(*ifgb.flds...)...)
+ selector.GroupBy(selector.Columns(*_g.flds...)...)
if err := selector.Err(); err != nil {
return err
}
rows := &sql.Rows{}
query, args := selector.Query()
- if err := ifgb.build.driver.Query(ctx, query, args, rows); err != nil {
+ if err := _g.build.driver.Query(ctx, query, args, rows); err != nil {
return err
}
defer rows.Close()
@@ -579,27 +579,27 @@ type ItemFieldSelect struct {
}
// Aggregate adds the given aggregation functions to the selector query.
-func (ifs *ItemFieldSelect) Aggregate(fns ...AggregateFunc) *ItemFieldSelect {
- ifs.fns = append(ifs.fns, fns...)
- return ifs
+func (_s *ItemFieldSelect) Aggregate(fns ...AggregateFunc) *ItemFieldSelect {
+ _s.fns = append(_s.fns, fns...)
+ return _s
}
// Scan applies the selector query and scans the result into the given value.
-func (ifs *ItemFieldSelect) Scan(ctx context.Context, v any) error {
- ctx = setContextOp(ctx, ifs.ctx, ent.OpQuerySelect)
- if err := ifs.prepareQuery(ctx); err != nil {
+func (_s *ItemFieldSelect) Scan(ctx context.Context, v any) error {
+ ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect)
+ if err := _s.prepareQuery(ctx); err != nil {
return err
}
- return scanWithInterceptors[*ItemFieldQuery, *ItemFieldSelect](ctx, ifs.ItemFieldQuery, ifs, ifs.inters, v)
+ return scanWithInterceptors[*ItemFieldQuery, *ItemFieldSelect](ctx, _s.ItemFieldQuery, _s, _s.inters, v)
}
-func (ifs *ItemFieldSelect) sqlScan(ctx context.Context, root *ItemFieldQuery, v any) error {
+func (_s *ItemFieldSelect) sqlScan(ctx context.Context, root *ItemFieldQuery, v any) error {
selector := root.sqlQuery(ctx)
- aggregation := make([]string, 0, len(ifs.fns))
- for _, fn := range ifs.fns {
+ aggregation := make([]string, 0, len(_s.fns))
+ for _, fn := range _s.fns {
aggregation = append(aggregation, fn(selector))
}
- switch n := len(*ifs.selector.flds); {
+ switch n := len(*_s.selector.flds); {
case n == 0 && len(aggregation) > 0:
selector.Select(aggregation...)
case n != 0 && len(aggregation) > 0:
@@ -607,7 +607,7 @@ func (ifs *ItemFieldSelect) sqlScan(ctx context.Context, root *ItemFieldQuery, v
}
rows := &sql.Rows{}
query, args := selector.Query()
- if err := ifs.driver.Query(ctx, query, args, rows); err != nil {
+ if err := _s.driver.Query(ctx, query, args, rows); err != nil {
return err
}
defer rows.Close()
diff --git a/backend/internal/data/ent/itemfield_update.go b/backend/internal/data/ent/itemfield_update.go
index aab940a2..941c4328 100644
--- a/backend/internal/data/ent/itemfield_update.go
+++ b/backend/internal/data/ent/itemfield_update.go
@@ -25,179 +25,179 @@ type ItemFieldUpdate struct {
}
// Where appends a list predicates to the ItemFieldUpdate builder.
-func (ifu *ItemFieldUpdate) Where(ps ...predicate.ItemField) *ItemFieldUpdate {
- ifu.mutation.Where(ps...)
- return ifu
+func (_u *ItemFieldUpdate) Where(ps ...predicate.ItemField) *ItemFieldUpdate {
+ _u.mutation.Where(ps...)
+ return _u
}
// SetUpdatedAt sets the "updated_at" field.
-func (ifu *ItemFieldUpdate) SetUpdatedAt(t time.Time) *ItemFieldUpdate {
- ifu.mutation.SetUpdatedAt(t)
- return ifu
+func (_u *ItemFieldUpdate) SetUpdatedAt(v time.Time) *ItemFieldUpdate {
+ _u.mutation.SetUpdatedAt(v)
+ return _u
}
// SetName sets the "name" field.
-func (ifu *ItemFieldUpdate) SetName(s string) *ItemFieldUpdate {
- ifu.mutation.SetName(s)
- return ifu
+func (_u *ItemFieldUpdate) SetName(v string) *ItemFieldUpdate {
+ _u.mutation.SetName(v)
+ return _u
}
// SetNillableName sets the "name" field if the given value is not nil.
-func (ifu *ItemFieldUpdate) SetNillableName(s *string) *ItemFieldUpdate {
- if s != nil {
- ifu.SetName(*s)
+func (_u *ItemFieldUpdate) SetNillableName(v *string) *ItemFieldUpdate {
+ if v != nil {
+ _u.SetName(*v)
}
- return ifu
+ return _u
}
// SetDescription sets the "description" field.
-func (ifu *ItemFieldUpdate) SetDescription(s string) *ItemFieldUpdate {
- ifu.mutation.SetDescription(s)
- return ifu
+func (_u *ItemFieldUpdate) SetDescription(v string) *ItemFieldUpdate {
+ _u.mutation.SetDescription(v)
+ return _u
}
// SetNillableDescription sets the "description" field if the given value is not nil.
-func (ifu *ItemFieldUpdate) SetNillableDescription(s *string) *ItemFieldUpdate {
- if s != nil {
- ifu.SetDescription(*s)
+func (_u *ItemFieldUpdate) SetNillableDescription(v *string) *ItemFieldUpdate {
+ if v != nil {
+ _u.SetDescription(*v)
}
- return ifu
+ return _u
}
// ClearDescription clears the value of the "description" field.
-func (ifu *ItemFieldUpdate) ClearDescription() *ItemFieldUpdate {
- ifu.mutation.ClearDescription()
- return ifu
+func (_u *ItemFieldUpdate) ClearDescription() *ItemFieldUpdate {
+ _u.mutation.ClearDescription()
+ return _u
}
// SetType sets the "type" field.
-func (ifu *ItemFieldUpdate) SetType(i itemfield.Type) *ItemFieldUpdate {
- ifu.mutation.SetType(i)
- return ifu
+func (_u *ItemFieldUpdate) SetType(v itemfield.Type) *ItemFieldUpdate {
+ _u.mutation.SetType(v)
+ return _u
}
// SetNillableType sets the "type" field if the given value is not nil.
-func (ifu *ItemFieldUpdate) SetNillableType(i *itemfield.Type) *ItemFieldUpdate {
- if i != nil {
- ifu.SetType(*i)
+func (_u *ItemFieldUpdate) SetNillableType(v *itemfield.Type) *ItemFieldUpdate {
+ if v != nil {
+ _u.SetType(*v)
}
- return ifu
+ return _u
}
// SetTextValue sets the "text_value" field.
-func (ifu *ItemFieldUpdate) SetTextValue(s string) *ItemFieldUpdate {
- ifu.mutation.SetTextValue(s)
- return ifu
+func (_u *ItemFieldUpdate) SetTextValue(v string) *ItemFieldUpdate {
+ _u.mutation.SetTextValue(v)
+ return _u
}
// SetNillableTextValue sets the "text_value" field if the given value is not nil.
-func (ifu *ItemFieldUpdate) SetNillableTextValue(s *string) *ItemFieldUpdate {
- if s != nil {
- ifu.SetTextValue(*s)
+func (_u *ItemFieldUpdate) SetNillableTextValue(v *string) *ItemFieldUpdate {
+ if v != nil {
+ _u.SetTextValue(*v)
}
- return ifu
+ return _u
}
// ClearTextValue clears the value of the "text_value" field.
-func (ifu *ItemFieldUpdate) ClearTextValue() *ItemFieldUpdate {
- ifu.mutation.ClearTextValue()
- return ifu
+func (_u *ItemFieldUpdate) ClearTextValue() *ItemFieldUpdate {
+ _u.mutation.ClearTextValue()
+ return _u
}
// SetNumberValue sets the "number_value" field.
-func (ifu *ItemFieldUpdate) SetNumberValue(i int) *ItemFieldUpdate {
- ifu.mutation.ResetNumberValue()
- ifu.mutation.SetNumberValue(i)
- return ifu
+func (_u *ItemFieldUpdate) SetNumberValue(v int) *ItemFieldUpdate {
+ _u.mutation.ResetNumberValue()
+ _u.mutation.SetNumberValue(v)
+ return _u
}
// SetNillableNumberValue sets the "number_value" field if the given value is not nil.
-func (ifu *ItemFieldUpdate) SetNillableNumberValue(i *int) *ItemFieldUpdate {
- if i != nil {
- ifu.SetNumberValue(*i)
+func (_u *ItemFieldUpdate) SetNillableNumberValue(v *int) *ItemFieldUpdate {
+ if v != nil {
+ _u.SetNumberValue(*v)
}
- return ifu
+ return _u
}
-// AddNumberValue adds i to the "number_value" field.
-func (ifu *ItemFieldUpdate) AddNumberValue(i int) *ItemFieldUpdate {
- ifu.mutation.AddNumberValue(i)
- return ifu
+// AddNumberValue adds value to the "number_value" field.
+func (_u *ItemFieldUpdate) AddNumberValue(v int) *ItemFieldUpdate {
+ _u.mutation.AddNumberValue(v)
+ return _u
}
// ClearNumberValue clears the value of the "number_value" field.
-func (ifu *ItemFieldUpdate) ClearNumberValue() *ItemFieldUpdate {
- ifu.mutation.ClearNumberValue()
- return ifu
+func (_u *ItemFieldUpdate) ClearNumberValue() *ItemFieldUpdate {
+ _u.mutation.ClearNumberValue()
+ return _u
}
// SetBooleanValue sets the "boolean_value" field.
-func (ifu *ItemFieldUpdate) SetBooleanValue(b bool) *ItemFieldUpdate {
- ifu.mutation.SetBooleanValue(b)
- return ifu
+func (_u *ItemFieldUpdate) SetBooleanValue(v bool) *ItemFieldUpdate {
+ _u.mutation.SetBooleanValue(v)
+ return _u
}
// SetNillableBooleanValue sets the "boolean_value" field if the given value is not nil.
-func (ifu *ItemFieldUpdate) SetNillableBooleanValue(b *bool) *ItemFieldUpdate {
- if b != nil {
- ifu.SetBooleanValue(*b)
+func (_u *ItemFieldUpdate) SetNillableBooleanValue(v *bool) *ItemFieldUpdate {
+ if v != nil {
+ _u.SetBooleanValue(*v)
}
- return ifu
+ return _u
}
// SetTimeValue sets the "time_value" field.
-func (ifu *ItemFieldUpdate) SetTimeValue(t time.Time) *ItemFieldUpdate {
- ifu.mutation.SetTimeValue(t)
- return ifu
+func (_u *ItemFieldUpdate) SetTimeValue(v time.Time) *ItemFieldUpdate {
+ _u.mutation.SetTimeValue(v)
+ return _u
}
// SetNillableTimeValue sets the "time_value" field if the given value is not nil.
-func (ifu *ItemFieldUpdate) SetNillableTimeValue(t *time.Time) *ItemFieldUpdate {
- if t != nil {
- ifu.SetTimeValue(*t)
+func (_u *ItemFieldUpdate) SetNillableTimeValue(v *time.Time) *ItemFieldUpdate {
+ if v != nil {
+ _u.SetTimeValue(*v)
}
- return ifu
+ return _u
}
// SetItemID sets the "item" edge to the Item entity by ID.
-func (ifu *ItemFieldUpdate) SetItemID(id uuid.UUID) *ItemFieldUpdate {
- ifu.mutation.SetItemID(id)
- return ifu
+func (_u *ItemFieldUpdate) SetItemID(id uuid.UUID) *ItemFieldUpdate {
+ _u.mutation.SetItemID(id)
+ return _u
}
// SetNillableItemID sets the "item" edge to the Item entity by ID if the given value is not nil.
-func (ifu *ItemFieldUpdate) SetNillableItemID(id *uuid.UUID) *ItemFieldUpdate {
+func (_u *ItemFieldUpdate) SetNillableItemID(id *uuid.UUID) *ItemFieldUpdate {
if id != nil {
- ifu = ifu.SetItemID(*id)
+ _u = _u.SetItemID(*id)
}
- return ifu
+ return _u
}
// SetItem sets the "item" edge to the Item entity.
-func (ifu *ItemFieldUpdate) SetItem(i *Item) *ItemFieldUpdate {
- return ifu.SetItemID(i.ID)
+func (_u *ItemFieldUpdate) SetItem(v *Item) *ItemFieldUpdate {
+ return _u.SetItemID(v.ID)
}
// Mutation returns the ItemFieldMutation object of the builder.
-func (ifu *ItemFieldUpdate) Mutation() *ItemFieldMutation {
- return ifu.mutation
+func (_u *ItemFieldUpdate) Mutation() *ItemFieldMutation {
+ return _u.mutation
}
// ClearItem clears the "item" edge to the Item entity.
-func (ifu *ItemFieldUpdate) ClearItem() *ItemFieldUpdate {
- ifu.mutation.ClearItem()
- return ifu
+func (_u *ItemFieldUpdate) ClearItem() *ItemFieldUpdate {
+ _u.mutation.ClearItem()
+ return _u
}
// Save executes the query and returns the number of nodes affected by the update operation.
-func (ifu *ItemFieldUpdate) Save(ctx context.Context) (int, error) {
- ifu.defaults()
- return withHooks(ctx, ifu.sqlSave, ifu.mutation, ifu.hooks)
+func (_u *ItemFieldUpdate) Save(ctx context.Context) (int, error) {
+ _u.defaults()
+ return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
}
// SaveX is like Save, but panics if an error occurs.
-func (ifu *ItemFieldUpdate) SaveX(ctx context.Context) int {
- affected, err := ifu.Save(ctx)
+func (_u *ItemFieldUpdate) SaveX(ctx context.Context) int {
+ affected, err := _u.Save(ctx)
if err != nil {
panic(err)
}
@@ -205,44 +205,44 @@ func (ifu *ItemFieldUpdate) SaveX(ctx context.Context) int {
}
// Exec executes the query.
-func (ifu *ItemFieldUpdate) Exec(ctx context.Context) error {
- _, err := ifu.Save(ctx)
+func (_u *ItemFieldUpdate) Exec(ctx context.Context) error {
+ _, err := _u.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
-func (ifu *ItemFieldUpdate) ExecX(ctx context.Context) {
- if err := ifu.Exec(ctx); err != nil {
+func (_u *ItemFieldUpdate) ExecX(ctx context.Context) {
+ if err := _u.Exec(ctx); err != nil {
panic(err)
}
}
// defaults sets the default values of the builder before save.
-func (ifu *ItemFieldUpdate) defaults() {
- if _, ok := ifu.mutation.UpdatedAt(); !ok {
+func (_u *ItemFieldUpdate) defaults() {
+ if _, ok := _u.mutation.UpdatedAt(); !ok {
v := itemfield.UpdateDefaultUpdatedAt()
- ifu.mutation.SetUpdatedAt(v)
+ _u.mutation.SetUpdatedAt(v)
}
}
// check runs all checks and user-defined validators on the builder.
-func (ifu *ItemFieldUpdate) check() error {
- if v, ok := ifu.mutation.Name(); ok {
+func (_u *ItemFieldUpdate) check() error {
+ if v, ok := _u.mutation.Name(); ok {
if err := itemfield.NameValidator(v); err != nil {
return &ValidationError{Name: "name", err: fmt.Errorf(`ent: validator failed for field "ItemField.name": %w`, err)}
}
}
- if v, ok := ifu.mutation.Description(); ok {
+ if v, ok := _u.mutation.Description(); ok {
if err := itemfield.DescriptionValidator(v); err != nil {
return &ValidationError{Name: "description", err: fmt.Errorf(`ent: validator failed for field "ItemField.description": %w`, err)}
}
}
- if v, ok := ifu.mutation.GetType(); ok {
+ if v, ok := _u.mutation.GetType(); ok {
if err := itemfield.TypeValidator(v); err != nil {
return &ValidationError{Name: "type", err: fmt.Errorf(`ent: validator failed for field "ItemField.type": %w`, err)}
}
}
- if v, ok := ifu.mutation.TextValue(); ok {
+ if v, ok := _u.mutation.TextValue(); ok {
if err := itemfield.TextValueValidator(v); err != nil {
return &ValidationError{Name: "text_value", err: fmt.Errorf(`ent: validator failed for field "ItemField.text_value": %w`, err)}
}
@@ -250,55 +250,55 @@ func (ifu *ItemFieldUpdate) check() error {
return nil
}
-func (ifu *ItemFieldUpdate) sqlSave(ctx context.Context) (n int, err error) {
- if err := ifu.check(); err != nil {
- return n, err
+func (_u *ItemFieldUpdate) sqlSave(ctx context.Context) (_node int, err error) {
+ if err := _u.check(); err != nil {
+ return _node, err
}
_spec := sqlgraph.NewUpdateSpec(itemfield.Table, itemfield.Columns, sqlgraph.NewFieldSpec(itemfield.FieldID, field.TypeUUID))
- if ps := ifu.mutation.predicates; len(ps) > 0 {
+ if ps := _u.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
- if value, ok := ifu.mutation.UpdatedAt(); ok {
+ if value, ok := _u.mutation.UpdatedAt(); ok {
_spec.SetField(itemfield.FieldUpdatedAt, field.TypeTime, value)
}
- if value, ok := ifu.mutation.Name(); ok {
+ if value, ok := _u.mutation.Name(); ok {
_spec.SetField(itemfield.FieldName, field.TypeString, value)
}
- if value, ok := ifu.mutation.Description(); ok {
+ if value, ok := _u.mutation.Description(); ok {
_spec.SetField(itemfield.FieldDescription, field.TypeString, value)
}
- if ifu.mutation.DescriptionCleared() {
+ if _u.mutation.DescriptionCleared() {
_spec.ClearField(itemfield.FieldDescription, field.TypeString)
}
- if value, ok := ifu.mutation.GetType(); ok {
+ if value, ok := _u.mutation.GetType(); ok {
_spec.SetField(itemfield.FieldType, field.TypeEnum, value)
}
- if value, ok := ifu.mutation.TextValue(); ok {
+ if value, ok := _u.mutation.TextValue(); ok {
_spec.SetField(itemfield.FieldTextValue, field.TypeString, value)
}
- if ifu.mutation.TextValueCleared() {
+ if _u.mutation.TextValueCleared() {
_spec.ClearField(itemfield.FieldTextValue, field.TypeString)
}
- if value, ok := ifu.mutation.NumberValue(); ok {
+ if value, ok := _u.mutation.NumberValue(); ok {
_spec.SetField(itemfield.FieldNumberValue, field.TypeInt, value)
}
- if value, ok := ifu.mutation.AddedNumberValue(); ok {
+ if value, ok := _u.mutation.AddedNumberValue(); ok {
_spec.AddField(itemfield.FieldNumberValue, field.TypeInt, value)
}
- if ifu.mutation.NumberValueCleared() {
+ if _u.mutation.NumberValueCleared() {
_spec.ClearField(itemfield.FieldNumberValue, field.TypeInt)
}
- if value, ok := ifu.mutation.BooleanValue(); ok {
+ if value, ok := _u.mutation.BooleanValue(); ok {
_spec.SetField(itemfield.FieldBooleanValue, field.TypeBool, value)
}
- if value, ok := ifu.mutation.TimeValue(); ok {
+ if value, ok := _u.mutation.TimeValue(); ok {
_spec.SetField(itemfield.FieldTimeValue, field.TypeTime, value)
}
- if ifu.mutation.ItemCleared() {
+ if _u.mutation.ItemCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -311,7 +311,7 @@ func (ifu *ItemFieldUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := ifu.mutation.ItemIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.ItemIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -327,7 +327,7 @@ func (ifu *ItemFieldUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- if n, err = sqlgraph.UpdateNodes(ctx, ifu.driver, _spec); err != nil {
+ if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil {
if _, ok := err.(*sqlgraph.NotFoundError); ok {
err = &NotFoundError{itemfield.Label}
} else if sqlgraph.IsConstraintError(err) {
@@ -335,8 +335,8 @@ func (ifu *ItemFieldUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
return 0, err
}
- ifu.mutation.done = true
- return n, nil
+ _u.mutation.done = true
+ return _node, nil
}
// ItemFieldUpdateOne is the builder for updating a single ItemField entity.
@@ -348,186 +348,186 @@ type ItemFieldUpdateOne struct {
}
// SetUpdatedAt sets the "updated_at" field.
-func (ifuo *ItemFieldUpdateOne) SetUpdatedAt(t time.Time) *ItemFieldUpdateOne {
- ifuo.mutation.SetUpdatedAt(t)
- return ifuo
+func (_u *ItemFieldUpdateOne) SetUpdatedAt(v time.Time) *ItemFieldUpdateOne {
+ _u.mutation.SetUpdatedAt(v)
+ return _u
}
// SetName sets the "name" field.
-func (ifuo *ItemFieldUpdateOne) SetName(s string) *ItemFieldUpdateOne {
- ifuo.mutation.SetName(s)
- return ifuo
+func (_u *ItemFieldUpdateOne) SetName(v string) *ItemFieldUpdateOne {
+ _u.mutation.SetName(v)
+ return _u
}
// SetNillableName sets the "name" field if the given value is not nil.
-func (ifuo *ItemFieldUpdateOne) SetNillableName(s *string) *ItemFieldUpdateOne {
- if s != nil {
- ifuo.SetName(*s)
+func (_u *ItemFieldUpdateOne) SetNillableName(v *string) *ItemFieldUpdateOne {
+ if v != nil {
+ _u.SetName(*v)
}
- return ifuo
+ return _u
}
// SetDescription sets the "description" field.
-func (ifuo *ItemFieldUpdateOne) SetDescription(s string) *ItemFieldUpdateOne {
- ifuo.mutation.SetDescription(s)
- return ifuo
+func (_u *ItemFieldUpdateOne) SetDescription(v string) *ItemFieldUpdateOne {
+ _u.mutation.SetDescription(v)
+ return _u
}
// SetNillableDescription sets the "description" field if the given value is not nil.
-func (ifuo *ItemFieldUpdateOne) SetNillableDescription(s *string) *ItemFieldUpdateOne {
- if s != nil {
- ifuo.SetDescription(*s)
+func (_u *ItemFieldUpdateOne) SetNillableDescription(v *string) *ItemFieldUpdateOne {
+ if v != nil {
+ _u.SetDescription(*v)
}
- return ifuo
+ return _u
}
// ClearDescription clears the value of the "description" field.
-func (ifuo *ItemFieldUpdateOne) ClearDescription() *ItemFieldUpdateOne {
- ifuo.mutation.ClearDescription()
- return ifuo
+func (_u *ItemFieldUpdateOne) ClearDescription() *ItemFieldUpdateOne {
+ _u.mutation.ClearDescription()
+ return _u
}
// SetType sets the "type" field.
-func (ifuo *ItemFieldUpdateOne) SetType(i itemfield.Type) *ItemFieldUpdateOne {
- ifuo.mutation.SetType(i)
- return ifuo
+func (_u *ItemFieldUpdateOne) SetType(v itemfield.Type) *ItemFieldUpdateOne {
+ _u.mutation.SetType(v)
+ return _u
}
// SetNillableType sets the "type" field if the given value is not nil.
-func (ifuo *ItemFieldUpdateOne) SetNillableType(i *itemfield.Type) *ItemFieldUpdateOne {
- if i != nil {
- ifuo.SetType(*i)
+func (_u *ItemFieldUpdateOne) SetNillableType(v *itemfield.Type) *ItemFieldUpdateOne {
+ if v != nil {
+ _u.SetType(*v)
}
- return ifuo
+ return _u
}
// SetTextValue sets the "text_value" field.
-func (ifuo *ItemFieldUpdateOne) SetTextValue(s string) *ItemFieldUpdateOne {
- ifuo.mutation.SetTextValue(s)
- return ifuo
+func (_u *ItemFieldUpdateOne) SetTextValue(v string) *ItemFieldUpdateOne {
+ _u.mutation.SetTextValue(v)
+ return _u
}
// SetNillableTextValue sets the "text_value" field if the given value is not nil.
-func (ifuo *ItemFieldUpdateOne) SetNillableTextValue(s *string) *ItemFieldUpdateOne {
- if s != nil {
- ifuo.SetTextValue(*s)
+func (_u *ItemFieldUpdateOne) SetNillableTextValue(v *string) *ItemFieldUpdateOne {
+ if v != nil {
+ _u.SetTextValue(*v)
}
- return ifuo
+ return _u
}
// ClearTextValue clears the value of the "text_value" field.
-func (ifuo *ItemFieldUpdateOne) ClearTextValue() *ItemFieldUpdateOne {
- ifuo.mutation.ClearTextValue()
- return ifuo
+func (_u *ItemFieldUpdateOne) ClearTextValue() *ItemFieldUpdateOne {
+ _u.mutation.ClearTextValue()
+ return _u
}
// SetNumberValue sets the "number_value" field.
-func (ifuo *ItemFieldUpdateOne) SetNumberValue(i int) *ItemFieldUpdateOne {
- ifuo.mutation.ResetNumberValue()
- ifuo.mutation.SetNumberValue(i)
- return ifuo
+func (_u *ItemFieldUpdateOne) SetNumberValue(v int) *ItemFieldUpdateOne {
+ _u.mutation.ResetNumberValue()
+ _u.mutation.SetNumberValue(v)
+ return _u
}
// SetNillableNumberValue sets the "number_value" field if the given value is not nil.
-func (ifuo *ItemFieldUpdateOne) SetNillableNumberValue(i *int) *ItemFieldUpdateOne {
- if i != nil {
- ifuo.SetNumberValue(*i)
+func (_u *ItemFieldUpdateOne) SetNillableNumberValue(v *int) *ItemFieldUpdateOne {
+ if v != nil {
+ _u.SetNumberValue(*v)
}
- return ifuo
+ return _u
}
-// AddNumberValue adds i to the "number_value" field.
-func (ifuo *ItemFieldUpdateOne) AddNumberValue(i int) *ItemFieldUpdateOne {
- ifuo.mutation.AddNumberValue(i)
- return ifuo
+// AddNumberValue adds value to the "number_value" field.
+func (_u *ItemFieldUpdateOne) AddNumberValue(v int) *ItemFieldUpdateOne {
+ _u.mutation.AddNumberValue(v)
+ return _u
}
// ClearNumberValue clears the value of the "number_value" field.
-func (ifuo *ItemFieldUpdateOne) ClearNumberValue() *ItemFieldUpdateOne {
- ifuo.mutation.ClearNumberValue()
- return ifuo
+func (_u *ItemFieldUpdateOne) ClearNumberValue() *ItemFieldUpdateOne {
+ _u.mutation.ClearNumberValue()
+ return _u
}
// SetBooleanValue sets the "boolean_value" field.
-func (ifuo *ItemFieldUpdateOne) SetBooleanValue(b bool) *ItemFieldUpdateOne {
- ifuo.mutation.SetBooleanValue(b)
- return ifuo
+func (_u *ItemFieldUpdateOne) SetBooleanValue(v bool) *ItemFieldUpdateOne {
+ _u.mutation.SetBooleanValue(v)
+ return _u
}
// SetNillableBooleanValue sets the "boolean_value" field if the given value is not nil.
-func (ifuo *ItemFieldUpdateOne) SetNillableBooleanValue(b *bool) *ItemFieldUpdateOne {
- if b != nil {
- ifuo.SetBooleanValue(*b)
+func (_u *ItemFieldUpdateOne) SetNillableBooleanValue(v *bool) *ItemFieldUpdateOne {
+ if v != nil {
+ _u.SetBooleanValue(*v)
}
- return ifuo
+ return _u
}
// SetTimeValue sets the "time_value" field.
-func (ifuo *ItemFieldUpdateOne) SetTimeValue(t time.Time) *ItemFieldUpdateOne {
- ifuo.mutation.SetTimeValue(t)
- return ifuo
+func (_u *ItemFieldUpdateOne) SetTimeValue(v time.Time) *ItemFieldUpdateOne {
+ _u.mutation.SetTimeValue(v)
+ return _u
}
// SetNillableTimeValue sets the "time_value" field if the given value is not nil.
-func (ifuo *ItemFieldUpdateOne) SetNillableTimeValue(t *time.Time) *ItemFieldUpdateOne {
- if t != nil {
- ifuo.SetTimeValue(*t)
+func (_u *ItemFieldUpdateOne) SetNillableTimeValue(v *time.Time) *ItemFieldUpdateOne {
+ if v != nil {
+ _u.SetTimeValue(*v)
}
- return ifuo
+ return _u
}
// SetItemID sets the "item" edge to the Item entity by ID.
-func (ifuo *ItemFieldUpdateOne) SetItemID(id uuid.UUID) *ItemFieldUpdateOne {
- ifuo.mutation.SetItemID(id)
- return ifuo
+func (_u *ItemFieldUpdateOne) SetItemID(id uuid.UUID) *ItemFieldUpdateOne {
+ _u.mutation.SetItemID(id)
+ return _u
}
// SetNillableItemID sets the "item" edge to the Item entity by ID if the given value is not nil.
-func (ifuo *ItemFieldUpdateOne) SetNillableItemID(id *uuid.UUID) *ItemFieldUpdateOne {
+func (_u *ItemFieldUpdateOne) SetNillableItemID(id *uuid.UUID) *ItemFieldUpdateOne {
if id != nil {
- ifuo = ifuo.SetItemID(*id)
+ _u = _u.SetItemID(*id)
}
- return ifuo
+ return _u
}
// SetItem sets the "item" edge to the Item entity.
-func (ifuo *ItemFieldUpdateOne) SetItem(i *Item) *ItemFieldUpdateOne {
- return ifuo.SetItemID(i.ID)
+func (_u *ItemFieldUpdateOne) SetItem(v *Item) *ItemFieldUpdateOne {
+ return _u.SetItemID(v.ID)
}
// Mutation returns the ItemFieldMutation object of the builder.
-func (ifuo *ItemFieldUpdateOne) Mutation() *ItemFieldMutation {
- return ifuo.mutation
+func (_u *ItemFieldUpdateOne) Mutation() *ItemFieldMutation {
+ return _u.mutation
}
// ClearItem clears the "item" edge to the Item entity.
-func (ifuo *ItemFieldUpdateOne) ClearItem() *ItemFieldUpdateOne {
- ifuo.mutation.ClearItem()
- return ifuo
+func (_u *ItemFieldUpdateOne) ClearItem() *ItemFieldUpdateOne {
+ _u.mutation.ClearItem()
+ return _u
}
// Where appends a list predicates to the ItemFieldUpdate builder.
-func (ifuo *ItemFieldUpdateOne) Where(ps ...predicate.ItemField) *ItemFieldUpdateOne {
- ifuo.mutation.Where(ps...)
- return ifuo
+func (_u *ItemFieldUpdateOne) Where(ps ...predicate.ItemField) *ItemFieldUpdateOne {
+ _u.mutation.Where(ps...)
+ return _u
}
// Select allows selecting one or more fields (columns) of the returned entity.
// The default is selecting all fields defined in the entity schema.
-func (ifuo *ItemFieldUpdateOne) Select(field string, fields ...string) *ItemFieldUpdateOne {
- ifuo.fields = append([]string{field}, fields...)
- return ifuo
+func (_u *ItemFieldUpdateOne) Select(field string, fields ...string) *ItemFieldUpdateOne {
+ _u.fields = append([]string{field}, fields...)
+ return _u
}
// Save executes the query and returns the updated ItemField entity.
-func (ifuo *ItemFieldUpdateOne) Save(ctx context.Context) (*ItemField, error) {
- ifuo.defaults()
- return withHooks(ctx, ifuo.sqlSave, ifuo.mutation, ifuo.hooks)
+func (_u *ItemFieldUpdateOne) Save(ctx context.Context) (*ItemField, error) {
+ _u.defaults()
+ return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
}
// SaveX is like Save, but panics if an error occurs.
-func (ifuo *ItemFieldUpdateOne) SaveX(ctx context.Context) *ItemField {
- node, err := ifuo.Save(ctx)
+func (_u *ItemFieldUpdateOne) SaveX(ctx context.Context) *ItemField {
+ node, err := _u.Save(ctx)
if err != nil {
panic(err)
}
@@ -535,44 +535,44 @@ func (ifuo *ItemFieldUpdateOne) SaveX(ctx context.Context) *ItemField {
}
// Exec executes the query on the entity.
-func (ifuo *ItemFieldUpdateOne) Exec(ctx context.Context) error {
- _, err := ifuo.Save(ctx)
+func (_u *ItemFieldUpdateOne) Exec(ctx context.Context) error {
+ _, err := _u.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
-func (ifuo *ItemFieldUpdateOne) ExecX(ctx context.Context) {
- if err := ifuo.Exec(ctx); err != nil {
+func (_u *ItemFieldUpdateOne) ExecX(ctx context.Context) {
+ if err := _u.Exec(ctx); err != nil {
panic(err)
}
}
// defaults sets the default values of the builder before save.
-func (ifuo *ItemFieldUpdateOne) defaults() {
- if _, ok := ifuo.mutation.UpdatedAt(); !ok {
+func (_u *ItemFieldUpdateOne) defaults() {
+ if _, ok := _u.mutation.UpdatedAt(); !ok {
v := itemfield.UpdateDefaultUpdatedAt()
- ifuo.mutation.SetUpdatedAt(v)
+ _u.mutation.SetUpdatedAt(v)
}
}
// check runs all checks and user-defined validators on the builder.
-func (ifuo *ItemFieldUpdateOne) check() error {
- if v, ok := ifuo.mutation.Name(); ok {
+func (_u *ItemFieldUpdateOne) check() error {
+ if v, ok := _u.mutation.Name(); ok {
if err := itemfield.NameValidator(v); err != nil {
return &ValidationError{Name: "name", err: fmt.Errorf(`ent: validator failed for field "ItemField.name": %w`, err)}
}
}
- if v, ok := ifuo.mutation.Description(); ok {
+ if v, ok := _u.mutation.Description(); ok {
if err := itemfield.DescriptionValidator(v); err != nil {
return &ValidationError{Name: "description", err: fmt.Errorf(`ent: validator failed for field "ItemField.description": %w`, err)}
}
}
- if v, ok := ifuo.mutation.GetType(); ok {
+ if v, ok := _u.mutation.GetType(); ok {
if err := itemfield.TypeValidator(v); err != nil {
return &ValidationError{Name: "type", err: fmt.Errorf(`ent: validator failed for field "ItemField.type": %w`, err)}
}
}
- if v, ok := ifuo.mutation.TextValue(); ok {
+ if v, ok := _u.mutation.TextValue(); ok {
if err := itemfield.TextValueValidator(v); err != nil {
return &ValidationError{Name: "text_value", err: fmt.Errorf(`ent: validator failed for field "ItemField.text_value": %w`, err)}
}
@@ -580,17 +580,17 @@ func (ifuo *ItemFieldUpdateOne) check() error {
return nil
}
-func (ifuo *ItemFieldUpdateOne) sqlSave(ctx context.Context) (_node *ItemField, err error) {
- if err := ifuo.check(); err != nil {
+func (_u *ItemFieldUpdateOne) sqlSave(ctx context.Context) (_node *ItemField, err error) {
+ if err := _u.check(); err != nil {
return _node, err
}
_spec := sqlgraph.NewUpdateSpec(itemfield.Table, itemfield.Columns, sqlgraph.NewFieldSpec(itemfield.FieldID, field.TypeUUID))
- id, ok := ifuo.mutation.ID()
+ id, ok := _u.mutation.ID()
if !ok {
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "ItemField.id" for update`)}
}
_spec.Node.ID.Value = id
- if fields := ifuo.fields; len(fields) > 0 {
+ if fields := _u.fields; len(fields) > 0 {
_spec.Node.Columns = make([]string, 0, len(fields))
_spec.Node.Columns = append(_spec.Node.Columns, itemfield.FieldID)
for _, f := range fields {
@@ -602,50 +602,50 @@ func (ifuo *ItemFieldUpdateOne) sqlSave(ctx context.Context) (_node *ItemField,
}
}
}
- if ps := ifuo.mutation.predicates; len(ps) > 0 {
+ if ps := _u.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
- if value, ok := ifuo.mutation.UpdatedAt(); ok {
+ if value, ok := _u.mutation.UpdatedAt(); ok {
_spec.SetField(itemfield.FieldUpdatedAt, field.TypeTime, value)
}
- if value, ok := ifuo.mutation.Name(); ok {
+ if value, ok := _u.mutation.Name(); ok {
_spec.SetField(itemfield.FieldName, field.TypeString, value)
}
- if value, ok := ifuo.mutation.Description(); ok {
+ if value, ok := _u.mutation.Description(); ok {
_spec.SetField(itemfield.FieldDescription, field.TypeString, value)
}
- if ifuo.mutation.DescriptionCleared() {
+ if _u.mutation.DescriptionCleared() {
_spec.ClearField(itemfield.FieldDescription, field.TypeString)
}
- if value, ok := ifuo.mutation.GetType(); ok {
+ if value, ok := _u.mutation.GetType(); ok {
_spec.SetField(itemfield.FieldType, field.TypeEnum, value)
}
- if value, ok := ifuo.mutation.TextValue(); ok {
+ if value, ok := _u.mutation.TextValue(); ok {
_spec.SetField(itemfield.FieldTextValue, field.TypeString, value)
}
- if ifuo.mutation.TextValueCleared() {
+ if _u.mutation.TextValueCleared() {
_spec.ClearField(itemfield.FieldTextValue, field.TypeString)
}
- if value, ok := ifuo.mutation.NumberValue(); ok {
+ if value, ok := _u.mutation.NumberValue(); ok {
_spec.SetField(itemfield.FieldNumberValue, field.TypeInt, value)
}
- if value, ok := ifuo.mutation.AddedNumberValue(); ok {
+ if value, ok := _u.mutation.AddedNumberValue(); ok {
_spec.AddField(itemfield.FieldNumberValue, field.TypeInt, value)
}
- if ifuo.mutation.NumberValueCleared() {
+ if _u.mutation.NumberValueCleared() {
_spec.ClearField(itemfield.FieldNumberValue, field.TypeInt)
}
- if value, ok := ifuo.mutation.BooleanValue(); ok {
+ if value, ok := _u.mutation.BooleanValue(); ok {
_spec.SetField(itemfield.FieldBooleanValue, field.TypeBool, value)
}
- if value, ok := ifuo.mutation.TimeValue(); ok {
+ if value, ok := _u.mutation.TimeValue(); ok {
_spec.SetField(itemfield.FieldTimeValue, field.TypeTime, value)
}
- if ifuo.mutation.ItemCleared() {
+ if _u.mutation.ItemCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -658,7 +658,7 @@ func (ifuo *ItemFieldUpdateOne) sqlSave(ctx context.Context) (_node *ItemField,
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := ifuo.mutation.ItemIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.ItemIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -674,10 +674,10 @@ func (ifuo *ItemFieldUpdateOne) sqlSave(ctx context.Context) (_node *ItemField,
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- _node = &ItemField{config: ifuo.config}
+ _node = &ItemField{config: _u.config}
_spec.Assign = _node.assignValues
_spec.ScanValues = _node.scanValues
- if err = sqlgraph.UpdateNode(ctx, ifuo.driver, _spec); err != nil {
+ if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil {
if _, ok := err.(*sqlgraph.NotFoundError); ok {
err = &NotFoundError{itemfield.Label}
} else if sqlgraph.IsConstraintError(err) {
@@ -685,6 +685,6 @@ func (ifuo *ItemFieldUpdateOne) sqlSave(ctx context.Context) (_node *ItemField,
}
return nil, err
}
- ifuo.mutation.done = true
+ _u.mutation.done = true
return _node, nil
}
diff --git a/backend/internal/data/ent/label.go b/backend/internal/data/ent/label.go
index e2a82a56..8203bd5d 100644
--- a/backend/internal/data/ent/label.go
+++ b/backend/internal/data/ent/label.go
@@ -89,7 +89,7 @@ func (*Label) scanValues(columns []string) ([]any, error) {
// assignValues assigns the values that were returned from sql.Rows (after scanning)
// to the Label fields.
-func (l *Label) assignValues(columns []string, values []any) error {
+func (_m *Label) assignValues(columns []string, values []any) error {
if m, n := len(values), len(columns); m < n {
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
}
@@ -99,47 +99,47 @@ func (l *Label) assignValues(columns []string, values []any) error {
if value, ok := values[i].(*uuid.UUID); !ok {
return fmt.Errorf("unexpected type %T for field id", values[i])
} else if value != nil {
- l.ID = *value
+ _m.ID = *value
}
case label.FieldCreatedAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field created_at", values[i])
} else if value.Valid {
- l.CreatedAt = value.Time
+ _m.CreatedAt = value.Time
}
case label.FieldUpdatedAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field updated_at", values[i])
} else if value.Valid {
- l.UpdatedAt = value.Time
+ _m.UpdatedAt = value.Time
}
case label.FieldName:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field name", values[i])
} else if value.Valid {
- l.Name = value.String
+ _m.Name = value.String
}
case label.FieldDescription:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field description", values[i])
} else if value.Valid {
- l.Description = value.String
+ _m.Description = value.String
}
case label.FieldColor:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field color", values[i])
} else if value.Valid {
- l.Color = value.String
+ _m.Color = value.String
}
case label.ForeignKeys[0]:
if value, ok := values[i].(*sql.NullScanner); !ok {
return fmt.Errorf("unexpected type %T for field group_labels", values[i])
} else if value.Valid {
- l.group_labels = new(uuid.UUID)
- *l.group_labels = *value.S.(*uuid.UUID)
+ _m.group_labels = new(uuid.UUID)
+ *_m.group_labels = *value.S.(*uuid.UUID)
}
default:
- l.selectValues.Set(columns[i], values[i])
+ _m.selectValues.Set(columns[i], values[i])
}
}
return nil
@@ -147,57 +147,57 @@ func (l *Label) assignValues(columns []string, values []any) error {
// Value returns the ent.Value that was dynamically selected and assigned to the Label.
// This includes values selected through modifiers, order, etc.
-func (l *Label) Value(name string) (ent.Value, error) {
- return l.selectValues.Get(name)
+func (_m *Label) Value(name string) (ent.Value, error) {
+ return _m.selectValues.Get(name)
}
// QueryGroup queries the "group" edge of the Label entity.
-func (l *Label) QueryGroup() *GroupQuery {
- return NewLabelClient(l.config).QueryGroup(l)
+func (_m *Label) QueryGroup() *GroupQuery {
+ return NewLabelClient(_m.config).QueryGroup(_m)
}
// QueryItems queries the "items" edge of the Label entity.
-func (l *Label) QueryItems() *ItemQuery {
- return NewLabelClient(l.config).QueryItems(l)
+func (_m *Label) QueryItems() *ItemQuery {
+ return NewLabelClient(_m.config).QueryItems(_m)
}
// Update returns a builder for updating this Label.
// Note that you need to call Label.Unwrap() before calling this method if this Label
// was returned from a transaction, and the transaction was committed or rolled back.
-func (l *Label) Update() *LabelUpdateOne {
- return NewLabelClient(l.config).UpdateOne(l)
+func (_m *Label) Update() *LabelUpdateOne {
+ return NewLabelClient(_m.config).UpdateOne(_m)
}
// Unwrap unwraps the Label 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 (l *Label) Unwrap() *Label {
- _tx, ok := l.config.driver.(*txDriver)
+func (_m *Label) Unwrap() *Label {
+ _tx, ok := _m.config.driver.(*txDriver)
if !ok {
panic("ent: Label is not a transactional entity")
}
- l.config.driver = _tx.drv
- return l
+ _m.config.driver = _tx.drv
+ return _m
}
// String implements the fmt.Stringer.
-func (l *Label) String() string {
+func (_m *Label) String() string {
var builder strings.Builder
builder.WriteString("Label(")
- builder.WriteString(fmt.Sprintf("id=%v, ", l.ID))
+ builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
builder.WriteString("created_at=")
- builder.WriteString(l.CreatedAt.Format(time.ANSIC))
+ builder.WriteString(_m.CreatedAt.Format(time.ANSIC))
builder.WriteString(", ")
builder.WriteString("updated_at=")
- builder.WriteString(l.UpdatedAt.Format(time.ANSIC))
+ builder.WriteString(_m.UpdatedAt.Format(time.ANSIC))
builder.WriteString(", ")
builder.WriteString("name=")
- builder.WriteString(l.Name)
+ builder.WriteString(_m.Name)
builder.WriteString(", ")
builder.WriteString("description=")
- builder.WriteString(l.Description)
+ builder.WriteString(_m.Description)
builder.WriteString(", ")
builder.WriteString("color=")
- builder.WriteString(l.Color)
+ builder.WriteString(_m.Color)
builder.WriteByte(')')
return builder.String()
}
diff --git a/backend/internal/data/ent/label_create.go b/backend/internal/data/ent/label_create.go
index 7434b815..a1cdf28c 100644
--- a/backend/internal/data/ent/label_create.go
+++ b/backend/internal/data/ent/label_create.go
@@ -24,121 +24,121 @@ type LabelCreate struct {
}
// SetCreatedAt sets the "created_at" field.
-func (lc *LabelCreate) SetCreatedAt(t time.Time) *LabelCreate {
- lc.mutation.SetCreatedAt(t)
- return lc
+func (_c *LabelCreate) SetCreatedAt(v time.Time) *LabelCreate {
+ _c.mutation.SetCreatedAt(v)
+ return _c
}
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
-func (lc *LabelCreate) SetNillableCreatedAt(t *time.Time) *LabelCreate {
- if t != nil {
- lc.SetCreatedAt(*t)
+func (_c *LabelCreate) SetNillableCreatedAt(v *time.Time) *LabelCreate {
+ if v != nil {
+ _c.SetCreatedAt(*v)
}
- return lc
+ return _c
}
// SetUpdatedAt sets the "updated_at" field.
-func (lc *LabelCreate) SetUpdatedAt(t time.Time) *LabelCreate {
- lc.mutation.SetUpdatedAt(t)
- return lc
+func (_c *LabelCreate) SetUpdatedAt(v time.Time) *LabelCreate {
+ _c.mutation.SetUpdatedAt(v)
+ return _c
}
// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
-func (lc *LabelCreate) SetNillableUpdatedAt(t *time.Time) *LabelCreate {
- if t != nil {
- lc.SetUpdatedAt(*t)
+func (_c *LabelCreate) SetNillableUpdatedAt(v *time.Time) *LabelCreate {
+ if v != nil {
+ _c.SetUpdatedAt(*v)
}
- return lc
+ return _c
}
// SetName sets the "name" field.
-func (lc *LabelCreate) SetName(s string) *LabelCreate {
- lc.mutation.SetName(s)
- return lc
+func (_c *LabelCreate) SetName(v string) *LabelCreate {
+ _c.mutation.SetName(v)
+ return _c
}
// SetDescription sets the "description" field.
-func (lc *LabelCreate) SetDescription(s string) *LabelCreate {
- lc.mutation.SetDescription(s)
- return lc
+func (_c *LabelCreate) SetDescription(v string) *LabelCreate {
+ _c.mutation.SetDescription(v)
+ return _c
}
// SetNillableDescription sets the "description" field if the given value is not nil.
-func (lc *LabelCreate) SetNillableDescription(s *string) *LabelCreate {
- if s != nil {
- lc.SetDescription(*s)
+func (_c *LabelCreate) SetNillableDescription(v *string) *LabelCreate {
+ if v != nil {
+ _c.SetDescription(*v)
}
- return lc
+ return _c
}
// SetColor sets the "color" field.
-func (lc *LabelCreate) SetColor(s string) *LabelCreate {
- lc.mutation.SetColor(s)
- return lc
+func (_c *LabelCreate) SetColor(v string) *LabelCreate {
+ _c.mutation.SetColor(v)
+ return _c
}
// SetNillableColor sets the "color" field if the given value is not nil.
-func (lc *LabelCreate) SetNillableColor(s *string) *LabelCreate {
- if s != nil {
- lc.SetColor(*s)
+func (_c *LabelCreate) SetNillableColor(v *string) *LabelCreate {
+ if v != nil {
+ _c.SetColor(*v)
}
- return lc
+ return _c
}
// SetID sets the "id" field.
-func (lc *LabelCreate) SetID(u uuid.UUID) *LabelCreate {
- lc.mutation.SetID(u)
- return lc
+func (_c *LabelCreate) SetID(v uuid.UUID) *LabelCreate {
+ _c.mutation.SetID(v)
+ return _c
}
// SetNillableID sets the "id" field if the given value is not nil.
-func (lc *LabelCreate) SetNillableID(u *uuid.UUID) *LabelCreate {
- if u != nil {
- lc.SetID(*u)
+func (_c *LabelCreate) SetNillableID(v *uuid.UUID) *LabelCreate {
+ if v != nil {
+ _c.SetID(*v)
}
- return lc
+ return _c
}
// SetGroupID sets the "group" edge to the Group entity by ID.
-func (lc *LabelCreate) SetGroupID(id uuid.UUID) *LabelCreate {
- lc.mutation.SetGroupID(id)
- return lc
+func (_c *LabelCreate) SetGroupID(id uuid.UUID) *LabelCreate {
+ _c.mutation.SetGroupID(id)
+ return _c
}
// SetGroup sets the "group" edge to the Group entity.
-func (lc *LabelCreate) SetGroup(g *Group) *LabelCreate {
- return lc.SetGroupID(g.ID)
+func (_c *LabelCreate) SetGroup(v *Group) *LabelCreate {
+ return _c.SetGroupID(v.ID)
}
// AddItemIDs adds the "items" edge to the Item entity by IDs.
-func (lc *LabelCreate) AddItemIDs(ids ...uuid.UUID) *LabelCreate {
- lc.mutation.AddItemIDs(ids...)
- return lc
+func (_c *LabelCreate) AddItemIDs(ids ...uuid.UUID) *LabelCreate {
+ _c.mutation.AddItemIDs(ids...)
+ return _c
}
// AddItems adds the "items" edges to the Item entity.
-func (lc *LabelCreate) AddItems(i ...*Item) *LabelCreate {
- ids := make([]uuid.UUID, len(i))
- for j := range i {
- ids[j] = i[j].ID
+func (_c *LabelCreate) AddItems(v ...*Item) *LabelCreate {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return lc.AddItemIDs(ids...)
+ return _c.AddItemIDs(ids...)
}
// Mutation returns the LabelMutation object of the builder.
-func (lc *LabelCreate) Mutation() *LabelMutation {
- return lc.mutation
+func (_c *LabelCreate) Mutation() *LabelMutation {
+ return _c.mutation
}
// Save creates the Label in the database.
-func (lc *LabelCreate) Save(ctx context.Context) (*Label, error) {
- lc.defaults()
- return withHooks(ctx, lc.sqlSave, lc.mutation, lc.hooks)
+func (_c *LabelCreate) Save(ctx context.Context) (*Label, error) {
+ _c.defaults()
+ return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
}
// SaveX calls Save and panics if Save returns an error.
-func (lc *LabelCreate) SaveX(ctx context.Context) *Label {
- v, err := lc.Save(ctx)
+func (_c *LabelCreate) SaveX(ctx context.Context) *Label {
+ v, err := _c.Save(ctx)
if err != nil {
panic(err)
}
@@ -146,72 +146,72 @@ func (lc *LabelCreate) SaveX(ctx context.Context) *Label {
}
// Exec executes the query.
-func (lc *LabelCreate) Exec(ctx context.Context) error {
- _, err := lc.Save(ctx)
+func (_c *LabelCreate) Exec(ctx context.Context) error {
+ _, err := _c.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
-func (lc *LabelCreate) ExecX(ctx context.Context) {
- if err := lc.Exec(ctx); err != nil {
+func (_c *LabelCreate) ExecX(ctx context.Context) {
+ if err := _c.Exec(ctx); err != nil {
panic(err)
}
}
// defaults sets the default values of the builder before save.
-func (lc *LabelCreate) defaults() {
- if _, ok := lc.mutation.CreatedAt(); !ok {
+func (_c *LabelCreate) defaults() {
+ if _, ok := _c.mutation.CreatedAt(); !ok {
v := label.DefaultCreatedAt()
- lc.mutation.SetCreatedAt(v)
+ _c.mutation.SetCreatedAt(v)
}
- if _, ok := lc.mutation.UpdatedAt(); !ok {
+ if _, ok := _c.mutation.UpdatedAt(); !ok {
v := label.DefaultUpdatedAt()
- lc.mutation.SetUpdatedAt(v)
+ _c.mutation.SetUpdatedAt(v)
}
- if _, ok := lc.mutation.ID(); !ok {
+ if _, ok := _c.mutation.ID(); !ok {
v := label.DefaultID()
- lc.mutation.SetID(v)
+ _c.mutation.SetID(v)
}
}
// check runs all checks and user-defined validators on the builder.
-func (lc *LabelCreate) check() error {
- if _, ok := lc.mutation.CreatedAt(); !ok {
+func (_c *LabelCreate) check() error {
+ if _, ok := _c.mutation.CreatedAt(); !ok {
return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "Label.created_at"`)}
}
- if _, ok := lc.mutation.UpdatedAt(); !ok {
+ if _, ok := _c.mutation.UpdatedAt(); !ok {
return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "Label.updated_at"`)}
}
- if _, ok := lc.mutation.Name(); !ok {
+ if _, ok := _c.mutation.Name(); !ok {
return &ValidationError{Name: "name", err: errors.New(`ent: missing required field "Label.name"`)}
}
- if v, ok := lc.mutation.Name(); ok {
+ if v, ok := _c.mutation.Name(); ok {
if err := label.NameValidator(v); err != nil {
return &ValidationError{Name: "name", err: fmt.Errorf(`ent: validator failed for field "Label.name": %w`, err)}
}
}
- if v, ok := lc.mutation.Description(); ok {
+ if v, ok := _c.mutation.Description(); ok {
if err := label.DescriptionValidator(v); err != nil {
return &ValidationError{Name: "description", err: fmt.Errorf(`ent: validator failed for field "Label.description": %w`, err)}
}
}
- if v, ok := lc.mutation.Color(); ok {
+ if v, ok := _c.mutation.Color(); ok {
if err := label.ColorValidator(v); err != nil {
return &ValidationError{Name: "color", err: fmt.Errorf(`ent: validator failed for field "Label.color": %w`, err)}
}
}
- if len(lc.mutation.GroupIDs()) == 0 {
+ if len(_c.mutation.GroupIDs()) == 0 {
return &ValidationError{Name: "group", err: errors.New(`ent: missing required edge "Label.group"`)}
}
return nil
}
-func (lc *LabelCreate) sqlSave(ctx context.Context) (*Label, error) {
- if err := lc.check(); err != nil {
+func (_c *LabelCreate) sqlSave(ctx context.Context) (*Label, error) {
+ if err := _c.check(); err != nil {
return nil, err
}
- _node, _spec := lc.createSpec()
- if err := sqlgraph.CreateNode(ctx, lc.driver, _spec); err != nil {
+ _node, _spec := _c.createSpec()
+ if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil {
if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
@@ -224,41 +224,41 @@ func (lc *LabelCreate) sqlSave(ctx context.Context) (*Label, error) {
return nil, err
}
}
- lc.mutation.id = &_node.ID
- lc.mutation.done = true
+ _c.mutation.id = &_node.ID
+ _c.mutation.done = true
return _node, nil
}
-func (lc *LabelCreate) createSpec() (*Label, *sqlgraph.CreateSpec) {
+func (_c *LabelCreate) createSpec() (*Label, *sqlgraph.CreateSpec) {
var (
- _node = &Label{config: lc.config}
+ _node = &Label{config: _c.config}
_spec = sqlgraph.NewCreateSpec(label.Table, sqlgraph.NewFieldSpec(label.FieldID, field.TypeUUID))
)
- if id, ok := lc.mutation.ID(); ok {
+ if id, ok := _c.mutation.ID(); ok {
_node.ID = id
_spec.ID.Value = &id
}
- if value, ok := lc.mutation.CreatedAt(); ok {
+ if value, ok := _c.mutation.CreatedAt(); ok {
_spec.SetField(label.FieldCreatedAt, field.TypeTime, value)
_node.CreatedAt = value
}
- if value, ok := lc.mutation.UpdatedAt(); ok {
+ if value, ok := _c.mutation.UpdatedAt(); ok {
_spec.SetField(label.FieldUpdatedAt, field.TypeTime, value)
_node.UpdatedAt = value
}
- if value, ok := lc.mutation.Name(); ok {
+ if value, ok := _c.mutation.Name(); ok {
_spec.SetField(label.FieldName, field.TypeString, value)
_node.Name = value
}
- if value, ok := lc.mutation.Description(); ok {
+ if value, ok := _c.mutation.Description(); ok {
_spec.SetField(label.FieldDescription, field.TypeString, value)
_node.Description = value
}
- if value, ok := lc.mutation.Color(); ok {
+ if value, ok := _c.mutation.Color(); ok {
_spec.SetField(label.FieldColor, field.TypeString, value)
_node.Color = value
}
- if nodes := lc.mutation.GroupIDs(); len(nodes) > 0 {
+ if nodes := _c.mutation.GroupIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -275,7 +275,7 @@ func (lc *LabelCreate) createSpec() (*Label, *sqlgraph.CreateSpec) {
_node.group_labels = &nodes[0]
_spec.Edges = append(_spec.Edges, edge)
}
- if nodes := lc.mutation.ItemsIDs(); len(nodes) > 0 {
+ if nodes := _c.mutation.ItemsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2M,
Inverse: false,
@@ -302,16 +302,16 @@ type LabelCreateBulk struct {
}
// Save creates the Label entities in the database.
-func (lcb *LabelCreateBulk) Save(ctx context.Context) ([]*Label, error) {
- if lcb.err != nil {
- return nil, lcb.err
- }
- specs := make([]*sqlgraph.CreateSpec, len(lcb.builders))
- nodes := make([]*Label, len(lcb.builders))
- mutators := make([]Mutator, len(lcb.builders))
- for i := range lcb.builders {
+func (_c *LabelCreateBulk) Save(ctx context.Context) ([]*Label, error) {
+ if _c.err != nil {
+ return nil, _c.err
+ }
+ specs := make([]*sqlgraph.CreateSpec, len(_c.builders))
+ nodes := make([]*Label, len(_c.builders))
+ mutators := make([]Mutator, len(_c.builders))
+ for i := range _c.builders {
func(i int, root context.Context) {
- builder := lcb.builders[i]
+ builder := _c.builders[i]
builder.defaults()
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
mutation, ok := m.(*LabelMutation)
@@ -325,11 +325,11 @@ func (lcb *LabelCreateBulk) Save(ctx context.Context) ([]*Label, error) {
var err error
nodes[i], specs[i] = builder.createSpec()
if i < len(mutators)-1 {
- _, err = mutators[i+1].Mutate(root, lcb.builders[i+1].mutation)
+ _, err = mutators[i+1].Mutate(root, _c.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, lcb.driver, spec); err != nil {
+ if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil {
if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
@@ -349,7 +349,7 @@ func (lcb *LabelCreateBulk) Save(ctx context.Context) ([]*Label, error) {
}(i, ctx)
}
if len(mutators) > 0 {
- if _, err := mutators[0].Mutate(ctx, lcb.builders[0].mutation); err != nil {
+ if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil {
return nil, err
}
}
@@ -357,8 +357,8 @@ func (lcb *LabelCreateBulk) Save(ctx context.Context) ([]*Label, error) {
}
// SaveX is like Save, but panics if an error occurs.
-func (lcb *LabelCreateBulk) SaveX(ctx context.Context) []*Label {
- v, err := lcb.Save(ctx)
+func (_c *LabelCreateBulk) SaveX(ctx context.Context) []*Label {
+ v, err := _c.Save(ctx)
if err != nil {
panic(err)
}
@@ -366,14 +366,14 @@ func (lcb *LabelCreateBulk) SaveX(ctx context.Context) []*Label {
}
// Exec executes the query.
-func (lcb *LabelCreateBulk) Exec(ctx context.Context) error {
- _, err := lcb.Save(ctx)
+func (_c *LabelCreateBulk) Exec(ctx context.Context) error {
+ _, err := _c.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
-func (lcb *LabelCreateBulk) ExecX(ctx context.Context) {
- if err := lcb.Exec(ctx); err != nil {
+func (_c *LabelCreateBulk) ExecX(ctx context.Context) {
+ if err := _c.Exec(ctx); err != nil {
panic(err)
}
}
diff --git a/backend/internal/data/ent/label_delete.go b/backend/internal/data/ent/label_delete.go
index c95af383..68cb8fac 100644
--- a/backend/internal/data/ent/label_delete.go
+++ b/backend/internal/data/ent/label_delete.go
@@ -20,56 +20,56 @@ type LabelDelete struct {
}
// Where appends a list predicates to the LabelDelete builder.
-func (ld *LabelDelete) Where(ps ...predicate.Label) *LabelDelete {
- ld.mutation.Where(ps...)
- return ld
+func (_d *LabelDelete) Where(ps ...predicate.Label) *LabelDelete {
+ _d.mutation.Where(ps...)
+ return _d
}
// Exec executes the deletion query and returns how many vertices were deleted.
-func (ld *LabelDelete) Exec(ctx context.Context) (int, error) {
- return withHooks(ctx, ld.sqlExec, ld.mutation, ld.hooks)
+func (_d *LabelDelete) Exec(ctx context.Context) (int, error) {
+ return withHooks(ctx, _d.sqlExec, _d.mutation, _d.hooks)
}
// ExecX is like Exec, but panics if an error occurs.
-func (ld *LabelDelete) ExecX(ctx context.Context) int {
- n, err := ld.Exec(ctx)
+func (_d *LabelDelete) ExecX(ctx context.Context) int {
+ n, err := _d.Exec(ctx)
if err != nil {
panic(err)
}
return n
}
-func (ld *LabelDelete) sqlExec(ctx context.Context) (int, error) {
+func (_d *LabelDelete) sqlExec(ctx context.Context) (int, error) {
_spec := sqlgraph.NewDeleteSpec(label.Table, sqlgraph.NewFieldSpec(label.FieldID, field.TypeUUID))
- if ps := ld.mutation.predicates; len(ps) > 0 {
+ if ps := _d.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
- affected, err := sqlgraph.DeleteNodes(ctx, ld.driver, _spec)
+ affected, err := sqlgraph.DeleteNodes(ctx, _d.driver, _spec)
if err != nil && sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
- ld.mutation.done = true
+ _d.mutation.done = true
return affected, err
}
// LabelDeleteOne is the builder for deleting a single Label entity.
type LabelDeleteOne struct {
- ld *LabelDelete
+ _d *LabelDelete
}
// Where appends a list predicates to the LabelDelete builder.
-func (ldo *LabelDeleteOne) Where(ps ...predicate.Label) *LabelDeleteOne {
- ldo.ld.mutation.Where(ps...)
- return ldo
+func (_d *LabelDeleteOne) Where(ps ...predicate.Label) *LabelDeleteOne {
+ _d._d.mutation.Where(ps...)
+ return _d
}
// Exec executes the deletion query.
-func (ldo *LabelDeleteOne) Exec(ctx context.Context) error {
- n, err := ldo.ld.Exec(ctx)
+func (_d *LabelDeleteOne) Exec(ctx context.Context) error {
+ n, err := _d._d.Exec(ctx)
switch {
case err != nil:
return err
@@ -81,8 +81,8 @@ func (ldo *LabelDeleteOne) Exec(ctx context.Context) error {
}
// ExecX is like Exec, but panics if an error occurs.
-func (ldo *LabelDeleteOne) ExecX(ctx context.Context) {
- if err := ldo.Exec(ctx); err != nil {
+func (_d *LabelDeleteOne) ExecX(ctx context.Context) {
+ if err := _d.Exec(ctx); err != nil {
panic(err)
}
}
diff --git a/backend/internal/data/ent/label_query.go b/backend/internal/data/ent/label_query.go
index b03c9bfc..f3661691 100644
--- a/backend/internal/data/ent/label_query.go
+++ b/backend/internal/data/ent/label_query.go
@@ -35,44 +35,44 @@ type LabelQuery struct {
}
// Where adds a new predicate for the LabelQuery builder.
-func (lq *LabelQuery) Where(ps ...predicate.Label) *LabelQuery {
- lq.predicates = append(lq.predicates, ps...)
- return lq
+func (_q *LabelQuery) Where(ps ...predicate.Label) *LabelQuery {
+ _q.predicates = append(_q.predicates, ps...)
+ return _q
}
// Limit the number of records to be returned by this query.
-func (lq *LabelQuery) Limit(limit int) *LabelQuery {
- lq.ctx.Limit = &limit
- return lq
+func (_q *LabelQuery) Limit(limit int) *LabelQuery {
+ _q.ctx.Limit = &limit
+ return _q
}
// Offset to start from.
-func (lq *LabelQuery) Offset(offset int) *LabelQuery {
- lq.ctx.Offset = &offset
- return lq
+func (_q *LabelQuery) Offset(offset int) *LabelQuery {
+ _q.ctx.Offset = &offset
+ return _q
}
// Unique configures the query builder to filter duplicate records on query.
// By default, unique is set to true, and can be disabled using this method.
-func (lq *LabelQuery) Unique(unique bool) *LabelQuery {
- lq.ctx.Unique = &unique
- return lq
+func (_q *LabelQuery) Unique(unique bool) *LabelQuery {
+ _q.ctx.Unique = &unique
+ return _q
}
// Order specifies how the records should be ordered.
-func (lq *LabelQuery) Order(o ...label.OrderOption) *LabelQuery {
- lq.order = append(lq.order, o...)
- return lq
+func (_q *LabelQuery) Order(o ...label.OrderOption) *LabelQuery {
+ _q.order = append(_q.order, o...)
+ return _q
}
// QueryGroup chains the current query on the "group" edge.
-func (lq *LabelQuery) QueryGroup() *GroupQuery {
- query := (&GroupClient{config: lq.config}).Query()
+func (_q *LabelQuery) QueryGroup() *GroupQuery {
+ query := (&GroupClient{config: _q.config}).Query()
query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
- if err := lq.prepareQuery(ctx); err != nil {
+ if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
- selector := lq.sqlQuery(ctx)
+ selector := _q.sqlQuery(ctx)
if err := selector.Err(); err != nil {
return nil, err
}
@@ -81,20 +81,20 @@ func (lq *LabelQuery) QueryGroup() *GroupQuery {
sqlgraph.To(group.Table, group.FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, label.GroupTable, label.GroupColumn),
)
- fromU = sqlgraph.SetNeighbors(lq.driver.Dialect(), step)
+ fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step)
return fromU, nil
}
return query
}
// QueryItems chains the current query on the "items" edge.
-func (lq *LabelQuery) QueryItems() *ItemQuery {
- query := (&ItemClient{config: lq.config}).Query()
+func (_q *LabelQuery) QueryItems() *ItemQuery {
+ query := (&ItemClient{config: _q.config}).Query()
query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
- if err := lq.prepareQuery(ctx); err != nil {
+ if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
- selector := lq.sqlQuery(ctx)
+ selector := _q.sqlQuery(ctx)
if err := selector.Err(); err != nil {
return nil, err
}
@@ -103,7 +103,7 @@ func (lq *LabelQuery) QueryItems() *ItemQuery {
sqlgraph.To(item.Table, item.FieldID),
sqlgraph.Edge(sqlgraph.M2M, false, label.ItemsTable, label.ItemsPrimaryKey...),
)
- fromU = sqlgraph.SetNeighbors(lq.driver.Dialect(), step)
+ fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step)
return fromU, nil
}
return query
@@ -111,8 +111,8 @@ func (lq *LabelQuery) QueryItems() *ItemQuery {
// First returns the first Label entity from the query.
// Returns a *NotFoundError when no Label was found.
-func (lq *LabelQuery) First(ctx context.Context) (*Label, error) {
- nodes, err := lq.Limit(1).All(setContextOp(ctx, lq.ctx, ent.OpQueryFirst))
+func (_q *LabelQuery) First(ctx context.Context) (*Label, error) {
+ nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst))
if err != nil {
return nil, err
}
@@ -123,8 +123,8 @@ func (lq *LabelQuery) First(ctx context.Context) (*Label, error) {
}
// FirstX is like First, but panics if an error occurs.
-func (lq *LabelQuery) FirstX(ctx context.Context) *Label {
- node, err := lq.First(ctx)
+func (_q *LabelQuery) FirstX(ctx context.Context) *Label {
+ node, err := _q.First(ctx)
if err != nil && !IsNotFound(err) {
panic(err)
}
@@ -133,9 +133,9 @@ func (lq *LabelQuery) FirstX(ctx context.Context) *Label {
// FirstID returns the first Label ID from the query.
// Returns a *NotFoundError when no Label ID was found.
-func (lq *LabelQuery) FirstID(ctx context.Context) (id uuid.UUID, err error) {
+func (_q *LabelQuery) FirstID(ctx context.Context) (id uuid.UUID, err error) {
var ids []uuid.UUID
- if ids, err = lq.Limit(1).IDs(setContextOp(ctx, lq.ctx, ent.OpQueryFirstID)); err != nil {
+ if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil {
return
}
if len(ids) == 0 {
@@ -146,8 +146,8 @@ func (lq *LabelQuery) FirstID(ctx context.Context) (id uuid.UUID, err error) {
}
// FirstIDX is like FirstID, but panics if an error occurs.
-func (lq *LabelQuery) FirstIDX(ctx context.Context) uuid.UUID {
- id, err := lq.FirstID(ctx)
+func (_q *LabelQuery) FirstIDX(ctx context.Context) uuid.UUID {
+ id, err := _q.FirstID(ctx)
if err != nil && !IsNotFound(err) {
panic(err)
}
@@ -157,8 +157,8 @@ func (lq *LabelQuery) FirstIDX(ctx context.Context) uuid.UUID {
// Only returns a single Label entity found by the query, ensuring it only returns one.
// Returns a *NotSingularError when more than one Label entity is found.
// Returns a *NotFoundError when no Label entities are found.
-func (lq *LabelQuery) Only(ctx context.Context) (*Label, error) {
- nodes, err := lq.Limit(2).All(setContextOp(ctx, lq.ctx, ent.OpQueryOnly))
+func (_q *LabelQuery) Only(ctx context.Context) (*Label, error) {
+ nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly))
if err != nil {
return nil, err
}
@@ -173,8 +173,8 @@ func (lq *LabelQuery) Only(ctx context.Context) (*Label, error) {
}
// OnlyX is like Only, but panics if an error occurs.
-func (lq *LabelQuery) OnlyX(ctx context.Context) *Label {
- node, err := lq.Only(ctx)
+func (_q *LabelQuery) OnlyX(ctx context.Context) *Label {
+ node, err := _q.Only(ctx)
if err != nil {
panic(err)
}
@@ -184,9 +184,9 @@ func (lq *LabelQuery) OnlyX(ctx context.Context) *Label {
// OnlyID is like Only, but returns the only Label ID in the query.
// Returns a *NotSingularError when more than one Label ID is found.
// Returns a *NotFoundError when no entities are found.
-func (lq *LabelQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error) {
+func (_q *LabelQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error) {
var ids []uuid.UUID
- if ids, err = lq.Limit(2).IDs(setContextOp(ctx, lq.ctx, ent.OpQueryOnlyID)); err != nil {
+ if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil {
return
}
switch len(ids) {
@@ -201,8 +201,8 @@ func (lq *LabelQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error) {
}
// OnlyIDX is like OnlyID, but panics if an error occurs.
-func (lq *LabelQuery) OnlyIDX(ctx context.Context) uuid.UUID {
- id, err := lq.OnlyID(ctx)
+func (_q *LabelQuery) OnlyIDX(ctx context.Context) uuid.UUID {
+ id, err := _q.OnlyID(ctx)
if err != nil {
panic(err)
}
@@ -210,18 +210,18 @@ func (lq *LabelQuery) OnlyIDX(ctx context.Context) uuid.UUID {
}
// All executes the query and returns a list of Labels.
-func (lq *LabelQuery) All(ctx context.Context) ([]*Label, error) {
- ctx = setContextOp(ctx, lq.ctx, ent.OpQueryAll)
- if err := lq.prepareQuery(ctx); err != nil {
+func (_q *LabelQuery) All(ctx context.Context) ([]*Label, error) {
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll)
+ if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
qr := querierAll[[]*Label, *LabelQuery]()
- return withInterceptors[[]*Label](ctx, lq, qr, lq.inters)
+ return withInterceptors[[]*Label](ctx, _q, qr, _q.inters)
}
// AllX is like All, but panics if an error occurs.
-func (lq *LabelQuery) AllX(ctx context.Context) []*Label {
- nodes, err := lq.All(ctx)
+func (_q *LabelQuery) AllX(ctx context.Context) []*Label {
+ nodes, err := _q.All(ctx)
if err != nil {
panic(err)
}
@@ -229,20 +229,20 @@ func (lq *LabelQuery) AllX(ctx context.Context) []*Label {
}
// IDs executes the query and returns a list of Label IDs.
-func (lq *LabelQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error) {
- if lq.ctx.Unique == nil && lq.path != nil {
- lq.Unique(true)
+func (_q *LabelQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error) {
+ if _q.ctx.Unique == nil && _q.path != nil {
+ _q.Unique(true)
}
- ctx = setContextOp(ctx, lq.ctx, ent.OpQueryIDs)
- if err = lq.Select(label.FieldID).Scan(ctx, &ids); err != nil {
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs)
+ if err = _q.Select(label.FieldID).Scan(ctx, &ids); err != nil {
return nil, err
}
return ids, nil
}
// IDsX is like IDs, but panics if an error occurs.
-func (lq *LabelQuery) IDsX(ctx context.Context) []uuid.UUID {
- ids, err := lq.IDs(ctx)
+func (_q *LabelQuery) IDsX(ctx context.Context) []uuid.UUID {
+ ids, err := _q.IDs(ctx)
if err != nil {
panic(err)
}
@@ -250,17 +250,17 @@ func (lq *LabelQuery) IDsX(ctx context.Context) []uuid.UUID {
}
// Count returns the count of the given query.
-func (lq *LabelQuery) Count(ctx context.Context) (int, error) {
- ctx = setContextOp(ctx, lq.ctx, ent.OpQueryCount)
- if err := lq.prepareQuery(ctx); err != nil {
+func (_q *LabelQuery) Count(ctx context.Context) (int, error) {
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryCount)
+ if err := _q.prepareQuery(ctx); err != nil {
return 0, err
}
- return withInterceptors[int](ctx, lq, querierCount[*LabelQuery](), lq.inters)
+ return withInterceptors[int](ctx, _q, querierCount[*LabelQuery](), _q.inters)
}
// CountX is like Count, but panics if an error occurs.
-func (lq *LabelQuery) CountX(ctx context.Context) int {
- count, err := lq.Count(ctx)
+func (_q *LabelQuery) CountX(ctx context.Context) int {
+ count, err := _q.Count(ctx)
if err != nil {
panic(err)
}
@@ -268,9 +268,9 @@ func (lq *LabelQuery) CountX(ctx context.Context) int {
}
// Exist returns true if the query has elements in the graph.
-func (lq *LabelQuery) Exist(ctx context.Context) (bool, error) {
- ctx = setContextOp(ctx, lq.ctx, ent.OpQueryExist)
- switch _, err := lq.FirstID(ctx); {
+func (_q *LabelQuery) Exist(ctx context.Context) (bool, error) {
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryExist)
+ switch _, err := _q.FirstID(ctx); {
case IsNotFound(err):
return false, nil
case err != nil:
@@ -281,8 +281,8 @@ func (lq *LabelQuery) Exist(ctx context.Context) (bool, error) {
}
// ExistX is like Exist, but panics if an error occurs.
-func (lq *LabelQuery) ExistX(ctx context.Context) bool {
- exist, err := lq.Exist(ctx)
+func (_q *LabelQuery) ExistX(ctx context.Context) bool {
+ exist, err := _q.Exist(ctx)
if err != nil {
panic(err)
}
@@ -291,44 +291,44 @@ func (lq *LabelQuery) ExistX(ctx context.Context) bool {
// Clone returns a duplicate of the LabelQuery builder, including all associated steps. It can be
// used to prepare common query builders and use them differently after the clone is made.
-func (lq *LabelQuery) Clone() *LabelQuery {
- if lq == nil {
+func (_q *LabelQuery) Clone() *LabelQuery {
+ if _q == nil {
return nil
}
return &LabelQuery{
- config: lq.config,
- ctx: lq.ctx.Clone(),
- order: append([]label.OrderOption{}, lq.order...),
- inters: append([]Interceptor{}, lq.inters...),
- predicates: append([]predicate.Label{}, lq.predicates...),
- withGroup: lq.withGroup.Clone(),
- withItems: lq.withItems.Clone(),
+ config: _q.config,
+ ctx: _q.ctx.Clone(),
+ order: append([]label.OrderOption{}, _q.order...),
+ inters: append([]Interceptor{}, _q.inters...),
+ predicates: append([]predicate.Label{}, _q.predicates...),
+ withGroup: _q.withGroup.Clone(),
+ withItems: _q.withItems.Clone(),
// clone intermediate query.
- sql: lq.sql.Clone(),
- path: lq.path,
+ sql: _q.sql.Clone(),
+ path: _q.path,
}
}
// WithGroup tells the query-builder to eager-load the nodes that are connected to
// the "group" edge. The optional arguments are used to configure the query builder of the edge.
-func (lq *LabelQuery) WithGroup(opts ...func(*GroupQuery)) *LabelQuery {
- query := (&GroupClient{config: lq.config}).Query()
+func (_q *LabelQuery) WithGroup(opts ...func(*GroupQuery)) *LabelQuery {
+ query := (&GroupClient{config: _q.config}).Query()
for _, opt := range opts {
opt(query)
}
- lq.withGroup = query
- return lq
+ _q.withGroup = query
+ return _q
}
// WithItems tells the query-builder to eager-load the nodes that are connected to
// the "items" edge. The optional arguments are used to configure the query builder of the edge.
-func (lq *LabelQuery) WithItems(opts ...func(*ItemQuery)) *LabelQuery {
- query := (&ItemClient{config: lq.config}).Query()
+func (_q *LabelQuery) WithItems(opts ...func(*ItemQuery)) *LabelQuery {
+ query := (&ItemClient{config: _q.config}).Query()
for _, opt := range opts {
opt(query)
}
- lq.withItems = query
- return lq
+ _q.withItems = query
+ return _q
}
// GroupBy is used to group vertices by one or more fields/columns.
@@ -345,10 +345,10 @@ func (lq *LabelQuery) WithItems(opts ...func(*ItemQuery)) *LabelQuery {
// GroupBy(label.FieldCreatedAt).
// Aggregate(ent.Count()).
// Scan(ctx, &v)
-func (lq *LabelQuery) GroupBy(field string, fields ...string) *LabelGroupBy {
- lq.ctx.Fields = append([]string{field}, fields...)
- grbuild := &LabelGroupBy{build: lq}
- grbuild.flds = &lq.ctx.Fields
+func (_q *LabelQuery) GroupBy(field string, fields ...string) *LabelGroupBy {
+ _q.ctx.Fields = append([]string{field}, fields...)
+ grbuild := &LabelGroupBy{build: _q}
+ grbuild.flds = &_q.ctx.Fields
grbuild.label = label.Label
grbuild.scan = grbuild.Scan
return grbuild
@@ -366,56 +366,56 @@ func (lq *LabelQuery) GroupBy(field string, fields ...string) *LabelGroupBy {
// client.Label.Query().
// Select(label.FieldCreatedAt).
// Scan(ctx, &v)
-func (lq *LabelQuery) Select(fields ...string) *LabelSelect {
- lq.ctx.Fields = append(lq.ctx.Fields, fields...)
- sbuild := &LabelSelect{LabelQuery: lq}
+func (_q *LabelQuery) Select(fields ...string) *LabelSelect {
+ _q.ctx.Fields = append(_q.ctx.Fields, fields...)
+ sbuild := &LabelSelect{LabelQuery: _q}
sbuild.label = label.Label
- sbuild.flds, sbuild.scan = &lq.ctx.Fields, sbuild.Scan
+ sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan
return sbuild
}
// Aggregate returns a LabelSelect configured with the given aggregations.
-func (lq *LabelQuery) Aggregate(fns ...AggregateFunc) *LabelSelect {
- return lq.Select().Aggregate(fns...)
+func (_q *LabelQuery) Aggregate(fns ...AggregateFunc) *LabelSelect {
+ return _q.Select().Aggregate(fns...)
}
-func (lq *LabelQuery) prepareQuery(ctx context.Context) error {
- for _, inter := range lq.inters {
+func (_q *LabelQuery) prepareQuery(ctx context.Context) error {
+ for _, inter := range _q.inters {
if inter == nil {
return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)")
}
if trv, ok := inter.(Traverser); ok {
- if err := trv.Traverse(ctx, lq); err != nil {
+ if err := trv.Traverse(ctx, _q); err != nil {
return err
}
}
}
- for _, f := range lq.ctx.Fields {
+ for _, f := range _q.ctx.Fields {
if !label.ValidColumn(f) {
return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
}
}
- if lq.path != nil {
- prev, err := lq.path(ctx)
+ if _q.path != nil {
+ prev, err := _q.path(ctx)
if err != nil {
return err
}
- lq.sql = prev
+ _q.sql = prev
}
return nil
}
-func (lq *LabelQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Label, error) {
+func (_q *LabelQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Label, error) {
var (
nodes = []*Label{}
- withFKs = lq.withFKs
- _spec = lq.querySpec()
+ withFKs = _q.withFKs
+ _spec = _q.querySpec()
loadedTypes = [2]bool{
- lq.withGroup != nil,
- lq.withItems != nil,
+ _q.withGroup != nil,
+ _q.withItems != nil,
}
)
- if lq.withGroup != nil {
+ if _q.withGroup != nil {
withFKs = true
}
if withFKs {
@@ -425,7 +425,7 @@ func (lq *LabelQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Label,
return (*Label).scanValues(nil, columns)
}
_spec.Assign = func(columns []string, values []any) error {
- node := &Label{config: lq.config}
+ node := &Label{config: _q.config}
nodes = append(nodes, node)
node.Edges.loadedTypes = loadedTypes
return node.assignValues(columns, values)
@@ -433,20 +433,20 @@ func (lq *LabelQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Label,
for i := range hooks {
hooks[i](ctx, _spec)
}
- if err := sqlgraph.QueryNodes(ctx, lq.driver, _spec); err != nil {
+ if err := sqlgraph.QueryNodes(ctx, _q.driver, _spec); err != nil {
return nil, err
}
if len(nodes) == 0 {
return nodes, nil
}
- if query := lq.withGroup; query != nil {
- if err := lq.loadGroup(ctx, query, nodes, nil,
+ if query := _q.withGroup; query != nil {
+ if err := _q.loadGroup(ctx, query, nodes, nil,
func(n *Label, e *Group) { n.Edges.Group = e }); err != nil {
return nil, err
}
}
- if query := lq.withItems; query != nil {
- if err := lq.loadItems(ctx, query, nodes,
+ if query := _q.withItems; query != nil {
+ if err := _q.loadItems(ctx, query, nodes,
func(n *Label) { n.Edges.Items = []*Item{} },
func(n *Label, e *Item) { n.Edges.Items = append(n.Edges.Items, e) }); err != nil {
return nil, err
@@ -455,7 +455,7 @@ func (lq *LabelQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Label,
return nodes, nil
}
-func (lq *LabelQuery) loadGroup(ctx context.Context, query *GroupQuery, nodes []*Label, init func(*Label), assign func(*Label, *Group)) error {
+func (_q *LabelQuery) loadGroup(ctx context.Context, query *GroupQuery, nodes []*Label, init func(*Label), assign func(*Label, *Group)) error {
ids := make([]uuid.UUID, 0, len(nodes))
nodeids := make(map[uuid.UUID][]*Label)
for i := range nodes {
@@ -487,7 +487,7 @@ func (lq *LabelQuery) loadGroup(ctx context.Context, query *GroupQuery, nodes []
}
return nil
}
-func (lq *LabelQuery) loadItems(ctx context.Context, query *ItemQuery, nodes []*Label, init func(*Label), assign func(*Label, *Item)) error {
+func (_q *LabelQuery) loadItems(ctx context.Context, query *ItemQuery, nodes []*Label, init func(*Label), assign func(*Label, *Item)) error {
edgeIDs := make([]driver.Value, len(nodes))
byID := make(map[uuid.UUID]*Label)
nids := make(map[uuid.UUID]map[*Label]struct{})
@@ -549,24 +549,24 @@ func (lq *LabelQuery) loadItems(ctx context.Context, query *ItemQuery, nodes []*
return nil
}
-func (lq *LabelQuery) sqlCount(ctx context.Context) (int, error) {
- _spec := lq.querySpec()
- _spec.Node.Columns = lq.ctx.Fields
- if len(lq.ctx.Fields) > 0 {
- _spec.Unique = lq.ctx.Unique != nil && *lq.ctx.Unique
+func (_q *LabelQuery) sqlCount(ctx context.Context) (int, error) {
+ _spec := _q.querySpec()
+ _spec.Node.Columns = _q.ctx.Fields
+ if len(_q.ctx.Fields) > 0 {
+ _spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique
}
- return sqlgraph.CountNodes(ctx, lq.driver, _spec)
+ return sqlgraph.CountNodes(ctx, _q.driver, _spec)
}
-func (lq *LabelQuery) querySpec() *sqlgraph.QuerySpec {
+func (_q *LabelQuery) querySpec() *sqlgraph.QuerySpec {
_spec := sqlgraph.NewQuerySpec(label.Table, label.Columns, sqlgraph.NewFieldSpec(label.FieldID, field.TypeUUID))
- _spec.From = lq.sql
- if unique := lq.ctx.Unique; unique != nil {
+ _spec.From = _q.sql
+ if unique := _q.ctx.Unique; unique != nil {
_spec.Unique = *unique
- } else if lq.path != nil {
+ } else if _q.path != nil {
_spec.Unique = true
}
- if fields := lq.ctx.Fields; len(fields) > 0 {
+ if fields := _q.ctx.Fields; len(fields) > 0 {
_spec.Node.Columns = make([]string, 0, len(fields))
_spec.Node.Columns = append(_spec.Node.Columns, label.FieldID)
for i := range fields {
@@ -575,20 +575,20 @@ func (lq *LabelQuery) querySpec() *sqlgraph.QuerySpec {
}
}
}
- if ps := lq.predicates; len(ps) > 0 {
+ if ps := _q.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
- if limit := lq.ctx.Limit; limit != nil {
+ if limit := _q.ctx.Limit; limit != nil {
_spec.Limit = *limit
}
- if offset := lq.ctx.Offset; offset != nil {
+ if offset := _q.ctx.Offset; offset != nil {
_spec.Offset = *offset
}
- if ps := lq.order; len(ps) > 0 {
+ if ps := _q.order; len(ps) > 0 {
_spec.Order = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
@@ -598,33 +598,33 @@ func (lq *LabelQuery) querySpec() *sqlgraph.QuerySpec {
return _spec
}
-func (lq *LabelQuery) sqlQuery(ctx context.Context) *sql.Selector {
- builder := sql.Dialect(lq.driver.Dialect())
+func (_q *LabelQuery) sqlQuery(ctx context.Context) *sql.Selector {
+ builder := sql.Dialect(_q.driver.Dialect())
t1 := builder.Table(label.Table)
- columns := lq.ctx.Fields
+ columns := _q.ctx.Fields
if len(columns) == 0 {
columns = label.Columns
}
selector := builder.Select(t1.Columns(columns...)...).From(t1)
- if lq.sql != nil {
- selector = lq.sql
+ if _q.sql != nil {
+ selector = _q.sql
selector.Select(selector.Columns(columns...)...)
}
- if lq.ctx.Unique != nil && *lq.ctx.Unique {
+ if _q.ctx.Unique != nil && *_q.ctx.Unique {
selector.Distinct()
}
- for _, p := range lq.predicates {
+ for _, p := range _q.predicates {
p(selector)
}
- for _, p := range lq.order {
+ for _, p := range _q.order {
p(selector)
}
- if offset := lq.ctx.Offset; offset != nil {
+ if offset := _q.ctx.Offset; offset != nil {
// limit is mandatory for offset clause. We start
// with default value, and override it below if needed.
selector.Offset(*offset).Limit(math.MaxInt32)
}
- if limit := lq.ctx.Limit; limit != nil {
+ if limit := _q.ctx.Limit; limit != nil {
selector.Limit(*limit)
}
return selector
@@ -637,41 +637,41 @@ type LabelGroupBy struct {
}
// Aggregate adds the given aggregation functions to the group-by query.
-func (lgb *LabelGroupBy) Aggregate(fns ...AggregateFunc) *LabelGroupBy {
- lgb.fns = append(lgb.fns, fns...)
- return lgb
+func (_g *LabelGroupBy) Aggregate(fns ...AggregateFunc) *LabelGroupBy {
+ _g.fns = append(_g.fns, fns...)
+ return _g
}
// Scan applies the selector query and scans the result into the given value.
-func (lgb *LabelGroupBy) Scan(ctx context.Context, v any) error {
- ctx = setContextOp(ctx, lgb.build.ctx, ent.OpQueryGroupBy)
- if err := lgb.build.prepareQuery(ctx); err != nil {
+func (_g *LabelGroupBy) Scan(ctx context.Context, v any) error {
+ ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy)
+ if err := _g.build.prepareQuery(ctx); err != nil {
return err
}
- return scanWithInterceptors[*LabelQuery, *LabelGroupBy](ctx, lgb.build, lgb, lgb.build.inters, v)
+ return scanWithInterceptors[*LabelQuery, *LabelGroupBy](ctx, _g.build, _g, _g.build.inters, v)
}
-func (lgb *LabelGroupBy) sqlScan(ctx context.Context, root *LabelQuery, v any) error {
+func (_g *LabelGroupBy) sqlScan(ctx context.Context, root *LabelQuery, v any) error {
selector := root.sqlQuery(ctx).Select()
- aggregation := make([]string, 0, len(lgb.fns))
- for _, fn := range lgb.fns {
+ aggregation := make([]string, 0, len(_g.fns))
+ for _, fn := range _g.fns {
aggregation = append(aggregation, fn(selector))
}
if len(selector.SelectedColumns()) == 0 {
- columns := make([]string, 0, len(*lgb.flds)+len(lgb.fns))
- for _, f := range *lgb.flds {
+ columns := make([]string, 0, len(*_g.flds)+len(_g.fns))
+ for _, f := range *_g.flds {
columns = append(columns, selector.C(f))
}
columns = append(columns, aggregation...)
selector.Select(columns...)
}
- selector.GroupBy(selector.Columns(*lgb.flds...)...)
+ selector.GroupBy(selector.Columns(*_g.flds...)...)
if err := selector.Err(); err != nil {
return err
}
rows := &sql.Rows{}
query, args := selector.Query()
- if err := lgb.build.driver.Query(ctx, query, args, rows); err != nil {
+ if err := _g.build.driver.Query(ctx, query, args, rows); err != nil {
return err
}
defer rows.Close()
@@ -685,27 +685,27 @@ type LabelSelect struct {
}
// Aggregate adds the given aggregation functions to the selector query.
-func (ls *LabelSelect) Aggregate(fns ...AggregateFunc) *LabelSelect {
- ls.fns = append(ls.fns, fns...)
- return ls
+func (_s *LabelSelect) Aggregate(fns ...AggregateFunc) *LabelSelect {
+ _s.fns = append(_s.fns, fns...)
+ return _s
}
// Scan applies the selector query and scans the result into the given value.
-func (ls *LabelSelect) Scan(ctx context.Context, v any) error {
- ctx = setContextOp(ctx, ls.ctx, ent.OpQuerySelect)
- if err := ls.prepareQuery(ctx); err != nil {
+func (_s *LabelSelect) Scan(ctx context.Context, v any) error {
+ ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect)
+ if err := _s.prepareQuery(ctx); err != nil {
return err
}
- return scanWithInterceptors[*LabelQuery, *LabelSelect](ctx, ls.LabelQuery, ls, ls.inters, v)
+ return scanWithInterceptors[*LabelQuery, *LabelSelect](ctx, _s.LabelQuery, _s, _s.inters, v)
}
-func (ls *LabelSelect) sqlScan(ctx context.Context, root *LabelQuery, v any) error {
+func (_s *LabelSelect) sqlScan(ctx context.Context, root *LabelQuery, v any) error {
selector := root.sqlQuery(ctx)
- aggregation := make([]string, 0, len(ls.fns))
- for _, fn := range ls.fns {
+ aggregation := make([]string, 0, len(_s.fns))
+ for _, fn := range _s.fns {
aggregation = append(aggregation, fn(selector))
}
- switch n := len(*ls.selector.flds); {
+ switch n := len(*_s.selector.flds); {
case n == 0 && len(aggregation) > 0:
selector.Select(aggregation...)
case n != 0 && len(aggregation) > 0:
@@ -713,7 +713,7 @@ func (ls *LabelSelect) sqlScan(ctx context.Context, root *LabelQuery, v any) err
}
rows := &sql.Rows{}
query, args := selector.Query()
- if err := ls.driver.Query(ctx, query, args, rows); err != nil {
+ if err := _s.driver.Query(ctx, query, args, rows); err != nil {
return err
}
defer rows.Close()
diff --git a/backend/internal/data/ent/label_update.go b/backend/internal/data/ent/label_update.go
index 1827d392..b9beb1ae 100644
--- a/backend/internal/data/ent/label_update.go
+++ b/backend/internal/data/ent/label_update.go
@@ -26,138 +26,138 @@ type LabelUpdate struct {
}
// Where appends a list predicates to the LabelUpdate builder.
-func (lu *LabelUpdate) Where(ps ...predicate.Label) *LabelUpdate {
- lu.mutation.Where(ps...)
- return lu
+func (_u *LabelUpdate) Where(ps ...predicate.Label) *LabelUpdate {
+ _u.mutation.Where(ps...)
+ return _u
}
// SetUpdatedAt sets the "updated_at" field.
-func (lu *LabelUpdate) SetUpdatedAt(t time.Time) *LabelUpdate {
- lu.mutation.SetUpdatedAt(t)
- return lu
+func (_u *LabelUpdate) SetUpdatedAt(v time.Time) *LabelUpdate {
+ _u.mutation.SetUpdatedAt(v)
+ return _u
}
// SetName sets the "name" field.
-func (lu *LabelUpdate) SetName(s string) *LabelUpdate {
- lu.mutation.SetName(s)
- return lu
+func (_u *LabelUpdate) SetName(v string) *LabelUpdate {
+ _u.mutation.SetName(v)
+ return _u
}
// SetNillableName sets the "name" field if the given value is not nil.
-func (lu *LabelUpdate) SetNillableName(s *string) *LabelUpdate {
- if s != nil {
- lu.SetName(*s)
+func (_u *LabelUpdate) SetNillableName(v *string) *LabelUpdate {
+ if v != nil {
+ _u.SetName(*v)
}
- return lu
+ return _u
}
// SetDescription sets the "description" field.
-func (lu *LabelUpdate) SetDescription(s string) *LabelUpdate {
- lu.mutation.SetDescription(s)
- return lu
+func (_u *LabelUpdate) SetDescription(v string) *LabelUpdate {
+ _u.mutation.SetDescription(v)
+ return _u
}
// SetNillableDescription sets the "description" field if the given value is not nil.
-func (lu *LabelUpdate) SetNillableDescription(s *string) *LabelUpdate {
- if s != nil {
- lu.SetDescription(*s)
+func (_u *LabelUpdate) SetNillableDescription(v *string) *LabelUpdate {
+ if v != nil {
+ _u.SetDescription(*v)
}
- return lu
+ return _u
}
// ClearDescription clears the value of the "description" field.
-func (lu *LabelUpdate) ClearDescription() *LabelUpdate {
- lu.mutation.ClearDescription()
- return lu
+func (_u *LabelUpdate) ClearDescription() *LabelUpdate {
+ _u.mutation.ClearDescription()
+ return _u
}
// SetColor sets the "color" field.
-func (lu *LabelUpdate) SetColor(s string) *LabelUpdate {
- lu.mutation.SetColor(s)
- return lu
+func (_u *LabelUpdate) SetColor(v string) *LabelUpdate {
+ _u.mutation.SetColor(v)
+ return _u
}
// SetNillableColor sets the "color" field if the given value is not nil.
-func (lu *LabelUpdate) SetNillableColor(s *string) *LabelUpdate {
- if s != nil {
- lu.SetColor(*s)
+func (_u *LabelUpdate) SetNillableColor(v *string) *LabelUpdate {
+ if v != nil {
+ _u.SetColor(*v)
}
- return lu
+ return _u
}
// ClearColor clears the value of the "color" field.
-func (lu *LabelUpdate) ClearColor() *LabelUpdate {
- lu.mutation.ClearColor()
- return lu
+func (_u *LabelUpdate) ClearColor() *LabelUpdate {
+ _u.mutation.ClearColor()
+ return _u
}
// SetGroupID sets the "group" edge to the Group entity by ID.
-func (lu *LabelUpdate) SetGroupID(id uuid.UUID) *LabelUpdate {
- lu.mutation.SetGroupID(id)
- return lu
+func (_u *LabelUpdate) SetGroupID(id uuid.UUID) *LabelUpdate {
+ _u.mutation.SetGroupID(id)
+ return _u
}
// SetGroup sets the "group" edge to the Group entity.
-func (lu *LabelUpdate) SetGroup(g *Group) *LabelUpdate {
- return lu.SetGroupID(g.ID)
+func (_u *LabelUpdate) SetGroup(v *Group) *LabelUpdate {
+ return _u.SetGroupID(v.ID)
}
// AddItemIDs adds the "items" edge to the Item entity by IDs.
-func (lu *LabelUpdate) AddItemIDs(ids ...uuid.UUID) *LabelUpdate {
- lu.mutation.AddItemIDs(ids...)
- return lu
+func (_u *LabelUpdate) AddItemIDs(ids ...uuid.UUID) *LabelUpdate {
+ _u.mutation.AddItemIDs(ids...)
+ return _u
}
// AddItems adds the "items" edges to the Item entity.
-func (lu *LabelUpdate) AddItems(i ...*Item) *LabelUpdate {
- ids := make([]uuid.UUID, len(i))
- for j := range i {
- ids[j] = i[j].ID
+func (_u *LabelUpdate) AddItems(v ...*Item) *LabelUpdate {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return lu.AddItemIDs(ids...)
+ return _u.AddItemIDs(ids...)
}
// Mutation returns the LabelMutation object of the builder.
-func (lu *LabelUpdate) Mutation() *LabelMutation {
- return lu.mutation
+func (_u *LabelUpdate) Mutation() *LabelMutation {
+ return _u.mutation
}
// ClearGroup clears the "group" edge to the Group entity.
-func (lu *LabelUpdate) ClearGroup() *LabelUpdate {
- lu.mutation.ClearGroup()
- return lu
+func (_u *LabelUpdate) ClearGroup() *LabelUpdate {
+ _u.mutation.ClearGroup()
+ return _u
}
// ClearItems clears all "items" edges to the Item entity.
-func (lu *LabelUpdate) ClearItems() *LabelUpdate {
- lu.mutation.ClearItems()
- return lu
+func (_u *LabelUpdate) ClearItems() *LabelUpdate {
+ _u.mutation.ClearItems()
+ return _u
}
// RemoveItemIDs removes the "items" edge to Item entities by IDs.
-func (lu *LabelUpdate) RemoveItemIDs(ids ...uuid.UUID) *LabelUpdate {
- lu.mutation.RemoveItemIDs(ids...)
- return lu
+func (_u *LabelUpdate) RemoveItemIDs(ids ...uuid.UUID) *LabelUpdate {
+ _u.mutation.RemoveItemIDs(ids...)
+ return _u
}
// RemoveItems removes "items" edges to Item entities.
-func (lu *LabelUpdate) RemoveItems(i ...*Item) *LabelUpdate {
- ids := make([]uuid.UUID, len(i))
- for j := range i {
- ids[j] = i[j].ID
+func (_u *LabelUpdate) RemoveItems(v ...*Item) *LabelUpdate {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return lu.RemoveItemIDs(ids...)
+ return _u.RemoveItemIDs(ids...)
}
// Save executes the query and returns the number of nodes affected by the update operation.
-func (lu *LabelUpdate) Save(ctx context.Context) (int, error) {
- lu.defaults()
- return withHooks(ctx, lu.sqlSave, lu.mutation, lu.hooks)
+func (_u *LabelUpdate) Save(ctx context.Context) (int, error) {
+ _u.defaults()
+ return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
}
// SaveX is like Save, but panics if an error occurs.
-func (lu *LabelUpdate) SaveX(ctx context.Context) int {
- affected, err := lu.Save(ctx)
+func (_u *LabelUpdate) SaveX(ctx context.Context) int {
+ affected, err := _u.Save(ctx)
if err != nil {
panic(err)
}
@@ -165,80 +165,80 @@ func (lu *LabelUpdate) SaveX(ctx context.Context) int {
}
// Exec executes the query.
-func (lu *LabelUpdate) Exec(ctx context.Context) error {
- _, err := lu.Save(ctx)
+func (_u *LabelUpdate) Exec(ctx context.Context) error {
+ _, err := _u.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
-func (lu *LabelUpdate) ExecX(ctx context.Context) {
- if err := lu.Exec(ctx); err != nil {
+func (_u *LabelUpdate) ExecX(ctx context.Context) {
+ if err := _u.Exec(ctx); err != nil {
panic(err)
}
}
// defaults sets the default values of the builder before save.
-func (lu *LabelUpdate) defaults() {
- if _, ok := lu.mutation.UpdatedAt(); !ok {
+func (_u *LabelUpdate) defaults() {
+ if _, ok := _u.mutation.UpdatedAt(); !ok {
v := label.UpdateDefaultUpdatedAt()
- lu.mutation.SetUpdatedAt(v)
+ _u.mutation.SetUpdatedAt(v)
}
}
// check runs all checks and user-defined validators on the builder.
-func (lu *LabelUpdate) check() error {
- if v, ok := lu.mutation.Name(); ok {
+func (_u *LabelUpdate) check() error {
+ if v, ok := _u.mutation.Name(); ok {
if err := label.NameValidator(v); err != nil {
return &ValidationError{Name: "name", err: fmt.Errorf(`ent: validator failed for field "Label.name": %w`, err)}
}
}
- if v, ok := lu.mutation.Description(); ok {
+ if v, ok := _u.mutation.Description(); ok {
if err := label.DescriptionValidator(v); err != nil {
return &ValidationError{Name: "description", err: fmt.Errorf(`ent: validator failed for field "Label.description": %w`, err)}
}
}
- if v, ok := lu.mutation.Color(); ok {
+ if v, ok := _u.mutation.Color(); ok {
if err := label.ColorValidator(v); err != nil {
return &ValidationError{Name: "color", err: fmt.Errorf(`ent: validator failed for field "Label.color": %w`, err)}
}
}
- if lu.mutation.GroupCleared() && len(lu.mutation.GroupIDs()) > 0 {
+ if _u.mutation.GroupCleared() && len(_u.mutation.GroupIDs()) > 0 {
return errors.New(`ent: clearing a required unique edge "Label.group"`)
}
return nil
}
-func (lu *LabelUpdate) sqlSave(ctx context.Context) (n int, err error) {
- if err := lu.check(); err != nil {
- return n, err
+func (_u *LabelUpdate) sqlSave(ctx context.Context) (_node int, err error) {
+ if err := _u.check(); err != nil {
+ return _node, err
}
_spec := sqlgraph.NewUpdateSpec(label.Table, label.Columns, sqlgraph.NewFieldSpec(label.FieldID, field.TypeUUID))
- if ps := lu.mutation.predicates; len(ps) > 0 {
+ if ps := _u.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
- if value, ok := lu.mutation.UpdatedAt(); ok {
+ if value, ok := _u.mutation.UpdatedAt(); ok {
_spec.SetField(label.FieldUpdatedAt, field.TypeTime, value)
}
- if value, ok := lu.mutation.Name(); ok {
+ if value, ok := _u.mutation.Name(); ok {
_spec.SetField(label.FieldName, field.TypeString, value)
}
- if value, ok := lu.mutation.Description(); ok {
+ if value, ok := _u.mutation.Description(); ok {
_spec.SetField(label.FieldDescription, field.TypeString, value)
}
- if lu.mutation.DescriptionCleared() {
+ if _u.mutation.DescriptionCleared() {
_spec.ClearField(label.FieldDescription, field.TypeString)
}
- if value, ok := lu.mutation.Color(); ok {
+ if value, ok := _u.mutation.Color(); ok {
_spec.SetField(label.FieldColor, field.TypeString, value)
}
- if lu.mutation.ColorCleared() {
+ if _u.mutation.ColorCleared() {
_spec.ClearField(label.FieldColor, field.TypeString)
}
- if lu.mutation.GroupCleared() {
+ if _u.mutation.GroupCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -251,7 +251,7 @@ func (lu *LabelUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := lu.mutation.GroupIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.GroupIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -267,7 +267,7 @@ func (lu *LabelUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- if lu.mutation.ItemsCleared() {
+ if _u.mutation.ItemsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2M,
Inverse: false,
@@ -280,7 +280,7 @@ func (lu *LabelUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := lu.mutation.RemovedItemsIDs(); len(nodes) > 0 && !lu.mutation.ItemsCleared() {
+ if nodes := _u.mutation.RemovedItemsIDs(); len(nodes) > 0 && !_u.mutation.ItemsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2M,
Inverse: false,
@@ -296,7 +296,7 @@ func (lu *LabelUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := lu.mutation.ItemsIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.ItemsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2M,
Inverse: false,
@@ -312,7 +312,7 @@ func (lu *LabelUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- if n, err = sqlgraph.UpdateNodes(ctx, lu.driver, _spec); err != nil {
+ if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil {
if _, ok := err.(*sqlgraph.NotFoundError); ok {
err = &NotFoundError{label.Label}
} else if sqlgraph.IsConstraintError(err) {
@@ -320,8 +320,8 @@ func (lu *LabelUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
return 0, err
}
- lu.mutation.done = true
- return n, nil
+ _u.mutation.done = true
+ return _node, nil
}
// LabelUpdateOne is the builder for updating a single Label entity.
@@ -333,145 +333,145 @@ type LabelUpdateOne struct {
}
// SetUpdatedAt sets the "updated_at" field.
-func (luo *LabelUpdateOne) SetUpdatedAt(t time.Time) *LabelUpdateOne {
- luo.mutation.SetUpdatedAt(t)
- return luo
+func (_u *LabelUpdateOne) SetUpdatedAt(v time.Time) *LabelUpdateOne {
+ _u.mutation.SetUpdatedAt(v)
+ return _u
}
// SetName sets the "name" field.
-func (luo *LabelUpdateOne) SetName(s string) *LabelUpdateOne {
- luo.mutation.SetName(s)
- return luo
+func (_u *LabelUpdateOne) SetName(v string) *LabelUpdateOne {
+ _u.mutation.SetName(v)
+ return _u
}
// SetNillableName sets the "name" field if the given value is not nil.
-func (luo *LabelUpdateOne) SetNillableName(s *string) *LabelUpdateOne {
- if s != nil {
- luo.SetName(*s)
+func (_u *LabelUpdateOne) SetNillableName(v *string) *LabelUpdateOne {
+ if v != nil {
+ _u.SetName(*v)
}
- return luo
+ return _u
}
// SetDescription sets the "description" field.
-func (luo *LabelUpdateOne) SetDescription(s string) *LabelUpdateOne {
- luo.mutation.SetDescription(s)
- return luo
+func (_u *LabelUpdateOne) SetDescription(v string) *LabelUpdateOne {
+ _u.mutation.SetDescription(v)
+ return _u
}
// SetNillableDescription sets the "description" field if the given value is not nil.
-func (luo *LabelUpdateOne) SetNillableDescription(s *string) *LabelUpdateOne {
- if s != nil {
- luo.SetDescription(*s)
+func (_u *LabelUpdateOne) SetNillableDescription(v *string) *LabelUpdateOne {
+ if v != nil {
+ _u.SetDescription(*v)
}
- return luo
+ return _u
}
// ClearDescription clears the value of the "description" field.
-func (luo *LabelUpdateOne) ClearDescription() *LabelUpdateOne {
- luo.mutation.ClearDescription()
- return luo
+func (_u *LabelUpdateOne) ClearDescription() *LabelUpdateOne {
+ _u.mutation.ClearDescription()
+ return _u
}
// SetColor sets the "color" field.
-func (luo *LabelUpdateOne) SetColor(s string) *LabelUpdateOne {
- luo.mutation.SetColor(s)
- return luo
+func (_u *LabelUpdateOne) SetColor(v string) *LabelUpdateOne {
+ _u.mutation.SetColor(v)
+ return _u
}
// SetNillableColor sets the "color" field if the given value is not nil.
-func (luo *LabelUpdateOne) SetNillableColor(s *string) *LabelUpdateOne {
- if s != nil {
- luo.SetColor(*s)
+func (_u *LabelUpdateOne) SetNillableColor(v *string) *LabelUpdateOne {
+ if v != nil {
+ _u.SetColor(*v)
}
- return luo
+ return _u
}
// ClearColor clears the value of the "color" field.
-func (luo *LabelUpdateOne) ClearColor() *LabelUpdateOne {
- luo.mutation.ClearColor()
- return luo
+func (_u *LabelUpdateOne) ClearColor() *LabelUpdateOne {
+ _u.mutation.ClearColor()
+ return _u
}
// SetGroupID sets the "group" edge to the Group entity by ID.
-func (luo *LabelUpdateOne) SetGroupID(id uuid.UUID) *LabelUpdateOne {
- luo.mutation.SetGroupID(id)
- return luo
+func (_u *LabelUpdateOne) SetGroupID(id uuid.UUID) *LabelUpdateOne {
+ _u.mutation.SetGroupID(id)
+ return _u
}
// SetGroup sets the "group" edge to the Group entity.
-func (luo *LabelUpdateOne) SetGroup(g *Group) *LabelUpdateOne {
- return luo.SetGroupID(g.ID)
+func (_u *LabelUpdateOne) SetGroup(v *Group) *LabelUpdateOne {
+ return _u.SetGroupID(v.ID)
}
// AddItemIDs adds the "items" edge to the Item entity by IDs.
-func (luo *LabelUpdateOne) AddItemIDs(ids ...uuid.UUID) *LabelUpdateOne {
- luo.mutation.AddItemIDs(ids...)
- return luo
+func (_u *LabelUpdateOne) AddItemIDs(ids ...uuid.UUID) *LabelUpdateOne {
+ _u.mutation.AddItemIDs(ids...)
+ return _u
}
// AddItems adds the "items" edges to the Item entity.
-func (luo *LabelUpdateOne) AddItems(i ...*Item) *LabelUpdateOne {
- ids := make([]uuid.UUID, len(i))
- for j := range i {
- ids[j] = i[j].ID
+func (_u *LabelUpdateOne) AddItems(v ...*Item) *LabelUpdateOne {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return luo.AddItemIDs(ids...)
+ return _u.AddItemIDs(ids...)
}
// Mutation returns the LabelMutation object of the builder.
-func (luo *LabelUpdateOne) Mutation() *LabelMutation {
- return luo.mutation
+func (_u *LabelUpdateOne) Mutation() *LabelMutation {
+ return _u.mutation
}
// ClearGroup clears the "group" edge to the Group entity.
-func (luo *LabelUpdateOne) ClearGroup() *LabelUpdateOne {
- luo.mutation.ClearGroup()
- return luo
+func (_u *LabelUpdateOne) ClearGroup() *LabelUpdateOne {
+ _u.mutation.ClearGroup()
+ return _u
}
// ClearItems clears all "items" edges to the Item entity.
-func (luo *LabelUpdateOne) ClearItems() *LabelUpdateOne {
- luo.mutation.ClearItems()
- return luo
+func (_u *LabelUpdateOne) ClearItems() *LabelUpdateOne {
+ _u.mutation.ClearItems()
+ return _u
}
// RemoveItemIDs removes the "items" edge to Item entities by IDs.
-func (luo *LabelUpdateOne) RemoveItemIDs(ids ...uuid.UUID) *LabelUpdateOne {
- luo.mutation.RemoveItemIDs(ids...)
- return luo
+func (_u *LabelUpdateOne) RemoveItemIDs(ids ...uuid.UUID) *LabelUpdateOne {
+ _u.mutation.RemoveItemIDs(ids...)
+ return _u
}
// RemoveItems removes "items" edges to Item entities.
-func (luo *LabelUpdateOne) RemoveItems(i ...*Item) *LabelUpdateOne {
- ids := make([]uuid.UUID, len(i))
- for j := range i {
- ids[j] = i[j].ID
+func (_u *LabelUpdateOne) RemoveItems(v ...*Item) *LabelUpdateOne {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return luo.RemoveItemIDs(ids...)
+ return _u.RemoveItemIDs(ids...)
}
// Where appends a list predicates to the LabelUpdate builder.
-func (luo *LabelUpdateOne) Where(ps ...predicate.Label) *LabelUpdateOne {
- luo.mutation.Where(ps...)
- return luo
+func (_u *LabelUpdateOne) Where(ps ...predicate.Label) *LabelUpdateOne {
+ _u.mutation.Where(ps...)
+ return _u
}
// Select allows selecting one or more fields (columns) of the returned entity.
// The default is selecting all fields defined in the entity schema.
-func (luo *LabelUpdateOne) Select(field string, fields ...string) *LabelUpdateOne {
- luo.fields = append([]string{field}, fields...)
- return luo
+func (_u *LabelUpdateOne) Select(field string, fields ...string) *LabelUpdateOne {
+ _u.fields = append([]string{field}, fields...)
+ return _u
}
// Save executes the query and returns the updated Label entity.
-func (luo *LabelUpdateOne) Save(ctx context.Context) (*Label, error) {
- luo.defaults()
- return withHooks(ctx, luo.sqlSave, luo.mutation, luo.hooks)
+func (_u *LabelUpdateOne) Save(ctx context.Context) (*Label, error) {
+ _u.defaults()
+ return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
}
// SaveX is like Save, but panics if an error occurs.
-func (luo *LabelUpdateOne) SaveX(ctx context.Context) *Label {
- node, err := luo.Save(ctx)
+func (_u *LabelUpdateOne) SaveX(ctx context.Context) *Label {
+ node, err := _u.Save(ctx)
if err != nil {
panic(err)
}
@@ -479,60 +479,60 @@ func (luo *LabelUpdateOne) SaveX(ctx context.Context) *Label {
}
// Exec executes the query on the entity.
-func (luo *LabelUpdateOne) Exec(ctx context.Context) error {
- _, err := luo.Save(ctx)
+func (_u *LabelUpdateOne) Exec(ctx context.Context) error {
+ _, err := _u.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
-func (luo *LabelUpdateOne) ExecX(ctx context.Context) {
- if err := luo.Exec(ctx); err != nil {
+func (_u *LabelUpdateOne) ExecX(ctx context.Context) {
+ if err := _u.Exec(ctx); err != nil {
panic(err)
}
}
// defaults sets the default values of the builder before save.
-func (luo *LabelUpdateOne) defaults() {
- if _, ok := luo.mutation.UpdatedAt(); !ok {
+func (_u *LabelUpdateOne) defaults() {
+ if _, ok := _u.mutation.UpdatedAt(); !ok {
v := label.UpdateDefaultUpdatedAt()
- luo.mutation.SetUpdatedAt(v)
+ _u.mutation.SetUpdatedAt(v)
}
}
// check runs all checks and user-defined validators on the builder.
-func (luo *LabelUpdateOne) check() error {
- if v, ok := luo.mutation.Name(); ok {
+func (_u *LabelUpdateOne) check() error {
+ if v, ok := _u.mutation.Name(); ok {
if err := label.NameValidator(v); err != nil {
return &ValidationError{Name: "name", err: fmt.Errorf(`ent: validator failed for field "Label.name": %w`, err)}
}
}
- if v, ok := luo.mutation.Description(); ok {
+ if v, ok := _u.mutation.Description(); ok {
if err := label.DescriptionValidator(v); err != nil {
return &ValidationError{Name: "description", err: fmt.Errorf(`ent: validator failed for field "Label.description": %w`, err)}
}
}
- if v, ok := luo.mutation.Color(); ok {
+ if v, ok := _u.mutation.Color(); ok {
if err := label.ColorValidator(v); err != nil {
return &ValidationError{Name: "color", err: fmt.Errorf(`ent: validator failed for field "Label.color": %w`, err)}
}
}
- if luo.mutation.GroupCleared() && len(luo.mutation.GroupIDs()) > 0 {
+ if _u.mutation.GroupCleared() && len(_u.mutation.GroupIDs()) > 0 {
return errors.New(`ent: clearing a required unique edge "Label.group"`)
}
return nil
}
-func (luo *LabelUpdateOne) sqlSave(ctx context.Context) (_node *Label, err error) {
- if err := luo.check(); err != nil {
+func (_u *LabelUpdateOne) sqlSave(ctx context.Context) (_node *Label, err error) {
+ if err := _u.check(); err != nil {
return _node, err
}
_spec := sqlgraph.NewUpdateSpec(label.Table, label.Columns, sqlgraph.NewFieldSpec(label.FieldID, field.TypeUUID))
- id, ok := luo.mutation.ID()
+ id, ok := _u.mutation.ID()
if !ok {
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Label.id" for update`)}
}
_spec.Node.ID.Value = id
- if fields := luo.fields; len(fields) > 0 {
+ if fields := _u.fields; len(fields) > 0 {
_spec.Node.Columns = make([]string, 0, len(fields))
_spec.Node.Columns = append(_spec.Node.Columns, label.FieldID)
for _, f := range fields {
@@ -544,32 +544,32 @@ func (luo *LabelUpdateOne) sqlSave(ctx context.Context) (_node *Label, err error
}
}
}
- if ps := luo.mutation.predicates; len(ps) > 0 {
+ if ps := _u.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
- if value, ok := luo.mutation.UpdatedAt(); ok {
+ if value, ok := _u.mutation.UpdatedAt(); ok {
_spec.SetField(label.FieldUpdatedAt, field.TypeTime, value)
}
- if value, ok := luo.mutation.Name(); ok {
+ if value, ok := _u.mutation.Name(); ok {
_spec.SetField(label.FieldName, field.TypeString, value)
}
- if value, ok := luo.mutation.Description(); ok {
+ if value, ok := _u.mutation.Description(); ok {
_spec.SetField(label.FieldDescription, field.TypeString, value)
}
- if luo.mutation.DescriptionCleared() {
+ if _u.mutation.DescriptionCleared() {
_spec.ClearField(label.FieldDescription, field.TypeString)
}
- if value, ok := luo.mutation.Color(); ok {
+ if value, ok := _u.mutation.Color(); ok {
_spec.SetField(label.FieldColor, field.TypeString, value)
}
- if luo.mutation.ColorCleared() {
+ if _u.mutation.ColorCleared() {
_spec.ClearField(label.FieldColor, field.TypeString)
}
- if luo.mutation.GroupCleared() {
+ if _u.mutation.GroupCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -582,7 +582,7 @@ func (luo *LabelUpdateOne) sqlSave(ctx context.Context) (_node *Label, err error
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := luo.mutation.GroupIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.GroupIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -598,7 +598,7 @@ func (luo *LabelUpdateOne) sqlSave(ctx context.Context) (_node *Label, err error
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- if luo.mutation.ItemsCleared() {
+ if _u.mutation.ItemsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2M,
Inverse: false,
@@ -611,7 +611,7 @@ func (luo *LabelUpdateOne) sqlSave(ctx context.Context) (_node *Label, err error
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := luo.mutation.RemovedItemsIDs(); len(nodes) > 0 && !luo.mutation.ItemsCleared() {
+ if nodes := _u.mutation.RemovedItemsIDs(); len(nodes) > 0 && !_u.mutation.ItemsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2M,
Inverse: false,
@@ -627,7 +627,7 @@ func (luo *LabelUpdateOne) sqlSave(ctx context.Context) (_node *Label, err error
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := luo.mutation.ItemsIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.ItemsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2M,
Inverse: false,
@@ -643,10 +643,10 @@ func (luo *LabelUpdateOne) sqlSave(ctx context.Context) (_node *Label, err error
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- _node = &Label{config: luo.config}
+ _node = &Label{config: _u.config}
_spec.Assign = _node.assignValues
_spec.ScanValues = _node.scanValues
- if err = sqlgraph.UpdateNode(ctx, luo.driver, _spec); err != nil {
+ if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil {
if _, ok := err.(*sqlgraph.NotFoundError); ok {
err = &NotFoundError{label.Label}
} else if sqlgraph.IsConstraintError(err) {
@@ -654,6 +654,6 @@ func (luo *LabelUpdateOne) sqlSave(ctx context.Context) (_node *Label, err error
}
return nil, err
}
- luo.mutation.done = true
+ _u.mutation.done = true
return _node, nil
}
diff --git a/backend/internal/data/ent/location.go b/backend/internal/data/ent/location.go
index ce52b2bb..e0e24001 100644
--- a/backend/internal/data/ent/location.go
+++ b/backend/internal/data/ent/location.go
@@ -114,7 +114,7 @@ func (*Location) scanValues(columns []string) ([]any, error) {
// assignValues assigns the values that were returned from sql.Rows (after scanning)
// to the Location fields.
-func (l *Location) assignValues(columns []string, values []any) error {
+func (_m *Location) assignValues(columns []string, values []any) error {
if m, n := len(values), len(columns); m < n {
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
}
@@ -124,48 +124,48 @@ func (l *Location) assignValues(columns []string, values []any) error {
if value, ok := values[i].(*uuid.UUID); !ok {
return fmt.Errorf("unexpected type %T for field id", values[i])
} else if value != nil {
- l.ID = *value
+ _m.ID = *value
}
case location.FieldCreatedAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field created_at", values[i])
} else if value.Valid {
- l.CreatedAt = value.Time
+ _m.CreatedAt = value.Time
}
case location.FieldUpdatedAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field updated_at", values[i])
} else if value.Valid {
- l.UpdatedAt = value.Time
+ _m.UpdatedAt = value.Time
}
case location.FieldName:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field name", values[i])
} else if value.Valid {
- l.Name = value.String
+ _m.Name = value.String
}
case location.FieldDescription:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field description", values[i])
} else if value.Valid {
- l.Description = value.String
+ _m.Description = value.String
}
case location.ForeignKeys[0]:
if value, ok := values[i].(*sql.NullScanner); !ok {
return fmt.Errorf("unexpected type %T for field group_locations", values[i])
} else if value.Valid {
- l.group_locations = new(uuid.UUID)
- *l.group_locations = *value.S.(*uuid.UUID)
+ _m.group_locations = new(uuid.UUID)
+ *_m.group_locations = *value.S.(*uuid.UUID)
}
case location.ForeignKeys[1]:
if value, ok := values[i].(*sql.NullScanner); !ok {
return fmt.Errorf("unexpected type %T for field location_children", values[i])
} else if value.Valid {
- l.location_children = new(uuid.UUID)
- *l.location_children = *value.S.(*uuid.UUID)
+ _m.location_children = new(uuid.UUID)
+ *_m.location_children = *value.S.(*uuid.UUID)
}
default:
- l.selectValues.Set(columns[i], values[i])
+ _m.selectValues.Set(columns[i], values[i])
}
}
return nil
@@ -173,64 +173,64 @@ func (l *Location) assignValues(columns []string, values []any) error {
// Value returns the ent.Value that was dynamically selected and assigned to the Location.
// This includes values selected through modifiers, order, etc.
-func (l *Location) Value(name string) (ent.Value, error) {
- return l.selectValues.Get(name)
+func (_m *Location) Value(name string) (ent.Value, error) {
+ return _m.selectValues.Get(name)
}
// QueryGroup queries the "group" edge of the Location entity.
-func (l *Location) QueryGroup() *GroupQuery {
- return NewLocationClient(l.config).QueryGroup(l)
+func (_m *Location) QueryGroup() *GroupQuery {
+ return NewLocationClient(_m.config).QueryGroup(_m)
}
// QueryParent queries the "parent" edge of the Location entity.
-func (l *Location) QueryParent() *LocationQuery {
- return NewLocationClient(l.config).QueryParent(l)
+func (_m *Location) QueryParent() *LocationQuery {
+ return NewLocationClient(_m.config).QueryParent(_m)
}
// QueryChildren queries the "children" edge of the Location entity.
-func (l *Location) QueryChildren() *LocationQuery {
- return NewLocationClient(l.config).QueryChildren(l)
+func (_m *Location) QueryChildren() *LocationQuery {
+ return NewLocationClient(_m.config).QueryChildren(_m)
}
// QueryItems queries the "items" edge of the Location entity.
-func (l *Location) QueryItems() *ItemQuery {
- return NewLocationClient(l.config).QueryItems(l)
+func (_m *Location) QueryItems() *ItemQuery {
+ return NewLocationClient(_m.config).QueryItems(_m)
}
// Update returns a builder for updating this Location.
// Note that you need to call Location.Unwrap() before calling this method if this Location
// was returned from a transaction, and the transaction was committed or rolled back.
-func (l *Location) Update() *LocationUpdateOne {
- return NewLocationClient(l.config).UpdateOne(l)
+func (_m *Location) Update() *LocationUpdateOne {
+ return NewLocationClient(_m.config).UpdateOne(_m)
}
// Unwrap unwraps the Location 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 (l *Location) Unwrap() *Location {
- _tx, ok := l.config.driver.(*txDriver)
+func (_m *Location) Unwrap() *Location {
+ _tx, ok := _m.config.driver.(*txDriver)
if !ok {
panic("ent: Location is not a transactional entity")
}
- l.config.driver = _tx.drv
- return l
+ _m.config.driver = _tx.drv
+ return _m
}
// String implements the fmt.Stringer.
-func (l *Location) String() string {
+func (_m *Location) String() string {
var builder strings.Builder
builder.WriteString("Location(")
- builder.WriteString(fmt.Sprintf("id=%v, ", l.ID))
+ builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
builder.WriteString("created_at=")
- builder.WriteString(l.CreatedAt.Format(time.ANSIC))
+ builder.WriteString(_m.CreatedAt.Format(time.ANSIC))
builder.WriteString(", ")
builder.WriteString("updated_at=")
- builder.WriteString(l.UpdatedAt.Format(time.ANSIC))
+ builder.WriteString(_m.UpdatedAt.Format(time.ANSIC))
builder.WriteString(", ")
builder.WriteString("name=")
- builder.WriteString(l.Name)
+ builder.WriteString(_m.Name)
builder.WriteString(", ")
builder.WriteString("description=")
- builder.WriteString(l.Description)
+ builder.WriteString(_m.Description)
builder.WriteByte(')')
return builder.String()
}
diff --git a/backend/internal/data/ent/location_create.go b/backend/internal/data/ent/location_create.go
index 7a7cdbda..901925be 100644
--- a/backend/internal/data/ent/location_create.go
+++ b/backend/internal/data/ent/location_create.go
@@ -24,141 +24,141 @@ type LocationCreate struct {
}
// SetCreatedAt sets the "created_at" field.
-func (lc *LocationCreate) SetCreatedAt(t time.Time) *LocationCreate {
- lc.mutation.SetCreatedAt(t)
- return lc
+func (_c *LocationCreate) SetCreatedAt(v time.Time) *LocationCreate {
+ _c.mutation.SetCreatedAt(v)
+ return _c
}
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
-func (lc *LocationCreate) SetNillableCreatedAt(t *time.Time) *LocationCreate {
- if t != nil {
- lc.SetCreatedAt(*t)
+func (_c *LocationCreate) SetNillableCreatedAt(v *time.Time) *LocationCreate {
+ if v != nil {
+ _c.SetCreatedAt(*v)
}
- return lc
+ return _c
}
// SetUpdatedAt sets the "updated_at" field.
-func (lc *LocationCreate) SetUpdatedAt(t time.Time) *LocationCreate {
- lc.mutation.SetUpdatedAt(t)
- return lc
+func (_c *LocationCreate) SetUpdatedAt(v time.Time) *LocationCreate {
+ _c.mutation.SetUpdatedAt(v)
+ return _c
}
// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
-func (lc *LocationCreate) SetNillableUpdatedAt(t *time.Time) *LocationCreate {
- if t != nil {
- lc.SetUpdatedAt(*t)
+func (_c *LocationCreate) SetNillableUpdatedAt(v *time.Time) *LocationCreate {
+ if v != nil {
+ _c.SetUpdatedAt(*v)
}
- return lc
+ return _c
}
// SetName sets the "name" field.
-func (lc *LocationCreate) SetName(s string) *LocationCreate {
- lc.mutation.SetName(s)
- return lc
+func (_c *LocationCreate) SetName(v string) *LocationCreate {
+ _c.mutation.SetName(v)
+ return _c
}
// SetDescription sets the "description" field.
-func (lc *LocationCreate) SetDescription(s string) *LocationCreate {
- lc.mutation.SetDescription(s)
- return lc
+func (_c *LocationCreate) SetDescription(v string) *LocationCreate {
+ _c.mutation.SetDescription(v)
+ return _c
}
// SetNillableDescription sets the "description" field if the given value is not nil.
-func (lc *LocationCreate) SetNillableDescription(s *string) *LocationCreate {
- if s != nil {
- lc.SetDescription(*s)
+func (_c *LocationCreate) SetNillableDescription(v *string) *LocationCreate {
+ if v != nil {
+ _c.SetDescription(*v)
}
- return lc
+ return _c
}
// SetID sets the "id" field.
-func (lc *LocationCreate) SetID(u uuid.UUID) *LocationCreate {
- lc.mutation.SetID(u)
- return lc
+func (_c *LocationCreate) SetID(v uuid.UUID) *LocationCreate {
+ _c.mutation.SetID(v)
+ return _c
}
// SetNillableID sets the "id" field if the given value is not nil.
-func (lc *LocationCreate) SetNillableID(u *uuid.UUID) *LocationCreate {
- if u != nil {
- lc.SetID(*u)
+func (_c *LocationCreate) SetNillableID(v *uuid.UUID) *LocationCreate {
+ if v != nil {
+ _c.SetID(*v)
}
- return lc
+ return _c
}
// SetGroupID sets the "group" edge to the Group entity by ID.
-func (lc *LocationCreate) SetGroupID(id uuid.UUID) *LocationCreate {
- lc.mutation.SetGroupID(id)
- return lc
+func (_c *LocationCreate) SetGroupID(id uuid.UUID) *LocationCreate {
+ _c.mutation.SetGroupID(id)
+ return _c
}
// SetGroup sets the "group" edge to the Group entity.
-func (lc *LocationCreate) SetGroup(g *Group) *LocationCreate {
- return lc.SetGroupID(g.ID)
+func (_c *LocationCreate) SetGroup(v *Group) *LocationCreate {
+ return _c.SetGroupID(v.ID)
}
// SetParentID sets the "parent" edge to the Location entity by ID.
-func (lc *LocationCreate) SetParentID(id uuid.UUID) *LocationCreate {
- lc.mutation.SetParentID(id)
- return lc
+func (_c *LocationCreate) SetParentID(id uuid.UUID) *LocationCreate {
+ _c.mutation.SetParentID(id)
+ return _c
}
// SetNillableParentID sets the "parent" edge to the Location entity by ID if the given value is not nil.
-func (lc *LocationCreate) SetNillableParentID(id *uuid.UUID) *LocationCreate {
+func (_c *LocationCreate) SetNillableParentID(id *uuid.UUID) *LocationCreate {
if id != nil {
- lc = lc.SetParentID(*id)
+ _c = _c.SetParentID(*id)
}
- return lc
+ return _c
}
// SetParent sets the "parent" edge to the Location entity.
-func (lc *LocationCreate) SetParent(l *Location) *LocationCreate {
- return lc.SetParentID(l.ID)
+func (_c *LocationCreate) SetParent(v *Location) *LocationCreate {
+ return _c.SetParentID(v.ID)
}
// AddChildIDs adds the "children" edge to the Location entity by IDs.
-func (lc *LocationCreate) AddChildIDs(ids ...uuid.UUID) *LocationCreate {
- lc.mutation.AddChildIDs(ids...)
- return lc
+func (_c *LocationCreate) AddChildIDs(ids ...uuid.UUID) *LocationCreate {
+ _c.mutation.AddChildIDs(ids...)
+ return _c
}
// AddChildren adds the "children" edges to the Location entity.
-func (lc *LocationCreate) AddChildren(l ...*Location) *LocationCreate {
- ids := make([]uuid.UUID, len(l))
- for i := range l {
- ids[i] = l[i].ID
+func (_c *LocationCreate) AddChildren(v ...*Location) *LocationCreate {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return lc.AddChildIDs(ids...)
+ return _c.AddChildIDs(ids...)
}
// AddItemIDs adds the "items" edge to the Item entity by IDs.
-func (lc *LocationCreate) AddItemIDs(ids ...uuid.UUID) *LocationCreate {
- lc.mutation.AddItemIDs(ids...)
- return lc
+func (_c *LocationCreate) AddItemIDs(ids ...uuid.UUID) *LocationCreate {
+ _c.mutation.AddItemIDs(ids...)
+ return _c
}
// AddItems adds the "items" edges to the Item entity.
-func (lc *LocationCreate) AddItems(i ...*Item) *LocationCreate {
- ids := make([]uuid.UUID, len(i))
- for j := range i {
- ids[j] = i[j].ID
+func (_c *LocationCreate) AddItems(v ...*Item) *LocationCreate {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return lc.AddItemIDs(ids...)
+ return _c.AddItemIDs(ids...)
}
// Mutation returns the LocationMutation object of the builder.
-func (lc *LocationCreate) Mutation() *LocationMutation {
- return lc.mutation
+func (_c *LocationCreate) Mutation() *LocationMutation {
+ return _c.mutation
}
// Save creates the Location in the database.
-func (lc *LocationCreate) Save(ctx context.Context) (*Location, error) {
- lc.defaults()
- return withHooks(ctx, lc.sqlSave, lc.mutation, lc.hooks)
+func (_c *LocationCreate) Save(ctx context.Context) (*Location, error) {
+ _c.defaults()
+ return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
}
// SaveX calls Save and panics if Save returns an error.
-func (lc *LocationCreate) SaveX(ctx context.Context) *Location {
- v, err := lc.Save(ctx)
+func (_c *LocationCreate) SaveX(ctx context.Context) *Location {
+ v, err := _c.Save(ctx)
if err != nil {
panic(err)
}
@@ -166,67 +166,67 @@ func (lc *LocationCreate) SaveX(ctx context.Context) *Location {
}
// Exec executes the query.
-func (lc *LocationCreate) Exec(ctx context.Context) error {
- _, err := lc.Save(ctx)
+func (_c *LocationCreate) Exec(ctx context.Context) error {
+ _, err := _c.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
-func (lc *LocationCreate) ExecX(ctx context.Context) {
- if err := lc.Exec(ctx); err != nil {
+func (_c *LocationCreate) ExecX(ctx context.Context) {
+ if err := _c.Exec(ctx); err != nil {
panic(err)
}
}
// defaults sets the default values of the builder before save.
-func (lc *LocationCreate) defaults() {
- if _, ok := lc.mutation.CreatedAt(); !ok {
+func (_c *LocationCreate) defaults() {
+ if _, ok := _c.mutation.CreatedAt(); !ok {
v := location.DefaultCreatedAt()
- lc.mutation.SetCreatedAt(v)
+ _c.mutation.SetCreatedAt(v)
}
- if _, ok := lc.mutation.UpdatedAt(); !ok {
+ if _, ok := _c.mutation.UpdatedAt(); !ok {
v := location.DefaultUpdatedAt()
- lc.mutation.SetUpdatedAt(v)
+ _c.mutation.SetUpdatedAt(v)
}
- if _, ok := lc.mutation.ID(); !ok {
+ if _, ok := _c.mutation.ID(); !ok {
v := location.DefaultID()
- lc.mutation.SetID(v)
+ _c.mutation.SetID(v)
}
}
// check runs all checks and user-defined validators on the builder.
-func (lc *LocationCreate) check() error {
- if _, ok := lc.mutation.CreatedAt(); !ok {
+func (_c *LocationCreate) check() error {
+ if _, ok := _c.mutation.CreatedAt(); !ok {
return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "Location.created_at"`)}
}
- if _, ok := lc.mutation.UpdatedAt(); !ok {
+ if _, ok := _c.mutation.UpdatedAt(); !ok {
return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "Location.updated_at"`)}
}
- if _, ok := lc.mutation.Name(); !ok {
+ if _, ok := _c.mutation.Name(); !ok {
return &ValidationError{Name: "name", err: errors.New(`ent: missing required field "Location.name"`)}
}
- if v, ok := lc.mutation.Name(); ok {
+ if v, ok := _c.mutation.Name(); ok {
if err := location.NameValidator(v); err != nil {
return &ValidationError{Name: "name", err: fmt.Errorf(`ent: validator failed for field "Location.name": %w`, err)}
}
}
- if v, ok := lc.mutation.Description(); ok {
+ if v, ok := _c.mutation.Description(); ok {
if err := location.DescriptionValidator(v); err != nil {
return &ValidationError{Name: "description", err: fmt.Errorf(`ent: validator failed for field "Location.description": %w`, err)}
}
}
- if len(lc.mutation.GroupIDs()) == 0 {
+ if len(_c.mutation.GroupIDs()) == 0 {
return &ValidationError{Name: "group", err: errors.New(`ent: missing required edge "Location.group"`)}
}
return nil
}
-func (lc *LocationCreate) sqlSave(ctx context.Context) (*Location, error) {
- if err := lc.check(); err != nil {
+func (_c *LocationCreate) sqlSave(ctx context.Context) (*Location, error) {
+ if err := _c.check(); err != nil {
return nil, err
}
- _node, _spec := lc.createSpec()
- if err := sqlgraph.CreateNode(ctx, lc.driver, _spec); err != nil {
+ _node, _spec := _c.createSpec()
+ if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil {
if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
@@ -239,37 +239,37 @@ func (lc *LocationCreate) sqlSave(ctx context.Context) (*Location, error) {
return nil, err
}
}
- lc.mutation.id = &_node.ID
- lc.mutation.done = true
+ _c.mutation.id = &_node.ID
+ _c.mutation.done = true
return _node, nil
}
-func (lc *LocationCreate) createSpec() (*Location, *sqlgraph.CreateSpec) {
+func (_c *LocationCreate) createSpec() (*Location, *sqlgraph.CreateSpec) {
var (
- _node = &Location{config: lc.config}
+ _node = &Location{config: _c.config}
_spec = sqlgraph.NewCreateSpec(location.Table, sqlgraph.NewFieldSpec(location.FieldID, field.TypeUUID))
)
- if id, ok := lc.mutation.ID(); ok {
+ if id, ok := _c.mutation.ID(); ok {
_node.ID = id
_spec.ID.Value = &id
}
- if value, ok := lc.mutation.CreatedAt(); ok {
+ if value, ok := _c.mutation.CreatedAt(); ok {
_spec.SetField(location.FieldCreatedAt, field.TypeTime, value)
_node.CreatedAt = value
}
- if value, ok := lc.mutation.UpdatedAt(); ok {
+ if value, ok := _c.mutation.UpdatedAt(); ok {
_spec.SetField(location.FieldUpdatedAt, field.TypeTime, value)
_node.UpdatedAt = value
}
- if value, ok := lc.mutation.Name(); ok {
+ if value, ok := _c.mutation.Name(); ok {
_spec.SetField(location.FieldName, field.TypeString, value)
_node.Name = value
}
- if value, ok := lc.mutation.Description(); ok {
+ if value, ok := _c.mutation.Description(); ok {
_spec.SetField(location.FieldDescription, field.TypeString, value)
_node.Description = value
}
- if nodes := lc.mutation.GroupIDs(); len(nodes) > 0 {
+ if nodes := _c.mutation.GroupIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -286,7 +286,7 @@ func (lc *LocationCreate) createSpec() (*Location, *sqlgraph.CreateSpec) {
_node.group_locations = &nodes[0]
_spec.Edges = append(_spec.Edges, edge)
}
- if nodes := lc.mutation.ParentIDs(); len(nodes) > 0 {
+ if nodes := _c.mutation.ParentIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -303,7 +303,7 @@ func (lc *LocationCreate) createSpec() (*Location, *sqlgraph.CreateSpec) {
_node.location_children = &nodes[0]
_spec.Edges = append(_spec.Edges, edge)
}
- if nodes := lc.mutation.ChildrenIDs(); len(nodes) > 0 {
+ if nodes := _c.mutation.ChildrenIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -319,7 +319,7 @@ func (lc *LocationCreate) createSpec() (*Location, *sqlgraph.CreateSpec) {
}
_spec.Edges = append(_spec.Edges, edge)
}
- if nodes := lc.mutation.ItemsIDs(); len(nodes) > 0 {
+ if nodes := _c.mutation.ItemsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -346,16 +346,16 @@ type LocationCreateBulk struct {
}
// Save creates the Location entities in the database.
-func (lcb *LocationCreateBulk) Save(ctx context.Context) ([]*Location, error) {
- if lcb.err != nil {
- return nil, lcb.err
- }
- specs := make([]*sqlgraph.CreateSpec, len(lcb.builders))
- nodes := make([]*Location, len(lcb.builders))
- mutators := make([]Mutator, len(lcb.builders))
- for i := range lcb.builders {
+func (_c *LocationCreateBulk) Save(ctx context.Context) ([]*Location, error) {
+ if _c.err != nil {
+ return nil, _c.err
+ }
+ specs := make([]*sqlgraph.CreateSpec, len(_c.builders))
+ nodes := make([]*Location, len(_c.builders))
+ mutators := make([]Mutator, len(_c.builders))
+ for i := range _c.builders {
func(i int, root context.Context) {
- builder := lcb.builders[i]
+ builder := _c.builders[i]
builder.defaults()
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
mutation, ok := m.(*LocationMutation)
@@ -369,11 +369,11 @@ func (lcb *LocationCreateBulk) Save(ctx context.Context) ([]*Location, error) {
var err error
nodes[i], specs[i] = builder.createSpec()
if i < len(mutators)-1 {
- _, err = mutators[i+1].Mutate(root, lcb.builders[i+1].mutation)
+ _, err = mutators[i+1].Mutate(root, _c.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, lcb.driver, spec); err != nil {
+ if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil {
if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
@@ -393,7 +393,7 @@ func (lcb *LocationCreateBulk) Save(ctx context.Context) ([]*Location, error) {
}(i, ctx)
}
if len(mutators) > 0 {
- if _, err := mutators[0].Mutate(ctx, lcb.builders[0].mutation); err != nil {
+ if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil {
return nil, err
}
}
@@ -401,8 +401,8 @@ func (lcb *LocationCreateBulk) Save(ctx context.Context) ([]*Location, error) {
}
// SaveX is like Save, but panics if an error occurs.
-func (lcb *LocationCreateBulk) SaveX(ctx context.Context) []*Location {
- v, err := lcb.Save(ctx)
+func (_c *LocationCreateBulk) SaveX(ctx context.Context) []*Location {
+ v, err := _c.Save(ctx)
if err != nil {
panic(err)
}
@@ -410,14 +410,14 @@ func (lcb *LocationCreateBulk) SaveX(ctx context.Context) []*Location {
}
// Exec executes the query.
-func (lcb *LocationCreateBulk) Exec(ctx context.Context) error {
- _, err := lcb.Save(ctx)
+func (_c *LocationCreateBulk) Exec(ctx context.Context) error {
+ _, err := _c.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
-func (lcb *LocationCreateBulk) ExecX(ctx context.Context) {
- if err := lcb.Exec(ctx); err != nil {
+func (_c *LocationCreateBulk) ExecX(ctx context.Context) {
+ if err := _c.Exec(ctx); err != nil {
panic(err)
}
}
diff --git a/backend/internal/data/ent/location_delete.go b/backend/internal/data/ent/location_delete.go
index 59ff9509..4292d82e 100644
--- a/backend/internal/data/ent/location_delete.go
+++ b/backend/internal/data/ent/location_delete.go
@@ -20,56 +20,56 @@ type LocationDelete struct {
}
// Where appends a list predicates to the LocationDelete builder.
-func (ld *LocationDelete) Where(ps ...predicate.Location) *LocationDelete {
- ld.mutation.Where(ps...)
- return ld
+func (_d *LocationDelete) Where(ps ...predicate.Location) *LocationDelete {
+ _d.mutation.Where(ps...)
+ return _d
}
// Exec executes the deletion query and returns how many vertices were deleted.
-func (ld *LocationDelete) Exec(ctx context.Context) (int, error) {
- return withHooks(ctx, ld.sqlExec, ld.mutation, ld.hooks)
+func (_d *LocationDelete) Exec(ctx context.Context) (int, error) {
+ return withHooks(ctx, _d.sqlExec, _d.mutation, _d.hooks)
}
// ExecX is like Exec, but panics if an error occurs.
-func (ld *LocationDelete) ExecX(ctx context.Context) int {
- n, err := ld.Exec(ctx)
+func (_d *LocationDelete) ExecX(ctx context.Context) int {
+ n, err := _d.Exec(ctx)
if err != nil {
panic(err)
}
return n
}
-func (ld *LocationDelete) sqlExec(ctx context.Context) (int, error) {
+func (_d *LocationDelete) sqlExec(ctx context.Context) (int, error) {
_spec := sqlgraph.NewDeleteSpec(location.Table, sqlgraph.NewFieldSpec(location.FieldID, field.TypeUUID))
- if ps := ld.mutation.predicates; len(ps) > 0 {
+ if ps := _d.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
- affected, err := sqlgraph.DeleteNodes(ctx, ld.driver, _spec)
+ affected, err := sqlgraph.DeleteNodes(ctx, _d.driver, _spec)
if err != nil && sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
- ld.mutation.done = true
+ _d.mutation.done = true
return affected, err
}
// LocationDeleteOne is the builder for deleting a single Location entity.
type LocationDeleteOne struct {
- ld *LocationDelete
+ _d *LocationDelete
}
// Where appends a list predicates to the LocationDelete builder.
-func (ldo *LocationDeleteOne) Where(ps ...predicate.Location) *LocationDeleteOne {
- ldo.ld.mutation.Where(ps...)
- return ldo
+func (_d *LocationDeleteOne) Where(ps ...predicate.Location) *LocationDeleteOne {
+ _d._d.mutation.Where(ps...)
+ return _d
}
// Exec executes the deletion query.
-func (ldo *LocationDeleteOne) Exec(ctx context.Context) error {
- n, err := ldo.ld.Exec(ctx)
+func (_d *LocationDeleteOne) Exec(ctx context.Context) error {
+ n, err := _d._d.Exec(ctx)
switch {
case err != nil:
return err
@@ -81,8 +81,8 @@ func (ldo *LocationDeleteOne) Exec(ctx context.Context) error {
}
// ExecX is like Exec, but panics if an error occurs.
-func (ldo *LocationDeleteOne) ExecX(ctx context.Context) {
- if err := ldo.Exec(ctx); err != nil {
+func (_d *LocationDeleteOne) ExecX(ctx context.Context) {
+ if err := _d.Exec(ctx); err != nil {
panic(err)
}
}
diff --git a/backend/internal/data/ent/location_query.go b/backend/internal/data/ent/location_query.go
index 42dae357..4e226d27 100644
--- a/backend/internal/data/ent/location_query.go
+++ b/backend/internal/data/ent/location_query.go
@@ -37,44 +37,44 @@ type LocationQuery struct {
}
// Where adds a new predicate for the LocationQuery builder.
-func (lq *LocationQuery) Where(ps ...predicate.Location) *LocationQuery {
- lq.predicates = append(lq.predicates, ps...)
- return lq
+func (_q *LocationQuery) Where(ps ...predicate.Location) *LocationQuery {
+ _q.predicates = append(_q.predicates, ps...)
+ return _q
}
// Limit the number of records to be returned by this query.
-func (lq *LocationQuery) Limit(limit int) *LocationQuery {
- lq.ctx.Limit = &limit
- return lq
+func (_q *LocationQuery) Limit(limit int) *LocationQuery {
+ _q.ctx.Limit = &limit
+ return _q
}
// Offset to start from.
-func (lq *LocationQuery) Offset(offset int) *LocationQuery {
- lq.ctx.Offset = &offset
- return lq
+func (_q *LocationQuery) Offset(offset int) *LocationQuery {
+ _q.ctx.Offset = &offset
+ return _q
}
// Unique configures the query builder to filter duplicate records on query.
// By default, unique is set to true, and can be disabled using this method.
-func (lq *LocationQuery) Unique(unique bool) *LocationQuery {
- lq.ctx.Unique = &unique
- return lq
+func (_q *LocationQuery) Unique(unique bool) *LocationQuery {
+ _q.ctx.Unique = &unique
+ return _q
}
// Order specifies how the records should be ordered.
-func (lq *LocationQuery) Order(o ...location.OrderOption) *LocationQuery {
- lq.order = append(lq.order, o...)
- return lq
+func (_q *LocationQuery) Order(o ...location.OrderOption) *LocationQuery {
+ _q.order = append(_q.order, o...)
+ return _q
}
// QueryGroup chains the current query on the "group" edge.
-func (lq *LocationQuery) QueryGroup() *GroupQuery {
- query := (&GroupClient{config: lq.config}).Query()
+func (_q *LocationQuery) QueryGroup() *GroupQuery {
+ query := (&GroupClient{config: _q.config}).Query()
query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
- if err := lq.prepareQuery(ctx); err != nil {
+ if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
- selector := lq.sqlQuery(ctx)
+ selector := _q.sqlQuery(ctx)
if err := selector.Err(); err != nil {
return nil, err
}
@@ -83,20 +83,20 @@ func (lq *LocationQuery) QueryGroup() *GroupQuery {
sqlgraph.To(group.Table, group.FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, location.GroupTable, location.GroupColumn),
)
- fromU = sqlgraph.SetNeighbors(lq.driver.Dialect(), step)
+ fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step)
return fromU, nil
}
return query
}
// QueryParent chains the current query on the "parent" edge.
-func (lq *LocationQuery) QueryParent() *LocationQuery {
- query := (&LocationClient{config: lq.config}).Query()
+func (_q *LocationQuery) QueryParent() *LocationQuery {
+ query := (&LocationClient{config: _q.config}).Query()
query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
- if err := lq.prepareQuery(ctx); err != nil {
+ if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
- selector := lq.sqlQuery(ctx)
+ selector := _q.sqlQuery(ctx)
if err := selector.Err(); err != nil {
return nil, err
}
@@ -105,20 +105,20 @@ func (lq *LocationQuery) QueryParent() *LocationQuery {
sqlgraph.To(location.Table, location.FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, location.ParentTable, location.ParentColumn),
)
- fromU = sqlgraph.SetNeighbors(lq.driver.Dialect(), step)
+ fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step)
return fromU, nil
}
return query
}
// QueryChildren chains the current query on the "children" edge.
-func (lq *LocationQuery) QueryChildren() *LocationQuery {
- query := (&LocationClient{config: lq.config}).Query()
+func (_q *LocationQuery) QueryChildren() *LocationQuery {
+ query := (&LocationClient{config: _q.config}).Query()
query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
- if err := lq.prepareQuery(ctx); err != nil {
+ if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
- selector := lq.sqlQuery(ctx)
+ selector := _q.sqlQuery(ctx)
if err := selector.Err(); err != nil {
return nil, err
}
@@ -127,20 +127,20 @@ func (lq *LocationQuery) QueryChildren() *LocationQuery {
sqlgraph.To(location.Table, location.FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, location.ChildrenTable, location.ChildrenColumn),
)
- fromU = sqlgraph.SetNeighbors(lq.driver.Dialect(), step)
+ fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step)
return fromU, nil
}
return query
}
// QueryItems chains the current query on the "items" edge.
-func (lq *LocationQuery) QueryItems() *ItemQuery {
- query := (&ItemClient{config: lq.config}).Query()
+func (_q *LocationQuery) QueryItems() *ItemQuery {
+ query := (&ItemClient{config: _q.config}).Query()
query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
- if err := lq.prepareQuery(ctx); err != nil {
+ if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
- selector := lq.sqlQuery(ctx)
+ selector := _q.sqlQuery(ctx)
if err := selector.Err(); err != nil {
return nil, err
}
@@ -149,7 +149,7 @@ func (lq *LocationQuery) QueryItems() *ItemQuery {
sqlgraph.To(item.Table, item.FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, location.ItemsTable, location.ItemsColumn),
)
- fromU = sqlgraph.SetNeighbors(lq.driver.Dialect(), step)
+ fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step)
return fromU, nil
}
return query
@@ -157,8 +157,8 @@ func (lq *LocationQuery) QueryItems() *ItemQuery {
// First returns the first Location entity from the query.
// Returns a *NotFoundError when no Location was found.
-func (lq *LocationQuery) First(ctx context.Context) (*Location, error) {
- nodes, err := lq.Limit(1).All(setContextOp(ctx, lq.ctx, ent.OpQueryFirst))
+func (_q *LocationQuery) First(ctx context.Context) (*Location, error) {
+ nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst))
if err != nil {
return nil, err
}
@@ -169,8 +169,8 @@ func (lq *LocationQuery) First(ctx context.Context) (*Location, error) {
}
// FirstX is like First, but panics if an error occurs.
-func (lq *LocationQuery) FirstX(ctx context.Context) *Location {
- node, err := lq.First(ctx)
+func (_q *LocationQuery) FirstX(ctx context.Context) *Location {
+ node, err := _q.First(ctx)
if err != nil && !IsNotFound(err) {
panic(err)
}
@@ -179,9 +179,9 @@ func (lq *LocationQuery) FirstX(ctx context.Context) *Location {
// FirstID returns the first Location ID from the query.
// Returns a *NotFoundError when no Location ID was found.
-func (lq *LocationQuery) FirstID(ctx context.Context) (id uuid.UUID, err error) {
+func (_q *LocationQuery) FirstID(ctx context.Context) (id uuid.UUID, err error) {
var ids []uuid.UUID
- if ids, err = lq.Limit(1).IDs(setContextOp(ctx, lq.ctx, ent.OpQueryFirstID)); err != nil {
+ if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil {
return
}
if len(ids) == 0 {
@@ -192,8 +192,8 @@ func (lq *LocationQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)
}
// FirstIDX is like FirstID, but panics if an error occurs.
-func (lq *LocationQuery) FirstIDX(ctx context.Context) uuid.UUID {
- id, err := lq.FirstID(ctx)
+func (_q *LocationQuery) FirstIDX(ctx context.Context) uuid.UUID {
+ id, err := _q.FirstID(ctx)
if err != nil && !IsNotFound(err) {
panic(err)
}
@@ -203,8 +203,8 @@ func (lq *LocationQuery) FirstIDX(ctx context.Context) uuid.UUID {
// Only returns a single Location entity found by the query, ensuring it only returns one.
// Returns a *NotSingularError when more than one Location entity is found.
// Returns a *NotFoundError when no Location entities are found.
-func (lq *LocationQuery) Only(ctx context.Context) (*Location, error) {
- nodes, err := lq.Limit(2).All(setContextOp(ctx, lq.ctx, ent.OpQueryOnly))
+func (_q *LocationQuery) Only(ctx context.Context) (*Location, error) {
+ nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly))
if err != nil {
return nil, err
}
@@ -219,8 +219,8 @@ func (lq *LocationQuery) Only(ctx context.Context) (*Location, error) {
}
// OnlyX is like Only, but panics if an error occurs.
-func (lq *LocationQuery) OnlyX(ctx context.Context) *Location {
- node, err := lq.Only(ctx)
+func (_q *LocationQuery) OnlyX(ctx context.Context) *Location {
+ node, err := _q.Only(ctx)
if err != nil {
panic(err)
}
@@ -230,9 +230,9 @@ func (lq *LocationQuery) OnlyX(ctx context.Context) *Location {
// OnlyID is like Only, but returns the only Location ID in the query.
// Returns a *NotSingularError when more than one Location ID is found.
// Returns a *NotFoundError when no entities are found.
-func (lq *LocationQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error) {
+func (_q *LocationQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error) {
var ids []uuid.UUID
- if ids, err = lq.Limit(2).IDs(setContextOp(ctx, lq.ctx, ent.OpQueryOnlyID)); err != nil {
+ if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil {
return
}
switch len(ids) {
@@ -247,8 +247,8 @@ func (lq *LocationQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error) {
}
// OnlyIDX is like OnlyID, but panics if an error occurs.
-func (lq *LocationQuery) OnlyIDX(ctx context.Context) uuid.UUID {
- id, err := lq.OnlyID(ctx)
+func (_q *LocationQuery) OnlyIDX(ctx context.Context) uuid.UUID {
+ id, err := _q.OnlyID(ctx)
if err != nil {
panic(err)
}
@@ -256,18 +256,18 @@ func (lq *LocationQuery) OnlyIDX(ctx context.Context) uuid.UUID {
}
// All executes the query and returns a list of Locations.
-func (lq *LocationQuery) All(ctx context.Context) ([]*Location, error) {
- ctx = setContextOp(ctx, lq.ctx, ent.OpQueryAll)
- if err := lq.prepareQuery(ctx); err != nil {
+func (_q *LocationQuery) All(ctx context.Context) ([]*Location, error) {
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll)
+ if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
qr := querierAll[[]*Location, *LocationQuery]()
- return withInterceptors[[]*Location](ctx, lq, qr, lq.inters)
+ return withInterceptors[[]*Location](ctx, _q, qr, _q.inters)
}
// AllX is like All, but panics if an error occurs.
-func (lq *LocationQuery) AllX(ctx context.Context) []*Location {
- nodes, err := lq.All(ctx)
+func (_q *LocationQuery) AllX(ctx context.Context) []*Location {
+ nodes, err := _q.All(ctx)
if err != nil {
panic(err)
}
@@ -275,20 +275,20 @@ func (lq *LocationQuery) AllX(ctx context.Context) []*Location {
}
// IDs executes the query and returns a list of Location IDs.
-func (lq *LocationQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error) {
- if lq.ctx.Unique == nil && lq.path != nil {
- lq.Unique(true)
+func (_q *LocationQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error) {
+ if _q.ctx.Unique == nil && _q.path != nil {
+ _q.Unique(true)
}
- ctx = setContextOp(ctx, lq.ctx, ent.OpQueryIDs)
- if err = lq.Select(location.FieldID).Scan(ctx, &ids); err != nil {
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs)
+ if err = _q.Select(location.FieldID).Scan(ctx, &ids); err != nil {
return nil, err
}
return ids, nil
}
// IDsX is like IDs, but panics if an error occurs.
-func (lq *LocationQuery) IDsX(ctx context.Context) []uuid.UUID {
- ids, err := lq.IDs(ctx)
+func (_q *LocationQuery) IDsX(ctx context.Context) []uuid.UUID {
+ ids, err := _q.IDs(ctx)
if err != nil {
panic(err)
}
@@ -296,17 +296,17 @@ func (lq *LocationQuery) IDsX(ctx context.Context) []uuid.UUID {
}
// Count returns the count of the given query.
-func (lq *LocationQuery) Count(ctx context.Context) (int, error) {
- ctx = setContextOp(ctx, lq.ctx, ent.OpQueryCount)
- if err := lq.prepareQuery(ctx); err != nil {
+func (_q *LocationQuery) Count(ctx context.Context) (int, error) {
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryCount)
+ if err := _q.prepareQuery(ctx); err != nil {
return 0, err
}
- return withInterceptors[int](ctx, lq, querierCount[*LocationQuery](), lq.inters)
+ return withInterceptors[int](ctx, _q, querierCount[*LocationQuery](), _q.inters)
}
// CountX is like Count, but panics if an error occurs.
-func (lq *LocationQuery) CountX(ctx context.Context) int {
- count, err := lq.Count(ctx)
+func (_q *LocationQuery) CountX(ctx context.Context) int {
+ count, err := _q.Count(ctx)
if err != nil {
panic(err)
}
@@ -314,9 +314,9 @@ func (lq *LocationQuery) CountX(ctx context.Context) int {
}
// Exist returns true if the query has elements in the graph.
-func (lq *LocationQuery) Exist(ctx context.Context) (bool, error) {
- ctx = setContextOp(ctx, lq.ctx, ent.OpQueryExist)
- switch _, err := lq.FirstID(ctx); {
+func (_q *LocationQuery) Exist(ctx context.Context) (bool, error) {
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryExist)
+ switch _, err := _q.FirstID(ctx); {
case IsNotFound(err):
return false, nil
case err != nil:
@@ -327,8 +327,8 @@ func (lq *LocationQuery) Exist(ctx context.Context) (bool, error) {
}
// ExistX is like Exist, but panics if an error occurs.
-func (lq *LocationQuery) ExistX(ctx context.Context) bool {
- exist, err := lq.Exist(ctx)
+func (_q *LocationQuery) ExistX(ctx context.Context) bool {
+ exist, err := _q.Exist(ctx)
if err != nil {
panic(err)
}
@@ -337,68 +337,68 @@ func (lq *LocationQuery) ExistX(ctx context.Context) bool {
// Clone returns a duplicate of the LocationQuery builder, including all associated steps. It can be
// used to prepare common query builders and use them differently after the clone is made.
-func (lq *LocationQuery) Clone() *LocationQuery {
- if lq == nil {
+func (_q *LocationQuery) Clone() *LocationQuery {
+ if _q == nil {
return nil
}
return &LocationQuery{
- config: lq.config,
- ctx: lq.ctx.Clone(),
- order: append([]location.OrderOption{}, lq.order...),
- inters: append([]Interceptor{}, lq.inters...),
- predicates: append([]predicate.Location{}, lq.predicates...),
- withGroup: lq.withGroup.Clone(),
- withParent: lq.withParent.Clone(),
- withChildren: lq.withChildren.Clone(),
- withItems: lq.withItems.Clone(),
+ config: _q.config,
+ ctx: _q.ctx.Clone(),
+ order: append([]location.OrderOption{}, _q.order...),
+ inters: append([]Interceptor{}, _q.inters...),
+ predicates: append([]predicate.Location{}, _q.predicates...),
+ withGroup: _q.withGroup.Clone(),
+ withParent: _q.withParent.Clone(),
+ withChildren: _q.withChildren.Clone(),
+ withItems: _q.withItems.Clone(),
// clone intermediate query.
- sql: lq.sql.Clone(),
- path: lq.path,
+ sql: _q.sql.Clone(),
+ path: _q.path,
}
}
// WithGroup tells the query-builder to eager-load the nodes that are connected to
// the "group" edge. The optional arguments are used to configure the query builder of the edge.
-func (lq *LocationQuery) WithGroup(opts ...func(*GroupQuery)) *LocationQuery {
- query := (&GroupClient{config: lq.config}).Query()
+func (_q *LocationQuery) WithGroup(opts ...func(*GroupQuery)) *LocationQuery {
+ query := (&GroupClient{config: _q.config}).Query()
for _, opt := range opts {
opt(query)
}
- lq.withGroup = query
- return lq
+ _q.withGroup = query
+ return _q
}
// WithParent tells the query-builder to eager-load the nodes that are connected to
// the "parent" edge. The optional arguments are used to configure the query builder of the edge.
-func (lq *LocationQuery) WithParent(opts ...func(*LocationQuery)) *LocationQuery {
- query := (&LocationClient{config: lq.config}).Query()
+func (_q *LocationQuery) WithParent(opts ...func(*LocationQuery)) *LocationQuery {
+ query := (&LocationClient{config: _q.config}).Query()
for _, opt := range opts {
opt(query)
}
- lq.withParent = query
- return lq
+ _q.withParent = query
+ return _q
}
// WithChildren tells the query-builder to eager-load the nodes that are connected to
// the "children" edge. The optional arguments are used to configure the query builder of the edge.
-func (lq *LocationQuery) WithChildren(opts ...func(*LocationQuery)) *LocationQuery {
- query := (&LocationClient{config: lq.config}).Query()
+func (_q *LocationQuery) WithChildren(opts ...func(*LocationQuery)) *LocationQuery {
+ query := (&LocationClient{config: _q.config}).Query()
for _, opt := range opts {
opt(query)
}
- lq.withChildren = query
- return lq
+ _q.withChildren = query
+ return _q
}
// WithItems tells the query-builder to eager-load the nodes that are connected to
// the "items" edge. The optional arguments are used to configure the query builder of the edge.
-func (lq *LocationQuery) WithItems(opts ...func(*ItemQuery)) *LocationQuery {
- query := (&ItemClient{config: lq.config}).Query()
+func (_q *LocationQuery) WithItems(opts ...func(*ItemQuery)) *LocationQuery {
+ query := (&ItemClient{config: _q.config}).Query()
for _, opt := range opts {
opt(query)
}
- lq.withItems = query
- return lq
+ _q.withItems = query
+ return _q
}
// GroupBy is used to group vertices by one or more fields/columns.
@@ -415,10 +415,10 @@ func (lq *LocationQuery) WithItems(opts ...func(*ItemQuery)) *LocationQuery {
// GroupBy(location.FieldCreatedAt).
// Aggregate(ent.Count()).
// Scan(ctx, &v)
-func (lq *LocationQuery) GroupBy(field string, fields ...string) *LocationGroupBy {
- lq.ctx.Fields = append([]string{field}, fields...)
- grbuild := &LocationGroupBy{build: lq}
- grbuild.flds = &lq.ctx.Fields
+func (_q *LocationQuery) GroupBy(field string, fields ...string) *LocationGroupBy {
+ _q.ctx.Fields = append([]string{field}, fields...)
+ grbuild := &LocationGroupBy{build: _q}
+ grbuild.flds = &_q.ctx.Fields
grbuild.label = location.Label
grbuild.scan = grbuild.Scan
return grbuild
@@ -436,58 +436,58 @@ func (lq *LocationQuery) GroupBy(field string, fields ...string) *LocationGroupB
// client.Location.Query().
// Select(location.FieldCreatedAt).
// Scan(ctx, &v)
-func (lq *LocationQuery) Select(fields ...string) *LocationSelect {
- lq.ctx.Fields = append(lq.ctx.Fields, fields...)
- sbuild := &LocationSelect{LocationQuery: lq}
+func (_q *LocationQuery) Select(fields ...string) *LocationSelect {
+ _q.ctx.Fields = append(_q.ctx.Fields, fields...)
+ sbuild := &LocationSelect{LocationQuery: _q}
sbuild.label = location.Label
- sbuild.flds, sbuild.scan = &lq.ctx.Fields, sbuild.Scan
+ sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan
return sbuild
}
// Aggregate returns a LocationSelect configured with the given aggregations.
-func (lq *LocationQuery) Aggregate(fns ...AggregateFunc) *LocationSelect {
- return lq.Select().Aggregate(fns...)
+func (_q *LocationQuery) Aggregate(fns ...AggregateFunc) *LocationSelect {
+ return _q.Select().Aggregate(fns...)
}
-func (lq *LocationQuery) prepareQuery(ctx context.Context) error {
- for _, inter := range lq.inters {
+func (_q *LocationQuery) prepareQuery(ctx context.Context) error {
+ for _, inter := range _q.inters {
if inter == nil {
return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)")
}
if trv, ok := inter.(Traverser); ok {
- if err := trv.Traverse(ctx, lq); err != nil {
+ if err := trv.Traverse(ctx, _q); err != nil {
return err
}
}
}
- for _, f := range lq.ctx.Fields {
+ for _, f := range _q.ctx.Fields {
if !location.ValidColumn(f) {
return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
}
}
- if lq.path != nil {
- prev, err := lq.path(ctx)
+ if _q.path != nil {
+ prev, err := _q.path(ctx)
if err != nil {
return err
}
- lq.sql = prev
+ _q.sql = prev
}
return nil
}
-func (lq *LocationQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Location, error) {
+func (_q *LocationQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Location, error) {
var (
nodes = []*Location{}
- withFKs = lq.withFKs
- _spec = lq.querySpec()
+ withFKs = _q.withFKs
+ _spec = _q.querySpec()
loadedTypes = [4]bool{
- lq.withGroup != nil,
- lq.withParent != nil,
- lq.withChildren != nil,
- lq.withItems != nil,
+ _q.withGroup != nil,
+ _q.withParent != nil,
+ _q.withChildren != nil,
+ _q.withItems != nil,
}
)
- if lq.withGroup != nil || lq.withParent != nil {
+ if _q.withGroup != nil || _q.withParent != nil {
withFKs = true
}
if withFKs {
@@ -497,7 +497,7 @@ func (lq *LocationQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Loc
return (*Location).scanValues(nil, columns)
}
_spec.Assign = func(columns []string, values []any) error {
- node := &Location{config: lq.config}
+ node := &Location{config: _q.config}
nodes = append(nodes, node)
node.Edges.loadedTypes = loadedTypes
return node.assignValues(columns, values)
@@ -505,33 +505,33 @@ func (lq *LocationQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Loc
for i := range hooks {
hooks[i](ctx, _spec)
}
- if err := sqlgraph.QueryNodes(ctx, lq.driver, _spec); err != nil {
+ if err := sqlgraph.QueryNodes(ctx, _q.driver, _spec); err != nil {
return nil, err
}
if len(nodes) == 0 {
return nodes, nil
}
- if query := lq.withGroup; query != nil {
- if err := lq.loadGroup(ctx, query, nodes, nil,
+ if query := _q.withGroup; query != nil {
+ if err := _q.loadGroup(ctx, query, nodes, nil,
func(n *Location, e *Group) { n.Edges.Group = e }); err != nil {
return nil, err
}
}
- if query := lq.withParent; query != nil {
- if err := lq.loadParent(ctx, query, nodes, nil,
+ if query := _q.withParent; query != nil {
+ if err := _q.loadParent(ctx, query, nodes, nil,
func(n *Location, e *Location) { n.Edges.Parent = e }); err != nil {
return nil, err
}
}
- if query := lq.withChildren; query != nil {
- if err := lq.loadChildren(ctx, query, nodes,
+ if query := _q.withChildren; query != nil {
+ if err := _q.loadChildren(ctx, query, nodes,
func(n *Location) { n.Edges.Children = []*Location{} },
func(n *Location, e *Location) { n.Edges.Children = append(n.Edges.Children, e) }); err != nil {
return nil, err
}
}
- if query := lq.withItems; query != nil {
- if err := lq.loadItems(ctx, query, nodes,
+ if query := _q.withItems; query != nil {
+ if err := _q.loadItems(ctx, query, nodes,
func(n *Location) { n.Edges.Items = []*Item{} },
func(n *Location, e *Item) { n.Edges.Items = append(n.Edges.Items, e) }); err != nil {
return nil, err
@@ -540,7 +540,7 @@ func (lq *LocationQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Loc
return nodes, nil
}
-func (lq *LocationQuery) loadGroup(ctx context.Context, query *GroupQuery, nodes []*Location, init func(*Location), assign func(*Location, *Group)) error {
+func (_q *LocationQuery) loadGroup(ctx context.Context, query *GroupQuery, nodes []*Location, init func(*Location), assign func(*Location, *Group)) error {
ids := make([]uuid.UUID, 0, len(nodes))
nodeids := make(map[uuid.UUID][]*Location)
for i := range nodes {
@@ -572,7 +572,7 @@ func (lq *LocationQuery) loadGroup(ctx context.Context, query *GroupQuery, nodes
}
return nil
}
-func (lq *LocationQuery) loadParent(ctx context.Context, query *LocationQuery, nodes []*Location, init func(*Location), assign func(*Location, *Location)) error {
+func (_q *LocationQuery) loadParent(ctx context.Context, query *LocationQuery, nodes []*Location, init func(*Location), assign func(*Location, *Location)) error {
ids := make([]uuid.UUID, 0, len(nodes))
nodeids := make(map[uuid.UUID][]*Location)
for i := range nodes {
@@ -604,7 +604,7 @@ func (lq *LocationQuery) loadParent(ctx context.Context, query *LocationQuery, n
}
return nil
}
-func (lq *LocationQuery) loadChildren(ctx context.Context, query *LocationQuery, nodes []*Location, init func(*Location), assign func(*Location, *Location)) error {
+func (_q *LocationQuery) loadChildren(ctx context.Context, query *LocationQuery, nodes []*Location, init func(*Location), assign func(*Location, *Location)) error {
fks := make([]driver.Value, 0, len(nodes))
nodeids := make(map[uuid.UUID]*Location)
for i := range nodes {
@@ -635,7 +635,7 @@ func (lq *LocationQuery) loadChildren(ctx context.Context, query *LocationQuery,
}
return nil
}
-func (lq *LocationQuery) loadItems(ctx context.Context, query *ItemQuery, nodes []*Location, init func(*Location), assign func(*Location, *Item)) error {
+func (_q *LocationQuery) loadItems(ctx context.Context, query *ItemQuery, nodes []*Location, init func(*Location), assign func(*Location, *Item)) error {
fks := make([]driver.Value, 0, len(nodes))
nodeids := make(map[uuid.UUID]*Location)
for i := range nodes {
@@ -667,24 +667,24 @@ func (lq *LocationQuery) loadItems(ctx context.Context, query *ItemQuery, nodes
return nil
}
-func (lq *LocationQuery) sqlCount(ctx context.Context) (int, error) {
- _spec := lq.querySpec()
- _spec.Node.Columns = lq.ctx.Fields
- if len(lq.ctx.Fields) > 0 {
- _spec.Unique = lq.ctx.Unique != nil && *lq.ctx.Unique
+func (_q *LocationQuery) sqlCount(ctx context.Context) (int, error) {
+ _spec := _q.querySpec()
+ _spec.Node.Columns = _q.ctx.Fields
+ if len(_q.ctx.Fields) > 0 {
+ _spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique
}
- return sqlgraph.CountNodes(ctx, lq.driver, _spec)
+ return sqlgraph.CountNodes(ctx, _q.driver, _spec)
}
-func (lq *LocationQuery) querySpec() *sqlgraph.QuerySpec {
+func (_q *LocationQuery) querySpec() *sqlgraph.QuerySpec {
_spec := sqlgraph.NewQuerySpec(location.Table, location.Columns, sqlgraph.NewFieldSpec(location.FieldID, field.TypeUUID))
- _spec.From = lq.sql
- if unique := lq.ctx.Unique; unique != nil {
+ _spec.From = _q.sql
+ if unique := _q.ctx.Unique; unique != nil {
_spec.Unique = *unique
- } else if lq.path != nil {
+ } else if _q.path != nil {
_spec.Unique = true
}
- if fields := lq.ctx.Fields; len(fields) > 0 {
+ if fields := _q.ctx.Fields; len(fields) > 0 {
_spec.Node.Columns = make([]string, 0, len(fields))
_spec.Node.Columns = append(_spec.Node.Columns, location.FieldID)
for i := range fields {
@@ -693,20 +693,20 @@ func (lq *LocationQuery) querySpec() *sqlgraph.QuerySpec {
}
}
}
- if ps := lq.predicates; len(ps) > 0 {
+ if ps := _q.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
- if limit := lq.ctx.Limit; limit != nil {
+ if limit := _q.ctx.Limit; limit != nil {
_spec.Limit = *limit
}
- if offset := lq.ctx.Offset; offset != nil {
+ if offset := _q.ctx.Offset; offset != nil {
_spec.Offset = *offset
}
- if ps := lq.order; len(ps) > 0 {
+ if ps := _q.order; len(ps) > 0 {
_spec.Order = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
@@ -716,33 +716,33 @@ func (lq *LocationQuery) querySpec() *sqlgraph.QuerySpec {
return _spec
}
-func (lq *LocationQuery) sqlQuery(ctx context.Context) *sql.Selector {
- builder := sql.Dialect(lq.driver.Dialect())
+func (_q *LocationQuery) sqlQuery(ctx context.Context) *sql.Selector {
+ builder := sql.Dialect(_q.driver.Dialect())
t1 := builder.Table(location.Table)
- columns := lq.ctx.Fields
+ columns := _q.ctx.Fields
if len(columns) == 0 {
columns = location.Columns
}
selector := builder.Select(t1.Columns(columns...)...).From(t1)
- if lq.sql != nil {
- selector = lq.sql
+ if _q.sql != nil {
+ selector = _q.sql
selector.Select(selector.Columns(columns...)...)
}
- if lq.ctx.Unique != nil && *lq.ctx.Unique {
+ if _q.ctx.Unique != nil && *_q.ctx.Unique {
selector.Distinct()
}
- for _, p := range lq.predicates {
+ for _, p := range _q.predicates {
p(selector)
}
- for _, p := range lq.order {
+ for _, p := range _q.order {
p(selector)
}
- if offset := lq.ctx.Offset; offset != nil {
+ if offset := _q.ctx.Offset; offset != nil {
// limit is mandatory for offset clause. We start
// with default value, and override it below if needed.
selector.Offset(*offset).Limit(math.MaxInt32)
}
- if limit := lq.ctx.Limit; limit != nil {
+ if limit := _q.ctx.Limit; limit != nil {
selector.Limit(*limit)
}
return selector
@@ -755,41 +755,41 @@ type LocationGroupBy struct {
}
// Aggregate adds the given aggregation functions to the group-by query.
-func (lgb *LocationGroupBy) Aggregate(fns ...AggregateFunc) *LocationGroupBy {
- lgb.fns = append(lgb.fns, fns...)
- return lgb
+func (_g *LocationGroupBy) Aggregate(fns ...AggregateFunc) *LocationGroupBy {
+ _g.fns = append(_g.fns, fns...)
+ return _g
}
// Scan applies the selector query and scans the result into the given value.
-func (lgb *LocationGroupBy) Scan(ctx context.Context, v any) error {
- ctx = setContextOp(ctx, lgb.build.ctx, ent.OpQueryGroupBy)
- if err := lgb.build.prepareQuery(ctx); err != nil {
+func (_g *LocationGroupBy) Scan(ctx context.Context, v any) error {
+ ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy)
+ if err := _g.build.prepareQuery(ctx); err != nil {
return err
}
- return scanWithInterceptors[*LocationQuery, *LocationGroupBy](ctx, lgb.build, lgb, lgb.build.inters, v)
+ return scanWithInterceptors[*LocationQuery, *LocationGroupBy](ctx, _g.build, _g, _g.build.inters, v)
}
-func (lgb *LocationGroupBy) sqlScan(ctx context.Context, root *LocationQuery, v any) error {
+func (_g *LocationGroupBy) sqlScan(ctx context.Context, root *LocationQuery, v any) error {
selector := root.sqlQuery(ctx).Select()
- aggregation := make([]string, 0, len(lgb.fns))
- for _, fn := range lgb.fns {
+ aggregation := make([]string, 0, len(_g.fns))
+ for _, fn := range _g.fns {
aggregation = append(aggregation, fn(selector))
}
if len(selector.SelectedColumns()) == 0 {
- columns := make([]string, 0, len(*lgb.flds)+len(lgb.fns))
- for _, f := range *lgb.flds {
+ columns := make([]string, 0, len(*_g.flds)+len(_g.fns))
+ for _, f := range *_g.flds {
columns = append(columns, selector.C(f))
}
columns = append(columns, aggregation...)
selector.Select(columns...)
}
- selector.GroupBy(selector.Columns(*lgb.flds...)...)
+ selector.GroupBy(selector.Columns(*_g.flds...)...)
if err := selector.Err(); err != nil {
return err
}
rows := &sql.Rows{}
query, args := selector.Query()
- if err := lgb.build.driver.Query(ctx, query, args, rows); err != nil {
+ if err := _g.build.driver.Query(ctx, query, args, rows); err != nil {
return err
}
defer rows.Close()
@@ -803,27 +803,27 @@ type LocationSelect struct {
}
// Aggregate adds the given aggregation functions to the selector query.
-func (ls *LocationSelect) Aggregate(fns ...AggregateFunc) *LocationSelect {
- ls.fns = append(ls.fns, fns...)
- return ls
+func (_s *LocationSelect) Aggregate(fns ...AggregateFunc) *LocationSelect {
+ _s.fns = append(_s.fns, fns...)
+ return _s
}
// Scan applies the selector query and scans the result into the given value.
-func (ls *LocationSelect) Scan(ctx context.Context, v any) error {
- ctx = setContextOp(ctx, ls.ctx, ent.OpQuerySelect)
- if err := ls.prepareQuery(ctx); err != nil {
+func (_s *LocationSelect) Scan(ctx context.Context, v any) error {
+ ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect)
+ if err := _s.prepareQuery(ctx); err != nil {
return err
}
- return scanWithInterceptors[*LocationQuery, *LocationSelect](ctx, ls.LocationQuery, ls, ls.inters, v)
+ return scanWithInterceptors[*LocationQuery, *LocationSelect](ctx, _s.LocationQuery, _s, _s.inters, v)
}
-func (ls *LocationSelect) sqlScan(ctx context.Context, root *LocationQuery, v any) error {
+func (_s *LocationSelect) sqlScan(ctx context.Context, root *LocationQuery, v any) error {
selector := root.sqlQuery(ctx)
- aggregation := make([]string, 0, len(ls.fns))
- for _, fn := range ls.fns {
+ aggregation := make([]string, 0, len(_s.fns))
+ for _, fn := range _s.fns {
aggregation = append(aggregation, fn(selector))
}
- switch n := len(*ls.selector.flds); {
+ switch n := len(*_s.selector.flds); {
case n == 0 && len(aggregation) > 0:
selector.Select(aggregation...)
case n != 0 && len(aggregation) > 0:
@@ -831,7 +831,7 @@ func (ls *LocationSelect) sqlScan(ctx context.Context, root *LocationQuery, v an
}
rows := &sql.Rows{}
query, args := selector.Query()
- if err := ls.driver.Query(ctx, query, args, rows); err != nil {
+ if err := _s.driver.Query(ctx, query, args, rows); err != nil {
return err
}
defer rows.Close()
diff --git a/backend/internal/data/ent/location_update.go b/backend/internal/data/ent/location_update.go
index f89d50b3..badd8bd0 100644
--- a/backend/internal/data/ent/location_update.go
+++ b/backend/internal/data/ent/location_update.go
@@ -26,179 +26,179 @@ type LocationUpdate struct {
}
// Where appends a list predicates to the LocationUpdate builder.
-func (lu *LocationUpdate) Where(ps ...predicate.Location) *LocationUpdate {
- lu.mutation.Where(ps...)
- return lu
+func (_u *LocationUpdate) Where(ps ...predicate.Location) *LocationUpdate {
+ _u.mutation.Where(ps...)
+ return _u
}
// SetUpdatedAt sets the "updated_at" field.
-func (lu *LocationUpdate) SetUpdatedAt(t time.Time) *LocationUpdate {
- lu.mutation.SetUpdatedAt(t)
- return lu
+func (_u *LocationUpdate) SetUpdatedAt(v time.Time) *LocationUpdate {
+ _u.mutation.SetUpdatedAt(v)
+ return _u
}
// SetName sets the "name" field.
-func (lu *LocationUpdate) SetName(s string) *LocationUpdate {
- lu.mutation.SetName(s)
- return lu
+func (_u *LocationUpdate) SetName(v string) *LocationUpdate {
+ _u.mutation.SetName(v)
+ return _u
}
// SetNillableName sets the "name" field if the given value is not nil.
-func (lu *LocationUpdate) SetNillableName(s *string) *LocationUpdate {
- if s != nil {
- lu.SetName(*s)
+func (_u *LocationUpdate) SetNillableName(v *string) *LocationUpdate {
+ if v != nil {
+ _u.SetName(*v)
}
- return lu
+ return _u
}
// SetDescription sets the "description" field.
-func (lu *LocationUpdate) SetDescription(s string) *LocationUpdate {
- lu.mutation.SetDescription(s)
- return lu
+func (_u *LocationUpdate) SetDescription(v string) *LocationUpdate {
+ _u.mutation.SetDescription(v)
+ return _u
}
// SetNillableDescription sets the "description" field if the given value is not nil.
-func (lu *LocationUpdate) SetNillableDescription(s *string) *LocationUpdate {
- if s != nil {
- lu.SetDescription(*s)
+func (_u *LocationUpdate) SetNillableDescription(v *string) *LocationUpdate {
+ if v != nil {
+ _u.SetDescription(*v)
}
- return lu
+ return _u
}
// ClearDescription clears the value of the "description" field.
-func (lu *LocationUpdate) ClearDescription() *LocationUpdate {
- lu.mutation.ClearDescription()
- return lu
+func (_u *LocationUpdate) ClearDescription() *LocationUpdate {
+ _u.mutation.ClearDescription()
+ return _u
}
// SetGroupID sets the "group" edge to the Group entity by ID.
-func (lu *LocationUpdate) SetGroupID(id uuid.UUID) *LocationUpdate {
- lu.mutation.SetGroupID(id)
- return lu
+func (_u *LocationUpdate) SetGroupID(id uuid.UUID) *LocationUpdate {
+ _u.mutation.SetGroupID(id)
+ return _u
}
// SetGroup sets the "group" edge to the Group entity.
-func (lu *LocationUpdate) SetGroup(g *Group) *LocationUpdate {
- return lu.SetGroupID(g.ID)
+func (_u *LocationUpdate) SetGroup(v *Group) *LocationUpdate {
+ return _u.SetGroupID(v.ID)
}
// SetParentID sets the "parent" edge to the Location entity by ID.
-func (lu *LocationUpdate) SetParentID(id uuid.UUID) *LocationUpdate {
- lu.mutation.SetParentID(id)
- return lu
+func (_u *LocationUpdate) SetParentID(id uuid.UUID) *LocationUpdate {
+ _u.mutation.SetParentID(id)
+ return _u
}
// SetNillableParentID sets the "parent" edge to the Location entity by ID if the given value is not nil.
-func (lu *LocationUpdate) SetNillableParentID(id *uuid.UUID) *LocationUpdate {
+func (_u *LocationUpdate) SetNillableParentID(id *uuid.UUID) *LocationUpdate {
if id != nil {
- lu = lu.SetParentID(*id)
+ _u = _u.SetParentID(*id)
}
- return lu
+ return _u
}
// SetParent sets the "parent" edge to the Location entity.
-func (lu *LocationUpdate) SetParent(l *Location) *LocationUpdate {
- return lu.SetParentID(l.ID)
+func (_u *LocationUpdate) SetParent(v *Location) *LocationUpdate {
+ return _u.SetParentID(v.ID)
}
// AddChildIDs adds the "children" edge to the Location entity by IDs.
-func (lu *LocationUpdate) AddChildIDs(ids ...uuid.UUID) *LocationUpdate {
- lu.mutation.AddChildIDs(ids...)
- return lu
+func (_u *LocationUpdate) AddChildIDs(ids ...uuid.UUID) *LocationUpdate {
+ _u.mutation.AddChildIDs(ids...)
+ return _u
}
// AddChildren adds the "children" edges to the Location entity.
-func (lu *LocationUpdate) AddChildren(l ...*Location) *LocationUpdate {
- ids := make([]uuid.UUID, len(l))
- for i := range l {
- ids[i] = l[i].ID
+func (_u *LocationUpdate) AddChildren(v ...*Location) *LocationUpdate {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return lu.AddChildIDs(ids...)
+ return _u.AddChildIDs(ids...)
}
// AddItemIDs adds the "items" edge to the Item entity by IDs.
-func (lu *LocationUpdate) AddItemIDs(ids ...uuid.UUID) *LocationUpdate {
- lu.mutation.AddItemIDs(ids...)
- return lu
+func (_u *LocationUpdate) AddItemIDs(ids ...uuid.UUID) *LocationUpdate {
+ _u.mutation.AddItemIDs(ids...)
+ return _u
}
// AddItems adds the "items" edges to the Item entity.
-func (lu *LocationUpdate) AddItems(i ...*Item) *LocationUpdate {
- ids := make([]uuid.UUID, len(i))
- for j := range i {
- ids[j] = i[j].ID
+func (_u *LocationUpdate) AddItems(v ...*Item) *LocationUpdate {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return lu.AddItemIDs(ids...)
+ return _u.AddItemIDs(ids...)
}
// Mutation returns the LocationMutation object of the builder.
-func (lu *LocationUpdate) Mutation() *LocationMutation {
- return lu.mutation
+func (_u *LocationUpdate) Mutation() *LocationMutation {
+ return _u.mutation
}
// ClearGroup clears the "group" edge to the Group entity.
-func (lu *LocationUpdate) ClearGroup() *LocationUpdate {
- lu.mutation.ClearGroup()
- return lu
+func (_u *LocationUpdate) ClearGroup() *LocationUpdate {
+ _u.mutation.ClearGroup()
+ return _u
}
// ClearParent clears the "parent" edge to the Location entity.
-func (lu *LocationUpdate) ClearParent() *LocationUpdate {
- lu.mutation.ClearParent()
- return lu
+func (_u *LocationUpdate) ClearParent() *LocationUpdate {
+ _u.mutation.ClearParent()
+ return _u
}
// ClearChildren clears all "children" edges to the Location entity.
-func (lu *LocationUpdate) ClearChildren() *LocationUpdate {
- lu.mutation.ClearChildren()
- return lu
+func (_u *LocationUpdate) ClearChildren() *LocationUpdate {
+ _u.mutation.ClearChildren()
+ return _u
}
// RemoveChildIDs removes the "children" edge to Location entities by IDs.
-func (lu *LocationUpdate) RemoveChildIDs(ids ...uuid.UUID) *LocationUpdate {
- lu.mutation.RemoveChildIDs(ids...)
- return lu
+func (_u *LocationUpdate) RemoveChildIDs(ids ...uuid.UUID) *LocationUpdate {
+ _u.mutation.RemoveChildIDs(ids...)
+ return _u
}
// RemoveChildren removes "children" edges to Location entities.
-func (lu *LocationUpdate) RemoveChildren(l ...*Location) *LocationUpdate {
- ids := make([]uuid.UUID, len(l))
- for i := range l {
- ids[i] = l[i].ID
+func (_u *LocationUpdate) RemoveChildren(v ...*Location) *LocationUpdate {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return lu.RemoveChildIDs(ids...)
+ return _u.RemoveChildIDs(ids...)
}
// ClearItems clears all "items" edges to the Item entity.
-func (lu *LocationUpdate) ClearItems() *LocationUpdate {
- lu.mutation.ClearItems()
- return lu
+func (_u *LocationUpdate) ClearItems() *LocationUpdate {
+ _u.mutation.ClearItems()
+ return _u
}
// RemoveItemIDs removes the "items" edge to Item entities by IDs.
-func (lu *LocationUpdate) RemoveItemIDs(ids ...uuid.UUID) *LocationUpdate {
- lu.mutation.RemoveItemIDs(ids...)
- return lu
+func (_u *LocationUpdate) RemoveItemIDs(ids ...uuid.UUID) *LocationUpdate {
+ _u.mutation.RemoveItemIDs(ids...)
+ return _u
}
// RemoveItems removes "items" edges to Item entities.
-func (lu *LocationUpdate) RemoveItems(i ...*Item) *LocationUpdate {
- ids := make([]uuid.UUID, len(i))
- for j := range i {
- ids[j] = i[j].ID
+func (_u *LocationUpdate) RemoveItems(v ...*Item) *LocationUpdate {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return lu.RemoveItemIDs(ids...)
+ return _u.RemoveItemIDs(ids...)
}
// Save executes the query and returns the number of nodes affected by the update operation.
-func (lu *LocationUpdate) Save(ctx context.Context) (int, error) {
- lu.defaults()
- return withHooks(ctx, lu.sqlSave, lu.mutation, lu.hooks)
+func (_u *LocationUpdate) Save(ctx context.Context) (int, error) {
+ _u.defaults()
+ return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
}
// SaveX is like Save, but panics if an error occurs.
-func (lu *LocationUpdate) SaveX(ctx context.Context) int {
- affected, err := lu.Save(ctx)
+func (_u *LocationUpdate) SaveX(ctx context.Context) int {
+ affected, err := _u.Save(ctx)
if err != nil {
panic(err)
}
@@ -206,69 +206,69 @@ func (lu *LocationUpdate) SaveX(ctx context.Context) int {
}
// Exec executes the query.
-func (lu *LocationUpdate) Exec(ctx context.Context) error {
- _, err := lu.Save(ctx)
+func (_u *LocationUpdate) Exec(ctx context.Context) error {
+ _, err := _u.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
-func (lu *LocationUpdate) ExecX(ctx context.Context) {
- if err := lu.Exec(ctx); err != nil {
+func (_u *LocationUpdate) ExecX(ctx context.Context) {
+ if err := _u.Exec(ctx); err != nil {
panic(err)
}
}
// defaults sets the default values of the builder before save.
-func (lu *LocationUpdate) defaults() {
- if _, ok := lu.mutation.UpdatedAt(); !ok {
+func (_u *LocationUpdate) defaults() {
+ if _, ok := _u.mutation.UpdatedAt(); !ok {
v := location.UpdateDefaultUpdatedAt()
- lu.mutation.SetUpdatedAt(v)
+ _u.mutation.SetUpdatedAt(v)
}
}
// check runs all checks and user-defined validators on the builder.
-func (lu *LocationUpdate) check() error {
- if v, ok := lu.mutation.Name(); ok {
+func (_u *LocationUpdate) check() error {
+ if v, ok := _u.mutation.Name(); ok {
if err := location.NameValidator(v); err != nil {
return &ValidationError{Name: "name", err: fmt.Errorf(`ent: validator failed for field "Location.name": %w`, err)}
}
}
- if v, ok := lu.mutation.Description(); ok {
+ if v, ok := _u.mutation.Description(); ok {
if err := location.DescriptionValidator(v); err != nil {
return &ValidationError{Name: "description", err: fmt.Errorf(`ent: validator failed for field "Location.description": %w`, err)}
}
}
- if lu.mutation.GroupCleared() && len(lu.mutation.GroupIDs()) > 0 {
+ if _u.mutation.GroupCleared() && len(_u.mutation.GroupIDs()) > 0 {
return errors.New(`ent: clearing a required unique edge "Location.group"`)
}
return nil
}
-func (lu *LocationUpdate) sqlSave(ctx context.Context) (n int, err error) {
- if err := lu.check(); err != nil {
- return n, err
+func (_u *LocationUpdate) sqlSave(ctx context.Context) (_node int, err error) {
+ if err := _u.check(); err != nil {
+ return _node, err
}
_spec := sqlgraph.NewUpdateSpec(location.Table, location.Columns, sqlgraph.NewFieldSpec(location.FieldID, field.TypeUUID))
- if ps := lu.mutation.predicates; len(ps) > 0 {
+ if ps := _u.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
- if value, ok := lu.mutation.UpdatedAt(); ok {
+ if value, ok := _u.mutation.UpdatedAt(); ok {
_spec.SetField(location.FieldUpdatedAt, field.TypeTime, value)
}
- if value, ok := lu.mutation.Name(); ok {
+ if value, ok := _u.mutation.Name(); ok {
_spec.SetField(location.FieldName, field.TypeString, value)
}
- if value, ok := lu.mutation.Description(); ok {
+ if value, ok := _u.mutation.Description(); ok {
_spec.SetField(location.FieldDescription, field.TypeString, value)
}
- if lu.mutation.DescriptionCleared() {
+ if _u.mutation.DescriptionCleared() {
_spec.ClearField(location.FieldDescription, field.TypeString)
}
- if lu.mutation.GroupCleared() {
+ if _u.mutation.GroupCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -281,7 +281,7 @@ func (lu *LocationUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := lu.mutation.GroupIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.GroupIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -297,7 +297,7 @@ func (lu *LocationUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- if lu.mutation.ParentCleared() {
+ if _u.mutation.ParentCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -310,7 +310,7 @@ func (lu *LocationUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := lu.mutation.ParentIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.ParentIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -326,7 +326,7 @@ func (lu *LocationUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- if lu.mutation.ChildrenCleared() {
+ if _u.mutation.ChildrenCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -339,7 +339,7 @@ func (lu *LocationUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := lu.mutation.RemovedChildrenIDs(); len(nodes) > 0 && !lu.mutation.ChildrenCleared() {
+ if nodes := _u.mutation.RemovedChildrenIDs(); len(nodes) > 0 && !_u.mutation.ChildrenCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -355,7 +355,7 @@ func (lu *LocationUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := lu.mutation.ChildrenIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.ChildrenIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -371,7 +371,7 @@ func (lu *LocationUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- if lu.mutation.ItemsCleared() {
+ if _u.mutation.ItemsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -384,7 +384,7 @@ func (lu *LocationUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := lu.mutation.RemovedItemsIDs(); len(nodes) > 0 && !lu.mutation.ItemsCleared() {
+ if nodes := _u.mutation.RemovedItemsIDs(); len(nodes) > 0 && !_u.mutation.ItemsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -400,7 +400,7 @@ func (lu *LocationUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := lu.mutation.ItemsIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.ItemsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -416,7 +416,7 @@ func (lu *LocationUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- if n, err = sqlgraph.UpdateNodes(ctx, lu.driver, _spec); err != nil {
+ if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil {
if _, ok := err.(*sqlgraph.NotFoundError); ok {
err = &NotFoundError{location.Label}
} else if sqlgraph.IsConstraintError(err) {
@@ -424,8 +424,8 @@ func (lu *LocationUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
return 0, err
}
- lu.mutation.done = true
- return n, nil
+ _u.mutation.done = true
+ return _node, nil
}
// LocationUpdateOne is the builder for updating a single Location entity.
@@ -437,186 +437,186 @@ type LocationUpdateOne struct {
}
// SetUpdatedAt sets the "updated_at" field.
-func (luo *LocationUpdateOne) SetUpdatedAt(t time.Time) *LocationUpdateOne {
- luo.mutation.SetUpdatedAt(t)
- return luo
+func (_u *LocationUpdateOne) SetUpdatedAt(v time.Time) *LocationUpdateOne {
+ _u.mutation.SetUpdatedAt(v)
+ return _u
}
// SetName sets the "name" field.
-func (luo *LocationUpdateOne) SetName(s string) *LocationUpdateOne {
- luo.mutation.SetName(s)
- return luo
+func (_u *LocationUpdateOne) SetName(v string) *LocationUpdateOne {
+ _u.mutation.SetName(v)
+ return _u
}
// SetNillableName sets the "name" field if the given value is not nil.
-func (luo *LocationUpdateOne) SetNillableName(s *string) *LocationUpdateOne {
- if s != nil {
- luo.SetName(*s)
+func (_u *LocationUpdateOne) SetNillableName(v *string) *LocationUpdateOne {
+ if v != nil {
+ _u.SetName(*v)
}
- return luo
+ return _u
}
// SetDescription sets the "description" field.
-func (luo *LocationUpdateOne) SetDescription(s string) *LocationUpdateOne {
- luo.mutation.SetDescription(s)
- return luo
+func (_u *LocationUpdateOne) SetDescription(v string) *LocationUpdateOne {
+ _u.mutation.SetDescription(v)
+ return _u
}
// SetNillableDescription sets the "description" field if the given value is not nil.
-func (luo *LocationUpdateOne) SetNillableDescription(s *string) *LocationUpdateOne {
- if s != nil {
- luo.SetDescription(*s)
+func (_u *LocationUpdateOne) SetNillableDescription(v *string) *LocationUpdateOne {
+ if v != nil {
+ _u.SetDescription(*v)
}
- return luo
+ return _u
}
// ClearDescription clears the value of the "description" field.
-func (luo *LocationUpdateOne) ClearDescription() *LocationUpdateOne {
- luo.mutation.ClearDescription()
- return luo
+func (_u *LocationUpdateOne) ClearDescription() *LocationUpdateOne {
+ _u.mutation.ClearDescription()
+ return _u
}
// SetGroupID sets the "group" edge to the Group entity by ID.
-func (luo *LocationUpdateOne) SetGroupID(id uuid.UUID) *LocationUpdateOne {
- luo.mutation.SetGroupID(id)
- return luo
+func (_u *LocationUpdateOne) SetGroupID(id uuid.UUID) *LocationUpdateOne {
+ _u.mutation.SetGroupID(id)
+ return _u
}
// SetGroup sets the "group" edge to the Group entity.
-func (luo *LocationUpdateOne) SetGroup(g *Group) *LocationUpdateOne {
- return luo.SetGroupID(g.ID)
+func (_u *LocationUpdateOne) SetGroup(v *Group) *LocationUpdateOne {
+ return _u.SetGroupID(v.ID)
}
// SetParentID sets the "parent" edge to the Location entity by ID.
-func (luo *LocationUpdateOne) SetParentID(id uuid.UUID) *LocationUpdateOne {
- luo.mutation.SetParentID(id)
- return luo
+func (_u *LocationUpdateOne) SetParentID(id uuid.UUID) *LocationUpdateOne {
+ _u.mutation.SetParentID(id)
+ return _u
}
// SetNillableParentID sets the "parent" edge to the Location entity by ID if the given value is not nil.
-func (luo *LocationUpdateOne) SetNillableParentID(id *uuid.UUID) *LocationUpdateOne {
+func (_u *LocationUpdateOne) SetNillableParentID(id *uuid.UUID) *LocationUpdateOne {
if id != nil {
- luo = luo.SetParentID(*id)
+ _u = _u.SetParentID(*id)
}
- return luo
+ return _u
}
// SetParent sets the "parent" edge to the Location entity.
-func (luo *LocationUpdateOne) SetParent(l *Location) *LocationUpdateOne {
- return luo.SetParentID(l.ID)
+func (_u *LocationUpdateOne) SetParent(v *Location) *LocationUpdateOne {
+ return _u.SetParentID(v.ID)
}
// AddChildIDs adds the "children" edge to the Location entity by IDs.
-func (luo *LocationUpdateOne) AddChildIDs(ids ...uuid.UUID) *LocationUpdateOne {
- luo.mutation.AddChildIDs(ids...)
- return luo
+func (_u *LocationUpdateOne) AddChildIDs(ids ...uuid.UUID) *LocationUpdateOne {
+ _u.mutation.AddChildIDs(ids...)
+ return _u
}
// AddChildren adds the "children" edges to the Location entity.
-func (luo *LocationUpdateOne) AddChildren(l ...*Location) *LocationUpdateOne {
- ids := make([]uuid.UUID, len(l))
- for i := range l {
- ids[i] = l[i].ID
+func (_u *LocationUpdateOne) AddChildren(v ...*Location) *LocationUpdateOne {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return luo.AddChildIDs(ids...)
+ return _u.AddChildIDs(ids...)
}
// AddItemIDs adds the "items" edge to the Item entity by IDs.
-func (luo *LocationUpdateOne) AddItemIDs(ids ...uuid.UUID) *LocationUpdateOne {
- luo.mutation.AddItemIDs(ids...)
- return luo
+func (_u *LocationUpdateOne) AddItemIDs(ids ...uuid.UUID) *LocationUpdateOne {
+ _u.mutation.AddItemIDs(ids...)
+ return _u
}
// AddItems adds the "items" edges to the Item entity.
-func (luo *LocationUpdateOne) AddItems(i ...*Item) *LocationUpdateOne {
- ids := make([]uuid.UUID, len(i))
- for j := range i {
- ids[j] = i[j].ID
+func (_u *LocationUpdateOne) AddItems(v ...*Item) *LocationUpdateOne {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return luo.AddItemIDs(ids...)
+ return _u.AddItemIDs(ids...)
}
// Mutation returns the LocationMutation object of the builder.
-func (luo *LocationUpdateOne) Mutation() *LocationMutation {
- return luo.mutation
+func (_u *LocationUpdateOne) Mutation() *LocationMutation {
+ return _u.mutation
}
// ClearGroup clears the "group" edge to the Group entity.
-func (luo *LocationUpdateOne) ClearGroup() *LocationUpdateOne {
- luo.mutation.ClearGroup()
- return luo
+func (_u *LocationUpdateOne) ClearGroup() *LocationUpdateOne {
+ _u.mutation.ClearGroup()
+ return _u
}
// ClearParent clears the "parent" edge to the Location entity.
-func (luo *LocationUpdateOne) ClearParent() *LocationUpdateOne {
- luo.mutation.ClearParent()
- return luo
+func (_u *LocationUpdateOne) ClearParent() *LocationUpdateOne {
+ _u.mutation.ClearParent()
+ return _u
}
// ClearChildren clears all "children" edges to the Location entity.
-func (luo *LocationUpdateOne) ClearChildren() *LocationUpdateOne {
- luo.mutation.ClearChildren()
- return luo
+func (_u *LocationUpdateOne) ClearChildren() *LocationUpdateOne {
+ _u.mutation.ClearChildren()
+ return _u
}
// RemoveChildIDs removes the "children" edge to Location entities by IDs.
-func (luo *LocationUpdateOne) RemoveChildIDs(ids ...uuid.UUID) *LocationUpdateOne {
- luo.mutation.RemoveChildIDs(ids...)
- return luo
+func (_u *LocationUpdateOne) RemoveChildIDs(ids ...uuid.UUID) *LocationUpdateOne {
+ _u.mutation.RemoveChildIDs(ids...)
+ return _u
}
// RemoveChildren removes "children" edges to Location entities.
-func (luo *LocationUpdateOne) RemoveChildren(l ...*Location) *LocationUpdateOne {
- ids := make([]uuid.UUID, len(l))
- for i := range l {
- ids[i] = l[i].ID
+func (_u *LocationUpdateOne) RemoveChildren(v ...*Location) *LocationUpdateOne {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return luo.RemoveChildIDs(ids...)
+ return _u.RemoveChildIDs(ids...)
}
// ClearItems clears all "items" edges to the Item entity.
-func (luo *LocationUpdateOne) ClearItems() *LocationUpdateOne {
- luo.mutation.ClearItems()
- return luo
+func (_u *LocationUpdateOne) ClearItems() *LocationUpdateOne {
+ _u.mutation.ClearItems()
+ return _u
}
// RemoveItemIDs removes the "items" edge to Item entities by IDs.
-func (luo *LocationUpdateOne) RemoveItemIDs(ids ...uuid.UUID) *LocationUpdateOne {
- luo.mutation.RemoveItemIDs(ids...)
- return luo
+func (_u *LocationUpdateOne) RemoveItemIDs(ids ...uuid.UUID) *LocationUpdateOne {
+ _u.mutation.RemoveItemIDs(ids...)
+ return _u
}
// RemoveItems removes "items" edges to Item entities.
-func (luo *LocationUpdateOne) RemoveItems(i ...*Item) *LocationUpdateOne {
- ids := make([]uuid.UUID, len(i))
- for j := range i {
- ids[j] = i[j].ID
+func (_u *LocationUpdateOne) RemoveItems(v ...*Item) *LocationUpdateOne {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return luo.RemoveItemIDs(ids...)
+ return _u.RemoveItemIDs(ids...)
}
// Where appends a list predicates to the LocationUpdate builder.
-func (luo *LocationUpdateOne) Where(ps ...predicate.Location) *LocationUpdateOne {
- luo.mutation.Where(ps...)
- return luo
+func (_u *LocationUpdateOne) Where(ps ...predicate.Location) *LocationUpdateOne {
+ _u.mutation.Where(ps...)
+ return _u
}
// Select allows selecting one or more fields (columns) of the returned entity.
// The default is selecting all fields defined in the entity schema.
-func (luo *LocationUpdateOne) Select(field string, fields ...string) *LocationUpdateOne {
- luo.fields = append([]string{field}, fields...)
- return luo
+func (_u *LocationUpdateOne) Select(field string, fields ...string) *LocationUpdateOne {
+ _u.fields = append([]string{field}, fields...)
+ return _u
}
// Save executes the query and returns the updated Location entity.
-func (luo *LocationUpdateOne) Save(ctx context.Context) (*Location, error) {
- luo.defaults()
- return withHooks(ctx, luo.sqlSave, luo.mutation, luo.hooks)
+func (_u *LocationUpdateOne) Save(ctx context.Context) (*Location, error) {
+ _u.defaults()
+ return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
}
// SaveX is like Save, but panics if an error occurs.
-func (luo *LocationUpdateOne) SaveX(ctx context.Context) *Location {
- node, err := luo.Save(ctx)
+func (_u *LocationUpdateOne) SaveX(ctx context.Context) *Location {
+ node, err := _u.Save(ctx)
if err != nil {
panic(err)
}
@@ -624,55 +624,55 @@ func (luo *LocationUpdateOne) SaveX(ctx context.Context) *Location {
}
// Exec executes the query on the entity.
-func (luo *LocationUpdateOne) Exec(ctx context.Context) error {
- _, err := luo.Save(ctx)
+func (_u *LocationUpdateOne) Exec(ctx context.Context) error {
+ _, err := _u.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
-func (luo *LocationUpdateOne) ExecX(ctx context.Context) {
- if err := luo.Exec(ctx); err != nil {
+func (_u *LocationUpdateOne) ExecX(ctx context.Context) {
+ if err := _u.Exec(ctx); err != nil {
panic(err)
}
}
// defaults sets the default values of the builder before save.
-func (luo *LocationUpdateOne) defaults() {
- if _, ok := luo.mutation.UpdatedAt(); !ok {
+func (_u *LocationUpdateOne) defaults() {
+ if _, ok := _u.mutation.UpdatedAt(); !ok {
v := location.UpdateDefaultUpdatedAt()
- luo.mutation.SetUpdatedAt(v)
+ _u.mutation.SetUpdatedAt(v)
}
}
// check runs all checks and user-defined validators on the builder.
-func (luo *LocationUpdateOne) check() error {
- if v, ok := luo.mutation.Name(); ok {
+func (_u *LocationUpdateOne) check() error {
+ if v, ok := _u.mutation.Name(); ok {
if err := location.NameValidator(v); err != nil {
return &ValidationError{Name: "name", err: fmt.Errorf(`ent: validator failed for field "Location.name": %w`, err)}
}
}
- if v, ok := luo.mutation.Description(); ok {
+ if v, ok := _u.mutation.Description(); ok {
if err := location.DescriptionValidator(v); err != nil {
return &ValidationError{Name: "description", err: fmt.Errorf(`ent: validator failed for field "Location.description": %w`, err)}
}
}
- if luo.mutation.GroupCleared() && len(luo.mutation.GroupIDs()) > 0 {
+ if _u.mutation.GroupCleared() && len(_u.mutation.GroupIDs()) > 0 {
return errors.New(`ent: clearing a required unique edge "Location.group"`)
}
return nil
}
-func (luo *LocationUpdateOne) sqlSave(ctx context.Context) (_node *Location, err error) {
- if err := luo.check(); err != nil {
+func (_u *LocationUpdateOne) sqlSave(ctx context.Context) (_node *Location, err error) {
+ if err := _u.check(); err != nil {
return _node, err
}
_spec := sqlgraph.NewUpdateSpec(location.Table, location.Columns, sqlgraph.NewFieldSpec(location.FieldID, field.TypeUUID))
- id, ok := luo.mutation.ID()
+ id, ok := _u.mutation.ID()
if !ok {
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Location.id" for update`)}
}
_spec.Node.ID.Value = id
- if fields := luo.fields; len(fields) > 0 {
+ if fields := _u.fields; len(fields) > 0 {
_spec.Node.Columns = make([]string, 0, len(fields))
_spec.Node.Columns = append(_spec.Node.Columns, location.FieldID)
for _, f := range fields {
@@ -684,26 +684,26 @@ func (luo *LocationUpdateOne) sqlSave(ctx context.Context) (_node *Location, err
}
}
}
- if ps := luo.mutation.predicates; len(ps) > 0 {
+ if ps := _u.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
- if value, ok := luo.mutation.UpdatedAt(); ok {
+ if value, ok := _u.mutation.UpdatedAt(); ok {
_spec.SetField(location.FieldUpdatedAt, field.TypeTime, value)
}
- if value, ok := luo.mutation.Name(); ok {
+ if value, ok := _u.mutation.Name(); ok {
_spec.SetField(location.FieldName, field.TypeString, value)
}
- if value, ok := luo.mutation.Description(); ok {
+ if value, ok := _u.mutation.Description(); ok {
_spec.SetField(location.FieldDescription, field.TypeString, value)
}
- if luo.mutation.DescriptionCleared() {
+ if _u.mutation.DescriptionCleared() {
_spec.ClearField(location.FieldDescription, field.TypeString)
}
- if luo.mutation.GroupCleared() {
+ if _u.mutation.GroupCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -716,7 +716,7 @@ func (luo *LocationUpdateOne) sqlSave(ctx context.Context) (_node *Location, err
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := luo.mutation.GroupIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.GroupIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -732,7 +732,7 @@ func (luo *LocationUpdateOne) sqlSave(ctx context.Context) (_node *Location, err
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- if luo.mutation.ParentCleared() {
+ if _u.mutation.ParentCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -745,7 +745,7 @@ func (luo *LocationUpdateOne) sqlSave(ctx context.Context) (_node *Location, err
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := luo.mutation.ParentIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.ParentIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -761,7 +761,7 @@ func (luo *LocationUpdateOne) sqlSave(ctx context.Context) (_node *Location, err
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- if luo.mutation.ChildrenCleared() {
+ if _u.mutation.ChildrenCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -774,7 +774,7 @@ func (luo *LocationUpdateOne) sqlSave(ctx context.Context) (_node *Location, err
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := luo.mutation.RemovedChildrenIDs(); len(nodes) > 0 && !luo.mutation.ChildrenCleared() {
+ if nodes := _u.mutation.RemovedChildrenIDs(); len(nodes) > 0 && !_u.mutation.ChildrenCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -790,7 +790,7 @@ func (luo *LocationUpdateOne) sqlSave(ctx context.Context) (_node *Location, err
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := luo.mutation.ChildrenIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.ChildrenIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -806,7 +806,7 @@ func (luo *LocationUpdateOne) sqlSave(ctx context.Context) (_node *Location, err
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- if luo.mutation.ItemsCleared() {
+ if _u.mutation.ItemsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -819,7 +819,7 @@ func (luo *LocationUpdateOne) sqlSave(ctx context.Context) (_node *Location, err
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := luo.mutation.RemovedItemsIDs(); len(nodes) > 0 && !luo.mutation.ItemsCleared() {
+ if nodes := _u.mutation.RemovedItemsIDs(); len(nodes) > 0 && !_u.mutation.ItemsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -835,7 +835,7 @@ func (luo *LocationUpdateOne) sqlSave(ctx context.Context) (_node *Location, err
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := luo.mutation.ItemsIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.ItemsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -851,10 +851,10 @@ func (luo *LocationUpdateOne) sqlSave(ctx context.Context) (_node *Location, err
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- _node = &Location{config: luo.config}
+ _node = &Location{config: _u.config}
_spec.Assign = _node.assignValues
_spec.ScanValues = _node.scanValues
- if err = sqlgraph.UpdateNode(ctx, luo.driver, _spec); err != nil {
+ if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil {
if _, ok := err.(*sqlgraph.NotFoundError); ok {
err = &NotFoundError{location.Label}
} else if sqlgraph.IsConstraintError(err) {
@@ -862,6 +862,6 @@ func (luo *LocationUpdateOne) sqlSave(ctx context.Context) (_node *Location, err
}
return nil, err
}
- luo.mutation.done = true
+ _u.mutation.done = true
return _node, nil
}
diff --git a/backend/internal/data/ent/maintenanceentry.go b/backend/internal/data/ent/maintenanceentry.go
index c5417d21..9d870b78 100644
--- a/backend/internal/data/ent/maintenanceentry.go
+++ b/backend/internal/data/ent/maintenanceentry.go
@@ -83,7 +83,7 @@ func (*MaintenanceEntry) scanValues(columns []string) ([]any, error) {
// assignValues assigns the values that were returned from sql.Rows (after scanning)
// to the MaintenanceEntry fields.
-func (me *MaintenanceEntry) assignValues(columns []string, values []any) error {
+func (_m *MaintenanceEntry) assignValues(columns []string, values []any) error {
if m, n := len(values), len(columns); m < n {
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
}
@@ -93,58 +93,58 @@ func (me *MaintenanceEntry) assignValues(columns []string, values []any) error {
if value, ok := values[i].(*uuid.UUID); !ok {
return fmt.Errorf("unexpected type %T for field id", values[i])
} else if value != nil {
- me.ID = *value
+ _m.ID = *value
}
case maintenanceentry.FieldCreatedAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field created_at", values[i])
} else if value.Valid {
- me.CreatedAt = value.Time
+ _m.CreatedAt = value.Time
}
case maintenanceentry.FieldUpdatedAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field updated_at", values[i])
} else if value.Valid {
- me.UpdatedAt = value.Time
+ _m.UpdatedAt = value.Time
}
case maintenanceentry.FieldItemID:
if value, ok := values[i].(*uuid.UUID); !ok {
return fmt.Errorf("unexpected type %T for field item_id", values[i])
} else if value != nil {
- me.ItemID = *value
+ _m.ItemID = *value
}
case maintenanceentry.FieldDate:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field date", values[i])
} else if value.Valid {
- me.Date = value.Time
+ _m.Date = value.Time
}
case maintenanceentry.FieldScheduledDate:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field scheduled_date", values[i])
} else if value.Valid {
- me.ScheduledDate = value.Time
+ _m.ScheduledDate = value.Time
}
case maintenanceentry.FieldName:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field name", values[i])
} else if value.Valid {
- me.Name = value.String
+ _m.Name = value.String
}
case maintenanceentry.FieldDescription:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field description", values[i])
} else if value.Valid {
- me.Description = value.String
+ _m.Description = value.String
}
case maintenanceentry.FieldCost:
if value, ok := values[i].(*sql.NullFloat64); !ok {
return fmt.Errorf("unexpected type %T for field cost", values[i])
} else if value.Valid {
- me.Cost = value.Float64
+ _m.Cost = value.Float64
}
default:
- me.selectValues.Set(columns[i], values[i])
+ _m.selectValues.Set(columns[i], values[i])
}
}
return nil
@@ -152,61 +152,61 @@ func (me *MaintenanceEntry) assignValues(columns []string, values []any) error {
// Value returns the ent.Value that was dynamically selected and assigned to the MaintenanceEntry.
// This includes values selected through modifiers, order, etc.
-func (me *MaintenanceEntry) Value(name string) (ent.Value, error) {
- return me.selectValues.Get(name)
+func (_m *MaintenanceEntry) Value(name string) (ent.Value, error) {
+ return _m.selectValues.Get(name)
}
// QueryItem queries the "item" edge of the MaintenanceEntry entity.
-func (me *MaintenanceEntry) QueryItem() *ItemQuery {
- return NewMaintenanceEntryClient(me.config).QueryItem(me)
+func (_m *MaintenanceEntry) QueryItem() *ItemQuery {
+ return NewMaintenanceEntryClient(_m.config).QueryItem(_m)
}
// Update returns a builder for updating this MaintenanceEntry.
// Note that you need to call MaintenanceEntry.Unwrap() before calling this method if this MaintenanceEntry
// was returned from a transaction, and the transaction was committed or rolled back.
-func (me *MaintenanceEntry) Update() *MaintenanceEntryUpdateOne {
- return NewMaintenanceEntryClient(me.config).UpdateOne(me)
+func (_m *MaintenanceEntry) Update() *MaintenanceEntryUpdateOne {
+ return NewMaintenanceEntryClient(_m.config).UpdateOne(_m)
}
// Unwrap unwraps the MaintenanceEntry 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 (me *MaintenanceEntry) Unwrap() *MaintenanceEntry {
- _tx, ok := me.config.driver.(*txDriver)
+func (_m *MaintenanceEntry) Unwrap() *MaintenanceEntry {
+ _tx, ok := _m.config.driver.(*txDriver)
if !ok {
panic("ent: MaintenanceEntry is not a transactional entity")
}
- me.config.driver = _tx.drv
- return me
+ _m.config.driver = _tx.drv
+ return _m
}
// String implements the fmt.Stringer.
-func (me *MaintenanceEntry) String() string {
+func (_m *MaintenanceEntry) String() string {
var builder strings.Builder
builder.WriteString("MaintenanceEntry(")
- builder.WriteString(fmt.Sprintf("id=%v, ", me.ID))
+ builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
builder.WriteString("created_at=")
- builder.WriteString(me.CreatedAt.Format(time.ANSIC))
+ builder.WriteString(_m.CreatedAt.Format(time.ANSIC))
builder.WriteString(", ")
builder.WriteString("updated_at=")
- builder.WriteString(me.UpdatedAt.Format(time.ANSIC))
+ builder.WriteString(_m.UpdatedAt.Format(time.ANSIC))
builder.WriteString(", ")
builder.WriteString("item_id=")
- builder.WriteString(fmt.Sprintf("%v", me.ItemID))
+ builder.WriteString(fmt.Sprintf("%v", _m.ItemID))
builder.WriteString(", ")
builder.WriteString("date=")
- builder.WriteString(me.Date.Format(time.ANSIC))
+ builder.WriteString(_m.Date.Format(time.ANSIC))
builder.WriteString(", ")
builder.WriteString("scheduled_date=")
- builder.WriteString(me.ScheduledDate.Format(time.ANSIC))
+ builder.WriteString(_m.ScheduledDate.Format(time.ANSIC))
builder.WriteString(", ")
builder.WriteString("name=")
- builder.WriteString(me.Name)
+ builder.WriteString(_m.Name)
builder.WriteString(", ")
builder.WriteString("description=")
- builder.WriteString(me.Description)
+ builder.WriteString(_m.Description)
builder.WriteString(", ")
builder.WriteString("cost=")
- builder.WriteString(fmt.Sprintf("%v", me.Cost))
+ builder.WriteString(fmt.Sprintf("%v", _m.Cost))
builder.WriteByte(')')
return builder.String()
}
diff --git a/backend/internal/data/ent/maintenanceentry_create.go b/backend/internal/data/ent/maintenanceentry_create.go
index b8df2734..75d3bb82 100644
--- a/backend/internal/data/ent/maintenanceentry_create.go
+++ b/backend/internal/data/ent/maintenanceentry_create.go
@@ -23,134 +23,134 @@ type MaintenanceEntryCreate struct {
}
// SetCreatedAt sets the "created_at" field.
-func (mec *MaintenanceEntryCreate) SetCreatedAt(t time.Time) *MaintenanceEntryCreate {
- mec.mutation.SetCreatedAt(t)
- return mec
+func (_c *MaintenanceEntryCreate) SetCreatedAt(v time.Time) *MaintenanceEntryCreate {
+ _c.mutation.SetCreatedAt(v)
+ return _c
}
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
-func (mec *MaintenanceEntryCreate) SetNillableCreatedAt(t *time.Time) *MaintenanceEntryCreate {
- if t != nil {
- mec.SetCreatedAt(*t)
+func (_c *MaintenanceEntryCreate) SetNillableCreatedAt(v *time.Time) *MaintenanceEntryCreate {
+ if v != nil {
+ _c.SetCreatedAt(*v)
}
- return mec
+ return _c
}
// SetUpdatedAt sets the "updated_at" field.
-func (mec *MaintenanceEntryCreate) SetUpdatedAt(t time.Time) *MaintenanceEntryCreate {
- mec.mutation.SetUpdatedAt(t)
- return mec
+func (_c *MaintenanceEntryCreate) SetUpdatedAt(v time.Time) *MaintenanceEntryCreate {
+ _c.mutation.SetUpdatedAt(v)
+ return _c
}
// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
-func (mec *MaintenanceEntryCreate) SetNillableUpdatedAt(t *time.Time) *MaintenanceEntryCreate {
- if t != nil {
- mec.SetUpdatedAt(*t)
+func (_c *MaintenanceEntryCreate) SetNillableUpdatedAt(v *time.Time) *MaintenanceEntryCreate {
+ if v != nil {
+ _c.SetUpdatedAt(*v)
}
- return mec
+ return _c
}
// SetItemID sets the "item_id" field.
-func (mec *MaintenanceEntryCreate) SetItemID(u uuid.UUID) *MaintenanceEntryCreate {
- mec.mutation.SetItemID(u)
- return mec
+func (_c *MaintenanceEntryCreate) SetItemID(v uuid.UUID) *MaintenanceEntryCreate {
+ _c.mutation.SetItemID(v)
+ return _c
}
// SetDate sets the "date" field.
-func (mec *MaintenanceEntryCreate) SetDate(t time.Time) *MaintenanceEntryCreate {
- mec.mutation.SetDate(t)
- return mec
+func (_c *MaintenanceEntryCreate) SetDate(v time.Time) *MaintenanceEntryCreate {
+ _c.mutation.SetDate(v)
+ return _c
}
// SetNillableDate sets the "date" field if the given value is not nil.
-func (mec *MaintenanceEntryCreate) SetNillableDate(t *time.Time) *MaintenanceEntryCreate {
- if t != nil {
- mec.SetDate(*t)
+func (_c *MaintenanceEntryCreate) SetNillableDate(v *time.Time) *MaintenanceEntryCreate {
+ if v != nil {
+ _c.SetDate(*v)
}
- return mec
+ return _c
}
// SetScheduledDate sets the "scheduled_date" field.
-func (mec *MaintenanceEntryCreate) SetScheduledDate(t time.Time) *MaintenanceEntryCreate {
- mec.mutation.SetScheduledDate(t)
- return mec
+func (_c *MaintenanceEntryCreate) SetScheduledDate(v time.Time) *MaintenanceEntryCreate {
+ _c.mutation.SetScheduledDate(v)
+ return _c
}
// SetNillableScheduledDate sets the "scheduled_date" field if the given value is not nil.
-func (mec *MaintenanceEntryCreate) SetNillableScheduledDate(t *time.Time) *MaintenanceEntryCreate {
- if t != nil {
- mec.SetScheduledDate(*t)
+func (_c *MaintenanceEntryCreate) SetNillableScheduledDate(v *time.Time) *MaintenanceEntryCreate {
+ if v != nil {
+ _c.SetScheduledDate(*v)
}
- return mec
+ return _c
}
// SetName sets the "name" field.
-func (mec *MaintenanceEntryCreate) SetName(s string) *MaintenanceEntryCreate {
- mec.mutation.SetName(s)
- return mec
+func (_c *MaintenanceEntryCreate) SetName(v string) *MaintenanceEntryCreate {
+ _c.mutation.SetName(v)
+ return _c
}
// SetDescription sets the "description" field.
-func (mec *MaintenanceEntryCreate) SetDescription(s string) *MaintenanceEntryCreate {
- mec.mutation.SetDescription(s)
- return mec
+func (_c *MaintenanceEntryCreate) SetDescription(v string) *MaintenanceEntryCreate {
+ _c.mutation.SetDescription(v)
+ return _c
}
// SetNillableDescription sets the "description" field if the given value is not nil.
-func (mec *MaintenanceEntryCreate) SetNillableDescription(s *string) *MaintenanceEntryCreate {
- if s != nil {
- mec.SetDescription(*s)
+func (_c *MaintenanceEntryCreate) SetNillableDescription(v *string) *MaintenanceEntryCreate {
+ if v != nil {
+ _c.SetDescription(*v)
}
- return mec
+ return _c
}
// SetCost sets the "cost" field.
-func (mec *MaintenanceEntryCreate) SetCost(f float64) *MaintenanceEntryCreate {
- mec.mutation.SetCost(f)
- return mec
+func (_c *MaintenanceEntryCreate) SetCost(v float64) *MaintenanceEntryCreate {
+ _c.mutation.SetCost(v)
+ return _c
}
// SetNillableCost sets the "cost" field if the given value is not nil.
-func (mec *MaintenanceEntryCreate) SetNillableCost(f *float64) *MaintenanceEntryCreate {
- if f != nil {
- mec.SetCost(*f)
+func (_c *MaintenanceEntryCreate) SetNillableCost(v *float64) *MaintenanceEntryCreate {
+ if v != nil {
+ _c.SetCost(*v)
}
- return mec
+ return _c
}
// SetID sets the "id" field.
-func (mec *MaintenanceEntryCreate) SetID(u uuid.UUID) *MaintenanceEntryCreate {
- mec.mutation.SetID(u)
- return mec
+func (_c *MaintenanceEntryCreate) SetID(v uuid.UUID) *MaintenanceEntryCreate {
+ _c.mutation.SetID(v)
+ return _c
}
// SetNillableID sets the "id" field if the given value is not nil.
-func (mec *MaintenanceEntryCreate) SetNillableID(u *uuid.UUID) *MaintenanceEntryCreate {
- if u != nil {
- mec.SetID(*u)
+func (_c *MaintenanceEntryCreate) SetNillableID(v *uuid.UUID) *MaintenanceEntryCreate {
+ if v != nil {
+ _c.SetID(*v)
}
- return mec
+ return _c
}
// SetItem sets the "item" edge to the Item entity.
-func (mec *MaintenanceEntryCreate) SetItem(i *Item) *MaintenanceEntryCreate {
- return mec.SetItemID(i.ID)
+func (_c *MaintenanceEntryCreate) SetItem(v *Item) *MaintenanceEntryCreate {
+ return _c.SetItemID(v.ID)
}
// Mutation returns the MaintenanceEntryMutation object of the builder.
-func (mec *MaintenanceEntryCreate) Mutation() *MaintenanceEntryMutation {
- return mec.mutation
+func (_c *MaintenanceEntryCreate) Mutation() *MaintenanceEntryMutation {
+ return _c.mutation
}
// Save creates the MaintenanceEntry in the database.
-func (mec *MaintenanceEntryCreate) Save(ctx context.Context) (*MaintenanceEntry, error) {
- mec.defaults()
- return withHooks(ctx, mec.sqlSave, mec.mutation, mec.hooks)
+func (_c *MaintenanceEntryCreate) Save(ctx context.Context) (*MaintenanceEntry, error) {
+ _c.defaults()
+ return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
}
// SaveX calls Save and panics if Save returns an error.
-func (mec *MaintenanceEntryCreate) SaveX(ctx context.Context) *MaintenanceEntry {
- v, err := mec.Save(ctx)
+func (_c *MaintenanceEntryCreate) SaveX(ctx context.Context) *MaintenanceEntry {
+ v, err := _c.Save(ctx)
if err != nil {
panic(err)
}
@@ -158,77 +158,77 @@ func (mec *MaintenanceEntryCreate) SaveX(ctx context.Context) *MaintenanceEntry
}
// Exec executes the query.
-func (mec *MaintenanceEntryCreate) Exec(ctx context.Context) error {
- _, err := mec.Save(ctx)
+func (_c *MaintenanceEntryCreate) Exec(ctx context.Context) error {
+ _, err := _c.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
-func (mec *MaintenanceEntryCreate) ExecX(ctx context.Context) {
- if err := mec.Exec(ctx); err != nil {
+func (_c *MaintenanceEntryCreate) ExecX(ctx context.Context) {
+ if err := _c.Exec(ctx); err != nil {
panic(err)
}
}
// defaults sets the default values of the builder before save.
-func (mec *MaintenanceEntryCreate) defaults() {
- if _, ok := mec.mutation.CreatedAt(); !ok {
+func (_c *MaintenanceEntryCreate) defaults() {
+ if _, ok := _c.mutation.CreatedAt(); !ok {
v := maintenanceentry.DefaultCreatedAt()
- mec.mutation.SetCreatedAt(v)
+ _c.mutation.SetCreatedAt(v)
}
- if _, ok := mec.mutation.UpdatedAt(); !ok {
+ if _, ok := _c.mutation.UpdatedAt(); !ok {
v := maintenanceentry.DefaultUpdatedAt()
- mec.mutation.SetUpdatedAt(v)
+ _c.mutation.SetUpdatedAt(v)
}
- if _, ok := mec.mutation.Cost(); !ok {
+ if _, ok := _c.mutation.Cost(); !ok {
v := maintenanceentry.DefaultCost
- mec.mutation.SetCost(v)
+ _c.mutation.SetCost(v)
}
- if _, ok := mec.mutation.ID(); !ok {
+ if _, ok := _c.mutation.ID(); !ok {
v := maintenanceentry.DefaultID()
- mec.mutation.SetID(v)
+ _c.mutation.SetID(v)
}
}
// check runs all checks and user-defined validators on the builder.
-func (mec *MaintenanceEntryCreate) check() error {
- if _, ok := mec.mutation.CreatedAt(); !ok {
+func (_c *MaintenanceEntryCreate) check() error {
+ if _, ok := _c.mutation.CreatedAt(); !ok {
return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "MaintenanceEntry.created_at"`)}
}
- if _, ok := mec.mutation.UpdatedAt(); !ok {
+ if _, ok := _c.mutation.UpdatedAt(); !ok {
return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "MaintenanceEntry.updated_at"`)}
}
- if _, ok := mec.mutation.ItemID(); !ok {
+ if _, ok := _c.mutation.ItemID(); !ok {
return &ValidationError{Name: "item_id", err: errors.New(`ent: missing required field "MaintenanceEntry.item_id"`)}
}
- if _, ok := mec.mutation.Name(); !ok {
+ if _, ok := _c.mutation.Name(); !ok {
return &ValidationError{Name: "name", err: errors.New(`ent: missing required field "MaintenanceEntry.name"`)}
}
- if v, ok := mec.mutation.Name(); ok {
+ if v, ok := _c.mutation.Name(); ok {
if err := maintenanceentry.NameValidator(v); err != nil {
return &ValidationError{Name: "name", err: fmt.Errorf(`ent: validator failed for field "MaintenanceEntry.name": %w`, err)}
}
}
- if v, ok := mec.mutation.Description(); ok {
+ if v, ok := _c.mutation.Description(); ok {
if err := maintenanceentry.DescriptionValidator(v); err != nil {
return &ValidationError{Name: "description", err: fmt.Errorf(`ent: validator failed for field "MaintenanceEntry.description": %w`, err)}
}
}
- if _, ok := mec.mutation.Cost(); !ok {
+ if _, ok := _c.mutation.Cost(); !ok {
return &ValidationError{Name: "cost", err: errors.New(`ent: missing required field "MaintenanceEntry.cost"`)}
}
- if len(mec.mutation.ItemIDs()) == 0 {
+ if len(_c.mutation.ItemIDs()) == 0 {
return &ValidationError{Name: "item", err: errors.New(`ent: missing required edge "MaintenanceEntry.item"`)}
}
return nil
}
-func (mec *MaintenanceEntryCreate) sqlSave(ctx context.Context) (*MaintenanceEntry, error) {
- if err := mec.check(); err != nil {
+func (_c *MaintenanceEntryCreate) sqlSave(ctx context.Context) (*MaintenanceEntry, error) {
+ if err := _c.check(); err != nil {
return nil, err
}
- _node, _spec := mec.createSpec()
- if err := sqlgraph.CreateNode(ctx, mec.driver, _spec); err != nil {
+ _node, _spec := _c.createSpec()
+ if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil {
if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
@@ -241,49 +241,49 @@ func (mec *MaintenanceEntryCreate) sqlSave(ctx context.Context) (*MaintenanceEnt
return nil, err
}
}
- mec.mutation.id = &_node.ID
- mec.mutation.done = true
+ _c.mutation.id = &_node.ID
+ _c.mutation.done = true
return _node, nil
}
-func (mec *MaintenanceEntryCreate) createSpec() (*MaintenanceEntry, *sqlgraph.CreateSpec) {
+func (_c *MaintenanceEntryCreate) createSpec() (*MaintenanceEntry, *sqlgraph.CreateSpec) {
var (
- _node = &MaintenanceEntry{config: mec.config}
+ _node = &MaintenanceEntry{config: _c.config}
_spec = sqlgraph.NewCreateSpec(maintenanceentry.Table, sqlgraph.NewFieldSpec(maintenanceentry.FieldID, field.TypeUUID))
)
- if id, ok := mec.mutation.ID(); ok {
+ if id, ok := _c.mutation.ID(); ok {
_node.ID = id
_spec.ID.Value = &id
}
- if value, ok := mec.mutation.CreatedAt(); ok {
+ if value, ok := _c.mutation.CreatedAt(); ok {
_spec.SetField(maintenanceentry.FieldCreatedAt, field.TypeTime, value)
_node.CreatedAt = value
}
- if value, ok := mec.mutation.UpdatedAt(); ok {
+ if value, ok := _c.mutation.UpdatedAt(); ok {
_spec.SetField(maintenanceentry.FieldUpdatedAt, field.TypeTime, value)
_node.UpdatedAt = value
}
- if value, ok := mec.mutation.Date(); ok {
+ if value, ok := _c.mutation.Date(); ok {
_spec.SetField(maintenanceentry.FieldDate, field.TypeTime, value)
_node.Date = value
}
- if value, ok := mec.mutation.ScheduledDate(); ok {
+ if value, ok := _c.mutation.ScheduledDate(); ok {
_spec.SetField(maintenanceentry.FieldScheduledDate, field.TypeTime, value)
_node.ScheduledDate = value
}
- if value, ok := mec.mutation.Name(); ok {
+ if value, ok := _c.mutation.Name(); ok {
_spec.SetField(maintenanceentry.FieldName, field.TypeString, value)
_node.Name = value
}
- if value, ok := mec.mutation.Description(); ok {
+ if value, ok := _c.mutation.Description(); ok {
_spec.SetField(maintenanceentry.FieldDescription, field.TypeString, value)
_node.Description = value
}
- if value, ok := mec.mutation.Cost(); ok {
+ if value, ok := _c.mutation.Cost(); ok {
_spec.SetField(maintenanceentry.FieldCost, field.TypeFloat64, value)
_node.Cost = value
}
- if nodes := mec.mutation.ItemIDs(); len(nodes) > 0 {
+ if nodes := _c.mutation.ItemIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -311,16 +311,16 @@ type MaintenanceEntryCreateBulk struct {
}
// Save creates the MaintenanceEntry entities in the database.
-func (mecb *MaintenanceEntryCreateBulk) Save(ctx context.Context) ([]*MaintenanceEntry, error) {
- if mecb.err != nil {
- return nil, mecb.err
- }
- specs := make([]*sqlgraph.CreateSpec, len(mecb.builders))
- nodes := make([]*MaintenanceEntry, len(mecb.builders))
- mutators := make([]Mutator, len(mecb.builders))
- for i := range mecb.builders {
+func (_c *MaintenanceEntryCreateBulk) Save(ctx context.Context) ([]*MaintenanceEntry, error) {
+ if _c.err != nil {
+ return nil, _c.err
+ }
+ specs := make([]*sqlgraph.CreateSpec, len(_c.builders))
+ nodes := make([]*MaintenanceEntry, len(_c.builders))
+ mutators := make([]Mutator, len(_c.builders))
+ for i := range _c.builders {
func(i int, root context.Context) {
- builder := mecb.builders[i]
+ builder := _c.builders[i]
builder.defaults()
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
mutation, ok := m.(*MaintenanceEntryMutation)
@@ -334,11 +334,11 @@ func (mecb *MaintenanceEntryCreateBulk) Save(ctx context.Context) ([]*Maintenanc
var err error
nodes[i], specs[i] = builder.createSpec()
if i < len(mutators)-1 {
- _, err = mutators[i+1].Mutate(root, mecb.builders[i+1].mutation)
+ _, err = mutators[i+1].Mutate(root, _c.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, mecb.driver, spec); err != nil {
+ if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil {
if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
@@ -358,7 +358,7 @@ func (mecb *MaintenanceEntryCreateBulk) Save(ctx context.Context) ([]*Maintenanc
}(i, ctx)
}
if len(mutators) > 0 {
- if _, err := mutators[0].Mutate(ctx, mecb.builders[0].mutation); err != nil {
+ if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil {
return nil, err
}
}
@@ -366,8 +366,8 @@ func (mecb *MaintenanceEntryCreateBulk) Save(ctx context.Context) ([]*Maintenanc
}
// SaveX is like Save, but panics if an error occurs.
-func (mecb *MaintenanceEntryCreateBulk) SaveX(ctx context.Context) []*MaintenanceEntry {
- v, err := mecb.Save(ctx)
+func (_c *MaintenanceEntryCreateBulk) SaveX(ctx context.Context) []*MaintenanceEntry {
+ v, err := _c.Save(ctx)
if err != nil {
panic(err)
}
@@ -375,14 +375,14 @@ func (mecb *MaintenanceEntryCreateBulk) SaveX(ctx context.Context) []*Maintenanc
}
// Exec executes the query.
-func (mecb *MaintenanceEntryCreateBulk) Exec(ctx context.Context) error {
- _, err := mecb.Save(ctx)
+func (_c *MaintenanceEntryCreateBulk) Exec(ctx context.Context) error {
+ _, err := _c.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
-func (mecb *MaintenanceEntryCreateBulk) ExecX(ctx context.Context) {
- if err := mecb.Exec(ctx); err != nil {
+func (_c *MaintenanceEntryCreateBulk) ExecX(ctx context.Context) {
+ if err := _c.Exec(ctx); err != nil {
panic(err)
}
}
diff --git a/backend/internal/data/ent/maintenanceentry_delete.go b/backend/internal/data/ent/maintenanceentry_delete.go
index 88f4dab7..e41e45eb 100644
--- a/backend/internal/data/ent/maintenanceentry_delete.go
+++ b/backend/internal/data/ent/maintenanceentry_delete.go
@@ -20,56 +20,56 @@ type MaintenanceEntryDelete struct {
}
// Where appends a list predicates to the MaintenanceEntryDelete builder.
-func (med *MaintenanceEntryDelete) Where(ps ...predicate.MaintenanceEntry) *MaintenanceEntryDelete {
- med.mutation.Where(ps...)
- return med
+func (_d *MaintenanceEntryDelete) Where(ps ...predicate.MaintenanceEntry) *MaintenanceEntryDelete {
+ _d.mutation.Where(ps...)
+ return _d
}
// Exec executes the deletion query and returns how many vertices were deleted.
-func (med *MaintenanceEntryDelete) Exec(ctx context.Context) (int, error) {
- return withHooks(ctx, med.sqlExec, med.mutation, med.hooks)
+func (_d *MaintenanceEntryDelete) Exec(ctx context.Context) (int, error) {
+ return withHooks(ctx, _d.sqlExec, _d.mutation, _d.hooks)
}
// ExecX is like Exec, but panics if an error occurs.
-func (med *MaintenanceEntryDelete) ExecX(ctx context.Context) int {
- n, err := med.Exec(ctx)
+func (_d *MaintenanceEntryDelete) ExecX(ctx context.Context) int {
+ n, err := _d.Exec(ctx)
if err != nil {
panic(err)
}
return n
}
-func (med *MaintenanceEntryDelete) sqlExec(ctx context.Context) (int, error) {
+func (_d *MaintenanceEntryDelete) sqlExec(ctx context.Context) (int, error) {
_spec := sqlgraph.NewDeleteSpec(maintenanceentry.Table, sqlgraph.NewFieldSpec(maintenanceentry.FieldID, field.TypeUUID))
- if ps := med.mutation.predicates; len(ps) > 0 {
+ if ps := _d.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
- affected, err := sqlgraph.DeleteNodes(ctx, med.driver, _spec)
+ affected, err := sqlgraph.DeleteNodes(ctx, _d.driver, _spec)
if err != nil && sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
- med.mutation.done = true
+ _d.mutation.done = true
return affected, err
}
// MaintenanceEntryDeleteOne is the builder for deleting a single MaintenanceEntry entity.
type MaintenanceEntryDeleteOne struct {
- med *MaintenanceEntryDelete
+ _d *MaintenanceEntryDelete
}
// Where appends a list predicates to the MaintenanceEntryDelete builder.
-func (medo *MaintenanceEntryDeleteOne) Where(ps ...predicate.MaintenanceEntry) *MaintenanceEntryDeleteOne {
- medo.med.mutation.Where(ps...)
- return medo
+func (_d *MaintenanceEntryDeleteOne) Where(ps ...predicate.MaintenanceEntry) *MaintenanceEntryDeleteOne {
+ _d._d.mutation.Where(ps...)
+ return _d
}
// Exec executes the deletion query.
-func (medo *MaintenanceEntryDeleteOne) Exec(ctx context.Context) error {
- n, err := medo.med.Exec(ctx)
+func (_d *MaintenanceEntryDeleteOne) Exec(ctx context.Context) error {
+ n, err := _d._d.Exec(ctx)
switch {
case err != nil:
return err
@@ -81,8 +81,8 @@ func (medo *MaintenanceEntryDeleteOne) Exec(ctx context.Context) error {
}
// ExecX is like Exec, but panics if an error occurs.
-func (medo *MaintenanceEntryDeleteOne) ExecX(ctx context.Context) {
- if err := medo.Exec(ctx); err != nil {
+func (_d *MaintenanceEntryDeleteOne) ExecX(ctx context.Context) {
+ if err := _d.Exec(ctx); err != nil {
panic(err)
}
}
diff --git a/backend/internal/data/ent/maintenanceentry_query.go b/backend/internal/data/ent/maintenanceentry_query.go
index 1879e6b7..99f60218 100644
--- a/backend/internal/data/ent/maintenanceentry_query.go
+++ b/backend/internal/data/ent/maintenanceentry_query.go
@@ -31,44 +31,44 @@ type MaintenanceEntryQuery struct {
}
// Where adds a new predicate for the MaintenanceEntryQuery builder.
-func (meq *MaintenanceEntryQuery) Where(ps ...predicate.MaintenanceEntry) *MaintenanceEntryQuery {
- meq.predicates = append(meq.predicates, ps...)
- return meq
+func (_q *MaintenanceEntryQuery) Where(ps ...predicate.MaintenanceEntry) *MaintenanceEntryQuery {
+ _q.predicates = append(_q.predicates, ps...)
+ return _q
}
// Limit the number of records to be returned by this query.
-func (meq *MaintenanceEntryQuery) Limit(limit int) *MaintenanceEntryQuery {
- meq.ctx.Limit = &limit
- return meq
+func (_q *MaintenanceEntryQuery) Limit(limit int) *MaintenanceEntryQuery {
+ _q.ctx.Limit = &limit
+ return _q
}
// Offset to start from.
-func (meq *MaintenanceEntryQuery) Offset(offset int) *MaintenanceEntryQuery {
- meq.ctx.Offset = &offset
- return meq
+func (_q *MaintenanceEntryQuery) Offset(offset int) *MaintenanceEntryQuery {
+ _q.ctx.Offset = &offset
+ return _q
}
// Unique configures the query builder to filter duplicate records on query.
// By default, unique is set to true, and can be disabled using this method.
-func (meq *MaintenanceEntryQuery) Unique(unique bool) *MaintenanceEntryQuery {
- meq.ctx.Unique = &unique
- return meq
+func (_q *MaintenanceEntryQuery) Unique(unique bool) *MaintenanceEntryQuery {
+ _q.ctx.Unique = &unique
+ return _q
}
// Order specifies how the records should be ordered.
-func (meq *MaintenanceEntryQuery) Order(o ...maintenanceentry.OrderOption) *MaintenanceEntryQuery {
- meq.order = append(meq.order, o...)
- return meq
+func (_q *MaintenanceEntryQuery) Order(o ...maintenanceentry.OrderOption) *MaintenanceEntryQuery {
+ _q.order = append(_q.order, o...)
+ return _q
}
// QueryItem chains the current query on the "item" edge.
-func (meq *MaintenanceEntryQuery) QueryItem() *ItemQuery {
- query := (&ItemClient{config: meq.config}).Query()
+func (_q *MaintenanceEntryQuery) QueryItem() *ItemQuery {
+ query := (&ItemClient{config: _q.config}).Query()
query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
- if err := meq.prepareQuery(ctx); err != nil {
+ if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
- selector := meq.sqlQuery(ctx)
+ selector := _q.sqlQuery(ctx)
if err := selector.Err(); err != nil {
return nil, err
}
@@ -77,7 +77,7 @@ func (meq *MaintenanceEntryQuery) QueryItem() *ItemQuery {
sqlgraph.To(item.Table, item.FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, maintenanceentry.ItemTable, maintenanceentry.ItemColumn),
)
- fromU = sqlgraph.SetNeighbors(meq.driver.Dialect(), step)
+ fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step)
return fromU, nil
}
return query
@@ -85,8 +85,8 @@ func (meq *MaintenanceEntryQuery) QueryItem() *ItemQuery {
// First returns the first MaintenanceEntry entity from the query.
// Returns a *NotFoundError when no MaintenanceEntry was found.
-func (meq *MaintenanceEntryQuery) First(ctx context.Context) (*MaintenanceEntry, error) {
- nodes, err := meq.Limit(1).All(setContextOp(ctx, meq.ctx, ent.OpQueryFirst))
+func (_q *MaintenanceEntryQuery) First(ctx context.Context) (*MaintenanceEntry, error) {
+ nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst))
if err != nil {
return nil, err
}
@@ -97,8 +97,8 @@ func (meq *MaintenanceEntryQuery) First(ctx context.Context) (*MaintenanceEntry,
}
// FirstX is like First, but panics if an error occurs.
-func (meq *MaintenanceEntryQuery) FirstX(ctx context.Context) *MaintenanceEntry {
- node, err := meq.First(ctx)
+func (_q *MaintenanceEntryQuery) FirstX(ctx context.Context) *MaintenanceEntry {
+ node, err := _q.First(ctx)
if err != nil && !IsNotFound(err) {
panic(err)
}
@@ -107,9 +107,9 @@ func (meq *MaintenanceEntryQuery) FirstX(ctx context.Context) *MaintenanceEntry
// FirstID returns the first MaintenanceEntry ID from the query.
// Returns a *NotFoundError when no MaintenanceEntry ID was found.
-func (meq *MaintenanceEntryQuery) FirstID(ctx context.Context) (id uuid.UUID, err error) {
+func (_q *MaintenanceEntryQuery) FirstID(ctx context.Context) (id uuid.UUID, err error) {
var ids []uuid.UUID
- if ids, err = meq.Limit(1).IDs(setContextOp(ctx, meq.ctx, ent.OpQueryFirstID)); err != nil {
+ if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil {
return
}
if len(ids) == 0 {
@@ -120,8 +120,8 @@ func (meq *MaintenanceEntryQuery) FirstID(ctx context.Context) (id uuid.UUID, er
}
// FirstIDX is like FirstID, but panics if an error occurs.
-func (meq *MaintenanceEntryQuery) FirstIDX(ctx context.Context) uuid.UUID {
- id, err := meq.FirstID(ctx)
+func (_q *MaintenanceEntryQuery) FirstIDX(ctx context.Context) uuid.UUID {
+ id, err := _q.FirstID(ctx)
if err != nil && !IsNotFound(err) {
panic(err)
}
@@ -131,8 +131,8 @@ func (meq *MaintenanceEntryQuery) FirstIDX(ctx context.Context) uuid.UUID {
// Only returns a single MaintenanceEntry entity found by the query, ensuring it only returns one.
// Returns a *NotSingularError when more than one MaintenanceEntry entity is found.
// Returns a *NotFoundError when no MaintenanceEntry entities are found.
-func (meq *MaintenanceEntryQuery) Only(ctx context.Context) (*MaintenanceEntry, error) {
- nodes, err := meq.Limit(2).All(setContextOp(ctx, meq.ctx, ent.OpQueryOnly))
+func (_q *MaintenanceEntryQuery) Only(ctx context.Context) (*MaintenanceEntry, error) {
+ nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly))
if err != nil {
return nil, err
}
@@ -147,8 +147,8 @@ func (meq *MaintenanceEntryQuery) Only(ctx context.Context) (*MaintenanceEntry,
}
// OnlyX is like Only, but panics if an error occurs.
-func (meq *MaintenanceEntryQuery) OnlyX(ctx context.Context) *MaintenanceEntry {
- node, err := meq.Only(ctx)
+func (_q *MaintenanceEntryQuery) OnlyX(ctx context.Context) *MaintenanceEntry {
+ node, err := _q.Only(ctx)
if err != nil {
panic(err)
}
@@ -158,9 +158,9 @@ func (meq *MaintenanceEntryQuery) OnlyX(ctx context.Context) *MaintenanceEntry {
// OnlyID is like Only, but returns the only MaintenanceEntry ID in the query.
// Returns a *NotSingularError when more than one MaintenanceEntry ID is found.
// Returns a *NotFoundError when no entities are found.
-func (meq *MaintenanceEntryQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error) {
+func (_q *MaintenanceEntryQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error) {
var ids []uuid.UUID
- if ids, err = meq.Limit(2).IDs(setContextOp(ctx, meq.ctx, ent.OpQueryOnlyID)); err != nil {
+ if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil {
return
}
switch len(ids) {
@@ -175,8 +175,8 @@ func (meq *MaintenanceEntryQuery) OnlyID(ctx context.Context) (id uuid.UUID, err
}
// OnlyIDX is like OnlyID, but panics if an error occurs.
-func (meq *MaintenanceEntryQuery) OnlyIDX(ctx context.Context) uuid.UUID {
- id, err := meq.OnlyID(ctx)
+func (_q *MaintenanceEntryQuery) OnlyIDX(ctx context.Context) uuid.UUID {
+ id, err := _q.OnlyID(ctx)
if err != nil {
panic(err)
}
@@ -184,18 +184,18 @@ func (meq *MaintenanceEntryQuery) OnlyIDX(ctx context.Context) uuid.UUID {
}
// All executes the query and returns a list of MaintenanceEntries.
-func (meq *MaintenanceEntryQuery) All(ctx context.Context) ([]*MaintenanceEntry, error) {
- ctx = setContextOp(ctx, meq.ctx, ent.OpQueryAll)
- if err := meq.prepareQuery(ctx); err != nil {
+func (_q *MaintenanceEntryQuery) All(ctx context.Context) ([]*MaintenanceEntry, error) {
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll)
+ if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
qr := querierAll[[]*MaintenanceEntry, *MaintenanceEntryQuery]()
- return withInterceptors[[]*MaintenanceEntry](ctx, meq, qr, meq.inters)
+ return withInterceptors[[]*MaintenanceEntry](ctx, _q, qr, _q.inters)
}
// AllX is like All, but panics if an error occurs.
-func (meq *MaintenanceEntryQuery) AllX(ctx context.Context) []*MaintenanceEntry {
- nodes, err := meq.All(ctx)
+func (_q *MaintenanceEntryQuery) AllX(ctx context.Context) []*MaintenanceEntry {
+ nodes, err := _q.All(ctx)
if err != nil {
panic(err)
}
@@ -203,20 +203,20 @@ func (meq *MaintenanceEntryQuery) AllX(ctx context.Context) []*MaintenanceEntry
}
// IDs executes the query and returns a list of MaintenanceEntry IDs.
-func (meq *MaintenanceEntryQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error) {
- if meq.ctx.Unique == nil && meq.path != nil {
- meq.Unique(true)
+func (_q *MaintenanceEntryQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error) {
+ if _q.ctx.Unique == nil && _q.path != nil {
+ _q.Unique(true)
}
- ctx = setContextOp(ctx, meq.ctx, ent.OpQueryIDs)
- if err = meq.Select(maintenanceentry.FieldID).Scan(ctx, &ids); err != nil {
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs)
+ if err = _q.Select(maintenanceentry.FieldID).Scan(ctx, &ids); err != nil {
return nil, err
}
return ids, nil
}
// IDsX is like IDs, but panics if an error occurs.
-func (meq *MaintenanceEntryQuery) IDsX(ctx context.Context) []uuid.UUID {
- ids, err := meq.IDs(ctx)
+func (_q *MaintenanceEntryQuery) IDsX(ctx context.Context) []uuid.UUID {
+ ids, err := _q.IDs(ctx)
if err != nil {
panic(err)
}
@@ -224,17 +224,17 @@ func (meq *MaintenanceEntryQuery) IDsX(ctx context.Context) []uuid.UUID {
}
// Count returns the count of the given query.
-func (meq *MaintenanceEntryQuery) Count(ctx context.Context) (int, error) {
- ctx = setContextOp(ctx, meq.ctx, ent.OpQueryCount)
- if err := meq.prepareQuery(ctx); err != nil {
+func (_q *MaintenanceEntryQuery) Count(ctx context.Context) (int, error) {
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryCount)
+ if err := _q.prepareQuery(ctx); err != nil {
return 0, err
}
- return withInterceptors[int](ctx, meq, querierCount[*MaintenanceEntryQuery](), meq.inters)
+ return withInterceptors[int](ctx, _q, querierCount[*MaintenanceEntryQuery](), _q.inters)
}
// CountX is like Count, but panics if an error occurs.
-func (meq *MaintenanceEntryQuery) CountX(ctx context.Context) int {
- count, err := meq.Count(ctx)
+func (_q *MaintenanceEntryQuery) CountX(ctx context.Context) int {
+ count, err := _q.Count(ctx)
if err != nil {
panic(err)
}
@@ -242,9 +242,9 @@ func (meq *MaintenanceEntryQuery) CountX(ctx context.Context) int {
}
// Exist returns true if the query has elements in the graph.
-func (meq *MaintenanceEntryQuery) Exist(ctx context.Context) (bool, error) {
- ctx = setContextOp(ctx, meq.ctx, ent.OpQueryExist)
- switch _, err := meq.FirstID(ctx); {
+func (_q *MaintenanceEntryQuery) Exist(ctx context.Context) (bool, error) {
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryExist)
+ switch _, err := _q.FirstID(ctx); {
case IsNotFound(err):
return false, nil
case err != nil:
@@ -255,8 +255,8 @@ func (meq *MaintenanceEntryQuery) Exist(ctx context.Context) (bool, error) {
}
// ExistX is like Exist, but panics if an error occurs.
-func (meq *MaintenanceEntryQuery) ExistX(ctx context.Context) bool {
- exist, err := meq.Exist(ctx)
+func (_q *MaintenanceEntryQuery) ExistX(ctx context.Context) bool {
+ exist, err := _q.Exist(ctx)
if err != nil {
panic(err)
}
@@ -265,32 +265,32 @@ func (meq *MaintenanceEntryQuery) ExistX(ctx context.Context) bool {
// Clone returns a duplicate of the MaintenanceEntryQuery builder, including all associated steps. It can be
// used to prepare common query builders and use them differently after the clone is made.
-func (meq *MaintenanceEntryQuery) Clone() *MaintenanceEntryQuery {
- if meq == nil {
+func (_q *MaintenanceEntryQuery) Clone() *MaintenanceEntryQuery {
+ if _q == nil {
return nil
}
return &MaintenanceEntryQuery{
- config: meq.config,
- ctx: meq.ctx.Clone(),
- order: append([]maintenanceentry.OrderOption{}, meq.order...),
- inters: append([]Interceptor{}, meq.inters...),
- predicates: append([]predicate.MaintenanceEntry{}, meq.predicates...),
- withItem: meq.withItem.Clone(),
+ config: _q.config,
+ ctx: _q.ctx.Clone(),
+ order: append([]maintenanceentry.OrderOption{}, _q.order...),
+ inters: append([]Interceptor{}, _q.inters...),
+ predicates: append([]predicate.MaintenanceEntry{}, _q.predicates...),
+ withItem: _q.withItem.Clone(),
// clone intermediate query.
- sql: meq.sql.Clone(),
- path: meq.path,
+ sql: _q.sql.Clone(),
+ path: _q.path,
}
}
// WithItem tells the query-builder to eager-load the nodes that are connected to
// the "item" edge. The optional arguments are used to configure the query builder of the edge.
-func (meq *MaintenanceEntryQuery) WithItem(opts ...func(*ItemQuery)) *MaintenanceEntryQuery {
- query := (&ItemClient{config: meq.config}).Query()
+func (_q *MaintenanceEntryQuery) WithItem(opts ...func(*ItemQuery)) *MaintenanceEntryQuery {
+ query := (&ItemClient{config: _q.config}).Query()
for _, opt := range opts {
opt(query)
}
- meq.withItem = query
- return meq
+ _q.withItem = query
+ return _q
}
// GroupBy is used to group vertices by one or more fields/columns.
@@ -307,10 +307,10 @@ func (meq *MaintenanceEntryQuery) WithItem(opts ...func(*ItemQuery)) *Maintenanc
// GroupBy(maintenanceentry.FieldCreatedAt).
// Aggregate(ent.Count()).
// Scan(ctx, &v)
-func (meq *MaintenanceEntryQuery) GroupBy(field string, fields ...string) *MaintenanceEntryGroupBy {
- meq.ctx.Fields = append([]string{field}, fields...)
- grbuild := &MaintenanceEntryGroupBy{build: meq}
- grbuild.flds = &meq.ctx.Fields
+func (_q *MaintenanceEntryQuery) GroupBy(field string, fields ...string) *MaintenanceEntryGroupBy {
+ _q.ctx.Fields = append([]string{field}, fields...)
+ grbuild := &MaintenanceEntryGroupBy{build: _q}
+ grbuild.flds = &_q.ctx.Fields
grbuild.label = maintenanceentry.Label
grbuild.scan = grbuild.Scan
return grbuild
@@ -328,58 +328,58 @@ func (meq *MaintenanceEntryQuery) GroupBy(field string, fields ...string) *Maint
// client.MaintenanceEntry.Query().
// Select(maintenanceentry.FieldCreatedAt).
// Scan(ctx, &v)
-func (meq *MaintenanceEntryQuery) Select(fields ...string) *MaintenanceEntrySelect {
- meq.ctx.Fields = append(meq.ctx.Fields, fields...)
- sbuild := &MaintenanceEntrySelect{MaintenanceEntryQuery: meq}
+func (_q *MaintenanceEntryQuery) Select(fields ...string) *MaintenanceEntrySelect {
+ _q.ctx.Fields = append(_q.ctx.Fields, fields...)
+ sbuild := &MaintenanceEntrySelect{MaintenanceEntryQuery: _q}
sbuild.label = maintenanceentry.Label
- sbuild.flds, sbuild.scan = &meq.ctx.Fields, sbuild.Scan
+ sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan
return sbuild
}
// Aggregate returns a MaintenanceEntrySelect configured with the given aggregations.
-func (meq *MaintenanceEntryQuery) Aggregate(fns ...AggregateFunc) *MaintenanceEntrySelect {
- return meq.Select().Aggregate(fns...)
+func (_q *MaintenanceEntryQuery) Aggregate(fns ...AggregateFunc) *MaintenanceEntrySelect {
+ return _q.Select().Aggregate(fns...)
}
-func (meq *MaintenanceEntryQuery) prepareQuery(ctx context.Context) error {
- for _, inter := range meq.inters {
+func (_q *MaintenanceEntryQuery) prepareQuery(ctx context.Context) error {
+ for _, inter := range _q.inters {
if inter == nil {
return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)")
}
if trv, ok := inter.(Traverser); ok {
- if err := trv.Traverse(ctx, meq); err != nil {
+ if err := trv.Traverse(ctx, _q); err != nil {
return err
}
}
}
- for _, f := range meq.ctx.Fields {
+ for _, f := range _q.ctx.Fields {
if !maintenanceentry.ValidColumn(f) {
return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
}
}
- if meq.path != nil {
- prev, err := meq.path(ctx)
+ if _q.path != nil {
+ prev, err := _q.path(ctx)
if err != nil {
return err
}
- meq.sql = prev
+ _q.sql = prev
}
return nil
}
-func (meq *MaintenanceEntryQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*MaintenanceEntry, error) {
+func (_q *MaintenanceEntryQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*MaintenanceEntry, error) {
var (
nodes = []*MaintenanceEntry{}
- _spec = meq.querySpec()
+ _spec = _q.querySpec()
loadedTypes = [1]bool{
- meq.withItem != nil,
+ _q.withItem != nil,
}
)
_spec.ScanValues = func(columns []string) ([]any, error) {
return (*MaintenanceEntry).scanValues(nil, columns)
}
_spec.Assign = func(columns []string, values []any) error {
- node := &MaintenanceEntry{config: meq.config}
+ node := &MaintenanceEntry{config: _q.config}
nodes = append(nodes, node)
node.Edges.loadedTypes = loadedTypes
return node.assignValues(columns, values)
@@ -387,14 +387,14 @@ func (meq *MaintenanceEntryQuery) sqlAll(ctx context.Context, hooks ...queryHook
for i := range hooks {
hooks[i](ctx, _spec)
}
- if err := sqlgraph.QueryNodes(ctx, meq.driver, _spec); err != nil {
+ if err := sqlgraph.QueryNodes(ctx, _q.driver, _spec); err != nil {
return nil, err
}
if len(nodes) == 0 {
return nodes, nil
}
- if query := meq.withItem; query != nil {
- if err := meq.loadItem(ctx, query, nodes, nil,
+ if query := _q.withItem; query != nil {
+ if err := _q.loadItem(ctx, query, nodes, nil,
func(n *MaintenanceEntry, e *Item) { n.Edges.Item = e }); err != nil {
return nil, err
}
@@ -402,7 +402,7 @@ func (meq *MaintenanceEntryQuery) sqlAll(ctx context.Context, hooks ...queryHook
return nodes, nil
}
-func (meq *MaintenanceEntryQuery) loadItem(ctx context.Context, query *ItemQuery, nodes []*MaintenanceEntry, init func(*MaintenanceEntry), assign func(*MaintenanceEntry, *Item)) error {
+func (_q *MaintenanceEntryQuery) loadItem(ctx context.Context, query *ItemQuery, nodes []*MaintenanceEntry, init func(*MaintenanceEntry), assign func(*MaintenanceEntry, *Item)) error {
ids := make([]uuid.UUID, 0, len(nodes))
nodeids := make(map[uuid.UUID][]*MaintenanceEntry)
for i := range nodes {
@@ -432,24 +432,24 @@ func (meq *MaintenanceEntryQuery) loadItem(ctx context.Context, query *ItemQuery
return nil
}
-func (meq *MaintenanceEntryQuery) sqlCount(ctx context.Context) (int, error) {
- _spec := meq.querySpec()
- _spec.Node.Columns = meq.ctx.Fields
- if len(meq.ctx.Fields) > 0 {
- _spec.Unique = meq.ctx.Unique != nil && *meq.ctx.Unique
+func (_q *MaintenanceEntryQuery) sqlCount(ctx context.Context) (int, error) {
+ _spec := _q.querySpec()
+ _spec.Node.Columns = _q.ctx.Fields
+ if len(_q.ctx.Fields) > 0 {
+ _spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique
}
- return sqlgraph.CountNodes(ctx, meq.driver, _spec)
+ return sqlgraph.CountNodes(ctx, _q.driver, _spec)
}
-func (meq *MaintenanceEntryQuery) querySpec() *sqlgraph.QuerySpec {
+func (_q *MaintenanceEntryQuery) querySpec() *sqlgraph.QuerySpec {
_spec := sqlgraph.NewQuerySpec(maintenanceentry.Table, maintenanceentry.Columns, sqlgraph.NewFieldSpec(maintenanceentry.FieldID, field.TypeUUID))
- _spec.From = meq.sql
- if unique := meq.ctx.Unique; unique != nil {
+ _spec.From = _q.sql
+ if unique := _q.ctx.Unique; unique != nil {
_spec.Unique = *unique
- } else if meq.path != nil {
+ } else if _q.path != nil {
_spec.Unique = true
}
- if fields := meq.ctx.Fields; len(fields) > 0 {
+ if fields := _q.ctx.Fields; len(fields) > 0 {
_spec.Node.Columns = make([]string, 0, len(fields))
_spec.Node.Columns = append(_spec.Node.Columns, maintenanceentry.FieldID)
for i := range fields {
@@ -457,24 +457,24 @@ func (meq *MaintenanceEntryQuery) querySpec() *sqlgraph.QuerySpec {
_spec.Node.Columns = append(_spec.Node.Columns, fields[i])
}
}
- if meq.withItem != nil {
+ if _q.withItem != nil {
_spec.Node.AddColumnOnce(maintenanceentry.FieldItemID)
}
}
- if ps := meq.predicates; len(ps) > 0 {
+ if ps := _q.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
- if limit := meq.ctx.Limit; limit != nil {
+ if limit := _q.ctx.Limit; limit != nil {
_spec.Limit = *limit
}
- if offset := meq.ctx.Offset; offset != nil {
+ if offset := _q.ctx.Offset; offset != nil {
_spec.Offset = *offset
}
- if ps := meq.order; len(ps) > 0 {
+ if ps := _q.order; len(ps) > 0 {
_spec.Order = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
@@ -484,33 +484,33 @@ func (meq *MaintenanceEntryQuery) querySpec() *sqlgraph.QuerySpec {
return _spec
}
-func (meq *MaintenanceEntryQuery) sqlQuery(ctx context.Context) *sql.Selector {
- builder := sql.Dialect(meq.driver.Dialect())
+func (_q *MaintenanceEntryQuery) sqlQuery(ctx context.Context) *sql.Selector {
+ builder := sql.Dialect(_q.driver.Dialect())
t1 := builder.Table(maintenanceentry.Table)
- columns := meq.ctx.Fields
+ columns := _q.ctx.Fields
if len(columns) == 0 {
columns = maintenanceentry.Columns
}
selector := builder.Select(t1.Columns(columns...)...).From(t1)
- if meq.sql != nil {
- selector = meq.sql
+ if _q.sql != nil {
+ selector = _q.sql
selector.Select(selector.Columns(columns...)...)
}
- if meq.ctx.Unique != nil && *meq.ctx.Unique {
+ if _q.ctx.Unique != nil && *_q.ctx.Unique {
selector.Distinct()
}
- for _, p := range meq.predicates {
+ for _, p := range _q.predicates {
p(selector)
}
- for _, p := range meq.order {
+ for _, p := range _q.order {
p(selector)
}
- if offset := meq.ctx.Offset; offset != nil {
+ if offset := _q.ctx.Offset; offset != nil {
// limit is mandatory for offset clause. We start
// with default value, and override it below if needed.
selector.Offset(*offset).Limit(math.MaxInt32)
}
- if limit := meq.ctx.Limit; limit != nil {
+ if limit := _q.ctx.Limit; limit != nil {
selector.Limit(*limit)
}
return selector
@@ -523,41 +523,41 @@ type MaintenanceEntryGroupBy struct {
}
// Aggregate adds the given aggregation functions to the group-by query.
-func (megb *MaintenanceEntryGroupBy) Aggregate(fns ...AggregateFunc) *MaintenanceEntryGroupBy {
- megb.fns = append(megb.fns, fns...)
- return megb
+func (_g *MaintenanceEntryGroupBy) Aggregate(fns ...AggregateFunc) *MaintenanceEntryGroupBy {
+ _g.fns = append(_g.fns, fns...)
+ return _g
}
// Scan applies the selector query and scans the result into the given value.
-func (megb *MaintenanceEntryGroupBy) Scan(ctx context.Context, v any) error {
- ctx = setContextOp(ctx, megb.build.ctx, ent.OpQueryGroupBy)
- if err := megb.build.prepareQuery(ctx); err != nil {
+func (_g *MaintenanceEntryGroupBy) Scan(ctx context.Context, v any) error {
+ ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy)
+ if err := _g.build.prepareQuery(ctx); err != nil {
return err
}
- return scanWithInterceptors[*MaintenanceEntryQuery, *MaintenanceEntryGroupBy](ctx, megb.build, megb, megb.build.inters, v)
+ return scanWithInterceptors[*MaintenanceEntryQuery, *MaintenanceEntryGroupBy](ctx, _g.build, _g, _g.build.inters, v)
}
-func (megb *MaintenanceEntryGroupBy) sqlScan(ctx context.Context, root *MaintenanceEntryQuery, v any) error {
+func (_g *MaintenanceEntryGroupBy) sqlScan(ctx context.Context, root *MaintenanceEntryQuery, v any) error {
selector := root.sqlQuery(ctx).Select()
- aggregation := make([]string, 0, len(megb.fns))
- for _, fn := range megb.fns {
+ aggregation := make([]string, 0, len(_g.fns))
+ for _, fn := range _g.fns {
aggregation = append(aggregation, fn(selector))
}
if len(selector.SelectedColumns()) == 0 {
- columns := make([]string, 0, len(*megb.flds)+len(megb.fns))
- for _, f := range *megb.flds {
+ columns := make([]string, 0, len(*_g.flds)+len(_g.fns))
+ for _, f := range *_g.flds {
columns = append(columns, selector.C(f))
}
columns = append(columns, aggregation...)
selector.Select(columns...)
}
- selector.GroupBy(selector.Columns(*megb.flds...)...)
+ selector.GroupBy(selector.Columns(*_g.flds...)...)
if err := selector.Err(); err != nil {
return err
}
rows := &sql.Rows{}
query, args := selector.Query()
- if err := megb.build.driver.Query(ctx, query, args, rows); err != nil {
+ if err := _g.build.driver.Query(ctx, query, args, rows); err != nil {
return err
}
defer rows.Close()
@@ -571,27 +571,27 @@ type MaintenanceEntrySelect struct {
}
// Aggregate adds the given aggregation functions to the selector query.
-func (mes *MaintenanceEntrySelect) Aggregate(fns ...AggregateFunc) *MaintenanceEntrySelect {
- mes.fns = append(mes.fns, fns...)
- return mes
+func (_s *MaintenanceEntrySelect) Aggregate(fns ...AggregateFunc) *MaintenanceEntrySelect {
+ _s.fns = append(_s.fns, fns...)
+ return _s
}
// Scan applies the selector query and scans the result into the given value.
-func (mes *MaintenanceEntrySelect) Scan(ctx context.Context, v any) error {
- ctx = setContextOp(ctx, mes.ctx, ent.OpQuerySelect)
- if err := mes.prepareQuery(ctx); err != nil {
+func (_s *MaintenanceEntrySelect) Scan(ctx context.Context, v any) error {
+ ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect)
+ if err := _s.prepareQuery(ctx); err != nil {
return err
}
- return scanWithInterceptors[*MaintenanceEntryQuery, *MaintenanceEntrySelect](ctx, mes.MaintenanceEntryQuery, mes, mes.inters, v)
+ return scanWithInterceptors[*MaintenanceEntryQuery, *MaintenanceEntrySelect](ctx, _s.MaintenanceEntryQuery, _s, _s.inters, v)
}
-func (mes *MaintenanceEntrySelect) sqlScan(ctx context.Context, root *MaintenanceEntryQuery, v any) error {
+func (_s *MaintenanceEntrySelect) sqlScan(ctx context.Context, root *MaintenanceEntryQuery, v any) error {
selector := root.sqlQuery(ctx)
- aggregation := make([]string, 0, len(mes.fns))
- for _, fn := range mes.fns {
+ aggregation := make([]string, 0, len(_s.fns))
+ for _, fn := range _s.fns {
aggregation = append(aggregation, fn(selector))
}
- switch n := len(*mes.selector.flds); {
+ switch n := len(*_s.selector.flds); {
case n == 0 && len(aggregation) > 0:
selector.Select(aggregation...)
case n != 0 && len(aggregation) > 0:
@@ -599,7 +599,7 @@ func (mes *MaintenanceEntrySelect) sqlScan(ctx context.Context, root *Maintenanc
}
rows := &sql.Rows{}
query, args := selector.Query()
- if err := mes.driver.Query(ctx, query, args, rows); err != nil {
+ if err := _s.driver.Query(ctx, query, args, rows); err != nil {
return err
}
defer rows.Close()
diff --git a/backend/internal/data/ent/maintenanceentry_update.go b/backend/internal/data/ent/maintenanceentry_update.go
index 813cd189..bd27b50c 100644
--- a/backend/internal/data/ent/maintenanceentry_update.go
+++ b/backend/internal/data/ent/maintenanceentry_update.go
@@ -25,151 +25,151 @@ type MaintenanceEntryUpdate struct {
}
// Where appends a list predicates to the MaintenanceEntryUpdate builder.
-func (meu *MaintenanceEntryUpdate) Where(ps ...predicate.MaintenanceEntry) *MaintenanceEntryUpdate {
- meu.mutation.Where(ps...)
- return meu
+func (_u *MaintenanceEntryUpdate) Where(ps ...predicate.MaintenanceEntry) *MaintenanceEntryUpdate {
+ _u.mutation.Where(ps...)
+ return _u
}
// SetUpdatedAt sets the "updated_at" field.
-func (meu *MaintenanceEntryUpdate) SetUpdatedAt(t time.Time) *MaintenanceEntryUpdate {
- meu.mutation.SetUpdatedAt(t)
- return meu
+func (_u *MaintenanceEntryUpdate) SetUpdatedAt(v time.Time) *MaintenanceEntryUpdate {
+ _u.mutation.SetUpdatedAt(v)
+ return _u
}
// SetItemID sets the "item_id" field.
-func (meu *MaintenanceEntryUpdate) SetItemID(u uuid.UUID) *MaintenanceEntryUpdate {
- meu.mutation.SetItemID(u)
- return meu
+func (_u *MaintenanceEntryUpdate) SetItemID(v uuid.UUID) *MaintenanceEntryUpdate {
+ _u.mutation.SetItemID(v)
+ return _u
}
// SetNillableItemID sets the "item_id" field if the given value is not nil.
-func (meu *MaintenanceEntryUpdate) SetNillableItemID(u *uuid.UUID) *MaintenanceEntryUpdate {
- if u != nil {
- meu.SetItemID(*u)
+func (_u *MaintenanceEntryUpdate) SetNillableItemID(v *uuid.UUID) *MaintenanceEntryUpdate {
+ if v != nil {
+ _u.SetItemID(*v)
}
- return meu
+ return _u
}
// SetDate sets the "date" field.
-func (meu *MaintenanceEntryUpdate) SetDate(t time.Time) *MaintenanceEntryUpdate {
- meu.mutation.SetDate(t)
- return meu
+func (_u *MaintenanceEntryUpdate) SetDate(v time.Time) *MaintenanceEntryUpdate {
+ _u.mutation.SetDate(v)
+ return _u
}
// SetNillableDate sets the "date" field if the given value is not nil.
-func (meu *MaintenanceEntryUpdate) SetNillableDate(t *time.Time) *MaintenanceEntryUpdate {
- if t != nil {
- meu.SetDate(*t)
+func (_u *MaintenanceEntryUpdate) SetNillableDate(v *time.Time) *MaintenanceEntryUpdate {
+ if v != nil {
+ _u.SetDate(*v)
}
- return meu
+ return _u
}
// ClearDate clears the value of the "date" field.
-func (meu *MaintenanceEntryUpdate) ClearDate() *MaintenanceEntryUpdate {
- meu.mutation.ClearDate()
- return meu
+func (_u *MaintenanceEntryUpdate) ClearDate() *MaintenanceEntryUpdate {
+ _u.mutation.ClearDate()
+ return _u
}
// SetScheduledDate sets the "scheduled_date" field.
-func (meu *MaintenanceEntryUpdate) SetScheduledDate(t time.Time) *MaintenanceEntryUpdate {
- meu.mutation.SetScheduledDate(t)
- return meu
+func (_u *MaintenanceEntryUpdate) SetScheduledDate(v time.Time) *MaintenanceEntryUpdate {
+ _u.mutation.SetScheduledDate(v)
+ return _u
}
// SetNillableScheduledDate sets the "scheduled_date" field if the given value is not nil.
-func (meu *MaintenanceEntryUpdate) SetNillableScheduledDate(t *time.Time) *MaintenanceEntryUpdate {
- if t != nil {
- meu.SetScheduledDate(*t)
+func (_u *MaintenanceEntryUpdate) SetNillableScheduledDate(v *time.Time) *MaintenanceEntryUpdate {
+ if v != nil {
+ _u.SetScheduledDate(*v)
}
- return meu
+ return _u
}
// ClearScheduledDate clears the value of the "scheduled_date" field.
-func (meu *MaintenanceEntryUpdate) ClearScheduledDate() *MaintenanceEntryUpdate {
- meu.mutation.ClearScheduledDate()
- return meu
+func (_u *MaintenanceEntryUpdate) ClearScheduledDate() *MaintenanceEntryUpdate {
+ _u.mutation.ClearScheduledDate()
+ return _u
}
// SetName sets the "name" field.
-func (meu *MaintenanceEntryUpdate) SetName(s string) *MaintenanceEntryUpdate {
- meu.mutation.SetName(s)
- return meu
+func (_u *MaintenanceEntryUpdate) SetName(v string) *MaintenanceEntryUpdate {
+ _u.mutation.SetName(v)
+ return _u
}
// SetNillableName sets the "name" field if the given value is not nil.
-func (meu *MaintenanceEntryUpdate) SetNillableName(s *string) *MaintenanceEntryUpdate {
- if s != nil {
- meu.SetName(*s)
+func (_u *MaintenanceEntryUpdate) SetNillableName(v *string) *MaintenanceEntryUpdate {
+ if v != nil {
+ _u.SetName(*v)
}
- return meu
+ return _u
}
// SetDescription sets the "description" field.
-func (meu *MaintenanceEntryUpdate) SetDescription(s string) *MaintenanceEntryUpdate {
- meu.mutation.SetDescription(s)
- return meu
+func (_u *MaintenanceEntryUpdate) SetDescription(v string) *MaintenanceEntryUpdate {
+ _u.mutation.SetDescription(v)
+ return _u
}
// SetNillableDescription sets the "description" field if the given value is not nil.
-func (meu *MaintenanceEntryUpdate) SetNillableDescription(s *string) *MaintenanceEntryUpdate {
- if s != nil {
- meu.SetDescription(*s)
+func (_u *MaintenanceEntryUpdate) SetNillableDescription(v *string) *MaintenanceEntryUpdate {
+ if v != nil {
+ _u.SetDescription(*v)
}
- return meu
+ return _u
}
// ClearDescription clears the value of the "description" field.
-func (meu *MaintenanceEntryUpdate) ClearDescription() *MaintenanceEntryUpdate {
- meu.mutation.ClearDescription()
- return meu
+func (_u *MaintenanceEntryUpdate) ClearDescription() *MaintenanceEntryUpdate {
+ _u.mutation.ClearDescription()
+ return _u
}
// SetCost sets the "cost" field.
-func (meu *MaintenanceEntryUpdate) SetCost(f float64) *MaintenanceEntryUpdate {
- meu.mutation.ResetCost()
- meu.mutation.SetCost(f)
- return meu
+func (_u *MaintenanceEntryUpdate) SetCost(v float64) *MaintenanceEntryUpdate {
+ _u.mutation.ResetCost()
+ _u.mutation.SetCost(v)
+ return _u
}
// SetNillableCost sets the "cost" field if the given value is not nil.
-func (meu *MaintenanceEntryUpdate) SetNillableCost(f *float64) *MaintenanceEntryUpdate {
- if f != nil {
- meu.SetCost(*f)
+func (_u *MaintenanceEntryUpdate) SetNillableCost(v *float64) *MaintenanceEntryUpdate {
+ if v != nil {
+ _u.SetCost(*v)
}
- return meu
+ return _u
}
-// AddCost adds f to the "cost" field.
-func (meu *MaintenanceEntryUpdate) AddCost(f float64) *MaintenanceEntryUpdate {
- meu.mutation.AddCost(f)
- return meu
+// AddCost adds value to the "cost" field.
+func (_u *MaintenanceEntryUpdate) AddCost(v float64) *MaintenanceEntryUpdate {
+ _u.mutation.AddCost(v)
+ return _u
}
// SetItem sets the "item" edge to the Item entity.
-func (meu *MaintenanceEntryUpdate) SetItem(i *Item) *MaintenanceEntryUpdate {
- return meu.SetItemID(i.ID)
+func (_u *MaintenanceEntryUpdate) SetItem(v *Item) *MaintenanceEntryUpdate {
+ return _u.SetItemID(v.ID)
}
// Mutation returns the MaintenanceEntryMutation object of the builder.
-func (meu *MaintenanceEntryUpdate) Mutation() *MaintenanceEntryMutation {
- return meu.mutation
+func (_u *MaintenanceEntryUpdate) Mutation() *MaintenanceEntryMutation {
+ return _u.mutation
}
// ClearItem clears the "item" edge to the Item entity.
-func (meu *MaintenanceEntryUpdate) ClearItem() *MaintenanceEntryUpdate {
- meu.mutation.ClearItem()
- return meu
+func (_u *MaintenanceEntryUpdate) ClearItem() *MaintenanceEntryUpdate {
+ _u.mutation.ClearItem()
+ return _u
}
// Save executes the query and returns the number of nodes affected by the update operation.
-func (meu *MaintenanceEntryUpdate) Save(ctx context.Context) (int, error) {
- meu.defaults()
- return withHooks(ctx, meu.sqlSave, meu.mutation, meu.hooks)
+func (_u *MaintenanceEntryUpdate) Save(ctx context.Context) (int, error) {
+ _u.defaults()
+ return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
}
// SaveX is like Save, but panics if an error occurs.
-func (meu *MaintenanceEntryUpdate) SaveX(ctx context.Context) int {
- affected, err := meu.Save(ctx)
+func (_u *MaintenanceEntryUpdate) SaveX(ctx context.Context) int {
+ affected, err := _u.Save(ctx)
if err != nil {
panic(err)
}
@@ -177,87 +177,87 @@ func (meu *MaintenanceEntryUpdate) SaveX(ctx context.Context) int {
}
// Exec executes the query.
-func (meu *MaintenanceEntryUpdate) Exec(ctx context.Context) error {
- _, err := meu.Save(ctx)
+func (_u *MaintenanceEntryUpdate) Exec(ctx context.Context) error {
+ _, err := _u.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
-func (meu *MaintenanceEntryUpdate) ExecX(ctx context.Context) {
- if err := meu.Exec(ctx); err != nil {
+func (_u *MaintenanceEntryUpdate) ExecX(ctx context.Context) {
+ if err := _u.Exec(ctx); err != nil {
panic(err)
}
}
// defaults sets the default values of the builder before save.
-func (meu *MaintenanceEntryUpdate) defaults() {
- if _, ok := meu.mutation.UpdatedAt(); !ok {
+func (_u *MaintenanceEntryUpdate) defaults() {
+ if _, ok := _u.mutation.UpdatedAt(); !ok {
v := maintenanceentry.UpdateDefaultUpdatedAt()
- meu.mutation.SetUpdatedAt(v)
+ _u.mutation.SetUpdatedAt(v)
}
}
// check runs all checks and user-defined validators on the builder.
-func (meu *MaintenanceEntryUpdate) check() error {
- if v, ok := meu.mutation.Name(); ok {
+func (_u *MaintenanceEntryUpdate) check() error {
+ if v, ok := _u.mutation.Name(); ok {
if err := maintenanceentry.NameValidator(v); err != nil {
return &ValidationError{Name: "name", err: fmt.Errorf(`ent: validator failed for field "MaintenanceEntry.name": %w`, err)}
}
}
- if v, ok := meu.mutation.Description(); ok {
+ if v, ok := _u.mutation.Description(); ok {
if err := maintenanceentry.DescriptionValidator(v); err != nil {
return &ValidationError{Name: "description", err: fmt.Errorf(`ent: validator failed for field "MaintenanceEntry.description": %w`, err)}
}
}
- if meu.mutation.ItemCleared() && len(meu.mutation.ItemIDs()) > 0 {
+ if _u.mutation.ItemCleared() && len(_u.mutation.ItemIDs()) > 0 {
return errors.New(`ent: clearing a required unique edge "MaintenanceEntry.item"`)
}
return nil
}
-func (meu *MaintenanceEntryUpdate) sqlSave(ctx context.Context) (n int, err error) {
- if err := meu.check(); err != nil {
- return n, err
+func (_u *MaintenanceEntryUpdate) sqlSave(ctx context.Context) (_node int, err error) {
+ if err := _u.check(); err != nil {
+ return _node, err
}
_spec := sqlgraph.NewUpdateSpec(maintenanceentry.Table, maintenanceentry.Columns, sqlgraph.NewFieldSpec(maintenanceentry.FieldID, field.TypeUUID))
- if ps := meu.mutation.predicates; len(ps) > 0 {
+ if ps := _u.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
- if value, ok := meu.mutation.UpdatedAt(); ok {
+ if value, ok := _u.mutation.UpdatedAt(); ok {
_spec.SetField(maintenanceentry.FieldUpdatedAt, field.TypeTime, value)
}
- if value, ok := meu.mutation.Date(); ok {
+ if value, ok := _u.mutation.Date(); ok {
_spec.SetField(maintenanceentry.FieldDate, field.TypeTime, value)
}
- if meu.mutation.DateCleared() {
+ if _u.mutation.DateCleared() {
_spec.ClearField(maintenanceentry.FieldDate, field.TypeTime)
}
- if value, ok := meu.mutation.ScheduledDate(); ok {
+ if value, ok := _u.mutation.ScheduledDate(); ok {
_spec.SetField(maintenanceentry.FieldScheduledDate, field.TypeTime, value)
}
- if meu.mutation.ScheduledDateCleared() {
+ if _u.mutation.ScheduledDateCleared() {
_spec.ClearField(maintenanceentry.FieldScheduledDate, field.TypeTime)
}
- if value, ok := meu.mutation.Name(); ok {
+ if value, ok := _u.mutation.Name(); ok {
_spec.SetField(maintenanceentry.FieldName, field.TypeString, value)
}
- if value, ok := meu.mutation.Description(); ok {
+ if value, ok := _u.mutation.Description(); ok {
_spec.SetField(maintenanceentry.FieldDescription, field.TypeString, value)
}
- if meu.mutation.DescriptionCleared() {
+ if _u.mutation.DescriptionCleared() {
_spec.ClearField(maintenanceentry.FieldDescription, field.TypeString)
}
- if value, ok := meu.mutation.Cost(); ok {
+ if value, ok := _u.mutation.Cost(); ok {
_spec.SetField(maintenanceentry.FieldCost, field.TypeFloat64, value)
}
- if value, ok := meu.mutation.AddedCost(); ok {
+ if value, ok := _u.mutation.AddedCost(); ok {
_spec.AddField(maintenanceentry.FieldCost, field.TypeFloat64, value)
}
- if meu.mutation.ItemCleared() {
+ if _u.mutation.ItemCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -270,7 +270,7 @@ func (meu *MaintenanceEntryUpdate) sqlSave(ctx context.Context) (n int, err erro
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := meu.mutation.ItemIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.ItemIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -286,7 +286,7 @@ func (meu *MaintenanceEntryUpdate) sqlSave(ctx context.Context) (n int, err erro
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- if n, err = sqlgraph.UpdateNodes(ctx, meu.driver, _spec); err != nil {
+ if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil {
if _, ok := err.(*sqlgraph.NotFoundError); ok {
err = &NotFoundError{maintenanceentry.Label}
} else if sqlgraph.IsConstraintError(err) {
@@ -294,8 +294,8 @@ func (meu *MaintenanceEntryUpdate) sqlSave(ctx context.Context) (n int, err erro
}
return 0, err
}
- meu.mutation.done = true
- return n, nil
+ _u.mutation.done = true
+ return _node, nil
}
// MaintenanceEntryUpdateOne is the builder for updating a single MaintenanceEntry entity.
@@ -307,158 +307,158 @@ type MaintenanceEntryUpdateOne struct {
}
// SetUpdatedAt sets the "updated_at" field.
-func (meuo *MaintenanceEntryUpdateOne) SetUpdatedAt(t time.Time) *MaintenanceEntryUpdateOne {
- meuo.mutation.SetUpdatedAt(t)
- return meuo
+func (_u *MaintenanceEntryUpdateOne) SetUpdatedAt(v time.Time) *MaintenanceEntryUpdateOne {
+ _u.mutation.SetUpdatedAt(v)
+ return _u
}
// SetItemID sets the "item_id" field.
-func (meuo *MaintenanceEntryUpdateOne) SetItemID(u uuid.UUID) *MaintenanceEntryUpdateOne {
- meuo.mutation.SetItemID(u)
- return meuo
+func (_u *MaintenanceEntryUpdateOne) SetItemID(v uuid.UUID) *MaintenanceEntryUpdateOne {
+ _u.mutation.SetItemID(v)
+ return _u
}
// SetNillableItemID sets the "item_id" field if the given value is not nil.
-func (meuo *MaintenanceEntryUpdateOne) SetNillableItemID(u *uuid.UUID) *MaintenanceEntryUpdateOne {
- if u != nil {
- meuo.SetItemID(*u)
+func (_u *MaintenanceEntryUpdateOne) SetNillableItemID(v *uuid.UUID) *MaintenanceEntryUpdateOne {
+ if v != nil {
+ _u.SetItemID(*v)
}
- return meuo
+ return _u
}
// SetDate sets the "date" field.
-func (meuo *MaintenanceEntryUpdateOne) SetDate(t time.Time) *MaintenanceEntryUpdateOne {
- meuo.mutation.SetDate(t)
- return meuo
+func (_u *MaintenanceEntryUpdateOne) SetDate(v time.Time) *MaintenanceEntryUpdateOne {
+ _u.mutation.SetDate(v)
+ return _u
}
// SetNillableDate sets the "date" field if the given value is not nil.
-func (meuo *MaintenanceEntryUpdateOne) SetNillableDate(t *time.Time) *MaintenanceEntryUpdateOne {
- if t != nil {
- meuo.SetDate(*t)
+func (_u *MaintenanceEntryUpdateOne) SetNillableDate(v *time.Time) *MaintenanceEntryUpdateOne {
+ if v != nil {
+ _u.SetDate(*v)
}
- return meuo
+ return _u
}
// ClearDate clears the value of the "date" field.
-func (meuo *MaintenanceEntryUpdateOne) ClearDate() *MaintenanceEntryUpdateOne {
- meuo.mutation.ClearDate()
- return meuo
+func (_u *MaintenanceEntryUpdateOne) ClearDate() *MaintenanceEntryUpdateOne {
+ _u.mutation.ClearDate()
+ return _u
}
// SetScheduledDate sets the "scheduled_date" field.
-func (meuo *MaintenanceEntryUpdateOne) SetScheduledDate(t time.Time) *MaintenanceEntryUpdateOne {
- meuo.mutation.SetScheduledDate(t)
- return meuo
+func (_u *MaintenanceEntryUpdateOne) SetScheduledDate(v time.Time) *MaintenanceEntryUpdateOne {
+ _u.mutation.SetScheduledDate(v)
+ return _u
}
// SetNillableScheduledDate sets the "scheduled_date" field if the given value is not nil.
-func (meuo *MaintenanceEntryUpdateOne) SetNillableScheduledDate(t *time.Time) *MaintenanceEntryUpdateOne {
- if t != nil {
- meuo.SetScheduledDate(*t)
+func (_u *MaintenanceEntryUpdateOne) SetNillableScheduledDate(v *time.Time) *MaintenanceEntryUpdateOne {
+ if v != nil {
+ _u.SetScheduledDate(*v)
}
- return meuo
+ return _u
}
// ClearScheduledDate clears the value of the "scheduled_date" field.
-func (meuo *MaintenanceEntryUpdateOne) ClearScheduledDate() *MaintenanceEntryUpdateOne {
- meuo.mutation.ClearScheduledDate()
- return meuo
+func (_u *MaintenanceEntryUpdateOne) ClearScheduledDate() *MaintenanceEntryUpdateOne {
+ _u.mutation.ClearScheduledDate()
+ return _u
}
// SetName sets the "name" field.
-func (meuo *MaintenanceEntryUpdateOne) SetName(s string) *MaintenanceEntryUpdateOne {
- meuo.mutation.SetName(s)
- return meuo
+func (_u *MaintenanceEntryUpdateOne) SetName(v string) *MaintenanceEntryUpdateOne {
+ _u.mutation.SetName(v)
+ return _u
}
// SetNillableName sets the "name" field if the given value is not nil.
-func (meuo *MaintenanceEntryUpdateOne) SetNillableName(s *string) *MaintenanceEntryUpdateOne {
- if s != nil {
- meuo.SetName(*s)
+func (_u *MaintenanceEntryUpdateOne) SetNillableName(v *string) *MaintenanceEntryUpdateOne {
+ if v != nil {
+ _u.SetName(*v)
}
- return meuo
+ return _u
}
// SetDescription sets the "description" field.
-func (meuo *MaintenanceEntryUpdateOne) SetDescription(s string) *MaintenanceEntryUpdateOne {
- meuo.mutation.SetDescription(s)
- return meuo
+func (_u *MaintenanceEntryUpdateOne) SetDescription(v string) *MaintenanceEntryUpdateOne {
+ _u.mutation.SetDescription(v)
+ return _u
}
// SetNillableDescription sets the "description" field if the given value is not nil.
-func (meuo *MaintenanceEntryUpdateOne) SetNillableDescription(s *string) *MaintenanceEntryUpdateOne {
- if s != nil {
- meuo.SetDescription(*s)
+func (_u *MaintenanceEntryUpdateOne) SetNillableDescription(v *string) *MaintenanceEntryUpdateOne {
+ if v != nil {
+ _u.SetDescription(*v)
}
- return meuo
+ return _u
}
// ClearDescription clears the value of the "description" field.
-func (meuo *MaintenanceEntryUpdateOne) ClearDescription() *MaintenanceEntryUpdateOne {
- meuo.mutation.ClearDescription()
- return meuo
+func (_u *MaintenanceEntryUpdateOne) ClearDescription() *MaintenanceEntryUpdateOne {
+ _u.mutation.ClearDescription()
+ return _u
}
// SetCost sets the "cost" field.
-func (meuo *MaintenanceEntryUpdateOne) SetCost(f float64) *MaintenanceEntryUpdateOne {
- meuo.mutation.ResetCost()
- meuo.mutation.SetCost(f)
- return meuo
+func (_u *MaintenanceEntryUpdateOne) SetCost(v float64) *MaintenanceEntryUpdateOne {
+ _u.mutation.ResetCost()
+ _u.mutation.SetCost(v)
+ return _u
}
// SetNillableCost sets the "cost" field if the given value is not nil.
-func (meuo *MaintenanceEntryUpdateOne) SetNillableCost(f *float64) *MaintenanceEntryUpdateOne {
- if f != nil {
- meuo.SetCost(*f)
+func (_u *MaintenanceEntryUpdateOne) SetNillableCost(v *float64) *MaintenanceEntryUpdateOne {
+ if v != nil {
+ _u.SetCost(*v)
}
- return meuo
+ return _u
}
-// AddCost adds f to the "cost" field.
-func (meuo *MaintenanceEntryUpdateOne) AddCost(f float64) *MaintenanceEntryUpdateOne {
- meuo.mutation.AddCost(f)
- return meuo
+// AddCost adds value to the "cost" field.
+func (_u *MaintenanceEntryUpdateOne) AddCost(v float64) *MaintenanceEntryUpdateOne {
+ _u.mutation.AddCost(v)
+ return _u
}
// SetItem sets the "item" edge to the Item entity.
-func (meuo *MaintenanceEntryUpdateOne) SetItem(i *Item) *MaintenanceEntryUpdateOne {
- return meuo.SetItemID(i.ID)
+func (_u *MaintenanceEntryUpdateOne) SetItem(v *Item) *MaintenanceEntryUpdateOne {
+ return _u.SetItemID(v.ID)
}
// Mutation returns the MaintenanceEntryMutation object of the builder.
-func (meuo *MaintenanceEntryUpdateOne) Mutation() *MaintenanceEntryMutation {
- return meuo.mutation
+func (_u *MaintenanceEntryUpdateOne) Mutation() *MaintenanceEntryMutation {
+ return _u.mutation
}
// ClearItem clears the "item" edge to the Item entity.
-func (meuo *MaintenanceEntryUpdateOne) ClearItem() *MaintenanceEntryUpdateOne {
- meuo.mutation.ClearItem()
- return meuo
+func (_u *MaintenanceEntryUpdateOne) ClearItem() *MaintenanceEntryUpdateOne {
+ _u.mutation.ClearItem()
+ return _u
}
// Where appends a list predicates to the MaintenanceEntryUpdate builder.
-func (meuo *MaintenanceEntryUpdateOne) Where(ps ...predicate.MaintenanceEntry) *MaintenanceEntryUpdateOne {
- meuo.mutation.Where(ps...)
- return meuo
+func (_u *MaintenanceEntryUpdateOne) Where(ps ...predicate.MaintenanceEntry) *MaintenanceEntryUpdateOne {
+ _u.mutation.Where(ps...)
+ return _u
}
// Select allows selecting one or more fields (columns) of the returned entity.
// The default is selecting all fields defined in the entity schema.
-func (meuo *MaintenanceEntryUpdateOne) Select(field string, fields ...string) *MaintenanceEntryUpdateOne {
- meuo.fields = append([]string{field}, fields...)
- return meuo
+func (_u *MaintenanceEntryUpdateOne) Select(field string, fields ...string) *MaintenanceEntryUpdateOne {
+ _u.fields = append([]string{field}, fields...)
+ return _u
}
// Save executes the query and returns the updated MaintenanceEntry entity.
-func (meuo *MaintenanceEntryUpdateOne) Save(ctx context.Context) (*MaintenanceEntry, error) {
- meuo.defaults()
- return withHooks(ctx, meuo.sqlSave, meuo.mutation, meuo.hooks)
+func (_u *MaintenanceEntryUpdateOne) Save(ctx context.Context) (*MaintenanceEntry, error) {
+ _u.defaults()
+ return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
}
// SaveX is like Save, but panics if an error occurs.
-func (meuo *MaintenanceEntryUpdateOne) SaveX(ctx context.Context) *MaintenanceEntry {
- node, err := meuo.Save(ctx)
+func (_u *MaintenanceEntryUpdateOne) SaveX(ctx context.Context) *MaintenanceEntry {
+ node, err := _u.Save(ctx)
if err != nil {
panic(err)
}
@@ -466,55 +466,55 @@ func (meuo *MaintenanceEntryUpdateOne) SaveX(ctx context.Context) *MaintenanceEn
}
// Exec executes the query on the entity.
-func (meuo *MaintenanceEntryUpdateOne) Exec(ctx context.Context) error {
- _, err := meuo.Save(ctx)
+func (_u *MaintenanceEntryUpdateOne) Exec(ctx context.Context) error {
+ _, err := _u.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
-func (meuo *MaintenanceEntryUpdateOne) ExecX(ctx context.Context) {
- if err := meuo.Exec(ctx); err != nil {
+func (_u *MaintenanceEntryUpdateOne) ExecX(ctx context.Context) {
+ if err := _u.Exec(ctx); err != nil {
panic(err)
}
}
// defaults sets the default values of the builder before save.
-func (meuo *MaintenanceEntryUpdateOne) defaults() {
- if _, ok := meuo.mutation.UpdatedAt(); !ok {
+func (_u *MaintenanceEntryUpdateOne) defaults() {
+ if _, ok := _u.mutation.UpdatedAt(); !ok {
v := maintenanceentry.UpdateDefaultUpdatedAt()
- meuo.mutation.SetUpdatedAt(v)
+ _u.mutation.SetUpdatedAt(v)
}
}
// check runs all checks and user-defined validators on the builder.
-func (meuo *MaintenanceEntryUpdateOne) check() error {
- if v, ok := meuo.mutation.Name(); ok {
+func (_u *MaintenanceEntryUpdateOne) check() error {
+ if v, ok := _u.mutation.Name(); ok {
if err := maintenanceentry.NameValidator(v); err != nil {
return &ValidationError{Name: "name", err: fmt.Errorf(`ent: validator failed for field "MaintenanceEntry.name": %w`, err)}
}
}
- if v, ok := meuo.mutation.Description(); ok {
+ if v, ok := _u.mutation.Description(); ok {
if err := maintenanceentry.DescriptionValidator(v); err != nil {
return &ValidationError{Name: "description", err: fmt.Errorf(`ent: validator failed for field "MaintenanceEntry.description": %w`, err)}
}
}
- if meuo.mutation.ItemCleared() && len(meuo.mutation.ItemIDs()) > 0 {
+ if _u.mutation.ItemCleared() && len(_u.mutation.ItemIDs()) > 0 {
return errors.New(`ent: clearing a required unique edge "MaintenanceEntry.item"`)
}
return nil
}
-func (meuo *MaintenanceEntryUpdateOne) sqlSave(ctx context.Context) (_node *MaintenanceEntry, err error) {
- if err := meuo.check(); err != nil {
+func (_u *MaintenanceEntryUpdateOne) sqlSave(ctx context.Context) (_node *MaintenanceEntry, err error) {
+ if err := _u.check(); err != nil {
return _node, err
}
_spec := sqlgraph.NewUpdateSpec(maintenanceentry.Table, maintenanceentry.Columns, sqlgraph.NewFieldSpec(maintenanceentry.FieldID, field.TypeUUID))
- id, ok := meuo.mutation.ID()
+ id, ok := _u.mutation.ID()
if !ok {
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "MaintenanceEntry.id" for update`)}
}
_spec.Node.ID.Value = id
- if fields := meuo.fields; len(fields) > 0 {
+ if fields := _u.fields; len(fields) > 0 {
_spec.Node.Columns = make([]string, 0, len(fields))
_spec.Node.Columns = append(_spec.Node.Columns, maintenanceentry.FieldID)
for _, f := range fields {
@@ -526,44 +526,44 @@ func (meuo *MaintenanceEntryUpdateOne) sqlSave(ctx context.Context) (_node *Main
}
}
}
- if ps := meuo.mutation.predicates; len(ps) > 0 {
+ if ps := _u.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
- if value, ok := meuo.mutation.UpdatedAt(); ok {
+ if value, ok := _u.mutation.UpdatedAt(); ok {
_spec.SetField(maintenanceentry.FieldUpdatedAt, field.TypeTime, value)
}
- if value, ok := meuo.mutation.Date(); ok {
+ if value, ok := _u.mutation.Date(); ok {
_spec.SetField(maintenanceentry.FieldDate, field.TypeTime, value)
}
- if meuo.mutation.DateCleared() {
+ if _u.mutation.DateCleared() {
_spec.ClearField(maintenanceentry.FieldDate, field.TypeTime)
}
- if value, ok := meuo.mutation.ScheduledDate(); ok {
+ if value, ok := _u.mutation.ScheduledDate(); ok {
_spec.SetField(maintenanceentry.FieldScheduledDate, field.TypeTime, value)
}
- if meuo.mutation.ScheduledDateCleared() {
+ if _u.mutation.ScheduledDateCleared() {
_spec.ClearField(maintenanceentry.FieldScheduledDate, field.TypeTime)
}
- if value, ok := meuo.mutation.Name(); ok {
+ if value, ok := _u.mutation.Name(); ok {
_spec.SetField(maintenanceentry.FieldName, field.TypeString, value)
}
- if value, ok := meuo.mutation.Description(); ok {
+ if value, ok := _u.mutation.Description(); ok {
_spec.SetField(maintenanceentry.FieldDescription, field.TypeString, value)
}
- if meuo.mutation.DescriptionCleared() {
+ if _u.mutation.DescriptionCleared() {
_spec.ClearField(maintenanceentry.FieldDescription, field.TypeString)
}
- if value, ok := meuo.mutation.Cost(); ok {
+ if value, ok := _u.mutation.Cost(); ok {
_spec.SetField(maintenanceentry.FieldCost, field.TypeFloat64, value)
}
- if value, ok := meuo.mutation.AddedCost(); ok {
+ if value, ok := _u.mutation.AddedCost(); ok {
_spec.AddField(maintenanceentry.FieldCost, field.TypeFloat64, value)
}
- if meuo.mutation.ItemCleared() {
+ if _u.mutation.ItemCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -576,7 +576,7 @@ func (meuo *MaintenanceEntryUpdateOne) sqlSave(ctx context.Context) (_node *Main
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := meuo.mutation.ItemIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.ItemIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -592,10 +592,10 @@ func (meuo *MaintenanceEntryUpdateOne) sqlSave(ctx context.Context) (_node *Main
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- _node = &MaintenanceEntry{config: meuo.config}
+ _node = &MaintenanceEntry{config: _u.config}
_spec.Assign = _node.assignValues
_spec.ScanValues = _node.scanValues
- if err = sqlgraph.UpdateNode(ctx, meuo.driver, _spec); err != nil {
+ if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil {
if _, ok := err.(*sqlgraph.NotFoundError); ok {
err = &NotFoundError{maintenanceentry.Label}
} else if sqlgraph.IsConstraintError(err) {
@@ -603,6 +603,6 @@ func (meuo *MaintenanceEntryUpdateOne) sqlSave(ctx context.Context) (_node *Main
}
return nil, err
}
- meuo.mutation.done = true
+ _u.mutation.done = true
return _node, nil
}
diff --git a/backend/internal/data/ent/migrate/schema.go b/backend/internal/data/ent/migrate/schema.go
index 55a2d896..6669df41 100644
--- a/backend/internal/data/ent/migrate/schema.go
+++ b/backend/internal/data/ent/migrate/schema.go
@@ -386,11 +386,13 @@ var (
{Name: "updated_at", Type: field.TypeTime},
{Name: "name", Type: field.TypeString, Size: 255},
{Name: "email", Type: field.TypeString, Unique: true, Size: 255},
- {Name: "password", Type: field.TypeString, Size: 255},
+ {Name: "password", Type: field.TypeString, Nullable: true, Size: 255},
{Name: "is_superuser", Type: field.TypeBool, Default: false},
{Name: "superuser", Type: field.TypeBool, Default: false},
{Name: "role", Type: field.TypeEnum, Enums: []string{"user", "owner"}, Default: "user"},
{Name: "activated_on", Type: field.TypeTime, Nullable: true},
+ {Name: "oidc_issuer", Type: field.TypeString, Nullable: true},
+ {Name: "oidc_subject", Type: field.TypeString, Nullable: true},
{Name: "group_users", Type: field.TypeUUID},
}
// UsersTable holds the schema information for the "users" table.
@@ -401,11 +403,18 @@ var (
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "users_groups_users",
- Columns: []*schema.Column{UsersColumns[10]},
+ Columns: []*schema.Column{UsersColumns[12]},
RefColumns: []*schema.Column{GroupsColumns[0]},
OnDelete: schema.Cascade,
},
},
+ Indexes: []*schema.Index{
+ {
+ Name: "user_oidc_issuer_oidc_subject",
+ Unique: true,
+ Columns: []*schema.Column{UsersColumns[10], UsersColumns[11]},
+ },
+ },
}
// LabelItemsColumns holds the columns for the "label_items" table.
LabelItemsColumns = []*schema.Column{
diff --git a/backend/internal/data/ent/mutation.go b/backend/internal/data/ent/mutation.go
index 7f07202b..22908884 100644
--- a/backend/internal/data/ent/mutation.go
+++ b/backend/internal/data/ent/mutation.go
@@ -10169,6 +10169,8 @@ type UserMutation struct {
superuser *bool
role *user.Role
activated_on *time.Time
+ oidc_issuer *string
+ oidc_subject *string
clearedFields map[string]struct{}
group *uuid.UUID
clearedgroup bool
@@ -10448,7 +10450,7 @@ func (m *UserMutation) Password() (r string, exists bool) {
// OldPassword returns the old "password" field's value of the User entity.
// If the User 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 *UserMutation) OldPassword(ctx context.Context) (v string, err error) {
+func (m *UserMutation) OldPassword(ctx context.Context) (v *string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldPassword is only allowed on UpdateOne operations")
}
@@ -10462,9 +10464,22 @@ func (m *UserMutation) OldPassword(ctx context.Context) (v string, err error) {
return oldValue.Password, nil
}
+// ClearPassword clears the value of the "password" field.
+func (m *UserMutation) ClearPassword() {
+ m.password = nil
+ m.clearedFields[user.FieldPassword] = struct{}{}
+}
+
+// PasswordCleared returns if the "password" field was cleared in this mutation.
+func (m *UserMutation) PasswordCleared() bool {
+ _, ok := m.clearedFields[user.FieldPassword]
+ return ok
+}
+
// ResetPassword resets all changes to the "password" field.
func (m *UserMutation) ResetPassword() {
m.password = nil
+ delete(m.clearedFields, user.FieldPassword)
}
// SetIsSuperuser sets the "is_superuser" field.
@@ -10624,6 +10639,104 @@ func (m *UserMutation) ResetActivatedOn() {
delete(m.clearedFields, user.FieldActivatedOn)
}
+// SetOidcIssuer sets the "oidc_issuer" field.
+func (m *UserMutation) SetOidcIssuer(s string) {
+ m.oidc_issuer = &s
+}
+
+// OidcIssuer returns the value of the "oidc_issuer" field in the mutation.
+func (m *UserMutation) OidcIssuer() (r string, exists bool) {
+ v := m.oidc_issuer
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldOidcIssuer returns the old "oidc_issuer" field's value of the User entity.
+// If the User 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 *UserMutation) OldOidcIssuer(ctx context.Context) (v *string, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldOidcIssuer is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldOidcIssuer requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldOidcIssuer: %w", err)
+ }
+ return oldValue.OidcIssuer, nil
+}
+
+// ClearOidcIssuer clears the value of the "oidc_issuer" field.
+func (m *UserMutation) ClearOidcIssuer() {
+ m.oidc_issuer = nil
+ m.clearedFields[user.FieldOidcIssuer] = struct{}{}
+}
+
+// OidcIssuerCleared returns if the "oidc_issuer" field was cleared in this mutation.
+func (m *UserMutation) OidcIssuerCleared() bool {
+ _, ok := m.clearedFields[user.FieldOidcIssuer]
+ return ok
+}
+
+// ResetOidcIssuer resets all changes to the "oidc_issuer" field.
+func (m *UserMutation) ResetOidcIssuer() {
+ m.oidc_issuer = nil
+ delete(m.clearedFields, user.FieldOidcIssuer)
+}
+
+// SetOidcSubject sets the "oidc_subject" field.
+func (m *UserMutation) SetOidcSubject(s string) {
+ m.oidc_subject = &s
+}
+
+// OidcSubject returns the value of the "oidc_subject" field in the mutation.
+func (m *UserMutation) OidcSubject() (r string, exists bool) {
+ v := m.oidc_subject
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldOidcSubject returns the old "oidc_subject" field's value of the User entity.
+// If the User 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 *UserMutation) OldOidcSubject(ctx context.Context) (v *string, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldOidcSubject is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldOidcSubject requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldOidcSubject: %w", err)
+ }
+ return oldValue.OidcSubject, nil
+}
+
+// ClearOidcSubject clears the value of the "oidc_subject" field.
+func (m *UserMutation) ClearOidcSubject() {
+ m.oidc_subject = nil
+ m.clearedFields[user.FieldOidcSubject] = struct{}{}
+}
+
+// OidcSubjectCleared returns if the "oidc_subject" field was cleared in this mutation.
+func (m *UserMutation) OidcSubjectCleared() bool {
+ _, ok := m.clearedFields[user.FieldOidcSubject]
+ return ok
+}
+
+// ResetOidcSubject resets all changes to the "oidc_subject" field.
+func (m *UserMutation) ResetOidcSubject() {
+ m.oidc_subject = nil
+ delete(m.clearedFields, user.FieldOidcSubject)
+}
+
// SetGroupID sets the "group" edge to the Group entity by id.
func (m *UserMutation) SetGroupID(id uuid.UUID) {
m.group = &id
@@ -10805,7 +10918,7 @@ func (m *UserMutation) Type() string {
// order to get all numeric fields that were incremented/decremented, call
// AddedFields().
func (m *UserMutation) Fields() []string {
- fields := make([]string, 0, 9)
+ fields := make([]string, 0, 11)
if m.created_at != nil {
fields = append(fields, user.FieldCreatedAt)
}
@@ -10833,6 +10946,12 @@ func (m *UserMutation) Fields() []string {
if m.activated_on != nil {
fields = append(fields, user.FieldActivatedOn)
}
+ if m.oidc_issuer != nil {
+ fields = append(fields, user.FieldOidcIssuer)
+ }
+ if m.oidc_subject != nil {
+ fields = append(fields, user.FieldOidcSubject)
+ }
return fields
}
@@ -10859,6 +10978,10 @@ func (m *UserMutation) Field(name string) (ent.Value, bool) {
return m.Role()
case user.FieldActivatedOn:
return m.ActivatedOn()
+ case user.FieldOidcIssuer:
+ return m.OidcIssuer()
+ case user.FieldOidcSubject:
+ return m.OidcSubject()
}
return nil, false
}
@@ -10886,6 +11009,10 @@ func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, er
return m.OldRole(ctx)
case user.FieldActivatedOn:
return m.OldActivatedOn(ctx)
+ case user.FieldOidcIssuer:
+ return m.OldOidcIssuer(ctx)
+ case user.FieldOidcSubject:
+ return m.OldOidcSubject(ctx)
}
return nil, fmt.Errorf("unknown User field %s", name)
}
@@ -10958,6 +11085,20 @@ func (m *UserMutation) SetField(name string, value ent.Value) error {
}
m.SetActivatedOn(v)
return nil
+ case user.FieldOidcIssuer:
+ v, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetOidcIssuer(v)
+ return nil
+ case user.FieldOidcSubject:
+ v, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetOidcSubject(v)
+ return nil
}
return fmt.Errorf("unknown User field %s", name)
}
@@ -10988,9 +11129,18 @@ func (m *UserMutation) AddField(name string, value ent.Value) error {
// mutation.
func (m *UserMutation) ClearedFields() []string {
var fields []string
+ if m.FieldCleared(user.FieldPassword) {
+ fields = append(fields, user.FieldPassword)
+ }
if m.FieldCleared(user.FieldActivatedOn) {
fields = append(fields, user.FieldActivatedOn)
}
+ if m.FieldCleared(user.FieldOidcIssuer) {
+ fields = append(fields, user.FieldOidcIssuer)
+ }
+ if m.FieldCleared(user.FieldOidcSubject) {
+ fields = append(fields, user.FieldOidcSubject)
+ }
return fields
}
@@ -11005,9 +11155,18 @@ func (m *UserMutation) FieldCleared(name string) bool {
// error if the field is not defined in the schema.
func (m *UserMutation) ClearField(name string) error {
switch name {
+ case user.FieldPassword:
+ m.ClearPassword()
+ return nil
case user.FieldActivatedOn:
m.ClearActivatedOn()
return nil
+ case user.FieldOidcIssuer:
+ m.ClearOidcIssuer()
+ return nil
+ case user.FieldOidcSubject:
+ m.ClearOidcSubject()
+ return nil
}
return fmt.Errorf("unknown User nullable field %s", name)
}
@@ -11043,6 +11202,12 @@ func (m *UserMutation) ResetField(name string) error {
case user.FieldActivatedOn:
m.ResetActivatedOn()
return nil
+ case user.FieldOidcIssuer:
+ m.ResetOidcIssuer()
+ return nil
+ case user.FieldOidcSubject:
+ m.ResetOidcSubject()
+ return nil
}
return fmt.Errorf("unknown User field %s", name)
}
diff --git a/backend/internal/data/ent/notifier.go b/backend/internal/data/ent/notifier.go
index 03b4920e..d3b157f5 100644
--- a/backend/internal/data/ent/notifier.go
+++ b/backend/internal/data/ent/notifier.go
@@ -95,7 +95,7 @@ func (*Notifier) scanValues(columns []string) ([]any, error) {
// assignValues assigns the values that were returned from sql.Rows (after scanning)
// to the Notifier fields.
-func (n *Notifier) assignValues(columns []string, values []any) error {
+func (_m *Notifier) assignValues(columns []string, values []any) error {
if m, n := len(values), len(columns); m < n {
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
}
@@ -105,52 +105,52 @@ func (n *Notifier) assignValues(columns []string, values []any) error {
if value, ok := values[i].(*uuid.UUID); !ok {
return fmt.Errorf("unexpected type %T for field id", values[i])
} else if value != nil {
- n.ID = *value
+ _m.ID = *value
}
case notifier.FieldCreatedAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field created_at", values[i])
} else if value.Valid {
- n.CreatedAt = value.Time
+ _m.CreatedAt = value.Time
}
case notifier.FieldUpdatedAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field updated_at", values[i])
} else if value.Valid {
- n.UpdatedAt = value.Time
+ _m.UpdatedAt = value.Time
}
case notifier.FieldGroupID:
if value, ok := values[i].(*uuid.UUID); !ok {
return fmt.Errorf("unexpected type %T for field group_id", values[i])
} else if value != nil {
- n.GroupID = *value
+ _m.GroupID = *value
}
case notifier.FieldUserID:
if value, ok := values[i].(*uuid.UUID); !ok {
return fmt.Errorf("unexpected type %T for field user_id", values[i])
} else if value != nil {
- n.UserID = *value
+ _m.UserID = *value
}
case notifier.FieldName:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field name", values[i])
} else if value.Valid {
- n.Name = value.String
+ _m.Name = value.String
}
case notifier.FieldURL:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field url", values[i])
} else if value.Valid {
- n.URL = value.String
+ _m.URL = value.String
}
case notifier.FieldIsActive:
if value, ok := values[i].(*sql.NullBool); !ok {
return fmt.Errorf("unexpected type %T for field is_active", values[i])
} else if value.Valid {
- n.IsActive = value.Bool
+ _m.IsActive = value.Bool
}
default:
- n.selectValues.Set(columns[i], values[i])
+ _m.selectValues.Set(columns[i], values[i])
}
}
return nil
@@ -158,62 +158,62 @@ func (n *Notifier) assignValues(columns []string, values []any) error {
// Value returns the ent.Value that was dynamically selected and assigned to the Notifier.
// This includes values selected through modifiers, order, etc.
-func (n *Notifier) Value(name string) (ent.Value, error) {
- return n.selectValues.Get(name)
+func (_m *Notifier) Value(name string) (ent.Value, error) {
+ return _m.selectValues.Get(name)
}
// QueryGroup queries the "group" edge of the Notifier entity.
-func (n *Notifier) QueryGroup() *GroupQuery {
- return NewNotifierClient(n.config).QueryGroup(n)
+func (_m *Notifier) QueryGroup() *GroupQuery {
+ return NewNotifierClient(_m.config).QueryGroup(_m)
}
// QueryUser queries the "user" edge of the Notifier entity.
-func (n *Notifier) QueryUser() *UserQuery {
- return NewNotifierClient(n.config).QueryUser(n)
+func (_m *Notifier) QueryUser() *UserQuery {
+ return NewNotifierClient(_m.config).QueryUser(_m)
}
// Update returns a builder for updating this Notifier.
// Note that you need to call Notifier.Unwrap() before calling this method if this Notifier
// was returned from a transaction, and the transaction was committed or rolled back.
-func (n *Notifier) Update() *NotifierUpdateOne {
- return NewNotifierClient(n.config).UpdateOne(n)
+func (_m *Notifier) Update() *NotifierUpdateOne {
+ return NewNotifierClient(_m.config).UpdateOne(_m)
}
// Unwrap unwraps the Notifier 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 (n *Notifier) Unwrap() *Notifier {
- _tx, ok := n.config.driver.(*txDriver)
+func (_m *Notifier) Unwrap() *Notifier {
+ _tx, ok := _m.config.driver.(*txDriver)
if !ok {
panic("ent: Notifier is not a transactional entity")
}
- n.config.driver = _tx.drv
- return n
+ _m.config.driver = _tx.drv
+ return _m
}
// String implements the fmt.Stringer.
-func (n *Notifier) String() string {
+func (_m *Notifier) String() string {
var builder strings.Builder
builder.WriteString("Notifier(")
- builder.WriteString(fmt.Sprintf("id=%v, ", n.ID))
+ builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
builder.WriteString("created_at=")
- builder.WriteString(n.CreatedAt.Format(time.ANSIC))
+ builder.WriteString(_m.CreatedAt.Format(time.ANSIC))
builder.WriteString(", ")
builder.WriteString("updated_at=")
- builder.WriteString(n.UpdatedAt.Format(time.ANSIC))
+ builder.WriteString(_m.UpdatedAt.Format(time.ANSIC))
builder.WriteString(", ")
builder.WriteString("group_id=")
- builder.WriteString(fmt.Sprintf("%v", n.GroupID))
+ builder.WriteString(fmt.Sprintf("%v", _m.GroupID))
builder.WriteString(", ")
builder.WriteString("user_id=")
- builder.WriteString(fmt.Sprintf("%v", n.UserID))
+ builder.WriteString(fmt.Sprintf("%v", _m.UserID))
builder.WriteString(", ")
builder.WriteString("name=")
- builder.WriteString(n.Name)
+ builder.WriteString(_m.Name)
builder.WriteString(", ")
builder.WriteString("url=<sensitive>")
builder.WriteString(", ")
builder.WriteString("is_active=")
- builder.WriteString(fmt.Sprintf("%v", n.IsActive))
+ builder.WriteString(fmt.Sprintf("%v", _m.IsActive))
builder.WriteByte(')')
return builder.String()
}
diff --git a/backend/internal/data/ent/notifier_create.go b/backend/internal/data/ent/notifier_create.go
index 03e72335..0446c9de 100644
--- a/backend/internal/data/ent/notifier_create.go
+++ b/backend/internal/data/ent/notifier_create.go
@@ -24,109 +24,109 @@ type NotifierCreate struct {
}
// SetCreatedAt sets the "created_at" field.
-func (nc *NotifierCreate) SetCreatedAt(t time.Time) *NotifierCreate {
- nc.mutation.SetCreatedAt(t)
- return nc
+func (_c *NotifierCreate) SetCreatedAt(v time.Time) *NotifierCreate {
+ _c.mutation.SetCreatedAt(v)
+ return _c
}
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
-func (nc *NotifierCreate) SetNillableCreatedAt(t *time.Time) *NotifierCreate {
- if t != nil {
- nc.SetCreatedAt(*t)
+func (_c *NotifierCreate) SetNillableCreatedAt(v *time.Time) *NotifierCreate {
+ if v != nil {
+ _c.SetCreatedAt(*v)
}
- return nc
+ return _c
}
// SetUpdatedAt sets the "updated_at" field.
-func (nc *NotifierCreate) SetUpdatedAt(t time.Time) *NotifierCreate {
- nc.mutation.SetUpdatedAt(t)
- return nc
+func (_c *NotifierCreate) SetUpdatedAt(v time.Time) *NotifierCreate {
+ _c.mutation.SetUpdatedAt(v)
+ return _c
}
// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
-func (nc *NotifierCreate) SetNillableUpdatedAt(t *time.Time) *NotifierCreate {
- if t != nil {
- nc.SetUpdatedAt(*t)
+func (_c *NotifierCreate) SetNillableUpdatedAt(v *time.Time) *NotifierCreate {
+ if v != nil {
+ _c.SetUpdatedAt(*v)
}
- return nc
+ return _c
}
// SetGroupID sets the "group_id" field.
-func (nc *NotifierCreate) SetGroupID(u uuid.UUID) *NotifierCreate {
- nc.mutation.SetGroupID(u)
- return nc
+func (_c *NotifierCreate) SetGroupID(v uuid.UUID) *NotifierCreate {
+ _c.mutation.SetGroupID(v)
+ return _c
}
// SetUserID sets the "user_id" field.
-func (nc *NotifierCreate) SetUserID(u uuid.UUID) *NotifierCreate {
- nc.mutation.SetUserID(u)
- return nc
+func (_c *NotifierCreate) SetUserID(v uuid.UUID) *NotifierCreate {
+ _c.mutation.SetUserID(v)
+ return _c
}
// SetName sets the "name" field.
-func (nc *NotifierCreate) SetName(s string) *NotifierCreate {
- nc.mutation.SetName(s)
- return nc
+func (_c *NotifierCreate) SetName(v string) *NotifierCreate {
+ _c.mutation.SetName(v)
+ return _c
}
// SetURL sets the "url" field.
-func (nc *NotifierCreate) SetURL(s string) *NotifierCreate {
- nc.mutation.SetURL(s)
- return nc
+func (_c *NotifierCreate) SetURL(v string) *NotifierCreate {
+ _c.mutation.SetURL(v)
+ return _c
}
// SetIsActive sets the "is_active" field.
-func (nc *NotifierCreate) SetIsActive(b bool) *NotifierCreate {
- nc.mutation.SetIsActive(b)
- return nc
+func (_c *NotifierCreate) SetIsActive(v bool) *NotifierCreate {
+ _c.mutation.SetIsActive(v)
+ return _c
}
// SetNillableIsActive sets the "is_active" field if the given value is not nil.
-func (nc *NotifierCreate) SetNillableIsActive(b *bool) *NotifierCreate {
- if b != nil {
- nc.SetIsActive(*b)
+func (_c *NotifierCreate) SetNillableIsActive(v *bool) *NotifierCreate {
+ if v != nil {
+ _c.SetIsActive(*v)
}
- return nc
+ return _c
}
// SetID sets the "id" field.
-func (nc *NotifierCreate) SetID(u uuid.UUID) *NotifierCreate {
- nc.mutation.SetID(u)
- return nc
+func (_c *NotifierCreate) SetID(v uuid.UUID) *NotifierCreate {
+ _c.mutation.SetID(v)
+ return _c
}
// SetNillableID sets the "id" field if the given value is not nil.
-func (nc *NotifierCreate) SetNillableID(u *uuid.UUID) *NotifierCreate {
- if u != nil {
- nc.SetID(*u)
+func (_c *NotifierCreate) SetNillableID(v *uuid.UUID) *NotifierCreate {
+ if v != nil {
+ _c.SetID(*v)
}
- return nc
+ return _c
}
// SetGroup sets the "group" edge to the Group entity.
-func (nc *NotifierCreate) SetGroup(g *Group) *NotifierCreate {
- return nc.SetGroupID(g.ID)
+func (_c *NotifierCreate) SetGroup(v *Group) *NotifierCreate {
+ return _c.SetGroupID(v.ID)
}
// SetUser sets the "user" edge to the User entity.
-func (nc *NotifierCreate) SetUser(u *User) *NotifierCreate {
- return nc.SetUserID(u.ID)
+func (_c *NotifierCreate) SetUser(v *User) *NotifierCreate {
+ return _c.SetUserID(v.ID)
}
// Mutation returns the NotifierMutation object of the builder.
-func (nc *NotifierCreate) Mutation() *NotifierMutation {
- return nc.mutation
+func (_c *NotifierCreate) Mutation() *NotifierMutation {
+ return _c.mutation
}
// Save creates the Notifier in the database.
-func (nc *NotifierCreate) Save(ctx context.Context) (*Notifier, error) {
- nc.defaults()
- return withHooks(ctx, nc.sqlSave, nc.mutation, nc.hooks)
+func (_c *NotifierCreate) Save(ctx context.Context) (*Notifier, error) {
+ _c.defaults()
+ return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
}
// SaveX calls Save and panics if Save returns an error.
-func (nc *NotifierCreate) SaveX(ctx context.Context) *Notifier {
- v, err := nc.Save(ctx)
+func (_c *NotifierCreate) SaveX(ctx context.Context) *Notifier {
+ v, err := _c.Save(ctx)
if err != nil {
panic(err)
}
@@ -134,86 +134,86 @@ func (nc *NotifierCreate) SaveX(ctx context.Context) *Notifier {
}
// Exec executes the query.
-func (nc *NotifierCreate) Exec(ctx context.Context) error {
- _, err := nc.Save(ctx)
+func (_c *NotifierCreate) Exec(ctx context.Context) error {
+ _, err := _c.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
-func (nc *NotifierCreate) ExecX(ctx context.Context) {
- if err := nc.Exec(ctx); err != nil {
+func (_c *NotifierCreate) ExecX(ctx context.Context) {
+ if err := _c.Exec(ctx); err != nil {
panic(err)
}
}
// defaults sets the default values of the builder before save.
-func (nc *NotifierCreate) defaults() {
- if _, ok := nc.mutation.CreatedAt(); !ok {
+func (_c *NotifierCreate) defaults() {
+ if _, ok := _c.mutation.CreatedAt(); !ok {
v := notifier.DefaultCreatedAt()
- nc.mutation.SetCreatedAt(v)
+ _c.mutation.SetCreatedAt(v)
}
- if _, ok := nc.mutation.UpdatedAt(); !ok {
+ if _, ok := _c.mutation.UpdatedAt(); !ok {
v := notifier.DefaultUpdatedAt()
- nc.mutation.SetUpdatedAt(v)
+ _c.mutation.SetUpdatedAt(v)
}
- if _, ok := nc.mutation.IsActive(); !ok {
+ if _, ok := _c.mutation.IsActive(); !ok {
v := notifier.DefaultIsActive
- nc.mutation.SetIsActive(v)
+ _c.mutation.SetIsActive(v)
}
- if _, ok := nc.mutation.ID(); !ok {
+ if _, ok := _c.mutation.ID(); !ok {
v := notifier.DefaultID()
- nc.mutation.SetID(v)
+ _c.mutation.SetID(v)
}
}
// check runs all checks and user-defined validators on the builder.
-func (nc *NotifierCreate) check() error {
- if _, ok := nc.mutation.CreatedAt(); !ok {
+func (_c *NotifierCreate) check() error {
+ if _, ok := _c.mutation.CreatedAt(); !ok {
return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "Notifier.created_at"`)}
}
- if _, ok := nc.mutation.UpdatedAt(); !ok {
+ if _, ok := _c.mutation.UpdatedAt(); !ok {
return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "Notifier.updated_at"`)}
}
- if _, ok := nc.mutation.GroupID(); !ok {
+ if _, ok := _c.mutation.GroupID(); !ok {
return &ValidationError{Name: "group_id", err: errors.New(`ent: missing required field "Notifier.group_id"`)}
}
- if _, ok := nc.mutation.UserID(); !ok {
+ if _, ok := _c.mutation.UserID(); !ok {
return &ValidationError{Name: "user_id", err: errors.New(`ent: missing required field "Notifier.user_id"`)}
}
- if _, ok := nc.mutation.Name(); !ok {
+ if _, ok := _c.mutation.Name(); !ok {
return &ValidationError{Name: "name", err: errors.New(`ent: missing required field "Notifier.name"`)}
}
- if v, ok := nc.mutation.Name(); ok {
+ if v, ok := _c.mutation.Name(); ok {
if err := notifier.NameValidator(v); err != nil {
return &ValidationError{Name: "name", err: fmt.Errorf(`ent: validator failed for field "Notifier.name": %w`, err)}
}
}
- if _, ok := nc.mutation.URL(); !ok {
+ if _, ok := _c.mutation.URL(); !ok {
return &ValidationError{Name: "url", err: errors.New(`ent: missing required field "Notifier.url"`)}
}
- if v, ok := nc.mutation.URL(); ok {
+ if v, ok := _c.mutation.URL(); ok {
if err := notifier.URLValidator(v); err != nil {
return &ValidationError{Name: "url", err: fmt.Errorf(`ent: validator failed for field "Notifier.url": %w`, err)}
}
}
- if _, ok := nc.mutation.IsActive(); !ok {
+ if _, ok := _c.mutation.IsActive(); !ok {
return &ValidationError{Name: "is_active", err: errors.New(`ent: missing required field "Notifier.is_active"`)}
}
- if len(nc.mutation.GroupIDs()) == 0 {
+ if len(_c.mutation.GroupIDs()) == 0 {
return &ValidationError{Name: "group", err: errors.New(`ent: missing required edge "Notifier.group"`)}
}
- if len(nc.mutation.UserIDs()) == 0 {
+ if len(_c.mutation.UserIDs()) == 0 {
return &ValidationError{Name: "user", err: errors.New(`ent: missing required edge "Notifier.user"`)}
}
return nil
}
-func (nc *NotifierCreate) sqlSave(ctx context.Context) (*Notifier, error) {
- if err := nc.check(); err != nil {
+func (_c *NotifierCreate) sqlSave(ctx context.Context) (*Notifier, error) {
+ if err := _c.check(); err != nil {
return nil, err
}
- _node, _spec := nc.createSpec()
- if err := sqlgraph.CreateNode(ctx, nc.driver, _spec); err != nil {
+ _node, _spec := _c.createSpec()
+ if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil {
if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
@@ -226,41 +226,41 @@ func (nc *NotifierCreate) sqlSave(ctx context.Context) (*Notifier, error) {
return nil, err
}
}
- nc.mutation.id = &_node.ID
- nc.mutation.done = true
+ _c.mutation.id = &_node.ID
+ _c.mutation.done = true
return _node, nil
}
-func (nc *NotifierCreate) createSpec() (*Notifier, *sqlgraph.CreateSpec) {
+func (_c *NotifierCreate) createSpec() (*Notifier, *sqlgraph.CreateSpec) {
var (
- _node = &Notifier{config: nc.config}
+ _node = &Notifier{config: _c.config}
_spec = sqlgraph.NewCreateSpec(notifier.Table, sqlgraph.NewFieldSpec(notifier.FieldID, field.TypeUUID))
)
- if id, ok := nc.mutation.ID(); ok {
+ if id, ok := _c.mutation.ID(); ok {
_node.ID = id
_spec.ID.Value = &id
}
- if value, ok := nc.mutation.CreatedAt(); ok {
+ if value, ok := _c.mutation.CreatedAt(); ok {
_spec.SetField(notifier.FieldCreatedAt, field.TypeTime, value)
_node.CreatedAt = value
}
- if value, ok := nc.mutation.UpdatedAt(); ok {
+ if value, ok := _c.mutation.UpdatedAt(); ok {
_spec.SetField(notifier.FieldUpdatedAt, field.TypeTime, value)
_node.UpdatedAt = value
}
- if value, ok := nc.mutation.Name(); ok {
+ if value, ok := _c.mutation.Name(); ok {
_spec.SetField(notifier.FieldName, field.TypeString, value)
_node.Name = value
}
- if value, ok := nc.mutation.URL(); ok {
+ if value, ok := _c.mutation.URL(); ok {
_spec.SetField(notifier.FieldURL, field.TypeString, value)
_node.URL = value
}
- if value, ok := nc.mutation.IsActive(); ok {
+ if value, ok := _c.mutation.IsActive(); ok {
_spec.SetField(notifier.FieldIsActive, field.TypeBool, value)
_node.IsActive = value
}
- if nodes := nc.mutation.GroupIDs(); len(nodes) > 0 {
+ if nodes := _c.mutation.GroupIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -277,7 +277,7 @@ func (nc *NotifierCreate) createSpec() (*Notifier, *sqlgraph.CreateSpec) {
_node.GroupID = nodes[0]
_spec.Edges = append(_spec.Edges, edge)
}
- if nodes := nc.mutation.UserIDs(); len(nodes) > 0 {
+ if nodes := _c.mutation.UserIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -305,16 +305,16 @@ type NotifierCreateBulk struct {
}
// Save creates the Notifier entities in the database.
-func (ncb *NotifierCreateBulk) Save(ctx context.Context) ([]*Notifier, error) {
- if ncb.err != nil {
- return nil, ncb.err
- }
- specs := make([]*sqlgraph.CreateSpec, len(ncb.builders))
- nodes := make([]*Notifier, len(ncb.builders))
- mutators := make([]Mutator, len(ncb.builders))
- for i := range ncb.builders {
+func (_c *NotifierCreateBulk) Save(ctx context.Context) ([]*Notifier, error) {
+ if _c.err != nil {
+ return nil, _c.err
+ }
+ specs := make([]*sqlgraph.CreateSpec, len(_c.builders))
+ nodes := make([]*Notifier, len(_c.builders))
+ mutators := make([]Mutator, len(_c.builders))
+ for i := range _c.builders {
func(i int, root context.Context) {
- builder := ncb.builders[i]
+ builder := _c.builders[i]
builder.defaults()
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
mutation, ok := m.(*NotifierMutation)
@@ -328,11 +328,11 @@ func (ncb *NotifierCreateBulk) Save(ctx context.Context) ([]*Notifier, error) {
var err error
nodes[i], specs[i] = builder.createSpec()
if i < len(mutators)-1 {
- _, err = mutators[i+1].Mutate(root, ncb.builders[i+1].mutation)
+ _, err = mutators[i+1].Mutate(root, _c.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, ncb.driver, spec); err != nil {
+ if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil {
if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
@@ -352,7 +352,7 @@ func (ncb *NotifierCreateBulk) Save(ctx context.Context) ([]*Notifier, error) {
}(i, ctx)
}
if len(mutators) > 0 {
- if _, err := mutators[0].Mutate(ctx, ncb.builders[0].mutation); err != nil {
+ if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil {
return nil, err
}
}
@@ -360,8 +360,8 @@ func (ncb *NotifierCreateBulk) Save(ctx context.Context) ([]*Notifier, error) {
}
// SaveX is like Save, but panics if an error occurs.
-func (ncb *NotifierCreateBulk) SaveX(ctx context.Context) []*Notifier {
- v, err := ncb.Save(ctx)
+func (_c *NotifierCreateBulk) SaveX(ctx context.Context) []*Notifier {
+ v, err := _c.Save(ctx)
if err != nil {
panic(err)
}
@@ -369,14 +369,14 @@ func (ncb *NotifierCreateBulk) SaveX(ctx context.Context) []*Notifier {
}
// Exec executes the query.
-func (ncb *NotifierCreateBulk) Exec(ctx context.Context) error {
- _, err := ncb.Save(ctx)
+func (_c *NotifierCreateBulk) Exec(ctx context.Context) error {
+ _, err := _c.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
-func (ncb *NotifierCreateBulk) ExecX(ctx context.Context) {
- if err := ncb.Exec(ctx); err != nil {
+func (_c *NotifierCreateBulk) ExecX(ctx context.Context) {
+ if err := _c.Exec(ctx); err != nil {
panic(err)
}
}
diff --git a/backend/internal/data/ent/notifier_delete.go b/backend/internal/data/ent/notifier_delete.go
index 2e809fa9..d6b09cde 100644
--- a/backend/internal/data/ent/notifier_delete.go
+++ b/backend/internal/data/ent/notifier_delete.go
@@ -20,56 +20,56 @@ type NotifierDelete struct {
}
// Where appends a list predicates to the NotifierDelete builder.
-func (nd *NotifierDelete) Where(ps ...predicate.Notifier) *NotifierDelete {
- nd.mutation.Where(ps...)
- return nd
+func (_d *NotifierDelete) Where(ps ...predicate.Notifier) *NotifierDelete {
+ _d.mutation.Where(ps...)
+ return _d
}
// Exec executes the deletion query and returns how many vertices were deleted.
-func (nd *NotifierDelete) Exec(ctx context.Context) (int, error) {
- return withHooks(ctx, nd.sqlExec, nd.mutation, nd.hooks)
+func (_d *NotifierDelete) Exec(ctx context.Context) (int, error) {
+ return withHooks(ctx, _d.sqlExec, _d.mutation, _d.hooks)
}
// ExecX is like Exec, but panics if an error occurs.
-func (nd *NotifierDelete) ExecX(ctx context.Context) int {
- n, err := nd.Exec(ctx)
+func (_d *NotifierDelete) ExecX(ctx context.Context) int {
+ n, err := _d.Exec(ctx)
if err != nil {
panic(err)
}
return n
}
-func (nd *NotifierDelete) sqlExec(ctx context.Context) (int, error) {
+func (_d *NotifierDelete) sqlExec(ctx context.Context) (int, error) {
_spec := sqlgraph.NewDeleteSpec(notifier.Table, sqlgraph.NewFieldSpec(notifier.FieldID, field.TypeUUID))
- if ps := nd.mutation.predicates; len(ps) > 0 {
+ if ps := _d.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
- affected, err := sqlgraph.DeleteNodes(ctx, nd.driver, _spec)
+ affected, err := sqlgraph.DeleteNodes(ctx, _d.driver, _spec)
if err != nil && sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
- nd.mutation.done = true
+ _d.mutation.done = true
return affected, err
}
// NotifierDeleteOne is the builder for deleting a single Notifier entity.
type NotifierDeleteOne struct {
- nd *NotifierDelete
+ _d *NotifierDelete
}
// Where appends a list predicates to the NotifierDelete builder.
-func (ndo *NotifierDeleteOne) Where(ps ...predicate.Notifier) *NotifierDeleteOne {
- ndo.nd.mutation.Where(ps...)
- return ndo
+func (_d *NotifierDeleteOne) Where(ps ...predicate.Notifier) *NotifierDeleteOne {
+ _d._d.mutation.Where(ps...)
+ return _d
}
// Exec executes the deletion query.
-func (ndo *NotifierDeleteOne) Exec(ctx context.Context) error {
- n, err := ndo.nd.Exec(ctx)
+func (_d *NotifierDeleteOne) Exec(ctx context.Context) error {
+ n, err := _d._d.Exec(ctx)
switch {
case err != nil:
return err
@@ -81,8 +81,8 @@ func (ndo *NotifierDeleteOne) Exec(ctx context.Context) error {
}
// ExecX is like Exec, but panics if an error occurs.
-func (ndo *NotifierDeleteOne) ExecX(ctx context.Context) {
- if err := ndo.Exec(ctx); err != nil {
+func (_d *NotifierDeleteOne) ExecX(ctx context.Context) {
+ if err := _d.Exec(ctx); err != nil {
panic(err)
}
}
diff --git a/backend/internal/data/ent/notifier_query.go b/backend/internal/data/ent/notifier_query.go
index 232b8113..744ba58e 100644
--- a/backend/internal/data/ent/notifier_query.go
+++ b/backend/internal/data/ent/notifier_query.go
@@ -33,44 +33,44 @@ type NotifierQuery struct {
}
// Where adds a new predicate for the NotifierQuery builder.
-func (nq *NotifierQuery) Where(ps ...predicate.Notifier) *NotifierQuery {
- nq.predicates = append(nq.predicates, ps...)
- return nq
+func (_q *NotifierQuery) Where(ps ...predicate.Notifier) *NotifierQuery {
+ _q.predicates = append(_q.predicates, ps...)
+ return _q
}
// Limit the number of records to be returned by this query.
-func (nq *NotifierQuery) Limit(limit int) *NotifierQuery {
- nq.ctx.Limit = &limit
- return nq
+func (_q *NotifierQuery) Limit(limit int) *NotifierQuery {
+ _q.ctx.Limit = &limit
+ return _q
}
// Offset to start from.
-func (nq *NotifierQuery) Offset(offset int) *NotifierQuery {
- nq.ctx.Offset = &offset
- return nq
+func (_q *NotifierQuery) Offset(offset int) *NotifierQuery {
+ _q.ctx.Offset = &offset
+ return _q
}
// Unique configures the query builder to filter duplicate records on query.
// By default, unique is set to true, and can be disabled using this method.
-func (nq *NotifierQuery) Unique(unique bool) *NotifierQuery {
- nq.ctx.Unique = &unique
- return nq
+func (_q *NotifierQuery) Unique(unique bool) *NotifierQuery {
+ _q.ctx.Unique = &unique
+ return _q
}
// Order specifies how the records should be ordered.
-func (nq *NotifierQuery) Order(o ...notifier.OrderOption) *NotifierQuery {
- nq.order = append(nq.order, o...)
- return nq
+func (_q *NotifierQuery) Order(o ...notifier.OrderOption) *NotifierQuery {
+ _q.order = append(_q.order, o...)
+ return _q
}
// QueryGroup chains the current query on the "group" edge.
-func (nq *NotifierQuery) QueryGroup() *GroupQuery {
- query := (&GroupClient{config: nq.config}).Query()
+func (_q *NotifierQuery) QueryGroup() *GroupQuery {
+ query := (&GroupClient{config: _q.config}).Query()
query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
- if err := nq.prepareQuery(ctx); err != nil {
+ if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
- selector := nq.sqlQuery(ctx)
+ selector := _q.sqlQuery(ctx)
if err := selector.Err(); err != nil {
return nil, err
}
@@ -79,20 +79,20 @@ func (nq *NotifierQuery) QueryGroup() *GroupQuery {
sqlgraph.To(group.Table, group.FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, notifier.GroupTable, notifier.GroupColumn),
)
- fromU = sqlgraph.SetNeighbors(nq.driver.Dialect(), step)
+ fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step)
return fromU, nil
}
return query
}
// QueryUser chains the current query on the "user" edge.
-func (nq *NotifierQuery) QueryUser() *UserQuery {
- query := (&UserClient{config: nq.config}).Query()
+func (_q *NotifierQuery) QueryUser() *UserQuery {
+ query := (&UserClient{config: _q.config}).Query()
query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
- if err := nq.prepareQuery(ctx); err != nil {
+ if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
- selector := nq.sqlQuery(ctx)
+ selector := _q.sqlQuery(ctx)
if err := selector.Err(); err != nil {
return nil, err
}
@@ -101,7 +101,7 @@ func (nq *NotifierQuery) QueryUser() *UserQuery {
sqlgraph.To(user.Table, user.FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, notifier.UserTable, notifier.UserColumn),
)
- fromU = sqlgraph.SetNeighbors(nq.driver.Dialect(), step)
+ fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step)
return fromU, nil
}
return query
@@ -109,8 +109,8 @@ func (nq *NotifierQuery) QueryUser() *UserQuery {
// First returns the first Notifier entity from the query.
// Returns a *NotFoundError when no Notifier was found.
-func (nq *NotifierQuery) First(ctx context.Context) (*Notifier, error) {
- nodes, err := nq.Limit(1).All(setContextOp(ctx, nq.ctx, ent.OpQueryFirst))
+func (_q *NotifierQuery) First(ctx context.Context) (*Notifier, error) {
+ nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst))
if err != nil {
return nil, err
}
@@ -121,8 +121,8 @@ func (nq *NotifierQuery) First(ctx context.Context) (*Notifier, error) {
}
// FirstX is like First, but panics if an error occurs.
-func (nq *NotifierQuery) FirstX(ctx context.Context) *Notifier {
- node, err := nq.First(ctx)
+func (_q *NotifierQuery) FirstX(ctx context.Context) *Notifier {
+ node, err := _q.First(ctx)
if err != nil && !IsNotFound(err) {
panic(err)
}
@@ -131,9 +131,9 @@ func (nq *NotifierQuery) FirstX(ctx context.Context) *Notifier {
// FirstID returns the first Notifier ID from the query.
// Returns a *NotFoundError when no Notifier ID was found.
-func (nq *NotifierQuery) FirstID(ctx context.Context) (id uuid.UUID, err error) {
+func (_q *NotifierQuery) FirstID(ctx context.Context) (id uuid.UUID, err error) {
var ids []uuid.UUID
- if ids, err = nq.Limit(1).IDs(setContextOp(ctx, nq.ctx, ent.OpQueryFirstID)); err != nil {
+ if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil {
return
}
if len(ids) == 0 {
@@ -144,8 +144,8 @@ func (nq *NotifierQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)
}
// FirstIDX is like FirstID, but panics if an error occurs.
-func (nq *NotifierQuery) FirstIDX(ctx context.Context) uuid.UUID {
- id, err := nq.FirstID(ctx)
+func (_q *NotifierQuery) FirstIDX(ctx context.Context) uuid.UUID {
+ id, err := _q.FirstID(ctx)
if err != nil && !IsNotFound(err) {
panic(err)
}
@@ -155,8 +155,8 @@ func (nq *NotifierQuery) FirstIDX(ctx context.Context) uuid.UUID {
// Only returns a single Notifier entity found by the query, ensuring it only returns one.
// Returns a *NotSingularError when more than one Notifier entity is found.
// Returns a *NotFoundError when no Notifier entities are found.
-func (nq *NotifierQuery) Only(ctx context.Context) (*Notifier, error) {
- nodes, err := nq.Limit(2).All(setContextOp(ctx, nq.ctx, ent.OpQueryOnly))
+func (_q *NotifierQuery) Only(ctx context.Context) (*Notifier, error) {
+ nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly))
if err != nil {
return nil, err
}
@@ -171,8 +171,8 @@ func (nq *NotifierQuery) Only(ctx context.Context) (*Notifier, error) {
}
// OnlyX is like Only, but panics if an error occurs.
-func (nq *NotifierQuery) OnlyX(ctx context.Context) *Notifier {
- node, err := nq.Only(ctx)
+func (_q *NotifierQuery) OnlyX(ctx context.Context) *Notifier {
+ node, err := _q.Only(ctx)
if err != nil {
panic(err)
}
@@ -182,9 +182,9 @@ func (nq *NotifierQuery) OnlyX(ctx context.Context) *Notifier {
// OnlyID is like Only, but returns the only Notifier ID in the query.
// Returns a *NotSingularError when more than one Notifier ID is found.
// Returns a *NotFoundError when no entities are found.
-func (nq *NotifierQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error) {
+func (_q *NotifierQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error) {
var ids []uuid.UUID
- if ids, err = nq.Limit(2).IDs(setContextOp(ctx, nq.ctx, ent.OpQueryOnlyID)); err != nil {
+ if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil {
return
}
switch len(ids) {
@@ -199,8 +199,8 @@ func (nq *NotifierQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error) {
}
// OnlyIDX is like OnlyID, but panics if an error occurs.
-func (nq *NotifierQuery) OnlyIDX(ctx context.Context) uuid.UUID {
- id, err := nq.OnlyID(ctx)
+func (_q *NotifierQuery) OnlyIDX(ctx context.Context) uuid.UUID {
+ id, err := _q.OnlyID(ctx)
if err != nil {
panic(err)
}
@@ -208,18 +208,18 @@ func (nq *NotifierQuery) OnlyIDX(ctx context.Context) uuid.UUID {
}
// All executes the query and returns a list of Notifiers.
-func (nq *NotifierQuery) All(ctx context.Context) ([]*Notifier, error) {
- ctx = setContextOp(ctx, nq.ctx, ent.OpQueryAll)
- if err := nq.prepareQuery(ctx); err != nil {
+func (_q *NotifierQuery) All(ctx context.Context) ([]*Notifier, error) {
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll)
+ if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
qr := querierAll[[]*Notifier, *NotifierQuery]()
- return withInterceptors[[]*Notifier](ctx, nq, qr, nq.inters)
+ return withInterceptors[[]*Notifier](ctx, _q, qr, _q.inters)
}
// AllX is like All, but panics if an error occurs.
-func (nq *NotifierQuery) AllX(ctx context.Context) []*Notifier {
- nodes, err := nq.All(ctx)
+func (_q *NotifierQuery) AllX(ctx context.Context) []*Notifier {
+ nodes, err := _q.All(ctx)
if err != nil {
panic(err)
}
@@ -227,20 +227,20 @@ func (nq *NotifierQuery) AllX(ctx context.Context) []*Notifier {
}
// IDs executes the query and returns a list of Notifier IDs.
-func (nq *NotifierQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error) {
- if nq.ctx.Unique == nil && nq.path != nil {
- nq.Unique(true)
+func (_q *NotifierQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error) {
+ if _q.ctx.Unique == nil && _q.path != nil {
+ _q.Unique(true)
}
- ctx = setContextOp(ctx, nq.ctx, ent.OpQueryIDs)
- if err = nq.Select(notifier.FieldID).Scan(ctx, &ids); err != nil {
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs)
+ if err = _q.Select(notifier.FieldID).Scan(ctx, &ids); err != nil {
return nil, err
}
return ids, nil
}
// IDsX is like IDs, but panics if an error occurs.
-func (nq *NotifierQuery) IDsX(ctx context.Context) []uuid.UUID {
- ids, err := nq.IDs(ctx)
+func (_q *NotifierQuery) IDsX(ctx context.Context) []uuid.UUID {
+ ids, err := _q.IDs(ctx)
if err != nil {
panic(err)
}
@@ -248,17 +248,17 @@ func (nq *NotifierQuery) IDsX(ctx context.Context) []uuid.UUID {
}
// Count returns the count of the given query.
-func (nq *NotifierQuery) Count(ctx context.Context) (int, error) {
- ctx = setContextOp(ctx, nq.ctx, ent.OpQueryCount)
- if err := nq.prepareQuery(ctx); err != nil {
+func (_q *NotifierQuery) Count(ctx context.Context) (int, error) {
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryCount)
+ if err := _q.prepareQuery(ctx); err != nil {
return 0, err
}
- return withInterceptors[int](ctx, nq, querierCount[*NotifierQuery](), nq.inters)
+ return withInterceptors[int](ctx, _q, querierCount[*NotifierQuery](), _q.inters)
}
// CountX is like Count, but panics if an error occurs.
-func (nq *NotifierQuery) CountX(ctx context.Context) int {
- count, err := nq.Count(ctx)
+func (_q *NotifierQuery) CountX(ctx context.Context) int {
+ count, err := _q.Count(ctx)
if err != nil {
panic(err)
}
@@ -266,9 +266,9 @@ func (nq *NotifierQuery) CountX(ctx context.Context) int {
}
// Exist returns true if the query has elements in the graph.
-func (nq *NotifierQuery) Exist(ctx context.Context) (bool, error) {
- ctx = setContextOp(ctx, nq.ctx, ent.OpQueryExist)
- switch _, err := nq.FirstID(ctx); {
+func (_q *NotifierQuery) Exist(ctx context.Context) (bool, error) {
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryExist)
+ switch _, err := _q.FirstID(ctx); {
case IsNotFound(err):
return false, nil
case err != nil:
@@ -279,8 +279,8 @@ func (nq *NotifierQuery) Exist(ctx context.Context) (bool, error) {
}
// ExistX is like Exist, but panics if an error occurs.
-func (nq *NotifierQuery) ExistX(ctx context.Context) bool {
- exist, err := nq.Exist(ctx)
+func (_q *NotifierQuery) ExistX(ctx context.Context) bool {
+ exist, err := _q.Exist(ctx)
if err != nil {
panic(err)
}
@@ -289,44 +289,44 @@ func (nq *NotifierQuery) ExistX(ctx context.Context) bool {
// Clone returns a duplicate of the NotifierQuery builder, including all associated steps. It can be
// used to prepare common query builders and use them differently after the clone is made.
-func (nq *NotifierQuery) Clone() *NotifierQuery {
- if nq == nil {
+func (_q *NotifierQuery) Clone() *NotifierQuery {
+ if _q == nil {
return nil
}
return &NotifierQuery{
- config: nq.config,
- ctx: nq.ctx.Clone(),
- order: append([]notifier.OrderOption{}, nq.order...),
- inters: append([]Interceptor{}, nq.inters...),
- predicates: append([]predicate.Notifier{}, nq.predicates...),
- withGroup: nq.withGroup.Clone(),
- withUser: nq.withUser.Clone(),
+ config: _q.config,
+ ctx: _q.ctx.Clone(),
+ order: append([]notifier.OrderOption{}, _q.order...),
+ inters: append([]Interceptor{}, _q.inters...),
+ predicates: append([]predicate.Notifier{}, _q.predicates...),
+ withGroup: _q.withGroup.Clone(),
+ withUser: _q.withUser.Clone(),
// clone intermediate query.
- sql: nq.sql.Clone(),
- path: nq.path,
+ sql: _q.sql.Clone(),
+ path: _q.path,
}
}
// WithGroup tells the query-builder to eager-load the nodes that are connected to
// the "group" edge. The optional arguments are used to configure the query builder of the edge.
-func (nq *NotifierQuery) WithGroup(opts ...func(*GroupQuery)) *NotifierQuery {
- query := (&GroupClient{config: nq.config}).Query()
+func (_q *NotifierQuery) WithGroup(opts ...func(*GroupQuery)) *NotifierQuery {
+ query := (&GroupClient{config: _q.config}).Query()
for _, opt := range opts {
opt(query)
}
- nq.withGroup = query
- return nq
+ _q.withGroup = query
+ return _q
}
// WithUser tells the query-builder to eager-load the nodes that are connected to
// the "user" edge. The optional arguments are used to configure the query builder of the edge.
-func (nq *NotifierQuery) WithUser(opts ...func(*UserQuery)) *NotifierQuery {
- query := (&UserClient{config: nq.config}).Query()
+func (_q *NotifierQuery) WithUser(opts ...func(*UserQuery)) *NotifierQuery {
+ query := (&UserClient{config: _q.config}).Query()
for _, opt := range opts {
opt(query)
}
- nq.withUser = query
- return nq
+ _q.withUser = query
+ return _q
}
// GroupBy is used to group vertices by one or more fields/columns.
@@ -343,10 +343,10 @@ func (nq *NotifierQuery) WithUser(opts ...func(*UserQuery)) *NotifierQuery {
// GroupBy(notifier.FieldCreatedAt).
// Aggregate(ent.Count()).
// Scan(ctx, &v)
-func (nq *NotifierQuery) GroupBy(field string, fields ...string) *NotifierGroupBy {
- nq.ctx.Fields = append([]string{field}, fields...)
- grbuild := &NotifierGroupBy{build: nq}
- grbuild.flds = &nq.ctx.Fields
+func (_q *NotifierQuery) GroupBy(field string, fields ...string) *NotifierGroupBy {
+ _q.ctx.Fields = append([]string{field}, fields...)
+ grbuild := &NotifierGroupBy{build: _q}
+ grbuild.flds = &_q.ctx.Fields
grbuild.label = notifier.Label
grbuild.scan = grbuild.Scan
return grbuild
@@ -364,59 +364,59 @@ func (nq *NotifierQuery) GroupBy(field string, fields ...string) *NotifierGroupB
// client.Notifier.Query().
// Select(notifier.FieldCreatedAt).
// Scan(ctx, &v)
-func (nq *NotifierQuery) Select(fields ...string) *NotifierSelect {
- nq.ctx.Fields = append(nq.ctx.Fields, fields...)
- sbuild := &NotifierSelect{NotifierQuery: nq}
+func (_q *NotifierQuery) Select(fields ...string) *NotifierSelect {
+ _q.ctx.Fields = append(_q.ctx.Fields, fields...)
+ sbuild := &NotifierSelect{NotifierQuery: _q}
sbuild.label = notifier.Label
- sbuild.flds, sbuild.scan = &nq.ctx.Fields, sbuild.Scan
+ sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan
return sbuild
}
// Aggregate returns a NotifierSelect configured with the given aggregations.
-func (nq *NotifierQuery) Aggregate(fns ...AggregateFunc) *NotifierSelect {
- return nq.Select().Aggregate(fns...)
+func (_q *NotifierQuery) Aggregate(fns ...AggregateFunc) *NotifierSelect {
+ return _q.Select().Aggregate(fns...)
}
-func (nq *NotifierQuery) prepareQuery(ctx context.Context) error {
- for _, inter := range nq.inters {
+func (_q *NotifierQuery) prepareQuery(ctx context.Context) error {
+ for _, inter := range _q.inters {
if inter == nil {
return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)")
}
if trv, ok := inter.(Traverser); ok {
- if err := trv.Traverse(ctx, nq); err != nil {
+ if err := trv.Traverse(ctx, _q); err != nil {
return err
}
}
}
- for _, f := range nq.ctx.Fields {
+ for _, f := range _q.ctx.Fields {
if !notifier.ValidColumn(f) {
return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
}
}
- if nq.path != nil {
- prev, err := nq.path(ctx)
+ if _q.path != nil {
+ prev, err := _q.path(ctx)
if err != nil {
return err
}
- nq.sql = prev
+ _q.sql = prev
}
return nil
}
-func (nq *NotifierQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Notifier, error) {
+func (_q *NotifierQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Notifier, error) {
var (
nodes = []*Notifier{}
- _spec = nq.querySpec()
+ _spec = _q.querySpec()
loadedTypes = [2]bool{
- nq.withGroup != nil,
- nq.withUser != nil,
+ _q.withGroup != nil,
+ _q.withUser != nil,
}
)
_spec.ScanValues = func(columns []string) ([]any, error) {
return (*Notifier).scanValues(nil, columns)
}
_spec.Assign = func(columns []string, values []any) error {
- node := &Notifier{config: nq.config}
+ node := &Notifier{config: _q.config}
nodes = append(nodes, node)
node.Edges.loadedTypes = loadedTypes
return node.assignValues(columns, values)
@@ -424,20 +424,20 @@ func (nq *NotifierQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Not
for i := range hooks {
hooks[i](ctx, _spec)
}
- if err := sqlgraph.QueryNodes(ctx, nq.driver, _spec); err != nil {
+ if err := sqlgraph.QueryNodes(ctx, _q.driver, _spec); err != nil {
return nil, err
}
if len(nodes) == 0 {
return nodes, nil
}
- if query := nq.withGroup; query != nil {
- if err := nq.loadGroup(ctx, query, nodes, nil,
+ if query := _q.withGroup; query != nil {
+ if err := _q.loadGroup(ctx, query, nodes, nil,
func(n *Notifier, e *Group) { n.Edges.Group = e }); err != nil {
return nil, err
}
}
- if query := nq.withUser; query != nil {
- if err := nq.loadUser(ctx, query, nodes, nil,
+ if query := _q.withUser; query != nil {
+ if err := _q.loadUser(ctx, query, nodes, nil,
func(n *Notifier, e *User) { n.Edges.User = e }); err != nil {
return nil, err
}
@@ -445,7 +445,7 @@ func (nq *NotifierQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Not
return nodes, nil
}
-func (nq *NotifierQuery) loadGroup(ctx context.Context, query *GroupQuery, nodes []*Notifier, init func(*Notifier), assign func(*Notifier, *Group)) error {
+func (_q *NotifierQuery) loadGroup(ctx context.Context, query *GroupQuery, nodes []*Notifier, init func(*Notifier), assign func(*Notifier, *Group)) error {
ids := make([]uuid.UUID, 0, len(nodes))
nodeids := make(map[uuid.UUID][]*Notifier)
for i := range nodes {
@@ -474,7 +474,7 @@ func (nq *NotifierQuery) loadGroup(ctx context.Context, query *GroupQuery, nodes
}
return nil
}
-func (nq *NotifierQuery) loadUser(ctx context.Context, query *UserQuery, nodes []*Notifier, init func(*Notifier), assign func(*Notifier, *User)) error {
+func (_q *NotifierQuery) loadUser(ctx context.Context, query *UserQuery, nodes []*Notifier, init func(*Notifier), assign func(*Notifier, *User)) error {
ids := make([]uuid.UUID, 0, len(nodes))
nodeids := make(map[uuid.UUID][]*Notifier)
for i := range nodes {
@@ -504,24 +504,24 @@ func (nq *NotifierQuery) loadUser(ctx context.Context, query *UserQuery, nodes [
return nil
}
-func (nq *NotifierQuery) sqlCount(ctx context.Context) (int, error) {
- _spec := nq.querySpec()
- _spec.Node.Columns = nq.ctx.Fields
- if len(nq.ctx.Fields) > 0 {
- _spec.Unique = nq.ctx.Unique != nil && *nq.ctx.Unique
+func (_q *NotifierQuery) sqlCount(ctx context.Context) (int, error) {
+ _spec := _q.querySpec()
+ _spec.Node.Columns = _q.ctx.Fields
+ if len(_q.ctx.Fields) > 0 {
+ _spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique
}
- return sqlgraph.CountNodes(ctx, nq.driver, _spec)
+ return sqlgraph.CountNodes(ctx, _q.driver, _spec)
}
-func (nq *NotifierQuery) querySpec() *sqlgraph.QuerySpec {
+func (_q *NotifierQuery) querySpec() *sqlgraph.QuerySpec {
_spec := sqlgraph.NewQuerySpec(notifier.Table, notifier.Columns, sqlgraph.NewFieldSpec(notifier.FieldID, field.TypeUUID))
- _spec.From = nq.sql
- if unique := nq.ctx.Unique; unique != nil {
+ _spec.From = _q.sql
+ if unique := _q.ctx.Unique; unique != nil {
_spec.Unique = *unique
- } else if nq.path != nil {
+ } else if _q.path != nil {
_spec.Unique = true
}
- if fields := nq.ctx.Fields; len(fields) > 0 {
+ if fields := _q.ctx.Fields; len(fields) > 0 {
_spec.Node.Columns = make([]string, 0, len(fields))
_spec.Node.Columns = append(_spec.Node.Columns, notifier.FieldID)
for i := range fields {
@@ -529,27 +529,27 @@ func (nq *NotifierQuery) querySpec() *sqlgraph.QuerySpec {
_spec.Node.Columns = append(_spec.Node.Columns, fields[i])
}
}
- if nq.withGroup != nil {
+ if _q.withGroup != nil {
_spec.Node.AddColumnOnce(notifier.FieldGroupID)
}
- if nq.withUser != nil {
+ if _q.withUser != nil {
_spec.Node.AddColumnOnce(notifier.FieldUserID)
}
}
- if ps := nq.predicates; len(ps) > 0 {
+ if ps := _q.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
- if limit := nq.ctx.Limit; limit != nil {
+ if limit := _q.ctx.Limit; limit != nil {
_spec.Limit = *limit
}
- if offset := nq.ctx.Offset; offset != nil {
+ if offset := _q.ctx.Offset; offset != nil {
_spec.Offset = *offset
}
- if ps := nq.order; len(ps) > 0 {
+ if ps := _q.order; len(ps) > 0 {
_spec.Order = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
@@ -559,33 +559,33 @@ func (nq *NotifierQuery) querySpec() *sqlgraph.QuerySpec {
return _spec
}
-func (nq *NotifierQuery) sqlQuery(ctx context.Context) *sql.Selector {
- builder := sql.Dialect(nq.driver.Dialect())
+func (_q *NotifierQuery) sqlQuery(ctx context.Context) *sql.Selector {
+ builder := sql.Dialect(_q.driver.Dialect())
t1 := builder.Table(notifier.Table)
- columns := nq.ctx.Fields
+ columns := _q.ctx.Fields
if len(columns) == 0 {
columns = notifier.Columns
}
selector := builder.Select(t1.Columns(columns...)...).From(t1)
- if nq.sql != nil {
- selector = nq.sql
+ if _q.sql != nil {
+ selector = _q.sql
selector.Select(selector.Columns(columns...)...)
}
- if nq.ctx.Unique != nil && *nq.ctx.Unique {
+ if _q.ctx.Unique != nil && *_q.ctx.Unique {
selector.Distinct()
}
- for _, p := range nq.predicates {
+ for _, p := range _q.predicates {
p(selector)
}
- for _, p := range nq.order {
+ for _, p := range _q.order {
p(selector)
}
- if offset := nq.ctx.Offset; offset != nil {
+ if offset := _q.ctx.Offset; offset != nil {
// limit is mandatory for offset clause. We start
// with default value, and override it below if needed.
selector.Offset(*offset).Limit(math.MaxInt32)
}
- if limit := nq.ctx.Limit; limit != nil {
+ if limit := _q.ctx.Limit; limit != nil {
selector.Limit(*limit)
}
return selector
@@ -598,41 +598,41 @@ type NotifierGroupBy struct {
}
// Aggregate adds the given aggregation functions to the group-by query.
-func (ngb *NotifierGroupBy) Aggregate(fns ...AggregateFunc) *NotifierGroupBy {
- ngb.fns = append(ngb.fns, fns...)
- return ngb
+func (_g *NotifierGroupBy) Aggregate(fns ...AggregateFunc) *NotifierGroupBy {
+ _g.fns = append(_g.fns, fns...)
+ return _g
}
// Scan applies the selector query and scans the result into the given value.
-func (ngb *NotifierGroupBy) Scan(ctx context.Context, v any) error {
- ctx = setContextOp(ctx, ngb.build.ctx, ent.OpQueryGroupBy)
- if err := ngb.build.prepareQuery(ctx); err != nil {
+func (_g *NotifierGroupBy) Scan(ctx context.Context, v any) error {
+ ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy)
+ if err := _g.build.prepareQuery(ctx); err != nil {
return err
}
- return scanWithInterceptors[*NotifierQuery, *NotifierGroupBy](ctx, ngb.build, ngb, ngb.build.inters, v)
+ return scanWithInterceptors[*NotifierQuery, *NotifierGroupBy](ctx, _g.build, _g, _g.build.inters, v)
}
-func (ngb *NotifierGroupBy) sqlScan(ctx context.Context, root *NotifierQuery, v any) error {
+func (_g *NotifierGroupBy) sqlScan(ctx context.Context, root *NotifierQuery, v any) error {
selector := root.sqlQuery(ctx).Select()
- aggregation := make([]string, 0, len(ngb.fns))
- for _, fn := range ngb.fns {
+ aggregation := make([]string, 0, len(_g.fns))
+ for _, fn := range _g.fns {
aggregation = append(aggregation, fn(selector))
}
if len(selector.SelectedColumns()) == 0 {
- columns := make([]string, 0, len(*ngb.flds)+len(ngb.fns))
- for _, f := range *ngb.flds {
+ columns := make([]string, 0, len(*_g.flds)+len(_g.fns))
+ for _, f := range *_g.flds {
columns = append(columns, selector.C(f))
}
columns = append(columns, aggregation...)
selector.Select(columns...)
}
- selector.GroupBy(selector.Columns(*ngb.flds...)...)
+ selector.GroupBy(selector.Columns(*_g.flds...)...)
if err := selector.Err(); err != nil {
return err
}
rows := &sql.Rows{}
query, args := selector.Query()
- if err := ngb.build.driver.Query(ctx, query, args, rows); err != nil {
+ if err := _g.build.driver.Query(ctx, query, args, rows); err != nil {
return err
}
defer rows.Close()
@@ -646,27 +646,27 @@ type NotifierSelect struct {
}
// Aggregate adds the given aggregation functions to the selector query.
-func (ns *NotifierSelect) Aggregate(fns ...AggregateFunc) *NotifierSelect {
- ns.fns = append(ns.fns, fns...)
- return ns
+func (_s *NotifierSelect) Aggregate(fns ...AggregateFunc) *NotifierSelect {
+ _s.fns = append(_s.fns, fns...)
+ return _s
}
// Scan applies the selector query and scans the result into the given value.
-func (ns *NotifierSelect) Scan(ctx context.Context, v any) error {
- ctx = setContextOp(ctx, ns.ctx, ent.OpQuerySelect)
- if err := ns.prepareQuery(ctx); err != nil {
+func (_s *NotifierSelect) Scan(ctx context.Context, v any) error {
+ ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect)
+ if err := _s.prepareQuery(ctx); err != nil {
return err
}
- return scanWithInterceptors[*NotifierQuery, *NotifierSelect](ctx, ns.NotifierQuery, ns, ns.inters, v)
+ return scanWithInterceptors[*NotifierQuery, *NotifierSelect](ctx, _s.NotifierQuery, _s, _s.inters, v)
}
-func (ns *NotifierSelect) sqlScan(ctx context.Context, root *NotifierQuery, v any) error {
+func (_s *NotifierSelect) sqlScan(ctx context.Context, root *NotifierQuery, v any) error {
selector := root.sqlQuery(ctx)
- aggregation := make([]string, 0, len(ns.fns))
- for _, fn := range ns.fns {
+ aggregation := make([]string, 0, len(_s.fns))
+ for _, fn := range _s.fns {
aggregation = append(aggregation, fn(selector))
}
- switch n := len(*ns.selector.flds); {
+ switch n := len(*_s.selector.flds); {
case n == 0 && len(aggregation) > 0:
selector.Select(aggregation...)
case n != 0 && len(aggregation) > 0:
@@ -674,7 +674,7 @@ func (ns *NotifierSelect) sqlScan(ctx context.Context, root *NotifierQuery, v an
}
rows := &sql.Rows{}
query, args := selector.Query()
- if err := ns.driver.Query(ctx, query, args, rows); err != nil {
+ if err := _s.driver.Query(ctx, query, args, rows); err != nil {
return err
}
defer rows.Close()
diff --git a/backend/internal/data/ent/notifier_update.go b/backend/internal/data/ent/notifier_update.go
index 683c413c..92524883 100644
--- a/backend/internal/data/ent/notifier_update.go
+++ b/backend/internal/data/ent/notifier_update.go
@@ -26,123 +26,123 @@ type NotifierUpdate struct {
}
// Where appends a list predicates to the NotifierUpdate builder.
-func (nu *NotifierUpdate) Where(ps ...predicate.Notifier) *NotifierUpdate {
- nu.mutation.Where(ps...)
- return nu
+func (_u *NotifierUpdate) Where(ps ...predicate.Notifier) *NotifierUpdate {
+ _u.mutation.Where(ps...)
+ return _u
}
// SetUpdatedAt sets the "updated_at" field.
-func (nu *NotifierUpdate) SetUpdatedAt(t time.Time) *NotifierUpdate {
- nu.mutation.SetUpdatedAt(t)
- return nu
+func (_u *NotifierUpdate) SetUpdatedAt(v time.Time) *NotifierUpdate {
+ _u.mutation.SetUpdatedAt(v)
+ return _u
}
// SetGroupID sets the "group_id" field.
-func (nu *NotifierUpdate) SetGroupID(u uuid.UUID) *NotifierUpdate {
- nu.mutation.SetGroupID(u)
- return nu
+func (_u *NotifierUpdate) SetGroupID(v uuid.UUID) *NotifierUpdate {
+ _u.mutation.SetGroupID(v)
+ return _u
}
// SetNillableGroupID sets the "group_id" field if the given value is not nil.
-func (nu *NotifierUpdate) SetNillableGroupID(u *uuid.UUID) *NotifierUpdate {
- if u != nil {
- nu.SetGroupID(*u)
+func (_u *NotifierUpdate) SetNillableGroupID(v *uuid.UUID) *NotifierUpdate {
+ if v != nil {
+ _u.SetGroupID(*v)
}
- return nu
+ return _u
}
// SetUserID sets the "user_id" field.
-func (nu *NotifierUpdate) SetUserID(u uuid.UUID) *NotifierUpdate {
- nu.mutation.SetUserID(u)
- return nu
+func (_u *NotifierUpdate) SetUserID(v uuid.UUID) *NotifierUpdate {
+ _u.mutation.SetUserID(v)
+ return _u
}
// SetNillableUserID sets the "user_id" field if the given value is not nil.
-func (nu *NotifierUpdate) SetNillableUserID(u *uuid.UUID) *NotifierUpdate {
- if u != nil {
- nu.SetUserID(*u)
+func (_u *NotifierUpdate) SetNillableUserID(v *uuid.UUID) *NotifierUpdate {
+ if v != nil {
+ _u.SetUserID(*v)
}
- return nu
+ return _u
}
// SetName sets the "name" field.
-func (nu *NotifierUpdate) SetName(s string) *NotifierUpdate {
- nu.mutation.SetName(s)
- return nu
+func (_u *NotifierUpdate) SetName(v string) *NotifierUpdate {
+ _u.mutation.SetName(v)
+ return _u
}
// SetNillableName sets the "name" field if the given value is not nil.
-func (nu *NotifierUpdate) SetNillableName(s *string) *NotifierUpdate {
- if s != nil {
- nu.SetName(*s)
+func (_u *NotifierUpdate) SetNillableName(v *string) *NotifierUpdate {
+ if v != nil {
+ _u.SetName(*v)
}
- return nu
+ return _u
}
// SetURL sets the "url" field.
-func (nu *NotifierUpdate) SetURL(s string) *NotifierUpdate {
- nu.mutation.SetURL(s)
- return nu
+func (_u *NotifierUpdate) SetURL(v string) *NotifierUpdate {
+ _u.mutation.SetURL(v)
+ return _u
}
// SetNillableURL sets the "url" field if the given value is not nil.
-func (nu *NotifierUpdate) SetNillableURL(s *string) *NotifierUpdate {
- if s != nil {
- nu.SetURL(*s)
+func (_u *NotifierUpdate) SetNillableURL(v *string) *NotifierUpdate {
+ if v != nil {
+ _u.SetURL(*v)
}
- return nu
+ return _u
}
// SetIsActive sets the "is_active" field.
-func (nu *NotifierUpdate) SetIsActive(b bool) *NotifierUpdate {
- nu.mutation.SetIsActive(b)
- return nu
+func (_u *NotifierUpdate) SetIsActive(v bool) *NotifierUpdate {
+ _u.mutation.SetIsActive(v)
+ return _u
}
// SetNillableIsActive sets the "is_active" field if the given value is not nil.
-func (nu *NotifierUpdate) SetNillableIsActive(b *bool) *NotifierUpdate {
- if b != nil {
- nu.SetIsActive(*b)
+func (_u *NotifierUpdate) SetNillableIsActive(v *bool) *NotifierUpdate {
+ if v != nil {
+ _u.SetIsActive(*v)
}
- return nu
+ return _u
}
// SetGroup sets the "group" edge to the Group entity.
-func (nu *NotifierUpdate) SetGroup(g *Group) *NotifierUpdate {
- return nu.SetGroupID(g.ID)
+func (_u *NotifierUpdate) SetGroup(v *Group) *NotifierUpdate {
+ return _u.SetGroupID(v.ID)
}
// SetUser sets the "user" edge to the User entity.
-func (nu *NotifierUpdate) SetUser(u *User) *NotifierUpdate {
- return nu.SetUserID(u.ID)
+func (_u *NotifierUpdate) SetUser(v *User) *NotifierUpdate {
+ return _u.SetUserID(v.ID)
}
// Mutation returns the NotifierMutation object of the builder.
-func (nu *NotifierUpdate) Mutation() *NotifierMutation {
- return nu.mutation
+func (_u *NotifierUpdate) Mutation() *NotifierMutation {
+ return _u.mutation
}
// ClearGroup clears the "group" edge to the Group entity.
-func (nu *NotifierUpdate) ClearGroup() *NotifierUpdate {
- nu.mutation.ClearGroup()
- return nu
+func (_u *NotifierUpdate) ClearGroup() *NotifierUpdate {
+ _u.mutation.ClearGroup()
+ return _u
}
// ClearUser clears the "user" edge to the User entity.
-func (nu *NotifierUpdate) ClearUser() *NotifierUpdate {
- nu.mutation.ClearUser()
- return nu
+func (_u *NotifierUpdate) ClearUser() *NotifierUpdate {
+ _u.mutation.ClearUser()
+ return _u
}
// Save executes the query and returns the number of nodes affected by the update operation.
-func (nu *NotifierUpdate) Save(ctx context.Context) (int, error) {
- nu.defaults()
- return withHooks(ctx, nu.sqlSave, nu.mutation, nu.hooks)
+func (_u *NotifierUpdate) Save(ctx context.Context) (int, error) {
+ _u.defaults()
+ return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
}
// SaveX is like Save, but panics if an error occurs.
-func (nu *NotifierUpdate) SaveX(ctx context.Context) int {
- affected, err := nu.Save(ctx)
+func (_u *NotifierUpdate) SaveX(ctx context.Context) int {
+ affected, err := _u.Save(ctx)
if err != nil {
panic(err)
}
@@ -150,72 +150,72 @@ func (nu *NotifierUpdate) SaveX(ctx context.Context) int {
}
// Exec executes the query.
-func (nu *NotifierUpdate) Exec(ctx context.Context) error {
- _, err := nu.Save(ctx)
+func (_u *NotifierUpdate) Exec(ctx context.Context) error {
+ _, err := _u.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
-func (nu *NotifierUpdate) ExecX(ctx context.Context) {
- if err := nu.Exec(ctx); err != nil {
+func (_u *NotifierUpdate) ExecX(ctx context.Context) {
+ if err := _u.Exec(ctx); err != nil {
panic(err)
}
}
// defaults sets the default values of the builder before save.
-func (nu *NotifierUpdate) defaults() {
- if _, ok := nu.mutation.UpdatedAt(); !ok {
+func (_u *NotifierUpdate) defaults() {
+ if _, ok := _u.mutation.UpdatedAt(); !ok {
v := notifier.UpdateDefaultUpdatedAt()
- nu.mutation.SetUpdatedAt(v)
+ _u.mutation.SetUpdatedAt(v)
}
}
// check runs all checks and user-defined validators on the builder.
-func (nu *NotifierUpdate) check() error {
- if v, ok := nu.mutation.Name(); ok {
+func (_u *NotifierUpdate) check() error {
+ if v, ok := _u.mutation.Name(); ok {
if err := notifier.NameValidator(v); err != nil {
return &ValidationError{Name: "name", err: fmt.Errorf(`ent: validator failed for field "Notifier.name": %w`, err)}
}
}
- if v, ok := nu.mutation.URL(); ok {
+ if v, ok := _u.mutation.URL(); ok {
if err := notifier.URLValidator(v); err != nil {
return &ValidationError{Name: "url", err: fmt.Errorf(`ent: validator failed for field "Notifier.url": %w`, err)}
}
}
- if nu.mutation.GroupCleared() && len(nu.mutation.GroupIDs()) > 0 {
+ if _u.mutation.GroupCleared() && len(_u.mutation.GroupIDs()) > 0 {
return errors.New(`ent: clearing a required unique edge "Notifier.group"`)
}
- if nu.mutation.UserCleared() && len(nu.mutation.UserIDs()) > 0 {
+ if _u.mutation.UserCleared() && len(_u.mutation.UserIDs()) > 0 {
return errors.New(`ent: clearing a required unique edge "Notifier.user"`)
}
return nil
}
-func (nu *NotifierUpdate) sqlSave(ctx context.Context) (n int, err error) {
- if err := nu.check(); err != nil {
- return n, err
+func (_u *NotifierUpdate) sqlSave(ctx context.Context) (_node int, err error) {
+ if err := _u.check(); err != nil {
+ return _node, err
}
_spec := sqlgraph.NewUpdateSpec(notifier.Table, notifier.Columns, sqlgraph.NewFieldSpec(notifier.FieldID, field.TypeUUID))
- if ps := nu.mutation.predicates; len(ps) > 0 {
+ if ps := _u.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
- if value, ok := nu.mutation.UpdatedAt(); ok {
+ if value, ok := _u.mutation.UpdatedAt(); ok {
_spec.SetField(notifier.FieldUpdatedAt, field.TypeTime, value)
}
- if value, ok := nu.mutation.Name(); ok {
+ if value, ok := _u.mutation.Name(); ok {
_spec.SetField(notifier.FieldName, field.TypeString, value)
}
- if value, ok := nu.mutation.URL(); ok {
+ if value, ok := _u.mutation.URL(); ok {
_spec.SetField(notifier.FieldURL, field.TypeString, value)
}
- if value, ok := nu.mutation.IsActive(); ok {
+ if value, ok := _u.mutation.IsActive(); ok {
_spec.SetField(notifier.FieldIsActive, field.TypeBool, value)
}
- if nu.mutation.GroupCleared() {
+ if _u.mutation.GroupCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -228,7 +228,7 @@ func (nu *NotifierUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := nu.mutation.GroupIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.GroupIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -244,7 +244,7 @@ func (nu *NotifierUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- if nu.mutation.UserCleared() {
+ if _u.mutation.UserCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -257,7 +257,7 @@ func (nu *NotifierUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := nu.mutation.UserIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.UserIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -273,7 +273,7 @@ func (nu *NotifierUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- if n, err = sqlgraph.UpdateNodes(ctx, nu.driver, _spec); err != nil {
+ if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil {
if _, ok := err.(*sqlgraph.NotFoundError); ok {
err = &NotFoundError{notifier.Label}
} else if sqlgraph.IsConstraintError(err) {
@@ -281,8 +281,8 @@ func (nu *NotifierUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
return 0, err
}
- nu.mutation.done = true
- return n, nil
+ _u.mutation.done = true
+ return _node, nil
}
// NotifierUpdateOne is the builder for updating a single Notifier entity.
@@ -294,130 +294,130 @@ type NotifierUpdateOne struct {
}
// SetUpdatedAt sets the "updated_at" field.
-func (nuo *NotifierUpdateOne) SetUpdatedAt(t time.Time) *NotifierUpdateOne {
- nuo.mutation.SetUpdatedAt(t)
- return nuo
+func (_u *NotifierUpdateOne) SetUpdatedAt(v time.Time) *NotifierUpdateOne {
+ _u.mutation.SetUpdatedAt(v)
+ return _u
}
// SetGroupID sets the "group_id" field.
-func (nuo *NotifierUpdateOne) SetGroupID(u uuid.UUID) *NotifierUpdateOne {
- nuo.mutation.SetGroupID(u)
- return nuo
+func (_u *NotifierUpdateOne) SetGroupID(v uuid.UUID) *NotifierUpdateOne {
+ _u.mutation.SetGroupID(v)
+ return _u
}
// SetNillableGroupID sets the "group_id" field if the given value is not nil.
-func (nuo *NotifierUpdateOne) SetNillableGroupID(u *uuid.UUID) *NotifierUpdateOne {
- if u != nil {
- nuo.SetGroupID(*u)
+func (_u *NotifierUpdateOne) SetNillableGroupID(v *uuid.UUID) *NotifierUpdateOne {
+ if v != nil {
+ _u.SetGroupID(*v)
}
- return nuo
+ return _u
}
// SetUserID sets the "user_id" field.
-func (nuo *NotifierUpdateOne) SetUserID(u uuid.UUID) *NotifierUpdateOne {
- nuo.mutation.SetUserID(u)
- return nuo
+func (_u *NotifierUpdateOne) SetUserID(v uuid.UUID) *NotifierUpdateOne {
+ _u.mutation.SetUserID(v)
+ return _u
}
// SetNillableUserID sets the "user_id" field if the given value is not nil.
-func (nuo *NotifierUpdateOne) SetNillableUserID(u *uuid.UUID) *NotifierUpdateOne {
- if u != nil {
- nuo.SetUserID(*u)
+func (_u *NotifierUpdateOne) SetNillableUserID(v *uuid.UUID) *NotifierUpdateOne {
+ if v != nil {
+ _u.SetUserID(*v)
}
- return nuo
+ return _u
}
// SetName sets the "name" field.
-func (nuo *NotifierUpdateOne) SetName(s string) *NotifierUpdateOne {
- nuo.mutation.SetName(s)
- return nuo
+func (_u *NotifierUpdateOne) SetName(v string) *NotifierUpdateOne {
+ _u.mutation.SetName(v)
+ return _u
}
// SetNillableName sets the "name" field if the given value is not nil.
-func (nuo *NotifierUpdateOne) SetNillableName(s *string) *NotifierUpdateOne {
- if s != nil {
- nuo.SetName(*s)
+func (_u *NotifierUpdateOne) SetNillableName(v *string) *NotifierUpdateOne {
+ if v != nil {
+ _u.SetName(*v)
}
- return nuo
+ return _u
}
// SetURL sets the "url" field.
-func (nuo *NotifierUpdateOne) SetURL(s string) *NotifierUpdateOne {
- nuo.mutation.SetURL(s)
- return nuo
+func (_u *NotifierUpdateOne) SetURL(v string) *NotifierUpdateOne {
+ _u.mutation.SetURL(v)
+ return _u
}
// SetNillableURL sets the "url" field if the given value is not nil.
-func (nuo *NotifierUpdateOne) SetNillableURL(s *string) *NotifierUpdateOne {
- if s != nil {
- nuo.SetURL(*s)
+func (_u *NotifierUpdateOne) SetNillableURL(v *string) *NotifierUpdateOne {
+ if v != nil {
+ _u.SetURL(*v)
}
- return nuo
+ return _u
}
// SetIsActive sets the "is_active" field.
-func (nuo *NotifierUpdateOne) SetIsActive(b bool) *NotifierUpdateOne {
- nuo.mutation.SetIsActive(b)
- return nuo
+func (_u *NotifierUpdateOne) SetIsActive(v bool) *NotifierUpdateOne {
+ _u.mutation.SetIsActive(v)
+ return _u
}
// SetNillableIsActive sets the "is_active" field if the given value is not nil.
-func (nuo *NotifierUpdateOne) SetNillableIsActive(b *bool) *NotifierUpdateOne {
- if b != nil {
- nuo.SetIsActive(*b)
+func (_u *NotifierUpdateOne) SetNillableIsActive(v *bool) *NotifierUpdateOne {
+ if v != nil {
+ _u.SetIsActive(*v)
}
- return nuo
+ return _u
}
// SetGroup sets the "group" edge to the Group entity.
-func (nuo *NotifierUpdateOne) SetGroup(g *Group) *NotifierUpdateOne {
- return nuo.SetGroupID(g.ID)
+func (_u *NotifierUpdateOne) SetGroup(v *Group) *NotifierUpdateOne {
+ return _u.SetGroupID(v.ID)
}
// SetUser sets the "user" edge to the User entity.
-func (nuo *NotifierUpdateOne) SetUser(u *User) *NotifierUpdateOne {
- return nuo.SetUserID(u.ID)
+func (_u *NotifierUpdateOne) SetUser(v *User) *NotifierUpdateOne {
+ return _u.SetUserID(v.ID)
}
// Mutation returns the NotifierMutation object of the builder.
-func (nuo *NotifierUpdateOne) Mutation() *NotifierMutation {
- return nuo.mutation
+func (_u *NotifierUpdateOne) Mutation() *NotifierMutation {
+ return _u.mutation
}
// ClearGroup clears the "group" edge to the Group entity.
-func (nuo *NotifierUpdateOne) ClearGroup() *NotifierUpdateOne {
- nuo.mutation.ClearGroup()
- return nuo
+func (_u *NotifierUpdateOne) ClearGroup() *NotifierUpdateOne {
+ _u.mutation.ClearGroup()
+ return _u
}
// ClearUser clears the "user" edge to the User entity.
-func (nuo *NotifierUpdateOne) ClearUser() *NotifierUpdateOne {
- nuo.mutation.ClearUser()
- return nuo
+func (_u *NotifierUpdateOne) ClearUser() *NotifierUpdateOne {
+ _u.mutation.ClearUser()
+ return _u
}
// Where appends a list predicates to the NotifierUpdate builder.
-func (nuo *NotifierUpdateOne) Where(ps ...predicate.Notifier) *NotifierUpdateOne {
- nuo.mutation.Where(ps...)
- return nuo
+func (_u *NotifierUpdateOne) Where(ps ...predicate.Notifier) *NotifierUpdateOne {
+ _u.mutation.Where(ps...)
+ return _u
}
// Select allows selecting one or more fields (columns) of the returned entity.
// The default is selecting all fields defined in the entity schema.
-func (nuo *NotifierUpdateOne) Select(field string, fields ...string) *NotifierUpdateOne {
- nuo.fields = append([]string{field}, fields...)
- return nuo
+func (_u *NotifierUpdateOne) Select(field string, fields ...string) *NotifierUpdateOne {
+ _u.fields = append([]string{field}, fields...)
+ return _u
}
// Save executes the query and returns the updated Notifier entity.
-func (nuo *NotifierUpdateOne) Save(ctx context.Context) (*Notifier, error) {
- nuo.defaults()
- return withHooks(ctx, nuo.sqlSave, nuo.mutation, nuo.hooks)
+func (_u *NotifierUpdateOne) Save(ctx context.Context) (*Notifier, error) {
+ _u.defaults()
+ return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
}
// SaveX is like Save, but panics if an error occurs.
-func (nuo *NotifierUpdateOne) SaveX(ctx context.Context) *Notifier {
- node, err := nuo.Save(ctx)
+func (_u *NotifierUpdateOne) SaveX(ctx context.Context) *Notifier {
+ node, err := _u.Save(ctx)
if err != nil {
panic(err)
}
@@ -425,58 +425,58 @@ func (nuo *NotifierUpdateOne) SaveX(ctx context.Context) *Notifier {
}
// Exec executes the query on the entity.
-func (nuo *NotifierUpdateOne) Exec(ctx context.Context) error {
- _, err := nuo.Save(ctx)
+func (_u *NotifierUpdateOne) Exec(ctx context.Context) error {
+ _, err := _u.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
-func (nuo *NotifierUpdateOne) ExecX(ctx context.Context) {
- if err := nuo.Exec(ctx); err != nil {
+func (_u *NotifierUpdateOne) ExecX(ctx context.Context) {
+ if err := _u.Exec(ctx); err != nil {
panic(err)
}
}
// defaults sets the default values of the builder before save.
-func (nuo *NotifierUpdateOne) defaults() {
- if _, ok := nuo.mutation.UpdatedAt(); !ok {
+func (_u *NotifierUpdateOne) defaults() {
+ if _, ok := _u.mutation.UpdatedAt(); !ok {
v := notifier.UpdateDefaultUpdatedAt()
- nuo.mutation.SetUpdatedAt(v)
+ _u.mutation.SetUpdatedAt(v)
}
}
// check runs all checks and user-defined validators on the builder.
-func (nuo *NotifierUpdateOne) check() error {
- if v, ok := nuo.mutation.Name(); ok {
+func (_u *NotifierUpdateOne) check() error {
+ if v, ok := _u.mutation.Name(); ok {
if err := notifier.NameValidator(v); err != nil {
return &ValidationError{Name: "name", err: fmt.Errorf(`ent: validator failed for field "Notifier.name": %w`, err)}
}
}
- if v, ok := nuo.mutation.URL(); ok {
+ if v, ok := _u.mutation.URL(); ok {
if err := notifier.URLValidator(v); err != nil {
return &ValidationError{Name: "url", err: fmt.Errorf(`ent: validator failed for field "Notifier.url": %w`, err)}
}
}
- if nuo.mutation.GroupCleared() && len(nuo.mutation.GroupIDs()) > 0 {
+ if _u.mutation.GroupCleared() && len(_u.mutation.GroupIDs()) > 0 {
return errors.New(`ent: clearing a required unique edge "Notifier.group"`)
}
- if nuo.mutation.UserCleared() && len(nuo.mutation.UserIDs()) > 0 {
+ if _u.mutation.UserCleared() && len(_u.mutation.UserIDs()) > 0 {
return errors.New(`ent: clearing a required unique edge "Notifier.user"`)
}
return nil
}
-func (nuo *NotifierUpdateOne) sqlSave(ctx context.Context) (_node *Notifier, err error) {
- if err := nuo.check(); err != nil {
+func (_u *NotifierUpdateOne) sqlSave(ctx context.Context) (_node *Notifier, err error) {
+ if err := _u.check(); err != nil {
return _node, err
}
_spec := sqlgraph.NewUpdateSpec(notifier.Table, notifier.Columns, sqlgraph.NewFieldSpec(notifier.FieldID, field.TypeUUID))
- id, ok := nuo.mutation.ID()
+ id, ok := _u.mutation.ID()
if !ok {
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Notifier.id" for update`)}
}
_spec.Node.ID.Value = id
- if fields := nuo.fields; len(fields) > 0 {
+ if fields := _u.fields; len(fields) > 0 {
_spec.Node.Columns = make([]string, 0, len(fields))
_spec.Node.Columns = append(_spec.Node.Columns, notifier.FieldID)
for _, f := range fields {
@@ -488,26 +488,26 @@ func (nuo *NotifierUpdateOne) sqlSave(ctx context.Context) (_node *Notifier, err
}
}
}
- if ps := nuo.mutation.predicates; len(ps) > 0 {
+ if ps := _u.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
- if value, ok := nuo.mutation.UpdatedAt(); ok {
+ if value, ok := _u.mutation.UpdatedAt(); ok {
_spec.SetField(notifier.FieldUpdatedAt, field.TypeTime, value)
}
- if value, ok := nuo.mutation.Name(); ok {
+ if value, ok := _u.mutation.Name(); ok {
_spec.SetField(notifier.FieldName, field.TypeString, value)
}
- if value, ok := nuo.mutation.URL(); ok {
+ if value, ok := _u.mutation.URL(); ok {
_spec.SetField(notifier.FieldURL, field.TypeString, value)
}
- if value, ok := nuo.mutation.IsActive(); ok {
+ if value, ok := _u.mutation.IsActive(); ok {
_spec.SetField(notifier.FieldIsActive, field.TypeBool, value)
}
- if nuo.mutation.GroupCleared() {
+ if _u.mutation.GroupCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -520,7 +520,7 @@ func (nuo *NotifierUpdateOne) sqlSave(ctx context.Context) (_node *Notifier, err
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := nuo.mutation.GroupIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.GroupIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -536,7 +536,7 @@ func (nuo *NotifierUpdateOne) sqlSave(ctx context.Context) (_node *Notifier, err
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- if nuo.mutation.UserCleared() {
+ if _u.mutation.UserCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -549,7 +549,7 @@ func (nuo *NotifierUpdateOne) sqlSave(ctx context.Context) (_node *Notifier, err
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := nuo.mutation.UserIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.UserIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -565,10 +565,10 @@ func (nuo *NotifierUpdateOne) sqlSave(ctx context.Context) (_node *Notifier, err
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- _node = &Notifier{config: nuo.config}
+ _node = &Notifier{config: _u.config}
_spec.Assign = _node.assignValues
_spec.ScanValues = _node.scanValues
- if err = sqlgraph.UpdateNode(ctx, nuo.driver, _spec); err != nil {
+ if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil {
if _, ok := err.(*sqlgraph.NotFoundError); ok {
err = &NotFoundError{notifier.Label}
} else if sqlgraph.IsConstraintError(err) {
@@ -576,6 +576,6 @@ func (nuo *NotifierUpdateOne) sqlSave(ctx context.Context) (_node *Notifier, err
}
return nil, err
}
- nuo.mutation.done = true
+ _u.mutation.done = true
return _node, nil
}
diff --git a/backend/internal/data/ent/runtime.go b/backend/internal/data/ent/runtime.go
index 4d73e455..2ac6b536 100644
--- a/backend/internal/data/ent/runtime.go
+++ b/backend/internal/data/ent/runtime.go
@@ -558,21 +558,7 @@ func init() {
// userDescPassword is the schema descriptor for password field.
userDescPassword := userFields[2].Descriptor()
// user.PasswordValidator is a validator for the "password" field. It is called by the builders before save.
- user.PasswordValidator = func() func(string) error {
- validators := userDescPassword.Validators
- fns := [...]func(string) error{
- validators[0].(func(string) error),
- validators[1].(func(string) error),
- }
- return func(password string) error {
- for _, fn := range fns {
- if err := fn(password); err != nil {
- return err
- }
- }
- return nil
- }
- }()
+ user.PasswordValidator = userDescPassword.Validators[0].(func(string) error)
// userDescIsSuperuser is the schema descriptor for is_superuser field.
userDescIsSuperuser := userFields[3].Descriptor()
// user.DefaultIsSuperuser holds the default value on creation for the is_superuser field.
diff --git a/backend/internal/data/ent/runtime/runtime.go b/backend/internal/data/ent/runtime/runtime.go
index 0b7e5d46..496e2095 100644
--- a/backend/internal/data/ent/runtime/runtime.go
+++ b/backend/internal/data/ent/runtime/runtime.go
@@ -5,6 +5,6 @@ package runtime
// The schema-stitching logic is generated in github.com/sysadminsmedia/homebox/backend/internal/data/ent/runtime.go
const (
- Version = "v0.14.4" // Version of ent codegen.
- Sum = "h1:/DhDraSLXIkBhyiVoJeSshr4ZYi7femzhj6/TckzZuI=" // Sum of ent codegen.
+ Version = "v0.14.5" // Version of ent codegen.
+ Sum = "h1:Rj2WOYJtCkWyFo6a+5wB3EfBRP0rnx1fMk6gGA0UUe4=" // Sum of ent codegen.
)
diff --git a/backend/internal/data/ent/schema/user.go b/backend/internal/data/ent/schema/user.go
index bd747aea..c1ff9c29 100644
--- a/backend/internal/data/ent/schema/user.go
+++ b/backend/internal/data/ent/schema/user.go
@@ -5,6 +5,7 @@ import (
"entgo.io/ent/dialect/entsql"
"entgo.io/ent/schema/edge"
"entgo.io/ent/schema/field"
+ "entgo.io/ent/schema/index"
"entgo.io/ent/schema/mixin"
"github.com/google/uuid"
"github.com/sysadminsmedia/homebox/backend/internal/data/ent/schema/mixins"
@@ -34,7 +35,8 @@ func (User) Fields() []ent.Field {
Unique(),
field.String("password").
MaxLen(255).
- NotEmpty().
+ Nillable().
+ Optional().
Sensitive(),
field.Bool("is_superuser").
Default(false),
@@ -45,6 +47,19 @@ func (User) Fields() []ent.Field {
Values("user", "owner"),
field.Time("activated_on").
Optional(),
+ // OIDC identity mapping fields (issuer + subject)
+ field.String("oidc_issuer").
+ Optional().
+ Nillable(),
+ field.String("oidc_subject").
+ Optional().
+ Nillable(),
+ }
+}
+
+func (User) Indexes() []ent.Index {
+ return []ent.Index{
+ index.Fields("oidc_issuer", "oidc_subject").Unique(),
}
}
@@ -81,14 +96,14 @@ func (g UserMixin) Fields() []ent.Field {
}
func (g UserMixin) Edges() []ent.Edge {
- edge := edge.From("user", User.Type).
+ e := edge.From("user", User.Type).
Ref(g.ref).
Unique().
Required()
if g.field != "" {
- edge = edge.Field(g.field)
+ e = e.Field(g.field)
}
- return []ent.Edge{edge}
+ return []ent.Edge{e}
}
diff --git a/backend/internal/data/ent/user.go b/backend/internal/data/ent/user.go
index c8d9b99b..9d7d4866 100644
--- a/backend/internal/data/ent/user.go
+++ b/backend/internal/data/ent/user.go
@@ -28,7 +28,7 @@ type User struct {
// Email holds the value of the "email" field.
Email string `json:"email,omitempty"`
// Password holds the value of the "password" field.
- Password string `json:"-"`
+ Password *string `json:"-"`
// IsSuperuser holds the value of the "is_superuser" field.
IsSuperuser bool `json:"is_superuser,omitempty"`
// Superuser holds the value of the "superuser" field.
@@ -37,6 +37,10 @@ type User struct {
Role user.Role `json:"role,omitempty"`
// ActivatedOn holds the value of the "activated_on" field.
ActivatedOn time.Time `json:"activated_on,omitempty"`
+ // OidcIssuer holds the value of the "oidc_issuer" field.
+ OidcIssuer *string `json:"oidc_issuer,omitempty"`
+ // OidcSubject holds the value of the "oidc_subject" field.
+ OidcSubject *string `json:"oidc_subject,omitempty"`
// Edges holds the relations/edges for other nodes in the graph.
// The values are being populated by the UserQuery when eager-loading is set.
Edges UserEdges `json:"edges"`
@@ -93,7 +97,7 @@ func (*User) scanValues(columns []string) ([]any, error) {
switch columns[i] {
case user.FieldIsSuperuser, user.FieldSuperuser:
values[i] = new(sql.NullBool)
- case user.FieldName, user.FieldEmail, user.FieldPassword, user.FieldRole:
+ case user.FieldName, user.FieldEmail, user.FieldPassword, user.FieldRole, user.FieldOidcIssuer, user.FieldOidcSubject:
values[i] = new(sql.NullString)
case user.FieldCreatedAt, user.FieldUpdatedAt, user.FieldActivatedOn:
values[i] = new(sql.NullTime)
@@ -110,7 +114,7 @@ func (*User) scanValues(columns []string) ([]any, error) {
// assignValues assigns the values that were returned from sql.Rows (after scanning)
// to the User fields.
-func (u *User) assignValues(columns []string, values []any) error {
+func (_m *User) assignValues(columns []string, values []any) error {
if m, n := len(values), len(columns); m < n {
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
}
@@ -120,71 +124,86 @@ func (u *User) assignValues(columns []string, values []any) error {
if value, ok := values[i].(*uuid.UUID); !ok {
return fmt.Errorf("unexpected type %T for field id", values[i])
} else if value != nil {
- u.ID = *value
+ _m.ID = *value
}
case user.FieldCreatedAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field created_at", values[i])
} else if value.Valid {
- u.CreatedAt = value.Time
+ _m.CreatedAt = value.Time
}
case user.FieldUpdatedAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field updated_at", values[i])
} else if value.Valid {
- u.UpdatedAt = value.Time
+ _m.UpdatedAt = value.Time
}
case user.FieldName:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field name", values[i])
} else if value.Valid {
- u.Name = value.String
+ _m.Name = value.String
}
case user.FieldEmail:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field email", values[i])
} else if value.Valid {
- u.Email = value.String
+ _m.Email = value.String
}
case user.FieldPassword:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field password", values[i])
} else if value.Valid {
- u.Password = value.String
+ _m.Password = new(string)
+ *_m.Password = value.String
}
case user.FieldIsSuperuser:
if value, ok := values[i].(*sql.NullBool); !ok {
return fmt.Errorf("unexpected type %T for field is_superuser", values[i])
} else if value.Valid {
- u.IsSuperuser = value.Bool
+ _m.IsSuperuser = value.Bool
}
case user.FieldSuperuser:
if value, ok := values[i].(*sql.NullBool); !ok {
return fmt.Errorf("unexpected type %T for field superuser", values[i])
} else if value.Valid {
- u.Superuser = value.Bool
+ _m.Superuser = value.Bool
}
case user.FieldRole:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field role", values[i])
} else if value.Valid {
- u.Role = user.Role(value.String)
+ _m.Role = user.Role(value.String)
}
case user.FieldActivatedOn:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field activated_on", values[i])
} else if value.Valid {
- u.ActivatedOn = value.Time
+ _m.ActivatedOn = value.Time
+ }
+ case user.FieldOidcIssuer:
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field oidc_issuer", values[i])
+ } else if value.Valid {
+ _m.OidcIssuer = new(string)
+ *_m.OidcIssuer = value.String
+ }
+ case user.FieldOidcSubject:
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field oidc_subject", values[i])
+ } else if value.Valid {
+ _m.OidcSubject = new(string)
+ *_m.OidcSubject = value.String
}
case user.ForeignKeys[0]:
if value, ok := values[i].(*sql.NullScanner); !ok {
return fmt.Errorf("unexpected type %T for field group_users", values[i])
} else if value.Valid {
- u.group_users = new(uuid.UUID)
- *u.group_users = *value.S.(*uuid.UUID)
+ _m.group_users = new(uuid.UUID)
+ *_m.group_users = *value.S.(*uuid.UUID)
}
default:
- u.selectValues.Set(columns[i], values[i])
+ _m.selectValues.Set(columns[i], values[i])
}
}
return nil
@@ -192,73 +211,83 @@ func (u *User) assignValues(columns []string, values []any) error {
// Value returns the ent.Value that was dynamically selected and assigned to the User.
// This includes values selected through modifiers, order, etc.
-func (u *User) Value(name string) (ent.Value, error) {
- return u.selectValues.Get(name)
+func (_m *User) Value(name string) (ent.Value, error) {
+ return _m.selectValues.Get(name)
}
// QueryGroup queries the "group" edge of the User entity.
-func (u *User) QueryGroup() *GroupQuery {
- return NewUserClient(u.config).QueryGroup(u)
+func (_m *User) QueryGroup() *GroupQuery {
+ return NewUserClient(_m.config).QueryGroup(_m)
}
// QueryAuthTokens queries the "auth_tokens" edge of the User entity.
-func (u *User) QueryAuthTokens() *AuthTokensQuery {
- return NewUserClient(u.config).QueryAuthTokens(u)
+func (_m *User) QueryAuthTokens() *AuthTokensQuery {
+ return NewUserClient(_m.config).QueryAuthTokens(_m)
}
// QueryNotifiers queries the "notifiers" edge of the User entity.
-func (u *User) QueryNotifiers() *NotifierQuery {
- return NewUserClient(u.config).QueryNotifiers(u)
+func (_m *User) QueryNotifiers() *NotifierQuery {
+ return NewUserClient(_m.config).QueryNotifiers(_m)
}
// Update returns a builder for updating this User.
// Note that you need to call User.Unwrap() before calling this method if this User
// was returned from a transaction, and the transaction was committed or rolled back.
-func (u *User) Update() *UserUpdateOne {
- return NewUserClient(u.config).UpdateOne(u)
+func (_m *User) Update() *UserUpdateOne {
+ return NewUserClient(_m.config).UpdateOne(_m)
}
// Unwrap unwraps the User 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 (u *User) Unwrap() *User {
- _tx, ok := u.config.driver.(*txDriver)
+func (_m *User) Unwrap() *User {
+ _tx, ok := _m.config.driver.(*txDriver)
if !ok {
panic("ent: User is not a transactional entity")
}
- u.config.driver = _tx.drv
- return u
+ _m.config.driver = _tx.drv
+ return _m
}
// String implements the fmt.Stringer.
-func (u *User) String() string {
+func (_m *User) String() string {
var builder strings.Builder
builder.WriteString("User(")
- builder.WriteString(fmt.Sprintf("id=%v, ", u.ID))
+ builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
builder.WriteString("created_at=")
- builder.WriteString(u.CreatedAt.Format(time.ANSIC))
+ builder.WriteString(_m.CreatedAt.Format(time.ANSIC))
builder.WriteString(", ")
builder.WriteString("updated_at=")
- builder.WriteString(u.UpdatedAt.Format(time.ANSIC))
+ builder.WriteString(_m.UpdatedAt.Format(time.ANSIC))
builder.WriteString(", ")
builder.WriteString("name=")
- builder.WriteString(u.Name)
+ builder.WriteString(_m.Name)
builder.WriteString(", ")
builder.WriteString("email=")
- builder.WriteString(u.Email)
+ builder.WriteString(_m.Email)
builder.WriteString(", ")
builder.WriteString("password=<sensitive>")
builder.WriteString(", ")
builder.WriteString("is_superuser=")
- builder.WriteString(fmt.Sprintf("%v", u.IsSuperuser))
+ builder.WriteString(fmt.Sprintf("%v", _m.IsSuperuser))
builder.WriteString(", ")
builder.WriteString("superuser=")
- builder.WriteString(fmt.Sprintf("%v", u.Superuser))
+ builder.WriteString(fmt.Sprintf("%v", _m.Superuser))
builder.WriteString(", ")
builder.WriteString("role=")
- builder.WriteString(fmt.Sprintf("%v", u.Role))
+ builder.WriteString(fmt.Sprintf("%v", _m.Role))
builder.WriteString(", ")
builder.WriteString("activated_on=")
- builder.WriteString(u.ActivatedOn.Format(time.ANSIC))
+ builder.WriteString(_m.ActivatedOn.Format(time.ANSIC))
+ builder.WriteString(", ")
+ if v := _m.OidcIssuer; v != nil {
+ builder.WriteString("oidc_issuer=")
+ builder.WriteString(*v)
+ }
+ builder.WriteString(", ")
+ if v := _m.OidcSubject; v != nil {
+ builder.WriteString("oidc_subject=")
+ builder.WriteString(*v)
+ }
builder.WriteByte(')')
return builder.String()
}
diff --git a/backend/internal/data/ent/user/user.go b/backend/internal/data/ent/user/user.go
index 33b657bd..473d1d7f 100644
--- a/backend/internal/data/ent/user/user.go
+++ b/backend/internal/data/ent/user/user.go
@@ -34,6 +34,10 @@ const (
FieldRole = "role"
// FieldActivatedOn holds the string denoting the activated_on field in the database.
FieldActivatedOn = "activated_on"
+ // FieldOidcIssuer holds the string denoting the oidc_issuer field in the database.
+ FieldOidcIssuer = "oidc_issuer"
+ // FieldOidcSubject holds the string denoting the oidc_subject field in the database.
+ FieldOidcSubject = "oidc_subject"
// EdgeGroup holds the string denoting the group edge name in mutations.
EdgeGroup = "group"
// EdgeAuthTokens holds the string denoting the auth_tokens edge name in mutations.
@@ -77,6 +81,8 @@ var Columns = []string{
FieldSuperuser,
FieldRole,
FieldActivatedOn,
+ FieldOidcIssuer,
+ FieldOidcSubject,
}
// ForeignKeys holds the SQL foreign-keys that are owned by the "users"
@@ -200,6 +206,16 @@ func ByActivatedOn(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldActivatedOn, opts...).ToFunc()
}
+// ByOidcIssuer orders the results by the oidc_issuer field.
+func ByOidcIssuer(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldOidcIssuer, opts...).ToFunc()
+}
+
+// ByOidcSubject orders the results by the oidc_subject field.
+func ByOidcSubject(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldOidcSubject, opts...).ToFunc()
+}
+
// ByGroupField orders the results by group field.
func ByGroupField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
diff --git a/backend/internal/data/ent/user/where.go b/backend/internal/data/ent/user/where.go
index f70676bc..0d4ed5cd 100644
--- a/backend/internal/data/ent/user/where.go
+++ b/backend/internal/data/ent/user/where.go
@@ -96,6 +96,16 @@ func ActivatedOn(v time.Time) predicate.User {
return predicate.User(sql.FieldEQ(FieldActivatedOn, v))
}
+// OidcIssuer applies equality check predicate on the "oidc_issuer" field. It's identical to OidcIssuerEQ.
+func OidcIssuer(v string) predicate.User {
+ return predicate.User(sql.FieldEQ(FieldOidcIssuer, v))
+}
+
+// OidcSubject applies equality check predicate on the "oidc_subject" field. It's identical to OidcSubjectEQ.
+func OidcSubject(v string) predicate.User {
+ return predicate.User(sql.FieldEQ(FieldOidcSubject, v))
+}
+
// CreatedAtEQ applies the EQ predicate on the "created_at" field.
func CreatedAtEQ(v time.Time) predicate.User {
return predicate.User(sql.FieldEQ(FieldCreatedAt, v))
@@ -361,6 +371,16 @@ func PasswordHasSuffix(v string) predicate.User {
return predicate.User(sql.FieldHasSuffix(FieldPassword, v))
}
+// PasswordIsNil applies the IsNil predicate on the "password" field.
+func PasswordIsNil() predicate.User {
+ return predicate.User(sql.FieldIsNull(FieldPassword))
+}
+
+// PasswordNotNil applies the NotNil predicate on the "password" field.
+func PasswordNotNil() predicate.User {
+ return predicate.User(sql.FieldNotNull(FieldPassword))
+}
+
// PasswordEqualFold applies the EqualFold predicate on the "password" field.
func PasswordEqualFold(v string) predicate.User {
return predicate.User(sql.FieldEqualFold(FieldPassword, v))
@@ -461,6 +481,156 @@ func ActivatedOnNotNil() predicate.User {
return predicate.User(sql.FieldNotNull(FieldActivatedOn))
}
+// OidcIssuerEQ applies the EQ predicate on the "oidc_issuer" field.
+func OidcIssuerEQ(v string) predicate.User {
+ return predicate.User(sql.FieldEQ(FieldOidcIssuer, v))
+}
+
+// OidcIssuerNEQ applies the NEQ predicate on the "oidc_issuer" field.
+func OidcIssuerNEQ(v string) predicate.User {
+ return predicate.User(sql.FieldNEQ(FieldOidcIssuer, v))
+}
+
+// OidcIssuerIn applies the In predicate on the "oidc_issuer" field.
+func OidcIssuerIn(vs ...string) predicate.User {
+ return predicate.User(sql.FieldIn(FieldOidcIssuer, vs...))
+}
+
+// OidcIssuerNotIn applies the NotIn predicate on the "oidc_issuer" field.
+func OidcIssuerNotIn(vs ...string) predicate.User {
+ return predicate.User(sql.FieldNotIn(FieldOidcIssuer, vs...))
+}
+
+// OidcIssuerGT applies the GT predicate on the "oidc_issuer" field.
+func OidcIssuerGT(v string) predicate.User {
+ return predicate.User(sql.FieldGT(FieldOidcIssuer, v))
+}
+
+// OidcIssuerGTE applies the GTE predicate on the "oidc_issuer" field.
+func OidcIssuerGTE(v string) predicate.User {
+ return predicate.User(sql.FieldGTE(FieldOidcIssuer, v))
+}
+
+// OidcIssuerLT applies the LT predicate on the "oidc_issuer" field.
+func OidcIssuerLT(v string) predicate.User {
+ return predicate.User(sql.FieldLT(FieldOidcIssuer, v))
+}
+
+// OidcIssuerLTE applies the LTE predicate on the "oidc_issuer" field.
+func OidcIssuerLTE(v string) predicate.User {
+ return predicate.User(sql.FieldLTE(FieldOidcIssuer, v))
+}
+
+// OidcIssuerContains applies the Contains predicate on the "oidc_issuer" field.
+func OidcIssuerContains(v string) predicate.User {
+ return predicate.User(sql.FieldContains(FieldOidcIssuer, v))
+}
+
+// OidcIssuerHasPrefix applies the HasPrefix predicate on the "oidc_issuer" field.
+func OidcIssuerHasPrefix(v string) predicate.User {
+ return predicate.User(sql.FieldHasPrefix(FieldOidcIssuer, v))
+}
+
+// OidcIssuerHasSuffix applies the HasSuffix predicate on the "oidc_issuer" field.
+func OidcIssuerHasSuffix(v string) predicate.User {
+ return predicate.User(sql.FieldHasSuffix(FieldOidcIssuer, v))
+}
+
+// OidcIssuerIsNil applies the IsNil predicate on the "oidc_issuer" field.
+func OidcIssuerIsNil() predicate.User {
+ return predicate.User(sql.FieldIsNull(FieldOidcIssuer))
+}
+
+// OidcIssuerNotNil applies the NotNil predicate on the "oidc_issuer" field.
+func OidcIssuerNotNil() predicate.User {
+ return predicate.User(sql.FieldNotNull(FieldOidcIssuer))
+}
+
+// OidcIssuerEqualFold applies the EqualFold predicate on the "oidc_issuer" field.
+func OidcIssuerEqualFold(v string) predicate.User {
+ return predicate.User(sql.FieldEqualFold(FieldOidcIssuer, v))
+}
+
+// OidcIssuerContainsFold applies the ContainsFold predicate on the "oidc_issuer" field.
+func OidcIssuerContainsFold(v string) predicate.User {
+ return predicate.User(sql.FieldContainsFold(FieldOidcIssuer, v))
+}
+
+// OidcSubjectEQ applies the EQ predicate on the "oidc_subject" field.
+func OidcSubjectEQ(v string) predicate.User {
+ return predicate.User(sql.FieldEQ(FieldOidcSubject, v))
+}
+
+// OidcSubjectNEQ applies the NEQ predicate on the "oidc_subject" field.
+func OidcSubjectNEQ(v string) predicate.User {
+ return predicate.User(sql.FieldNEQ(FieldOidcSubject, v))
+}
+
+// OidcSubjectIn applies the In predicate on the "oidc_subject" field.
+func OidcSubjectIn(vs ...string) predicate.User {
+ return predicate.User(sql.FieldIn(FieldOidcSubject, vs...))
+}
+
+// OidcSubjectNotIn applies the NotIn predicate on the "oidc_subject" field.
+func OidcSubjectNotIn(vs ...string) predicate.User {
+ return predicate.User(sql.FieldNotIn(FieldOidcSubject, vs...))
+}
+
+// OidcSubjectGT applies the GT predicate on the "oidc_subject" field.
+func OidcSubjectGT(v string) predicate.User {
+ return predicate.User(sql.FieldGT(FieldOidcSubject, v))
+}
+
+// OidcSubjectGTE applies the GTE predicate on the "oidc_subject" field.
+func OidcSubjectGTE(v string) predicate.User {
+ return predicate.User(sql.FieldGTE(FieldOidcSubject, v))
+}
+
+// OidcSubjectLT applies the LT predicate on the "oidc_subject" field.
+func OidcSubjectLT(v string) predicate.User {
+ return predicate.User(sql.FieldLT(FieldOidcSubject, v))
+}
+
+// OidcSubjectLTE applies the LTE predicate on the "oidc_subject" field.
+func OidcSubjectLTE(v string) predicate.User {
+ return predicate.User(sql.FieldLTE(FieldOidcSubject, v))
+}
+
+// OidcSubjectContains applies the Contains predicate on the "oidc_subject" field.
+func OidcSubjectContains(v string) predicate.User {
+ return predicate.User(sql.FieldContains(FieldOidcSubject, v))
+}
+
+// OidcSubjectHasPrefix applies the HasPrefix predicate on the "oidc_subject" field.
+func OidcSubjectHasPrefix(v string) predicate.User {
+ return predicate.User(sql.FieldHasPrefix(FieldOidcSubject, v))
+}
+
+// OidcSubjectHasSuffix applies the HasSuffix predicate on the "oidc_subject" field.
+func OidcSubjectHasSuffix(v string) predicate.User {
+ return predicate.User(sql.FieldHasSuffix(FieldOidcSubject, v))
+}
+
+// OidcSubjectIsNil applies the IsNil predicate on the "oidc_subject" field.
+func OidcSubjectIsNil() predicate.User {
+ return predicate.User(sql.FieldIsNull(FieldOidcSubject))
+}
+
+// OidcSubjectNotNil applies the NotNil predicate on the "oidc_subject" field.
+func OidcSubjectNotNil() predicate.User {
+ return predicate.User(sql.FieldNotNull(FieldOidcSubject))
+}
+
+// OidcSubjectEqualFold applies the EqualFold predicate on the "oidc_subject" field.
+func OidcSubjectEqualFold(v string) predicate.User {
+ return predicate.User(sql.FieldEqualFold(FieldOidcSubject, v))
+}
+
+// OidcSubjectContainsFold applies the ContainsFold predicate on the "oidc_subject" field.
+func OidcSubjectContainsFold(v string) predicate.User {
+ return predicate.User(sql.FieldContainsFold(FieldOidcSubject, v))
+}
+
// HasGroup applies the HasEdge predicate on the "group" edge.
func HasGroup() predicate.User {
return predicate.User(func(s *sql.Selector) {
diff --git a/backend/internal/data/ent/user_create.go b/backend/internal/data/ent/user_create.go
index 529ce637..3269f609 100644
--- a/backend/internal/data/ent/user_create.go
+++ b/backend/internal/data/ent/user_create.go
@@ -25,176 +25,212 @@ type UserCreate struct {
}
// SetCreatedAt sets the "created_at" field.
-func (uc *UserCreate) SetCreatedAt(t time.Time) *UserCreate {
- uc.mutation.SetCreatedAt(t)
- return uc
+func (_c *UserCreate) SetCreatedAt(v time.Time) *UserCreate {
+ _c.mutation.SetCreatedAt(v)
+ return _c
}
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
-func (uc *UserCreate) SetNillableCreatedAt(t *time.Time) *UserCreate {
- if t != nil {
- uc.SetCreatedAt(*t)
+func (_c *UserCreate) SetNillableCreatedAt(v *time.Time) *UserCreate {
+ if v != nil {
+ _c.SetCreatedAt(*v)
}
- return uc
+ return _c
}
// SetUpdatedAt sets the "updated_at" field.
-func (uc *UserCreate) SetUpdatedAt(t time.Time) *UserCreate {
- uc.mutation.SetUpdatedAt(t)
- return uc
+func (_c *UserCreate) SetUpdatedAt(v time.Time) *UserCreate {
+ _c.mutation.SetUpdatedAt(v)
+ return _c
}
// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
-func (uc *UserCreate) SetNillableUpdatedAt(t *time.Time) *UserCreate {
- if t != nil {
- uc.SetUpdatedAt(*t)
+func (_c *UserCreate) SetNillableUpdatedAt(v *time.Time) *UserCreate {
+ if v != nil {
+ _c.SetUpdatedAt(*v)
}
- return uc
+ return _c
}
// SetName sets the "name" field.
-func (uc *UserCreate) SetName(s string) *UserCreate {
- uc.mutation.SetName(s)
- return uc
+func (_c *UserCreate) SetName(v string) *UserCreate {
+ _c.mutation.SetName(v)
+ return _c
}
// SetEmail sets the "email" field.
-func (uc *UserCreate) SetEmail(s string) *UserCreate {
- uc.mutation.SetEmail(s)
- return uc
+func (_c *UserCreate) SetEmail(v string) *UserCreate {
+ _c.mutation.SetEmail(v)
+ return _c
}
// SetPassword sets the "password" field.
-func (uc *UserCreate) SetPassword(s string) *UserCreate {
- uc.mutation.SetPassword(s)
- return uc
+func (_c *UserCreate) SetPassword(v string) *UserCreate {
+ _c.mutation.SetPassword(v)
+ return _c
+}
+
+// SetNillablePassword sets the "password" field if the given value is not nil.
+func (_c *UserCreate) SetNillablePassword(v *string) *UserCreate {
+ if v != nil {
+ _c.SetPassword(*v)
+ }
+ return _c
}
// SetIsSuperuser sets the "is_superuser" field.
-func (uc *UserCreate) SetIsSuperuser(b bool) *UserCreate {
- uc.mutation.SetIsSuperuser(b)
- return uc
+func (_c *UserCreate) SetIsSuperuser(v bool) *UserCreate {
+ _c.mutation.SetIsSuperuser(v)
+ return _c
}
// SetNillableIsSuperuser sets the "is_superuser" field if the given value is not nil.
-func (uc *UserCreate) SetNillableIsSuperuser(b *bool) *UserCreate {
- if b != nil {
- uc.SetIsSuperuser(*b)
+func (_c *UserCreate) SetNillableIsSuperuser(v *bool) *UserCreate {
+ if v != nil {
+ _c.SetIsSuperuser(*v)
}
- return uc
+ return _c
}
// SetSuperuser sets the "superuser" field.
-func (uc *UserCreate) SetSuperuser(b bool) *UserCreate {
- uc.mutation.SetSuperuser(b)
- return uc
+func (_c *UserCreate) SetSuperuser(v bool) *UserCreate {
+ _c.mutation.SetSuperuser(v)
+ return _c
}
// SetNillableSuperuser sets the "superuser" field if the given value is not nil.
-func (uc *UserCreate) SetNillableSuperuser(b *bool) *UserCreate {
- if b != nil {
- uc.SetSuperuser(*b)
+func (_c *UserCreate) SetNillableSuperuser(v *bool) *UserCreate {
+ if v != nil {
+ _c.SetSuperuser(*v)
}
- return uc
+ return _c
}
// SetRole sets the "role" field.
-func (uc *UserCreate) SetRole(u user.Role) *UserCreate {
- uc.mutation.SetRole(u)
- return uc
+func (_c *UserCreate) SetRole(v user.Role) *UserCreate {
+ _c.mutation.SetRole(v)
+ return _c
}
// SetNillableRole sets the "role" field if the given value is not nil.
-func (uc *UserCreate) SetNillableRole(u *user.Role) *UserCreate {
- if u != nil {
- uc.SetRole(*u)
+func (_c *UserCreate) SetNillableRole(v *user.Role) *UserCreate {
+ if v != nil {
+ _c.SetRole(*v)
}
- return uc
+ return _c
}
// SetActivatedOn sets the "activated_on" field.
-func (uc *UserCreate) SetActivatedOn(t time.Time) *UserCreate {
- uc.mutation.SetActivatedOn(t)
- return uc
+func (_c *UserCreate) SetActivatedOn(v time.Time) *UserCreate {
+ _c.mutation.SetActivatedOn(v)
+ return _c
}
// SetNillableActivatedOn sets the "activated_on" field if the given value is not nil.
-func (uc *UserCreate) SetNillableActivatedOn(t *time.Time) *UserCreate {
- if t != nil {
- uc.SetActivatedOn(*t)
+func (_c *UserCreate) SetNillableActivatedOn(v *time.Time) *UserCreate {
+ if v != nil {
+ _c.SetActivatedOn(*v)
+ }
+ return _c
+}
+
+// SetOidcIssuer sets the "oidc_issuer" field.
+func (_c *UserCreate) SetOidcIssuer(v string) *UserCreate {
+ _c.mutation.SetOidcIssuer(v)
+ return _c
+}
+
+// SetNillableOidcIssuer sets the "oidc_issuer" field if the given value is not nil.
+func (_c *UserCreate) SetNillableOidcIssuer(v *string) *UserCreate {
+ if v != nil {
+ _c.SetOidcIssuer(*v)
}
- return uc
+ return _c
+}
+
+// SetOidcSubject sets the "oidc_subject" field.
+func (_c *UserCreate) SetOidcSubject(v string) *UserCreate {
+ _c.mutation.SetOidcSubject(v)
+ return _c
+}
+
+// SetNillableOidcSubject sets the "oidc_subject" field if the given value is not nil.
+func (_c *UserCreate) SetNillableOidcSubject(v *string) *UserCreate {
+ if v != nil {
+ _c.SetOidcSubject(*v)
+ }
+ return _c
}
// SetID sets the "id" field.
-func (uc *UserCreate) SetID(u uuid.UUID) *UserCreate {
- uc.mutation.SetID(u)
- return uc
+func (_c *UserCreate) SetID(v uuid.UUID) *UserCreate {
+ _c.mutation.SetID(v)
+ return _c
}
// SetNillableID sets the "id" field if the given value is not nil.
-func (uc *UserCreate) SetNillableID(u *uuid.UUID) *UserCreate {
- if u != nil {
- uc.SetID(*u)
+func (_c *UserCreate) SetNillableID(v *uuid.UUID) *UserCreate {
+ if v != nil {
+ _c.SetID(*v)
}
- return uc
+ return _c
}
// SetGroupID sets the "group" edge to the Group entity by ID.
-func (uc *UserCreate) SetGroupID(id uuid.UUID) *UserCreate {
- uc.mutation.SetGroupID(id)
- return uc
+func (_c *UserCreate) SetGroupID(id uuid.UUID) *UserCreate {
+ _c.mutation.SetGroupID(id)
+ return _c
}
// SetGroup sets the "group" edge to the Group entity.
-func (uc *UserCreate) SetGroup(g *Group) *UserCreate {
- return uc.SetGroupID(g.ID)
+func (_c *UserCreate) SetGroup(v *Group) *UserCreate {
+ return _c.SetGroupID(v.ID)
}
// AddAuthTokenIDs adds the "auth_tokens" edge to the AuthTokens entity by IDs.
-func (uc *UserCreate) AddAuthTokenIDs(ids ...uuid.UUID) *UserCreate {
- uc.mutation.AddAuthTokenIDs(ids...)
- return uc
+func (_c *UserCreate) AddAuthTokenIDs(ids ...uuid.UUID) *UserCreate {
+ _c.mutation.AddAuthTokenIDs(ids...)
+ return _c
}
// AddAuthTokens adds the "auth_tokens" edges to the AuthTokens entity.
-func (uc *UserCreate) AddAuthTokens(a ...*AuthTokens) *UserCreate {
- ids := make([]uuid.UUID, len(a))
- for i := range a {
- ids[i] = a[i].ID
+func (_c *UserCreate) AddAuthTokens(v ...*AuthTokens) *UserCreate {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return uc.AddAuthTokenIDs(ids...)
+ return _c.AddAuthTokenIDs(ids...)
}
// AddNotifierIDs adds the "notifiers" edge to the Notifier entity by IDs.
-func (uc *UserCreate) AddNotifierIDs(ids ...uuid.UUID) *UserCreate {
- uc.mutation.AddNotifierIDs(ids...)
- return uc
+func (_c *UserCreate) AddNotifierIDs(ids ...uuid.UUID) *UserCreate {
+ _c.mutation.AddNotifierIDs(ids...)
+ return _c
}
// AddNotifiers adds the "notifiers" edges to the Notifier entity.
-func (uc *UserCreate) AddNotifiers(n ...*Notifier) *UserCreate {
- ids := make([]uuid.UUID, len(n))
- for i := range n {
- ids[i] = n[i].ID
+func (_c *UserCreate) AddNotifiers(v ...*Notifier) *UserCreate {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return uc.AddNotifierIDs(ids...)
+ return _c.AddNotifierIDs(ids...)
}
// Mutation returns the UserMutation object of the builder.
-func (uc *UserCreate) Mutation() *UserMutation {
- return uc.mutation
+func (_c *UserCreate) Mutation() *UserMutation {
+ return _c.mutation
}
// Save creates the User in the database.
-func (uc *UserCreate) Save(ctx context.Context) (*User, error) {
- uc.defaults()
- return withHooks(ctx, uc.sqlSave, uc.mutation, uc.hooks)
+func (_c *UserCreate) Save(ctx context.Context) (*User, error) {
+ _c.defaults()
+ return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
}
// SaveX calls Save and panics if Save returns an error.
-func (uc *UserCreate) SaveX(ctx context.Context) *User {
- v, err := uc.Save(ctx)
+func (_c *UserCreate) SaveX(ctx context.Context) *User {
+ v, err := _c.Save(ctx)
if err != nil {
panic(err)
}
@@ -202,104 +238,101 @@ func (uc *UserCreate) SaveX(ctx context.Context) *User {
}
// Exec executes the query.
-func (uc *UserCreate) Exec(ctx context.Context) error {
- _, err := uc.Save(ctx)
+func (_c *UserCreate) Exec(ctx context.Context) error {
+ _, err := _c.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
-func (uc *UserCreate) ExecX(ctx context.Context) {
- if err := uc.Exec(ctx); err != nil {
+func (_c *UserCreate) ExecX(ctx context.Context) {
+ if err := _c.Exec(ctx); err != nil {
panic(err)
}
}
// defaults sets the default values of the builder before save.
-func (uc *UserCreate) defaults() {
- if _, ok := uc.mutation.CreatedAt(); !ok {
+func (_c *UserCreate) defaults() {
+ if _, ok := _c.mutation.CreatedAt(); !ok {
v := user.DefaultCreatedAt()
- uc.mutation.SetCreatedAt(v)
+ _c.mutation.SetCreatedAt(v)
}
- if _, ok := uc.mutation.UpdatedAt(); !ok {
+ if _, ok := _c.mutation.UpdatedAt(); !ok {
v := user.DefaultUpdatedAt()
- uc.mutation.SetUpdatedAt(v)
+ _c.mutation.SetUpdatedAt(v)
}
- if _, ok := uc.mutation.IsSuperuser(); !ok {
+ if _, ok := _c.mutation.IsSuperuser(); !ok {
v := user.DefaultIsSuperuser
- uc.mutation.SetIsSuperuser(v)
+ _c.mutation.SetIsSuperuser(v)
}
- if _, ok := uc.mutation.Superuser(); !ok {
+ if _, ok := _c.mutation.Superuser(); !ok {
v := user.DefaultSuperuser
- uc.mutation.SetSuperuser(v)
+ _c.mutation.SetSuperuser(v)
}
- if _, ok := uc.mutation.Role(); !ok {
+ if _, ok := _c.mutation.Role(); !ok {
v := user.DefaultRole
- uc.mutation.SetRole(v)
+ _c.mutation.SetRole(v)
}
- if _, ok := uc.mutation.ID(); !ok {
+ if _, ok := _c.mutation.ID(); !ok {
v := user.DefaultID()
- uc.mutation.SetID(v)
+ _c.mutation.SetID(v)
}
}
// check runs all checks and user-defined validators on the builder.
-func (uc *UserCreate) check() error {
- if _, ok := uc.mutation.CreatedAt(); !ok {
+func (_c *UserCreate) check() error {
+ if _, ok := _c.mutation.CreatedAt(); !ok {
return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "User.created_at"`)}
}
- if _, ok := uc.mutation.UpdatedAt(); !ok {
+ if _, ok := _c.mutation.UpdatedAt(); !ok {
return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "User.updated_at"`)}
}
- if _, ok := uc.mutation.Name(); !ok {
+ if _, ok := _c.mutation.Name(); !ok {
return &ValidationError{Name: "name", err: errors.New(`ent: missing required field "User.name"`)}
}
- if v, ok := uc.mutation.Name(); ok {
+ if v, ok := _c.mutation.Name(); ok {
if err := user.NameValidator(v); err != nil {
return &ValidationError{Name: "name", err: fmt.Errorf(`ent: validator failed for field "User.name": %w`, err)}
}
}
- if _, ok := uc.mutation.Email(); !ok {
+ if _, ok := _c.mutation.Email(); !ok {
return &ValidationError{Name: "email", err: errors.New(`ent: missing required field "User.email"`)}
}
- if v, ok := uc.mutation.Email(); ok {
+ if v, ok := _c.mutation.Email(); ok {
if err := user.EmailValidator(v); err != nil {
return &ValidationError{Name: "email", err: fmt.Errorf(`ent: validator failed for field "User.email": %w`, err)}
}
}
- if _, ok := uc.mutation.Password(); !ok {
- return &ValidationError{Name: "password", err: errors.New(`ent: missing required field "User.password"`)}
- }
- if v, ok := uc.mutation.Password(); ok {
+ if v, ok := _c.mutation.Password(); ok {
if err := user.PasswordValidator(v); err != nil {
return &ValidationError{Name: "password", err: fmt.Errorf(`ent: validator failed for field "User.password": %w`, err)}
}
}
- if _, ok := uc.mutation.IsSuperuser(); !ok {
+ if _, ok := _c.mutation.IsSuperuser(); !ok {
return &ValidationError{Name: "is_superuser", err: errors.New(`ent: missing required field "User.is_superuser"`)}
}
- if _, ok := uc.mutation.Superuser(); !ok {
+ if _, ok := _c.mutation.Superuser(); !ok {
return &ValidationError{Name: "superuser", err: errors.New(`ent: missing required field "User.superuser"`)}
}
- if _, ok := uc.mutation.Role(); !ok {
+ if _, ok := _c.mutation.Role(); !ok {
return &ValidationError{Name: "role", err: errors.New(`ent: missing required field "User.role"`)}
}
- if v, ok := uc.mutation.Role(); ok {
+ if v, ok := _c.mutation.Role(); ok {
if err := user.RoleValidator(v); err != nil {
return &ValidationError{Name: "role", err: fmt.Errorf(`ent: validator failed for field "User.role": %w`, err)}
}
}
- if len(uc.mutation.GroupIDs()) == 0 {
+ if len(_c.mutation.GroupIDs()) == 0 {
return &ValidationError{Name: "group", err: errors.New(`ent: missing required edge "User.group"`)}
}
return nil
}
-func (uc *UserCreate) sqlSave(ctx context.Context) (*User, error) {
- if err := uc.check(); err != nil {
+func (_c *UserCreate) sqlSave(ctx context.Context) (*User, error) {
+ if err := _c.check(); err != nil {
return nil, err
}
- _node, _spec := uc.createSpec()
- if err := sqlgraph.CreateNode(ctx, uc.driver, _spec); err != nil {
+ _node, _spec := _c.createSpec()
+ if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil {
if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
@@ -312,57 +345,65 @@ func (uc *UserCreate) sqlSave(ctx context.Context) (*User, error) {
return nil, err
}
}
- uc.mutation.id = &_node.ID
- uc.mutation.done = true
+ _c.mutation.id = &_node.ID
+ _c.mutation.done = true
return _node, nil
}
-func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) {
+func (_c *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) {
var (
- _node = &User{config: uc.config}
+ _node = &User{config: _c.config}
_spec = sqlgraph.NewCreateSpec(user.Table, sqlgraph.NewFieldSpec(user.FieldID, field.TypeUUID))
)
- if id, ok := uc.mutation.ID(); ok {
+ if id, ok := _c.mutation.ID(); ok {
_node.ID = id
_spec.ID.Value = &id
}
- if value, ok := uc.mutation.CreatedAt(); ok {
+ if value, ok := _c.mutation.CreatedAt(); ok {
_spec.SetField(user.FieldCreatedAt, field.TypeTime, value)
_node.CreatedAt = value
}
- if value, ok := uc.mutation.UpdatedAt(); ok {
+ if value, ok := _c.mutation.UpdatedAt(); ok {
_spec.SetField(user.FieldUpdatedAt, field.TypeTime, value)
_node.UpdatedAt = value
}
- if value, ok := uc.mutation.Name(); ok {
+ if value, ok := _c.mutation.Name(); ok {
_spec.SetField(user.FieldName, field.TypeString, value)
_node.Name = value
}
- if value, ok := uc.mutation.Email(); ok {
+ if value, ok := _c.mutation.Email(); ok {
_spec.SetField(user.FieldEmail, field.TypeString, value)
_node.Email = value
}
- if value, ok := uc.mutation.Password(); ok {
+ if value, ok := _c.mutation.Password(); ok {
_spec.SetField(user.FieldPassword, field.TypeString, value)
- _node.Password = value
+ _node.Password = &value
}
- if value, ok := uc.mutation.IsSuperuser(); ok {
+ if value, ok := _c.mutation.IsSuperuser(); ok {
_spec.SetField(user.FieldIsSuperuser, field.TypeBool, value)
_node.IsSuperuser = value
}
- if value, ok := uc.mutation.Superuser(); ok {
+ if value, ok := _c.mutation.Superuser(); ok {
_spec.SetField(user.FieldSuperuser, field.TypeBool, value)
_node.Superuser = value
}
- if value, ok := uc.mutation.Role(); ok {
+ if value, ok := _c.mutation.Role(); ok {
_spec.SetField(user.FieldRole, field.TypeEnum, value)
_node.Role = value
}
- if value, ok := uc.mutation.ActivatedOn(); ok {
+ if value, ok := _c.mutation.ActivatedOn(); ok {
_spec.SetField(user.FieldActivatedOn, field.TypeTime, value)
_node.ActivatedOn = value
}
- if nodes := uc.mutation.GroupIDs(); len(nodes) > 0 {
+ if value, ok := _c.mutation.OidcIssuer(); ok {
+ _spec.SetField(user.FieldOidcIssuer, field.TypeString, value)
+ _node.OidcIssuer = &value
+ }
+ if value, ok := _c.mutation.OidcSubject(); ok {
+ _spec.SetField(user.FieldOidcSubject, field.TypeString, value)
+ _node.OidcSubject = &value
+ }
+ if nodes := _c.mutation.GroupIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -379,7 +420,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) {
_node.group_users = &nodes[0]
_spec.Edges = append(_spec.Edges, edge)
}
- if nodes := uc.mutation.AuthTokensIDs(); len(nodes) > 0 {
+ if nodes := _c.mutation.AuthTokensIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -395,7 +436,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) {
}
_spec.Edges = append(_spec.Edges, edge)
}
- if nodes := uc.mutation.NotifiersIDs(); len(nodes) > 0 {
+ if nodes := _c.mutation.NotifiersIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -422,16 +463,16 @@ type UserCreateBulk struct {
}
// Save creates the User entities in the database.
-func (ucb *UserCreateBulk) Save(ctx context.Context) ([]*User, error) {
- if ucb.err != nil {
- return nil, ucb.err
- }
- specs := make([]*sqlgraph.CreateSpec, len(ucb.builders))
- nodes := make([]*User, len(ucb.builders))
- mutators := make([]Mutator, len(ucb.builders))
- for i := range ucb.builders {
+func (_c *UserCreateBulk) Save(ctx context.Context) ([]*User, error) {
+ if _c.err != nil {
+ return nil, _c.err
+ }
+ specs := make([]*sqlgraph.CreateSpec, len(_c.builders))
+ nodes := make([]*User, len(_c.builders))
+ mutators := make([]Mutator, len(_c.builders))
+ for i := range _c.builders {
func(i int, root context.Context) {
- builder := ucb.builders[i]
+ builder := _c.builders[i]
builder.defaults()
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
mutation, ok := m.(*UserMutation)
@@ -445,11 +486,11 @@ func (ucb *UserCreateBulk) Save(ctx context.Context) ([]*User, error) {
var err error
nodes[i], specs[i] = builder.createSpec()
if i < len(mutators)-1 {
- _, err = mutators[i+1].Mutate(root, ucb.builders[i+1].mutation)
+ _, err = mutators[i+1].Mutate(root, _c.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, ucb.driver, spec); err != nil {
+ if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil {
if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
@@ -469,7 +510,7 @@ func (ucb *UserCreateBulk) Save(ctx context.Context) ([]*User, error) {
}(i, ctx)
}
if len(mutators) > 0 {
- if _, err := mutators[0].Mutate(ctx, ucb.builders[0].mutation); err != nil {
+ if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil {
return nil, err
}
}
@@ -477,8 +518,8 @@ func (ucb *UserCreateBulk) Save(ctx context.Context) ([]*User, error) {
}
// SaveX is like Save, but panics if an error occurs.
-func (ucb *UserCreateBulk) SaveX(ctx context.Context) []*User {
- v, err := ucb.Save(ctx)
+func (_c *UserCreateBulk) SaveX(ctx context.Context) []*User {
+ v, err := _c.Save(ctx)
if err != nil {
panic(err)
}
@@ -486,14 +527,14 @@ func (ucb *UserCreateBulk) SaveX(ctx context.Context) []*User {
}
// Exec executes the query.
-func (ucb *UserCreateBulk) Exec(ctx context.Context) error {
- _, err := ucb.Save(ctx)
+func (_c *UserCreateBulk) Exec(ctx context.Context) error {
+ _, err := _c.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
-func (ucb *UserCreateBulk) ExecX(ctx context.Context) {
- if err := ucb.Exec(ctx); err != nil {
+func (_c *UserCreateBulk) ExecX(ctx context.Context) {
+ if err := _c.Exec(ctx); err != nil {
panic(err)
}
}
diff --git a/backend/internal/data/ent/user_delete.go b/backend/internal/data/ent/user_delete.go
index 2a81709a..53f2e5a5 100644
--- a/backend/internal/data/ent/user_delete.go
+++ b/backend/internal/data/ent/user_delete.go
@@ -20,56 +20,56 @@ type UserDelete struct {
}
// Where appends a list predicates to the UserDelete builder.
-func (ud *UserDelete) Where(ps ...predicate.User) *UserDelete {
- ud.mutation.Where(ps...)
- return ud
+func (_d *UserDelete) Where(ps ...predicate.User) *UserDelete {
+ _d.mutation.Where(ps...)
+ return _d
}
// Exec executes the deletion query and returns how many vertices were deleted.
-func (ud *UserDelete) Exec(ctx context.Context) (int, error) {
- return withHooks(ctx, ud.sqlExec, ud.mutation, ud.hooks)
+func (_d *UserDelete) Exec(ctx context.Context) (int, error) {
+ return withHooks(ctx, _d.sqlExec, _d.mutation, _d.hooks)
}
// ExecX is like Exec, but panics if an error occurs.
-func (ud *UserDelete) ExecX(ctx context.Context) int {
- n, err := ud.Exec(ctx)
+func (_d *UserDelete) ExecX(ctx context.Context) int {
+ n, err := _d.Exec(ctx)
if err != nil {
panic(err)
}
return n
}
-func (ud *UserDelete) sqlExec(ctx context.Context) (int, error) {
+func (_d *UserDelete) sqlExec(ctx context.Context) (int, error) {
_spec := sqlgraph.NewDeleteSpec(user.Table, sqlgraph.NewFieldSpec(user.FieldID, field.TypeUUID))
- if ps := ud.mutation.predicates; len(ps) > 0 {
+ if ps := _d.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
- affected, err := sqlgraph.DeleteNodes(ctx, ud.driver, _spec)
+ affected, err := sqlgraph.DeleteNodes(ctx, _d.driver, _spec)
if err != nil && sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
- ud.mutation.done = true
+ _d.mutation.done = true
return affected, err
}
// UserDeleteOne is the builder for deleting a single User entity.
type UserDeleteOne struct {
- ud *UserDelete
+ _d *UserDelete
}
// Where appends a list predicates to the UserDelete builder.
-func (udo *UserDeleteOne) Where(ps ...predicate.User) *UserDeleteOne {
- udo.ud.mutation.Where(ps...)
- return udo
+func (_d *UserDeleteOne) Where(ps ...predicate.User) *UserDeleteOne {
+ _d._d.mutation.Where(ps...)
+ return _d
}
// Exec executes the deletion query.
-func (udo *UserDeleteOne) Exec(ctx context.Context) error {
- n, err := udo.ud.Exec(ctx)
+func (_d *UserDeleteOne) Exec(ctx context.Context) error {
+ n, err := _d._d.Exec(ctx)
switch {
case err != nil:
return err
@@ -81,8 +81,8 @@ func (udo *UserDeleteOne) Exec(ctx context.Context) error {
}
// ExecX is like Exec, but panics if an error occurs.
-func (udo *UserDeleteOne) ExecX(ctx context.Context) {
- if err := udo.Exec(ctx); err != nil {
+func (_d *UserDeleteOne) ExecX(ctx context.Context) {
+ if err := _d.Exec(ctx); err != nil {
panic(err)
}
}
diff --git a/backend/internal/data/ent/user_query.go b/backend/internal/data/ent/user_query.go
index bd75ecd8..1084a718 100644
--- a/backend/internal/data/ent/user_query.go
+++ b/backend/internal/data/ent/user_query.go
@@ -37,44 +37,44 @@ type UserQuery struct {
}
// Where adds a new predicate for the UserQuery builder.
-func (uq *UserQuery) Where(ps ...predicate.User) *UserQuery {
- uq.predicates = append(uq.predicates, ps...)
- return uq
+func (_q *UserQuery) Where(ps ...predicate.User) *UserQuery {
+ _q.predicates = append(_q.predicates, ps...)
+ return _q
}
// Limit the number of records to be returned by this query.
-func (uq *UserQuery) Limit(limit int) *UserQuery {
- uq.ctx.Limit = &limit
- return uq
+func (_q *UserQuery) Limit(limit int) *UserQuery {
+ _q.ctx.Limit = &limit
+ return _q
}
// Offset to start from.
-func (uq *UserQuery) Offset(offset int) *UserQuery {
- uq.ctx.Offset = &offset
- return uq
+func (_q *UserQuery) Offset(offset int) *UserQuery {
+ _q.ctx.Offset = &offset
+ return _q
}
// Unique configures the query builder to filter duplicate records on query.
// By default, unique is set to true, and can be disabled using this method.
-func (uq *UserQuery) Unique(unique bool) *UserQuery {
- uq.ctx.Unique = &unique
- return uq
+func (_q *UserQuery) Unique(unique bool) *UserQuery {
+ _q.ctx.Unique = &unique
+ return _q
}
// Order specifies how the records should be ordered.
-func (uq *UserQuery) Order(o ...user.OrderOption) *UserQuery {
- uq.order = append(uq.order, o...)
- return uq
+func (_q *UserQuery) Order(o ...user.OrderOption) *UserQuery {
+ _q.order = append(_q.order, o...)
+ return _q
}
// QueryGroup chains the current query on the "group" edge.
-func (uq *UserQuery) QueryGroup() *GroupQuery {
- query := (&GroupClient{config: uq.config}).Query()
+func (_q *UserQuery) QueryGroup() *GroupQuery {
+ query := (&GroupClient{config: _q.config}).Query()
query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
- if err := uq.prepareQuery(ctx); err != nil {
+ if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
- selector := uq.sqlQuery(ctx)
+ selector := _q.sqlQuery(ctx)
if err := selector.Err(); err != nil {
return nil, err
}
@@ -83,20 +83,20 @@ func (uq *UserQuery) QueryGroup() *GroupQuery {
sqlgraph.To(group.Table, group.FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, user.GroupTable, user.GroupColumn),
)
- fromU = sqlgraph.SetNeighbors(uq.driver.Dialect(), step)
+ fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step)
return fromU, nil
}
return query
}
// QueryAuthTokens chains the current query on the "auth_tokens" edge.
-func (uq *UserQuery) QueryAuthTokens() *AuthTokensQuery {
- query := (&AuthTokensClient{config: uq.config}).Query()
+func (_q *UserQuery) QueryAuthTokens() *AuthTokensQuery {
+ query := (&AuthTokensClient{config: _q.config}).Query()
query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
- if err := uq.prepareQuery(ctx); err != nil {
+ if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
- selector := uq.sqlQuery(ctx)
+ selector := _q.sqlQuery(ctx)
if err := selector.Err(); err != nil {
return nil, err
}
@@ -105,20 +105,20 @@ func (uq *UserQuery) QueryAuthTokens() *AuthTokensQuery {
sqlgraph.To(authtokens.Table, authtokens.FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, user.AuthTokensTable, user.AuthTokensColumn),
)
- fromU = sqlgraph.SetNeighbors(uq.driver.Dialect(), step)
+ fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step)
return fromU, nil
}
return query
}
// QueryNotifiers chains the current query on the "notifiers" edge.
-func (uq *UserQuery) QueryNotifiers() *NotifierQuery {
- query := (&NotifierClient{config: uq.config}).Query()
+func (_q *UserQuery) QueryNotifiers() *NotifierQuery {
+ query := (&NotifierClient{config: _q.config}).Query()
query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
- if err := uq.prepareQuery(ctx); err != nil {
+ if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
- selector := uq.sqlQuery(ctx)
+ selector := _q.sqlQuery(ctx)
if err := selector.Err(); err != nil {
return nil, err
}
@@ -127,7 +127,7 @@ func (uq *UserQuery) QueryNotifiers() *NotifierQuery {
sqlgraph.To(notifier.Table, notifier.FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, user.NotifiersTable, user.NotifiersColumn),
)
- fromU = sqlgraph.SetNeighbors(uq.driver.Dialect(), step)
+ fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step)
return fromU, nil
}
return query
@@ -135,8 +135,8 @@ func (uq *UserQuery) QueryNotifiers() *NotifierQuery {
// First returns the first User entity from the query.
// Returns a *NotFoundError when no User was found.
-func (uq *UserQuery) First(ctx context.Context) (*User, error) {
- nodes, err := uq.Limit(1).All(setContextOp(ctx, uq.ctx, ent.OpQueryFirst))
+func (_q *UserQuery) First(ctx context.Context) (*User, error) {
+ nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst))
if err != nil {
return nil, err
}
@@ -147,8 +147,8 @@ func (uq *UserQuery) First(ctx context.Context) (*User, error) {
}
// FirstX is like First, but panics if an error occurs.
-func (uq *UserQuery) FirstX(ctx context.Context) *User {
- node, err := uq.First(ctx)
+func (_q *UserQuery) FirstX(ctx context.Context) *User {
+ node, err := _q.First(ctx)
if err != nil && !IsNotFound(err) {
panic(err)
}
@@ -157,9 +157,9 @@ func (uq *UserQuery) FirstX(ctx context.Context) *User {
// FirstID returns the first User ID from the query.
// Returns a *NotFoundError when no User ID was found.
-func (uq *UserQuery) FirstID(ctx context.Context) (id uuid.UUID, err error) {
+func (_q *UserQuery) FirstID(ctx context.Context) (id uuid.UUID, err error) {
var ids []uuid.UUID
- if ids, err = uq.Limit(1).IDs(setContextOp(ctx, uq.ctx, ent.OpQueryFirstID)); err != nil {
+ if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil {
return
}
if len(ids) == 0 {
@@ -170,8 +170,8 @@ func (uq *UserQuery) FirstID(ctx context.Context) (id uuid.UUID, err error) {
}
// FirstIDX is like FirstID, but panics if an error occurs.
-func (uq *UserQuery) FirstIDX(ctx context.Context) uuid.UUID {
- id, err := uq.FirstID(ctx)
+func (_q *UserQuery) FirstIDX(ctx context.Context) uuid.UUID {
+ id, err := _q.FirstID(ctx)
if err != nil && !IsNotFound(err) {
panic(err)
}
@@ -181,8 +181,8 @@ func (uq *UserQuery) FirstIDX(ctx context.Context) uuid.UUID {
// Only returns a single User entity found by the query, ensuring it only returns one.
// Returns a *NotSingularError when more than one User entity is found.
// Returns a *NotFoundError when no User entities are found.
-func (uq *UserQuery) Only(ctx context.Context) (*User, error) {
- nodes, err := uq.Limit(2).All(setContextOp(ctx, uq.ctx, ent.OpQueryOnly))
+func (_q *UserQuery) Only(ctx context.Context) (*User, error) {
+ nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly))
if err != nil {
return nil, err
}
@@ -197,8 +197,8 @@ func (uq *UserQuery) Only(ctx context.Context) (*User, error) {
}
// OnlyX is like Only, but panics if an error occurs.
-func (uq *UserQuery) OnlyX(ctx context.Context) *User {
- node, err := uq.Only(ctx)
+func (_q *UserQuery) OnlyX(ctx context.Context) *User {
+ node, err := _q.Only(ctx)
if err != nil {
panic(err)
}
@@ -208,9 +208,9 @@ func (uq *UserQuery) OnlyX(ctx context.Context) *User {
// OnlyID is like Only, but returns the only User ID in the query.
// Returns a *NotSingularError when more than one User ID is found.
// Returns a *NotFoundError when no entities are found.
-func (uq *UserQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error) {
+func (_q *UserQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error) {
var ids []uuid.UUID
- if ids, err = uq.Limit(2).IDs(setContextOp(ctx, uq.ctx, ent.OpQueryOnlyID)); err != nil {
+ if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil {
return
}
switch len(ids) {
@@ -225,8 +225,8 @@ func (uq *UserQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error) {
}
// OnlyIDX is like OnlyID, but panics if an error occurs.
-func (uq *UserQuery) OnlyIDX(ctx context.Context) uuid.UUID {
- id, err := uq.OnlyID(ctx)
+func (_q *UserQuery) OnlyIDX(ctx context.Context) uuid.UUID {
+ id, err := _q.OnlyID(ctx)
if err != nil {
panic(err)
}
@@ -234,18 +234,18 @@ func (uq *UserQuery) OnlyIDX(ctx context.Context) uuid.UUID {
}
// All executes the query and returns a list of Users.
-func (uq *UserQuery) All(ctx context.Context) ([]*User, error) {
- ctx = setContextOp(ctx, uq.ctx, ent.OpQueryAll)
- if err := uq.prepareQuery(ctx); err != nil {
+func (_q *UserQuery) All(ctx context.Context) ([]*User, error) {
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll)
+ if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
qr := querierAll[[]*User, *UserQuery]()
- return withInterceptors[[]*User](ctx, uq, qr, uq.inters)
+ return withInterceptors[[]*User](ctx, _q, qr, _q.inters)
}
// AllX is like All, but panics if an error occurs.
-func (uq *UserQuery) AllX(ctx context.Context) []*User {
- nodes, err := uq.All(ctx)
+func (_q *UserQuery) AllX(ctx context.Context) []*User {
+ nodes, err := _q.All(ctx)
if err != nil {
panic(err)
}
@@ -253,20 +253,20 @@ func (uq *UserQuery) AllX(ctx context.Context) []*User {
}
// IDs executes the query and returns a list of User IDs.
-func (uq *UserQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error) {
- if uq.ctx.Unique == nil && uq.path != nil {
- uq.Unique(true)
+func (_q *UserQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error) {
+ if _q.ctx.Unique == nil && _q.path != nil {
+ _q.Unique(true)
}
- ctx = setContextOp(ctx, uq.ctx, ent.OpQueryIDs)
- if err = uq.Select(user.FieldID).Scan(ctx, &ids); err != nil {
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs)
+ if err = _q.Select(user.FieldID).Scan(ctx, &ids); err != nil {
return nil, err
}
return ids, nil
}
// IDsX is like IDs, but panics if an error occurs.
-func (uq *UserQuery) IDsX(ctx context.Context) []uuid.UUID {
- ids, err := uq.IDs(ctx)
+func (_q *UserQuery) IDsX(ctx context.Context) []uuid.UUID {
+ ids, err := _q.IDs(ctx)
if err != nil {
panic(err)
}
@@ -274,17 +274,17 @@ func (uq *UserQuery) IDsX(ctx context.Context) []uuid.UUID {
}
// Count returns the count of the given query.
-func (uq *UserQuery) Count(ctx context.Context) (int, error) {
- ctx = setContextOp(ctx, uq.ctx, ent.OpQueryCount)
- if err := uq.prepareQuery(ctx); err != nil {
+func (_q *UserQuery) Count(ctx context.Context) (int, error) {
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryCount)
+ if err := _q.prepareQuery(ctx); err != nil {
return 0, err
}
- return withInterceptors[int](ctx, uq, querierCount[*UserQuery](), uq.inters)
+ return withInterceptors[int](ctx, _q, querierCount[*UserQuery](), _q.inters)
}
// CountX is like Count, but panics if an error occurs.
-func (uq *UserQuery) CountX(ctx context.Context) int {
- count, err := uq.Count(ctx)
+func (_q *UserQuery) CountX(ctx context.Context) int {
+ count, err := _q.Count(ctx)
if err != nil {
panic(err)
}
@@ -292,9 +292,9 @@ func (uq *UserQuery) CountX(ctx context.Context) int {
}
// Exist returns true if the query has elements in the graph.
-func (uq *UserQuery) Exist(ctx context.Context) (bool, error) {
- ctx = setContextOp(ctx, uq.ctx, ent.OpQueryExist)
- switch _, err := uq.FirstID(ctx); {
+func (_q *UserQuery) Exist(ctx context.Context) (bool, error) {
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryExist)
+ switch _, err := _q.FirstID(ctx); {
case IsNotFound(err):
return false, nil
case err != nil:
@@ -305,8 +305,8 @@ func (uq *UserQuery) Exist(ctx context.Context) (bool, error) {
}
// ExistX is like Exist, but panics if an error occurs.
-func (uq *UserQuery) ExistX(ctx context.Context) bool {
- exist, err := uq.Exist(ctx)
+func (_q *UserQuery) ExistX(ctx context.Context) bool {
+ exist, err := _q.Exist(ctx)
if err != nil {
panic(err)
}
@@ -315,56 +315,56 @@ func (uq *UserQuery) ExistX(ctx context.Context) bool {
// Clone returns a duplicate of the UserQuery builder, including all associated steps. It can be
// used to prepare common query builders and use them differently after the clone is made.
-func (uq *UserQuery) Clone() *UserQuery {
- if uq == nil {
+func (_q *UserQuery) Clone() *UserQuery {
+ if _q == nil {
return nil
}
return &UserQuery{
- config: uq.config,
- ctx: uq.ctx.Clone(),
- order: append([]user.OrderOption{}, uq.order...),
- inters: append([]Interceptor{}, uq.inters...),
- predicates: append([]predicate.User{}, uq.predicates...),
- withGroup: uq.withGroup.Clone(),
- withAuthTokens: uq.withAuthTokens.Clone(),
- withNotifiers: uq.withNotifiers.Clone(),
+ config: _q.config,
+ ctx: _q.ctx.Clone(),
+ order: append([]user.OrderOption{}, _q.order...),
+ inters: append([]Interceptor{}, _q.inters...),
+ predicates: append([]predicate.User{}, _q.predicates...),
+ withGroup: _q.withGroup.Clone(),
+ withAuthTokens: _q.withAuthTokens.Clone(),
+ withNotifiers: _q.withNotifiers.Clone(),
// clone intermediate query.
- sql: uq.sql.Clone(),
- path: uq.path,
+ sql: _q.sql.Clone(),
+ path: _q.path,
}
}
// WithGroup tells the query-builder to eager-load the nodes that are connected to
// the "group" edge. The optional arguments are used to configure the query builder of the edge.
-func (uq *UserQuery) WithGroup(opts ...func(*GroupQuery)) *UserQuery {
- query := (&GroupClient{config: uq.config}).Query()
+func (_q *UserQuery) WithGroup(opts ...func(*GroupQuery)) *UserQuery {
+ query := (&GroupClient{config: _q.config}).Query()
for _, opt := range opts {
opt(query)
}
- uq.withGroup = query
- return uq
+ _q.withGroup = query
+ return _q
}
// WithAuthTokens tells the query-builder to eager-load the nodes that are connected to
// the "auth_tokens" edge. The optional arguments are used to configure the query builder of the edge.
-func (uq *UserQuery) WithAuthTokens(opts ...func(*AuthTokensQuery)) *UserQuery {
- query := (&AuthTokensClient{config: uq.config}).Query()
+func (_q *UserQuery) WithAuthTokens(opts ...func(*AuthTokensQuery)) *UserQuery {
+ query := (&AuthTokensClient{config: _q.config}).Query()
for _, opt := range opts {
opt(query)
}
- uq.withAuthTokens = query
- return uq
+ _q.withAuthTokens = query
+ return _q
}
// WithNotifiers tells the query-builder to eager-load the nodes that are connected to
// the "notifiers" edge. The optional arguments are used to configure the query builder of the edge.
-func (uq *UserQuery) WithNotifiers(opts ...func(*NotifierQuery)) *UserQuery {
- query := (&NotifierClient{config: uq.config}).Query()
+func (_q *UserQuery) WithNotifiers(opts ...func(*NotifierQuery)) *UserQuery {
+ query := (&NotifierClient{config: _q.config}).Query()
for _, opt := range opts {
opt(query)
}
- uq.withNotifiers = query
- return uq
+ _q.withNotifiers = query
+ return _q
}
// GroupBy is used to group vertices by one or more fields/columns.
@@ -381,10 +381,10 @@ func (uq *UserQuery) WithNotifiers(opts ...func(*NotifierQuery)) *UserQuery {
// GroupBy(user.FieldCreatedAt).
// Aggregate(ent.Count()).
// Scan(ctx, &v)
-func (uq *UserQuery) GroupBy(field string, fields ...string) *UserGroupBy {
- uq.ctx.Fields = append([]string{field}, fields...)
- grbuild := &UserGroupBy{build: uq}
- grbuild.flds = &uq.ctx.Fields
+func (_q *UserQuery) GroupBy(field string, fields ...string) *UserGroupBy {
+ _q.ctx.Fields = append([]string{field}, fields...)
+ grbuild := &UserGroupBy{build: _q}
+ grbuild.flds = &_q.ctx.Fields
grbuild.label = user.Label
grbuild.scan = grbuild.Scan
return grbuild
@@ -402,57 +402,57 @@ func (uq *UserQuery) GroupBy(field string, fields ...string) *UserGroupBy {
// client.User.Query().
// Select(user.FieldCreatedAt).
// Scan(ctx, &v)
-func (uq *UserQuery) Select(fields ...string) *UserSelect {
- uq.ctx.Fields = append(uq.ctx.Fields, fields...)
- sbuild := &UserSelect{UserQuery: uq}
+func (_q *UserQuery) Select(fields ...string) *UserSelect {
+ _q.ctx.Fields = append(_q.ctx.Fields, fields...)
+ sbuild := &UserSelect{UserQuery: _q}
sbuild.label = user.Label
- sbuild.flds, sbuild.scan = &uq.ctx.Fields, sbuild.Scan
+ sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan
return sbuild
}
// Aggregate returns a UserSelect configured with the given aggregations.
-func (uq *UserQuery) Aggregate(fns ...AggregateFunc) *UserSelect {
- return uq.Select().Aggregate(fns...)
+func (_q *UserQuery) Aggregate(fns ...AggregateFunc) *UserSelect {
+ return _q.Select().Aggregate(fns...)
}
-func (uq *UserQuery) prepareQuery(ctx context.Context) error {
- for _, inter := range uq.inters {
+func (_q *UserQuery) prepareQuery(ctx context.Context) error {
+ for _, inter := range _q.inters {
if inter == nil {
return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)")
}
if trv, ok := inter.(Traverser); ok {
- if err := trv.Traverse(ctx, uq); err != nil {
+ if err := trv.Traverse(ctx, _q); err != nil {
return err
}
}
}
- for _, f := range uq.ctx.Fields {
+ for _, f := range _q.ctx.Fields {
if !user.ValidColumn(f) {
return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
}
}
- if uq.path != nil {
- prev, err := uq.path(ctx)
+ if _q.path != nil {
+ prev, err := _q.path(ctx)
if err != nil {
return err
}
- uq.sql = prev
+ _q.sql = prev
}
return nil
}
-func (uq *UserQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*User, error) {
+func (_q *UserQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*User, error) {
var (
nodes = []*User{}
- withFKs = uq.withFKs
- _spec = uq.querySpec()
+ withFKs = _q.withFKs
+ _spec = _q.querySpec()
loadedTypes = [3]bool{
- uq.withGroup != nil,
- uq.withAuthTokens != nil,
- uq.withNotifiers != nil,
+ _q.withGroup != nil,
+ _q.withAuthTokens != nil,
+ _q.withNotifiers != nil,
}
)
- if uq.withGroup != nil {
+ if _q.withGroup != nil {
withFKs = true
}
if withFKs {
@@ -462,7 +462,7 @@ func (uq *UserQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*User, e
return (*User).scanValues(nil, columns)
}
_spec.Assign = func(columns []string, values []any) error {
- node := &User{config: uq.config}
+ node := &User{config: _q.config}
nodes = append(nodes, node)
node.Edges.loadedTypes = loadedTypes
return node.assignValues(columns, values)
@@ -470,27 +470,27 @@ func (uq *UserQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*User, e
for i := range hooks {
hooks[i](ctx, _spec)
}
- if err := sqlgraph.QueryNodes(ctx, uq.driver, _spec); err != nil {
+ if err := sqlgraph.QueryNodes(ctx, _q.driver, _spec); err != nil {
return nil, err
}
if len(nodes) == 0 {
return nodes, nil
}
- if query := uq.withGroup; query != nil {
- if err := uq.loadGroup(ctx, query, nodes, nil,
+ if query := _q.withGroup; query != nil {
+ if err := _q.loadGroup(ctx, query, nodes, nil,
func(n *User, e *Group) { n.Edges.Group = e }); err != nil {
return nil, err
}
}
- if query := uq.withAuthTokens; query != nil {
- if err := uq.loadAuthTokens(ctx, query, nodes,
+ if query := _q.withAuthTokens; query != nil {
+ if err := _q.loadAuthTokens(ctx, query, nodes,
func(n *User) { n.Edges.AuthTokens = []*AuthTokens{} },
func(n *User, e *AuthTokens) { n.Edges.AuthTokens = append(n.Edges.AuthTokens, e) }); err != nil {
return nil, err
}
}
- if query := uq.withNotifiers; query != nil {
- if err := uq.loadNotifiers(ctx, query, nodes,
+ if query := _q.withNotifiers; query != nil {
+ if err := _q.loadNotifiers(ctx, query, nodes,
func(n *User) { n.Edges.Notifiers = []*Notifier{} },
func(n *User, e *Notifier) { n.Edges.Notifiers = append(n.Edges.Notifiers, e) }); err != nil {
return nil, err
@@ -499,7 +499,7 @@ func (uq *UserQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*User, e
return nodes, nil
}
-func (uq *UserQuery) loadGroup(ctx context.Context, query *GroupQuery, nodes []*User, init func(*User), assign func(*User, *Group)) error {
+func (_q *UserQuery) loadGroup(ctx context.Context, query *GroupQuery, nodes []*User, init func(*User), assign func(*User, *Group)) error {
ids := make([]uuid.UUID, 0, len(nodes))
nodeids := make(map[uuid.UUID][]*User)
for i := range nodes {
@@ -531,7 +531,7 @@ func (uq *UserQuery) loadGroup(ctx context.Context, query *GroupQuery, nodes []*
}
return nil
}
-func (uq *UserQuery) loadAuthTokens(ctx context.Context, query *AuthTokensQuery, nodes []*User, init func(*User), assign func(*User, *AuthTokens)) error {
+func (_q *UserQuery) loadAuthTokens(ctx context.Context, query *AuthTokensQuery, nodes []*User, init func(*User), assign func(*User, *AuthTokens)) error {
fks := make([]driver.Value, 0, len(nodes))
nodeids := make(map[uuid.UUID]*User)
for i := range nodes {
@@ -562,7 +562,7 @@ func (uq *UserQuery) loadAuthTokens(ctx context.Context, query *AuthTokensQuery,
}
return nil
}
-func (uq *UserQuery) loadNotifiers(ctx context.Context, query *NotifierQuery, nodes []*User, init func(*User), assign func(*User, *Notifier)) error {
+func (_q *UserQuery) loadNotifiers(ctx context.Context, query *NotifierQuery, nodes []*User, init func(*User), assign func(*User, *Notifier)) error {
fks := make([]driver.Value, 0, len(nodes))
nodeids := make(map[uuid.UUID]*User)
for i := range nodes {
@@ -593,24 +593,24 @@ func (uq *UserQuery) loadNotifiers(ctx context.Context, query *NotifierQuery, no
return nil
}
-func (uq *UserQuery) sqlCount(ctx context.Context) (int, error) {
- _spec := uq.querySpec()
- _spec.Node.Columns = uq.ctx.Fields
- if len(uq.ctx.Fields) > 0 {
- _spec.Unique = uq.ctx.Unique != nil && *uq.ctx.Unique
+func (_q *UserQuery) sqlCount(ctx context.Context) (int, error) {
+ _spec := _q.querySpec()
+ _spec.Node.Columns = _q.ctx.Fields
+ if len(_q.ctx.Fields) > 0 {
+ _spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique
}
- return sqlgraph.CountNodes(ctx, uq.driver, _spec)
+ return sqlgraph.CountNodes(ctx, _q.driver, _spec)
}
-func (uq *UserQuery) querySpec() *sqlgraph.QuerySpec {
+func (_q *UserQuery) querySpec() *sqlgraph.QuerySpec {
_spec := sqlgraph.NewQuerySpec(user.Table, user.Columns, sqlgraph.NewFieldSpec(user.FieldID, field.TypeUUID))
- _spec.From = uq.sql
- if unique := uq.ctx.Unique; unique != nil {
+ _spec.From = _q.sql
+ if unique := _q.ctx.Unique; unique != nil {
_spec.Unique = *unique
- } else if uq.path != nil {
+ } else if _q.path != nil {
_spec.Unique = true
}
- if fields := uq.ctx.Fields; len(fields) > 0 {
+ if fields := _q.ctx.Fields; len(fields) > 0 {
_spec.Node.Columns = make([]string, 0, len(fields))
_spec.Node.Columns = append(_spec.Node.Columns, user.FieldID)
for i := range fields {
@@ -619,20 +619,20 @@ func (uq *UserQuery) querySpec() *sqlgraph.QuerySpec {
}
}
}
- if ps := uq.predicates; len(ps) > 0 {
+ if ps := _q.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
- if limit := uq.ctx.Limit; limit != nil {
+ if limit := _q.ctx.Limit; limit != nil {
_spec.Limit = *limit
}
- if offset := uq.ctx.Offset; offset != nil {
+ if offset := _q.ctx.Offset; offset != nil {
_spec.Offset = *offset
}
- if ps := uq.order; len(ps) > 0 {
+ if ps := _q.order; len(ps) > 0 {
_spec.Order = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
@@ -642,33 +642,33 @@ func (uq *UserQuery) querySpec() *sqlgraph.QuerySpec {
return _spec
}
-func (uq *UserQuery) sqlQuery(ctx context.Context) *sql.Selector {
- builder := sql.Dialect(uq.driver.Dialect())
+func (_q *UserQuery) sqlQuery(ctx context.Context) *sql.Selector {
+ builder := sql.Dialect(_q.driver.Dialect())
t1 := builder.Table(user.Table)
- columns := uq.ctx.Fields
+ columns := _q.ctx.Fields
if len(columns) == 0 {
columns = user.Columns
}
selector := builder.Select(t1.Columns(columns...)...).From(t1)
- if uq.sql != nil {
- selector = uq.sql
+ if _q.sql != nil {
+ selector = _q.sql
selector.Select(selector.Columns(columns...)...)
}
- if uq.ctx.Unique != nil && *uq.ctx.Unique {
+ if _q.ctx.Unique != nil && *_q.ctx.Unique {
selector.Distinct()
}
- for _, p := range uq.predicates {
+ for _, p := range _q.predicates {
p(selector)
}
- for _, p := range uq.order {
+ for _, p := range _q.order {
p(selector)
}
- if offset := uq.ctx.Offset; offset != nil {
+ if offset := _q.ctx.Offset; offset != nil {
// limit is mandatory for offset clause. We start
// with default value, and override it below if needed.
selector.Offset(*offset).Limit(math.MaxInt32)
}
- if limit := uq.ctx.Limit; limit != nil {
+ if limit := _q.ctx.Limit; limit != nil {
selector.Limit(*limit)
}
return selector
@@ -681,41 +681,41 @@ type UserGroupBy struct {
}
// Aggregate adds the given aggregation functions to the group-by query.
-func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy {
- ugb.fns = append(ugb.fns, fns...)
- return ugb
+func (_g *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy {
+ _g.fns = append(_g.fns, fns...)
+ return _g
}
// Scan applies the selector query and scans the result into the given value.
-func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error {
- ctx = setContextOp(ctx, ugb.build.ctx, ent.OpQueryGroupBy)
- if err := ugb.build.prepareQuery(ctx); err != nil {
+func (_g *UserGroupBy) Scan(ctx context.Context, v any) error {
+ ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy)
+ if err := _g.build.prepareQuery(ctx); err != nil {
return err
}
- return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, ugb.build, ugb, ugb.build.inters, v)
+ return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, _g.build, _g, _g.build.inters, v)
}
-func (ugb *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error {
+func (_g *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error {
selector := root.sqlQuery(ctx).Select()
- aggregation := make([]string, 0, len(ugb.fns))
- for _, fn := range ugb.fns {
+ aggregation := make([]string, 0, len(_g.fns))
+ for _, fn := range _g.fns {
aggregation = append(aggregation, fn(selector))
}
if len(selector.SelectedColumns()) == 0 {
- columns := make([]string, 0, len(*ugb.flds)+len(ugb.fns))
- for _, f := range *ugb.flds {
+ columns := make([]string, 0, len(*_g.flds)+len(_g.fns))
+ for _, f := range *_g.flds {
columns = append(columns, selector.C(f))
}
columns = append(columns, aggregation...)
selector.Select(columns...)
}
- selector.GroupBy(selector.Columns(*ugb.flds...)...)
+ selector.GroupBy(selector.Columns(*_g.flds...)...)
if err := selector.Err(); err != nil {
return err
}
rows := &sql.Rows{}
query, args := selector.Query()
- if err := ugb.build.driver.Query(ctx, query, args, rows); err != nil {
+ if err := _g.build.driver.Query(ctx, query, args, rows); err != nil {
return err
}
defer rows.Close()
@@ -729,27 +729,27 @@ type UserSelect struct {
}
// Aggregate adds the given aggregation functions to the selector query.
-func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect {
- us.fns = append(us.fns, fns...)
- return us
+func (_s *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect {
+ _s.fns = append(_s.fns, fns...)
+ return _s
}
// Scan applies the selector query and scans the result into the given value.
-func (us *UserSelect) Scan(ctx context.Context, v any) error {
- ctx = setContextOp(ctx, us.ctx, ent.OpQuerySelect)
- if err := us.prepareQuery(ctx); err != nil {
+func (_s *UserSelect) Scan(ctx context.Context, v any) error {
+ ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect)
+ if err := _s.prepareQuery(ctx); err != nil {
return err
}
- return scanWithInterceptors[*UserQuery, *UserSelect](ctx, us.UserQuery, us, us.inters, v)
+ return scanWithInterceptors[*UserQuery, *UserSelect](ctx, _s.UserQuery, _s, _s.inters, v)
}
-func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error {
+func (_s *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error {
selector := root.sqlQuery(ctx)
- aggregation := make([]string, 0, len(us.fns))
- for _, fn := range us.fns {
+ aggregation := make([]string, 0, len(_s.fns))
+ for _, fn := range _s.fns {
aggregation = append(aggregation, fn(selector))
}
- switch n := len(*us.selector.flds); {
+ switch n := len(*_s.selector.flds); {
case n == 0 && len(aggregation) > 0:
selector.Select(aggregation...)
case n != 0 && len(aggregation) > 0:
@@ -757,7 +757,7 @@ func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error
}
rows := &sql.Rows{}
query, args := selector.Query()
- if err := us.driver.Query(ctx, query, args, rows); err != nil {
+ if err := _s.driver.Query(ctx, query, args, rows); err != nil {
return err
}
defer rows.Close()
diff --git a/backend/internal/data/ent/user_update.go b/backend/internal/data/ent/user_update.go
index 8697a637..c13f4057 100644
--- a/backend/internal/data/ent/user_update.go
+++ b/backend/internal/data/ent/user_update.go
@@ -27,224 +27,270 @@ type UserUpdate struct {
}
// Where appends a list predicates to the UserUpdate builder.
-func (uu *UserUpdate) Where(ps ...predicate.User) *UserUpdate {
- uu.mutation.Where(ps...)
- return uu
+func (_u *UserUpdate) Where(ps ...predicate.User) *UserUpdate {
+ _u.mutation.Where(ps...)
+ return _u
}
// SetUpdatedAt sets the "updated_at" field.
-func (uu *UserUpdate) SetUpdatedAt(t time.Time) *UserUpdate {
- uu.mutation.SetUpdatedAt(t)
- return uu
+func (_u *UserUpdate) SetUpdatedAt(v time.Time) *UserUpdate {
+ _u.mutation.SetUpdatedAt(v)
+ return _u
}
// SetName sets the "name" field.
-func (uu *UserUpdate) SetName(s string) *UserUpdate {
- uu.mutation.SetName(s)
- return uu
+func (_u *UserUpdate) SetName(v string) *UserUpdate {
+ _u.mutation.SetName(v)
+ return _u
}
// SetNillableName sets the "name" field if the given value is not nil.
-func (uu *UserUpdate) SetNillableName(s *string) *UserUpdate {
- if s != nil {
- uu.SetName(*s)
+func (_u *UserUpdate) SetNillableName(v *string) *UserUpdate {
+ if v != nil {
+ _u.SetName(*v)
}
- return uu
+ return _u
}
// SetEmail sets the "email" field.
-func (uu *UserUpdate) SetEmail(s string) *UserUpdate {
- uu.mutation.SetEmail(s)
- return uu
+func (_u *UserUpdate) SetEmail(v string) *UserUpdate {
+ _u.mutation.SetEmail(v)
+ return _u
}
// SetNillableEmail sets the "email" field if the given value is not nil.
-func (uu *UserUpdate) SetNillableEmail(s *string) *UserUpdate {
- if s != nil {
- uu.SetEmail(*s)
+func (_u *UserUpdate) SetNillableEmail(v *string) *UserUpdate {
+ if v != nil {
+ _u.SetEmail(*v)
}
- return uu
+ return _u
}
// SetPassword sets the "password" field.
-func (uu *UserUpdate) SetPassword(s string) *UserUpdate {
- uu.mutation.SetPassword(s)
- return uu
+func (_u *UserUpdate) SetPassword(v string) *UserUpdate {
+ _u.mutation.SetPassword(v)
+ return _u
}
// SetNillablePassword sets the "password" field if the given value is not nil.
-func (uu *UserUpdate) SetNillablePassword(s *string) *UserUpdate {
- if s != nil {
- uu.SetPassword(*s)
+func (_u *UserUpdate) SetNillablePassword(v *string) *UserUpdate {
+ if v != nil {
+ _u.SetPassword(*v)
}
- return uu
+ return _u
+}
+
+// ClearPassword clears the value of the "password" field.
+func (_u *UserUpdate) ClearPassword() *UserUpdate {
+ _u.mutation.ClearPassword()
+ return _u
}
// SetIsSuperuser sets the "is_superuser" field.
-func (uu *UserUpdate) SetIsSuperuser(b bool) *UserUpdate {
- uu.mutation.SetIsSuperuser(b)
- return uu
+func (_u *UserUpdate) SetIsSuperuser(v bool) *UserUpdate {
+ _u.mutation.SetIsSuperuser(v)
+ return _u
}
// SetNillableIsSuperuser sets the "is_superuser" field if the given value is not nil.
-func (uu *UserUpdate) SetNillableIsSuperuser(b *bool) *UserUpdate {
- if b != nil {
- uu.SetIsSuperuser(*b)
+func (_u *UserUpdate) SetNillableIsSuperuser(v *bool) *UserUpdate {
+ if v != nil {
+ _u.SetIsSuperuser(*v)
}
- return uu
+ return _u
}
// SetSuperuser sets the "superuser" field.
-func (uu *UserUpdate) SetSuperuser(b bool) *UserUpdate {
- uu.mutation.SetSuperuser(b)
- return uu
+func (_u *UserUpdate) SetSuperuser(v bool) *UserUpdate {
+ _u.mutation.SetSuperuser(v)
+ return _u
}
// SetNillableSuperuser sets the "superuser" field if the given value is not nil.
-func (uu *UserUpdate) SetNillableSuperuser(b *bool) *UserUpdate {
- if b != nil {
- uu.SetSuperuser(*b)
+func (_u *UserUpdate) SetNillableSuperuser(v *bool) *UserUpdate {
+ if v != nil {
+ _u.SetSuperuser(*v)
}
- return uu
+ return _u
}
// SetRole sets the "role" field.
-func (uu *UserUpdate) SetRole(u user.Role) *UserUpdate {
- uu.mutation.SetRole(u)
- return uu
+func (_u *UserUpdate) SetRole(v user.Role) *UserUpdate {
+ _u.mutation.SetRole(v)
+ return _u
}
// SetNillableRole sets the "role" field if the given value is not nil.
-func (uu *UserUpdate) SetNillableRole(u *user.Role) *UserUpdate {
- if u != nil {
- uu.SetRole(*u)
+func (_u *UserUpdate) SetNillableRole(v *user.Role) *UserUpdate {
+ if v != nil {
+ _u.SetRole(*v)
}
- return uu
+ return _u
}
// SetActivatedOn sets the "activated_on" field.
-func (uu *UserUpdate) SetActivatedOn(t time.Time) *UserUpdate {
- uu.mutation.SetActivatedOn(t)
- return uu
+func (_u *UserUpdate) SetActivatedOn(v time.Time) *UserUpdate {
+ _u.mutation.SetActivatedOn(v)
+ return _u
}
// SetNillableActivatedOn sets the "activated_on" field if the given value is not nil.
-func (uu *UserUpdate) SetNillableActivatedOn(t *time.Time) *UserUpdate {
- if t != nil {
- uu.SetActivatedOn(*t)
+func (_u *UserUpdate) SetNillableActivatedOn(v *time.Time) *UserUpdate {
+ if v != nil {
+ _u.SetActivatedOn(*v)
}
- return uu
+ return _u
}
// ClearActivatedOn clears the value of the "activated_on" field.
-func (uu *UserUpdate) ClearActivatedOn() *UserUpdate {
- uu.mutation.ClearActivatedOn()
- return uu
+func (_u *UserUpdate) ClearActivatedOn() *UserUpdate {
+ _u.mutation.ClearActivatedOn()
+ return _u
+}
+
+// SetOidcIssuer sets the "oidc_issuer" field.
+func (_u *UserUpdate) SetOidcIssuer(v string) *UserUpdate {
+ _u.mutation.SetOidcIssuer(v)
+ return _u
+}
+
+// SetNillableOidcIssuer sets the "oidc_issuer" field if the given value is not nil.
+func (_u *UserUpdate) SetNillableOidcIssuer(v *string) *UserUpdate {
+ if v != nil {
+ _u.SetOidcIssuer(*v)
+ }
+ return _u
+}
+
+// ClearOidcIssuer clears the value of the "oidc_issuer" field.
+func (_u *UserUpdate) ClearOidcIssuer() *UserUpdate {
+ _u.mutation.ClearOidcIssuer()
+ return _u
+}
+
+// SetOidcSubject sets the "oidc_subject" field.
+func (_u *UserUpdate) SetOidcSubject(v string) *UserUpdate {
+ _u.mutation.SetOidcSubject(v)
+ return _u
+}
+
+// SetNillableOidcSubject sets the "oidc_subject" field if the given value is not nil.
+func (_u *UserUpdate) SetNillableOidcSubject(v *string) *UserUpdate {
+ if v != nil {
+ _u.SetOidcSubject(*v)
+ }
+ return _u
+}
+
+// ClearOidcSubject clears the value of the "oidc_subject" field.
+func (_u *UserUpdate) ClearOidcSubject() *UserUpdate {
+ _u.mutation.ClearOidcSubject()
+ return _u
}
// SetGroupID sets the "group" edge to the Group entity by ID.
-func (uu *UserUpdate) SetGroupID(id uuid.UUID) *UserUpdate {
- uu.mutation.SetGroupID(id)
- return uu
+func (_u *UserUpdate) SetGroupID(id uuid.UUID) *UserUpdate {
+ _u.mutation.SetGroupID(id)
+ return _u
}
// SetGroup sets the "group" edge to the Group entity.
-func (uu *UserUpdate) SetGroup(g *Group) *UserUpdate {
- return uu.SetGroupID(g.ID)
+func (_u *UserUpdate) SetGroup(v *Group) *UserUpdate {
+ return _u.SetGroupID(v.ID)
}
// AddAuthTokenIDs adds the "auth_tokens" edge to the AuthTokens entity by IDs.
-func (uu *UserUpdate) AddAuthTokenIDs(ids ...uuid.UUID) *UserUpdate {
- uu.mutation.AddAuthTokenIDs(ids...)
- return uu
+func (_u *UserUpdate) AddAuthTokenIDs(ids ...uuid.UUID) *UserUpdate {
+ _u.mutation.AddAuthTokenIDs(ids...)
+ return _u
}
// AddAuthTokens adds the "auth_tokens" edges to the AuthTokens entity.
-func (uu *UserUpdate) AddAuthTokens(a ...*AuthTokens) *UserUpdate {
- ids := make([]uuid.UUID, len(a))
- for i := range a {
- ids[i] = a[i].ID
+func (_u *UserUpdate) AddAuthTokens(v ...*AuthTokens) *UserUpdate {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return uu.AddAuthTokenIDs(ids...)
+ return _u.AddAuthTokenIDs(ids...)
}
// AddNotifierIDs adds the "notifiers" edge to the Notifier entity by IDs.
-func (uu *UserUpdate) AddNotifierIDs(ids ...uuid.UUID) *UserUpdate {
- uu.mutation.AddNotifierIDs(ids...)
- return uu
+func (_u *UserUpdate) AddNotifierIDs(ids ...uuid.UUID) *UserUpdate {
+ _u.mutation.AddNotifierIDs(ids...)
+ return _u
}
// AddNotifiers adds the "notifiers" edges to the Notifier entity.
-func (uu *UserUpdate) AddNotifiers(n ...*Notifier) *UserUpdate {
- ids := make([]uuid.UUID, len(n))
- for i := range n {
- ids[i] = n[i].ID
+func (_u *UserUpdate) AddNotifiers(v ...*Notifier) *UserUpdate {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return uu.AddNotifierIDs(ids...)
+ return _u.AddNotifierIDs(ids...)
}
// Mutation returns the UserMutation object of the builder.
-func (uu *UserUpdate) Mutation() *UserMutation {
- return uu.mutation
+func (_u *UserUpdate) Mutation() *UserMutation {
+ return _u.mutation
}
// ClearGroup clears the "group" edge to the Group entity.
-func (uu *UserUpdate) ClearGroup() *UserUpdate {
- uu.mutation.ClearGroup()
- return uu
+func (_u *UserUpdate) ClearGroup() *UserUpdate {
+ _u.mutation.ClearGroup()
+ return _u
}
// ClearAuthTokens clears all "auth_tokens" edges to the AuthTokens entity.
-func (uu *UserUpdate) ClearAuthTokens() *UserUpdate {
- uu.mutation.ClearAuthTokens()
- return uu
+func (_u *UserUpdate) ClearAuthTokens() *UserUpdate {
+ _u.mutation.ClearAuthTokens()
+ return _u
}
// RemoveAuthTokenIDs removes the "auth_tokens" edge to AuthTokens entities by IDs.
-func (uu *UserUpdate) RemoveAuthTokenIDs(ids ...uuid.UUID) *UserUpdate {
- uu.mutation.RemoveAuthTokenIDs(ids...)
- return uu
+func (_u *UserUpdate) RemoveAuthTokenIDs(ids ...uuid.UUID) *UserUpdate {
+ _u.mutation.RemoveAuthTokenIDs(ids...)
+ return _u
}
// RemoveAuthTokens removes "auth_tokens" edges to AuthTokens entities.
-func (uu *UserUpdate) RemoveAuthTokens(a ...*AuthTokens) *UserUpdate {
- ids := make([]uuid.UUID, len(a))
- for i := range a {
- ids[i] = a[i].ID
+func (_u *UserUpdate) RemoveAuthTokens(v ...*AuthTokens) *UserUpdate {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return uu.RemoveAuthTokenIDs(ids...)
+ return _u.RemoveAuthTokenIDs(ids...)
}
// ClearNotifiers clears all "notifiers" edges to the Notifier entity.
-func (uu *UserUpdate) ClearNotifiers() *UserUpdate {
- uu.mutation.ClearNotifiers()
- return uu
+func (_u *UserUpdate) ClearNotifiers() *UserUpdate {
+ _u.mutation.ClearNotifiers()
+ return _u
}
// RemoveNotifierIDs removes the "notifiers" edge to Notifier entities by IDs.
-func (uu *UserUpdate) RemoveNotifierIDs(ids ...uuid.UUID) *UserUpdate {
- uu.mutation.RemoveNotifierIDs(ids...)
- return uu
+func (_u *UserUpdate) RemoveNotifierIDs(ids ...uuid.UUID) *UserUpdate {
+ _u.mutation.RemoveNotifierIDs(ids...)
+ return _u
}
// RemoveNotifiers removes "notifiers" edges to Notifier entities.
-func (uu *UserUpdate) RemoveNotifiers(n ...*Notifier) *UserUpdate {
- ids := make([]uuid.UUID, len(n))
- for i := range n {
- ids[i] = n[i].ID
+func (_u *UserUpdate) RemoveNotifiers(v ...*Notifier) *UserUpdate {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return uu.RemoveNotifierIDs(ids...)
+ return _u.RemoveNotifierIDs(ids...)
}
// Save executes the query and returns the number of nodes affected by the update operation.
-func (uu *UserUpdate) Save(ctx context.Context) (int, error) {
- uu.defaults()
- return withHooks(ctx, uu.sqlSave, uu.mutation, uu.hooks)
+func (_u *UserUpdate) Save(ctx context.Context) (int, error) {
+ _u.defaults()
+ return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
}
// SaveX is like Save, but panics if an error occurs.
-func (uu *UserUpdate) SaveX(ctx context.Context) int {
- affected, err := uu.Save(ctx)
+func (_u *UserUpdate) SaveX(ctx context.Context) int {
+ affected, err := _u.Save(ctx)
if err != nil {
panic(err)
}
@@ -252,94 +298,109 @@ func (uu *UserUpdate) SaveX(ctx context.Context) int {
}
// Exec executes the query.
-func (uu *UserUpdate) Exec(ctx context.Context) error {
- _, err := uu.Save(ctx)
+func (_u *UserUpdate) Exec(ctx context.Context) error {
+ _, err := _u.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
-func (uu *UserUpdate) ExecX(ctx context.Context) {
- if err := uu.Exec(ctx); err != nil {
+func (_u *UserUpdate) ExecX(ctx context.Context) {
+ if err := _u.Exec(ctx); err != nil {
panic(err)
}
}
// defaults sets the default values of the builder before save.
-func (uu *UserUpdate) defaults() {
- if _, ok := uu.mutation.UpdatedAt(); !ok {
+func (_u *UserUpdate) defaults() {
+ if _, ok := _u.mutation.UpdatedAt(); !ok {
v := user.UpdateDefaultUpdatedAt()
- uu.mutation.SetUpdatedAt(v)
+ _u.mutation.SetUpdatedAt(v)
}
}
// check runs all checks and user-defined validators on the builder.
-func (uu *UserUpdate) check() error {
- if v, ok := uu.mutation.Name(); ok {
+func (_u *UserUpdate) check() error {
+ if v, ok := _u.mutation.Name(); ok {
if err := user.NameValidator(v); err != nil {
return &ValidationError{Name: "name", err: fmt.Errorf(`ent: validator failed for field "User.name": %w`, err)}
}
}
- if v, ok := uu.mutation.Email(); ok {
+ if v, ok := _u.mutation.Email(); ok {
if err := user.EmailValidator(v); err != nil {
return &ValidationError{Name: "email", err: fmt.Errorf(`ent: validator failed for field "User.email": %w`, err)}
}
}
- if v, ok := uu.mutation.Password(); ok {
+ if v, ok := _u.mutation.Password(); ok {
if err := user.PasswordValidator(v); err != nil {
return &ValidationError{Name: "password", err: fmt.Errorf(`ent: validator failed for field "User.password": %w`, err)}
}
}
- if v, ok := uu.mutation.Role(); ok {
+ if v, ok := _u.mutation.Role(); ok {
if err := user.RoleValidator(v); err != nil {
return &ValidationError{Name: "role", err: fmt.Errorf(`ent: validator failed for field "User.role": %w`, err)}
}
}
- if uu.mutation.GroupCleared() && len(uu.mutation.GroupIDs()) > 0 {
+ if _u.mutation.GroupCleared() && len(_u.mutation.GroupIDs()) > 0 {
return errors.New(`ent: clearing a required unique edge "User.group"`)
}
return nil
}
-func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) {
- if err := uu.check(); err != nil {
- return n, err
+func (_u *UserUpdate) sqlSave(ctx context.Context) (_node int, err error) {
+ if err := _u.check(); err != nil {
+ return _node, err
}
_spec := sqlgraph.NewUpdateSpec(user.Table, user.Columns, sqlgraph.NewFieldSpec(user.FieldID, field.TypeUUID))
- if ps := uu.mutation.predicates; len(ps) > 0 {
+ if ps := _u.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
- if value, ok := uu.mutation.UpdatedAt(); ok {
+ if value, ok := _u.mutation.UpdatedAt(); ok {
_spec.SetField(user.FieldUpdatedAt, field.TypeTime, value)
}
- if value, ok := uu.mutation.Name(); ok {
+ if value, ok := _u.mutation.Name(); ok {
_spec.SetField(user.FieldName, field.TypeString, value)
}
- if value, ok := uu.mutation.Email(); ok {
+ if value, ok := _u.mutation.Email(); ok {
_spec.SetField(user.FieldEmail, field.TypeString, value)
}
- if value, ok := uu.mutation.Password(); ok {
+ if value, ok := _u.mutation.Password(); ok {
_spec.SetField(user.FieldPassword, field.TypeString, value)
}
- if value, ok := uu.mutation.IsSuperuser(); ok {
+ if _u.mutation.PasswordCleared() {
+ _spec.ClearField(user.FieldPassword, field.TypeString)
+ }
+ if value, ok := _u.mutation.IsSuperuser(); ok {
_spec.SetField(user.FieldIsSuperuser, field.TypeBool, value)
}
- if value, ok := uu.mutation.Superuser(); ok {
+ if value, ok := _u.mutation.Superuser(); ok {
_spec.SetField(user.FieldSuperuser, field.TypeBool, value)
}
- if value, ok := uu.mutation.Role(); ok {
+ if value, ok := _u.mutation.Role(); ok {
_spec.SetField(user.FieldRole, field.TypeEnum, value)
}
- if value, ok := uu.mutation.ActivatedOn(); ok {
+ if value, ok := _u.mutation.ActivatedOn(); ok {
_spec.SetField(user.FieldActivatedOn, field.TypeTime, value)
}
- if uu.mutation.ActivatedOnCleared() {
+ if _u.mutation.ActivatedOnCleared() {
_spec.ClearField(user.FieldActivatedOn, field.TypeTime)
}
- if uu.mutation.GroupCleared() {
+ if value, ok := _u.mutation.OidcIssuer(); ok {
+ _spec.SetField(user.FieldOidcIssuer, field.TypeString, value)
+ }
+ if _u.mutation.OidcIssuerCleared() {
+ _spec.ClearField(user.FieldOidcIssuer, field.TypeString)
+ }
+ if value, ok := _u.mutation.OidcSubject(); ok {
+ _spec.SetField(user.FieldOidcSubject, field.TypeString, value)
+ }
+ if _u.mutation.OidcSubjectCleared() {
+ _spec.ClearField(user.FieldOidcSubject, field.TypeString)
+ }
+ if _u.mutation.GroupCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -352,7 +413,7 @@ func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := uu.mutation.GroupIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.GroupIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -368,7 +429,7 @@ func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- if uu.mutation.AuthTokensCleared() {
+ if _u.mutation.AuthTokensCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -381,7 +442,7 @@ func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := uu.mutation.RemovedAuthTokensIDs(); len(nodes) > 0 && !uu.mutation.AuthTokensCleared() {
+ if nodes := _u.mutation.RemovedAuthTokensIDs(); len(nodes) > 0 && !_u.mutation.AuthTokensCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -397,7 +458,7 @@ func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := uu.mutation.AuthTokensIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.AuthTokensIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -413,7 +474,7 @@ func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- if uu.mutation.NotifiersCleared() {
+ if _u.mutation.NotifiersCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -426,7 +487,7 @@ func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := uu.mutation.RemovedNotifiersIDs(); len(nodes) > 0 && !uu.mutation.NotifiersCleared() {
+ if nodes := _u.mutation.RemovedNotifiersIDs(); len(nodes) > 0 && !_u.mutation.NotifiersCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -442,7 +503,7 @@ func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := uu.mutation.NotifiersIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.NotifiersIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -458,7 +519,7 @@ func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- if n, err = sqlgraph.UpdateNodes(ctx, uu.driver, _spec); err != nil {
+ if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil {
if _, ok := err.(*sqlgraph.NotFoundError); ok {
err = &NotFoundError{user.Label}
} else if sqlgraph.IsConstraintError(err) {
@@ -466,8 +527,8 @@ func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
return 0, err
}
- uu.mutation.done = true
- return n, nil
+ _u.mutation.done = true
+ return _node, nil
}
// UserUpdateOne is the builder for updating a single User entity.
@@ -479,231 +540,277 @@ type UserUpdateOne struct {
}
// SetUpdatedAt sets the "updated_at" field.
-func (uuo *UserUpdateOne) SetUpdatedAt(t time.Time) *UserUpdateOne {
- uuo.mutation.SetUpdatedAt(t)
- return uuo
+func (_u *UserUpdateOne) SetUpdatedAt(v time.Time) *UserUpdateOne {
+ _u.mutation.SetUpdatedAt(v)
+ return _u
}
// SetName sets the "name" field.
-func (uuo *UserUpdateOne) SetName(s string) *UserUpdateOne {
- uuo.mutation.SetName(s)
- return uuo
+func (_u *UserUpdateOne) SetName(v string) *UserUpdateOne {
+ _u.mutation.SetName(v)
+ return _u
}
// SetNillableName sets the "name" field if the given value is not nil.
-func (uuo *UserUpdateOne) SetNillableName(s *string) *UserUpdateOne {
- if s != nil {
- uuo.SetName(*s)
+func (_u *UserUpdateOne) SetNillableName(v *string) *UserUpdateOne {
+ if v != nil {
+ _u.SetName(*v)
}
- return uuo
+ return _u
}
// SetEmail sets the "email" field.
-func (uuo *UserUpdateOne) SetEmail(s string) *UserUpdateOne {
- uuo.mutation.SetEmail(s)
- return uuo
+func (_u *UserUpdateOne) SetEmail(v string) *UserUpdateOne {
+ _u.mutation.SetEmail(v)
+ return _u
}
// SetNillableEmail sets the "email" field if the given value is not nil.
-func (uuo *UserUpdateOne) SetNillableEmail(s *string) *UserUpdateOne {
- if s != nil {
- uuo.SetEmail(*s)
+func (_u *UserUpdateOne) SetNillableEmail(v *string) *UserUpdateOne {
+ if v != nil {
+ _u.SetEmail(*v)
}
- return uuo
+ return _u
}
// SetPassword sets the "password" field.
-func (uuo *UserUpdateOne) SetPassword(s string) *UserUpdateOne {
- uuo.mutation.SetPassword(s)
- return uuo
+func (_u *UserUpdateOne) SetPassword(v string) *UserUpdateOne {
+ _u.mutation.SetPassword(v)
+ return _u
}
// SetNillablePassword sets the "password" field if the given value is not nil.
-func (uuo *UserUpdateOne) SetNillablePassword(s *string) *UserUpdateOne {
- if s != nil {
- uuo.SetPassword(*s)
+func (_u *UserUpdateOne) SetNillablePassword(v *string) *UserUpdateOne {
+ if v != nil {
+ _u.SetPassword(*v)
}
- return uuo
+ return _u
+}
+
+// ClearPassword clears the value of the "password" field.
+func (_u *UserUpdateOne) ClearPassword() *UserUpdateOne {
+ _u.mutation.ClearPassword()
+ return _u
}
// SetIsSuperuser sets the "is_superuser" field.
-func (uuo *UserUpdateOne) SetIsSuperuser(b bool) *UserUpdateOne {
- uuo.mutation.SetIsSuperuser(b)
- return uuo
+func (_u *UserUpdateOne) SetIsSuperuser(v bool) *UserUpdateOne {
+ _u.mutation.SetIsSuperuser(v)
+ return _u
}
// SetNillableIsSuperuser sets the "is_superuser" field if the given value is not nil.
-func (uuo *UserUpdateOne) SetNillableIsSuperuser(b *bool) *UserUpdateOne {
- if b != nil {
- uuo.SetIsSuperuser(*b)
+func (_u *UserUpdateOne) SetNillableIsSuperuser(v *bool) *UserUpdateOne {
+ if v != nil {
+ _u.SetIsSuperuser(*v)
}
- return uuo
+ return _u
}
// SetSuperuser sets the "superuser" field.
-func (uuo *UserUpdateOne) SetSuperuser(b bool) *UserUpdateOne {
- uuo.mutation.SetSuperuser(b)
- return uuo
+func (_u *UserUpdateOne) SetSuperuser(v bool) *UserUpdateOne {
+ _u.mutation.SetSuperuser(v)
+ return _u
}
// SetNillableSuperuser sets the "superuser" field if the given value is not nil.
-func (uuo *UserUpdateOne) SetNillableSuperuser(b *bool) *UserUpdateOne {
- if b != nil {
- uuo.SetSuperuser(*b)
+func (_u *UserUpdateOne) SetNillableSuperuser(v *bool) *UserUpdateOne {
+ if v != nil {
+ _u.SetSuperuser(*v)
}
- return uuo
+ return _u
}
// SetRole sets the "role" field.
-func (uuo *UserUpdateOne) SetRole(u user.Role) *UserUpdateOne {
- uuo.mutation.SetRole(u)
- return uuo
+func (_u *UserUpdateOne) SetRole(v user.Role) *UserUpdateOne {
+ _u.mutation.SetRole(v)
+ return _u
}
// SetNillableRole sets the "role" field if the given value is not nil.
-func (uuo *UserUpdateOne) SetNillableRole(u *user.Role) *UserUpdateOne {
- if u != nil {
- uuo.SetRole(*u)
+func (_u *UserUpdateOne) SetNillableRole(v *user.Role) *UserUpdateOne {
+ if v != nil {
+ _u.SetRole(*v)
}
- return uuo
+ return _u
}
// SetActivatedOn sets the "activated_on" field.
-func (uuo *UserUpdateOne) SetActivatedOn(t time.Time) *UserUpdateOne {
- uuo.mutation.SetActivatedOn(t)
- return uuo
+func (_u *UserUpdateOne) SetActivatedOn(v time.Time) *UserUpdateOne {
+ _u.mutation.SetActivatedOn(v)
+ return _u
}
// SetNillableActivatedOn sets the "activated_on" field if the given value is not nil.
-func (uuo *UserUpdateOne) SetNillableActivatedOn(t *time.Time) *UserUpdateOne {
- if t != nil {
- uuo.SetActivatedOn(*t)
+func (_u *UserUpdateOne) SetNillableActivatedOn(v *time.Time) *UserUpdateOne {
+ if v != nil {
+ _u.SetActivatedOn(*v)
}
- return uuo
+ return _u
}
// ClearActivatedOn clears the value of the "activated_on" field.
-func (uuo *UserUpdateOne) ClearActivatedOn() *UserUpdateOne {
- uuo.mutation.ClearActivatedOn()
- return uuo
+func (_u *UserUpdateOne) ClearActivatedOn() *UserUpdateOne {
+ _u.mutation.ClearActivatedOn()
+ return _u
+}
+
+// SetOidcIssuer sets the "oidc_issuer" field.
+func (_u *UserUpdateOne) SetOidcIssuer(v string) *UserUpdateOne {
+ _u.mutation.SetOidcIssuer(v)
+ return _u
+}
+
+// SetNillableOidcIssuer sets the "oidc_issuer" field if the given value is not nil.
+func (_u *UserUpdateOne) SetNillableOidcIssuer(v *string) *UserUpdateOne {
+ if v != nil {
+ _u.SetOidcIssuer(*v)
+ }
+ return _u
+}
+
+// ClearOidcIssuer clears the value of the "oidc_issuer" field.
+func (_u *UserUpdateOne) ClearOidcIssuer() *UserUpdateOne {
+ _u.mutation.ClearOidcIssuer()
+ return _u
+}
+
+// SetOidcSubject sets the "oidc_subject" field.
+func (_u *UserUpdateOne) SetOidcSubject(v string) *UserUpdateOne {
+ _u.mutation.SetOidcSubject(v)
+ return _u
+}
+
+// SetNillableOidcSubject sets the "oidc_subject" field if the given value is not nil.
+func (_u *UserUpdateOne) SetNillableOidcSubject(v *string) *UserUpdateOne {
+ if v != nil {
+ _u.SetOidcSubject(*v)
+ }
+ return _u
+}
+
+// ClearOidcSubject clears the value of the "oidc_subject" field.
+func (_u *UserUpdateOne) ClearOidcSubject() *UserUpdateOne {
+ _u.mutation.ClearOidcSubject()
+ return _u
}
// SetGroupID sets the "group" edge to the Group entity by ID.
-func (uuo *UserUpdateOne) SetGroupID(id uuid.UUID) *UserUpdateOne {
- uuo.mutation.SetGroupID(id)
- return uuo
+func (_u *UserUpdateOne) SetGroupID(id uuid.UUID) *UserUpdateOne {
+ _u.mutation.SetGroupID(id)
+ return _u
}
// SetGroup sets the "group" edge to the Group entity.
-func (uuo *UserUpdateOne) SetGroup(g *Group) *UserUpdateOne {
- return uuo.SetGroupID(g.ID)
+func (_u *UserUpdateOne) SetGroup(v *Group) *UserUpdateOne {
+ return _u.SetGroupID(v.ID)
}
// AddAuthTokenIDs adds the "auth_tokens" edge to the AuthTokens entity by IDs.
-func (uuo *UserUpdateOne) AddAuthTokenIDs(ids ...uuid.UUID) *UserUpdateOne {
- uuo.mutation.AddAuthTokenIDs(ids...)
- return uuo
+func (_u *UserUpdateOne) AddAuthTokenIDs(ids ...uuid.UUID) *UserUpdateOne {
+ _u.mutation.AddAuthTokenIDs(ids...)
+ return _u
}
// AddAuthTokens adds the "auth_tokens" edges to the AuthTokens entity.
-func (uuo *UserUpdateOne) AddAuthTokens(a ...*AuthTokens) *UserUpdateOne {
- ids := make([]uuid.UUID, len(a))
- for i := range a {
- ids[i] = a[i].ID
+func (_u *UserUpdateOne) AddAuthTokens(v ...*AuthTokens) *UserUpdateOne {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return uuo.AddAuthTokenIDs(ids...)
+ return _u.AddAuthTokenIDs(ids...)
}
// AddNotifierIDs adds the "notifiers" edge to the Notifier entity by IDs.
-func (uuo *UserUpdateOne) AddNotifierIDs(ids ...uuid.UUID) *UserUpdateOne {
- uuo.mutation.AddNotifierIDs(ids...)
- return uuo
+func (_u *UserUpdateOne) AddNotifierIDs(ids ...uuid.UUID) *UserUpdateOne {
+ _u.mutation.AddNotifierIDs(ids...)
+ return _u
}
// AddNotifiers adds the "notifiers" edges to the Notifier entity.
-func (uuo *UserUpdateOne) AddNotifiers(n ...*Notifier) *UserUpdateOne {
- ids := make([]uuid.UUID, len(n))
- for i := range n {
- ids[i] = n[i].ID
+func (_u *UserUpdateOne) AddNotifiers(v ...*Notifier) *UserUpdateOne {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return uuo.AddNotifierIDs(ids...)
+ return _u.AddNotifierIDs(ids...)
}
// Mutation returns the UserMutation object of the builder.
-func (uuo *UserUpdateOne) Mutation() *UserMutation {
- return uuo.mutation
+func (_u *UserUpdateOne) Mutation() *UserMutation {
+ return _u.mutation
}
// ClearGroup clears the "group" edge to the Group entity.
-func (uuo *UserUpdateOne) ClearGroup() *UserUpdateOne {
- uuo.mutation.ClearGroup()
- return uuo
+func (_u *UserUpdateOne) ClearGroup() *UserUpdateOne {
+ _u.mutation.ClearGroup()
+ return _u
}
// ClearAuthTokens clears all "auth_tokens" edges to the AuthTokens entity.
-func (uuo *UserUpdateOne) ClearAuthTokens() *UserUpdateOne {
- uuo.mutation.ClearAuthTokens()
- return uuo
+func (_u *UserUpdateOne) ClearAuthTokens() *UserUpdateOne {
+ _u.mutation.ClearAuthTokens()
+ return _u
}
// RemoveAuthTokenIDs removes the "auth_tokens" edge to AuthTokens entities by IDs.
-func (uuo *UserUpdateOne) RemoveAuthTokenIDs(ids ...uuid.UUID) *UserUpdateOne {
- uuo.mutation.RemoveAuthTokenIDs(ids...)
- return uuo
+func (_u *UserUpdateOne) RemoveAuthTokenIDs(ids ...uuid.UUID) *UserUpdateOne {
+ _u.mutation.RemoveAuthTokenIDs(ids...)
+ return _u
}
// RemoveAuthTokens removes "auth_tokens" edges to AuthTokens entities.
-func (uuo *UserUpdateOne) RemoveAuthTokens(a ...*AuthTokens) *UserUpdateOne {
- ids := make([]uuid.UUID, len(a))
- for i := range a {
- ids[i] = a[i].ID
+func (_u *UserUpdateOne) RemoveAuthTokens(v ...*AuthTokens) *UserUpdateOne {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return uuo.RemoveAuthTokenIDs(ids...)
+ return _u.RemoveAuthTokenIDs(ids...)
}
// ClearNotifiers clears all "notifiers" edges to the Notifier entity.
-func (uuo *UserUpdateOne) ClearNotifiers() *UserUpdateOne {
- uuo.mutation.ClearNotifiers()
- return uuo
+func (_u *UserUpdateOne) ClearNotifiers() *UserUpdateOne {
+ _u.mutation.ClearNotifiers()
+ return _u
}
// RemoveNotifierIDs removes the "notifiers" edge to Notifier entities by IDs.
-func (uuo *UserUpdateOne) RemoveNotifierIDs(ids ...uuid.UUID) *UserUpdateOne {
- uuo.mutation.RemoveNotifierIDs(ids...)
- return uuo
+func (_u *UserUpdateOne) RemoveNotifierIDs(ids ...uuid.UUID) *UserUpdateOne {
+ _u.mutation.RemoveNotifierIDs(ids...)
+ return _u
}
// RemoveNotifiers removes "notifiers" edges to Notifier entities.
-func (uuo *UserUpdateOne) RemoveNotifiers(n ...*Notifier) *UserUpdateOne {
- ids := make([]uuid.UUID, len(n))
- for i := range n {
- ids[i] = n[i].ID
+func (_u *UserUpdateOne) RemoveNotifiers(v ...*Notifier) *UserUpdateOne {
+ ids := make([]uuid.UUID, len(v))
+ for i := range v {
+ ids[i] = v[i].ID
}
- return uuo.RemoveNotifierIDs(ids...)
+ return _u.RemoveNotifierIDs(ids...)
}
// Where appends a list predicates to the UserUpdate builder.
-func (uuo *UserUpdateOne) Where(ps ...predicate.User) *UserUpdateOne {
- uuo.mutation.Where(ps...)
- return uuo
+func (_u *UserUpdateOne) Where(ps ...predicate.User) *UserUpdateOne {
+ _u.mutation.Where(ps...)
+ return _u
}
// Select allows selecting one or more fields (columns) of the returned entity.
// The default is selecting all fields defined in the entity schema.
-func (uuo *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne {
- uuo.fields = append([]string{field}, fields...)
- return uuo
+func (_u *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne {
+ _u.fields = append([]string{field}, fields...)
+ return _u
}
// Save executes the query and returns the updated User entity.
-func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error) {
- uuo.defaults()
- return withHooks(ctx, uuo.sqlSave, uuo.mutation, uuo.hooks)
+func (_u *UserUpdateOne) Save(ctx context.Context) (*User, error) {
+ _u.defaults()
+ return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
}
// SaveX is like Save, but panics if an error occurs.
-func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User {
- node, err := uuo.Save(ctx)
+func (_u *UserUpdateOne) SaveX(ctx context.Context) *User {
+ node, err := _u.Save(ctx)
if err != nil {
panic(err)
}
@@ -711,65 +818,65 @@ func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User {
}
// Exec executes the query on the entity.
-func (uuo *UserUpdateOne) Exec(ctx context.Context) error {
- _, err := uuo.Save(ctx)
+func (_u *UserUpdateOne) Exec(ctx context.Context) error {
+ _, err := _u.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
-func (uuo *UserUpdateOne) ExecX(ctx context.Context) {
- if err := uuo.Exec(ctx); err != nil {
+func (_u *UserUpdateOne) ExecX(ctx context.Context) {
+ if err := _u.Exec(ctx); err != nil {
panic(err)
}
}
// defaults sets the default values of the builder before save.
-func (uuo *UserUpdateOne) defaults() {
- if _, ok := uuo.mutation.UpdatedAt(); !ok {
+func (_u *UserUpdateOne) defaults() {
+ if _, ok := _u.mutation.UpdatedAt(); !ok {
v := user.UpdateDefaultUpdatedAt()
- uuo.mutation.SetUpdatedAt(v)
+ _u.mutation.SetUpdatedAt(v)
}
}
// check runs all checks and user-defined validators on the builder.
-func (uuo *UserUpdateOne) check() error {
- if v, ok := uuo.mutation.Name(); ok {
+func (_u *UserUpdateOne) check() error {
+ if v, ok := _u.mutation.Name(); ok {
if err := user.NameValidator(v); err != nil {
return &ValidationError{Name: "name", err: fmt.Errorf(`ent: validator failed for field "User.name": %w`, err)}
}
}
- if v, ok := uuo.mutation.Email(); ok {
+ if v, ok := _u.mutation.Email(); ok {
if err := user.EmailValidator(v); err != nil {
return &ValidationError{Name: "email", err: fmt.Errorf(`ent: validator failed for field "User.email": %w`, err)}
}
}
- if v, ok := uuo.mutation.Password(); ok {
+ if v, ok := _u.mutation.Password(); ok {
if err := user.PasswordValidator(v); err != nil {
return &ValidationError{Name: "password", err: fmt.Errorf(`ent: validator failed for field "User.password": %w`, err)}
}
}
- if v, ok := uuo.mutation.Role(); ok {
+ if v, ok := _u.mutation.Role(); ok {
if err := user.RoleValidator(v); err != nil {
return &ValidationError{Name: "role", err: fmt.Errorf(`ent: validator failed for field "User.role": %w`, err)}
}
}
- if uuo.mutation.GroupCleared() && len(uuo.mutation.GroupIDs()) > 0 {
+ if _u.mutation.GroupCleared() && len(_u.mutation.GroupIDs()) > 0 {
return errors.New(`ent: clearing a required unique edge "User.group"`)
}
return nil
}
-func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) {
- if err := uuo.check(); err != nil {
+func (_u *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) {
+ if err := _u.check(); err != nil {
return _node, err
}
_spec := sqlgraph.NewUpdateSpec(user.Table, user.Columns, sqlgraph.NewFieldSpec(user.FieldID, field.TypeUUID))
- id, ok := uuo.mutation.ID()
+ id, ok := _u.mutation.ID()
if !ok {
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "User.id" for update`)}
}
_spec.Node.ID.Value = id
- if fields := uuo.fields; len(fields) > 0 {
+ if fields := _u.fields; len(fields) > 0 {
_spec.Node.Columns = make([]string, 0, len(fields))
_spec.Node.Columns = append(_spec.Node.Columns, user.FieldID)
for _, f := range fields {
@@ -781,41 +888,56 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error)
}
}
}
- if ps := uuo.mutation.predicates; len(ps) > 0 {
+ if ps := _u.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
- if value, ok := uuo.mutation.UpdatedAt(); ok {
+ if value, ok := _u.mutation.UpdatedAt(); ok {
_spec.SetField(user.FieldUpdatedAt, field.TypeTime, value)
}
- if value, ok := uuo.mutation.Name(); ok {
+ if value, ok := _u.mutation.Name(); ok {
_spec.SetField(user.FieldName, field.TypeString, value)
}
- if value, ok := uuo.mutation.Email(); ok {
+ if value, ok := _u.mutation.Email(); ok {
_spec.SetField(user.FieldEmail, field.TypeString, value)
}
- if value, ok := uuo.mutation.Password(); ok {
+ if value, ok := _u.mutation.Password(); ok {
_spec.SetField(user.FieldPassword, field.TypeString, value)
}
- if value, ok := uuo.mutation.IsSuperuser(); ok {
+ if _u.mutation.PasswordCleared() {
+ _spec.ClearField(user.FieldPassword, field.TypeString)
+ }
+ if value, ok := _u.mutation.IsSuperuser(); ok {
_spec.SetField(user.FieldIsSuperuser, field.TypeBool, value)
}
- if value, ok := uuo.mutation.Superuser(); ok {
+ if value, ok := _u.mutation.Superuser(); ok {
_spec.SetField(user.FieldSuperuser, field.TypeBool, value)
}
- if value, ok := uuo.mutation.Role(); ok {
+ if value, ok := _u.mutation.Role(); ok {
_spec.SetField(user.FieldRole, field.TypeEnum, value)
}
- if value, ok := uuo.mutation.ActivatedOn(); ok {
+ if value, ok := _u.mutation.ActivatedOn(); ok {
_spec.SetField(user.FieldActivatedOn, field.TypeTime, value)
}
- if uuo.mutation.ActivatedOnCleared() {
+ if _u.mutation.ActivatedOnCleared() {
_spec.ClearField(user.FieldActivatedOn, field.TypeTime)
}
- if uuo.mutation.GroupCleared() {
+ if value, ok := _u.mutation.OidcIssuer(); ok {
+ _spec.SetField(user.FieldOidcIssuer, field.TypeString, value)
+ }
+ if _u.mutation.OidcIssuerCleared() {
+ _spec.ClearField(user.FieldOidcIssuer, field.TypeString)
+ }
+ if value, ok := _u.mutation.OidcSubject(); ok {
+ _spec.SetField(user.FieldOidcSubject, field.TypeString, value)
+ }
+ if _u.mutation.OidcSubjectCleared() {
+ _spec.ClearField(user.FieldOidcSubject, field.TypeString)
+ }
+ if _u.mutation.GroupCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -828,7 +950,7 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := uuo.mutation.GroupIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.GroupIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
@@ -844,7 +966,7 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- if uuo.mutation.AuthTokensCleared() {
+ if _u.mutation.AuthTokensCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -857,7 +979,7 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := uuo.mutation.RemovedAuthTokensIDs(); len(nodes) > 0 && !uuo.mutation.AuthTokensCleared() {
+ if nodes := _u.mutation.RemovedAuthTokensIDs(); len(nodes) > 0 && !_u.mutation.AuthTokensCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -873,7 +995,7 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := uuo.mutation.AuthTokensIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.AuthTokensIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -889,7 +1011,7 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- if uuo.mutation.NotifiersCleared() {
+ if _u.mutation.NotifiersCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -902,7 +1024,7 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := uuo.mutation.RemovedNotifiersIDs(); len(nodes) > 0 && !uuo.mutation.NotifiersCleared() {
+ if nodes := _u.mutation.RemovedNotifiersIDs(); len(nodes) > 0 && !_u.mutation.NotifiersCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -918,7 +1040,7 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
- if nodes := uuo.mutation.NotifiersIDs(); len(nodes) > 0 {
+ if nodes := _u.mutation.NotifiersIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
@@ -934,10 +1056,10 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
- _node = &User{config: uuo.config}
+ _node = &User{config: _u.config}
_spec.Assign = _node.assignValues
_spec.ScanValues = _node.scanValues
- if err = sqlgraph.UpdateNode(ctx, uuo.driver, _spec); err != nil {
+ if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil {
if _, ok := err.(*sqlgraph.NotFoundError); ok {
err = &NotFoundError{user.Label}
} else if sqlgraph.IsConstraintError(err) {
@@ -945,6 +1067,6 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error)
}
return nil, err
}
- uuo.mutation.done = true
+ _u.mutation.done = true
return _node, nil
}
diff --git a/backend/internal/data/migrations/postgres/20251123000000_add_oidc_identity.sql b/backend/internal/data/migrations/postgres/20251123000000_add_oidc_identity.sql
new file mode 100644
index 00000000..8c8d87e8
--- /dev/null
+++ b/backend/internal/data/migrations/postgres/20251123000000_add_oidc_identity.sql
@@ -0,0 +1,8 @@
+-- +goose Up
+-- Add OIDC identity mapping columns and unique composite index (issuer + subject)
+ALTER TABLE public.users ADD COLUMN oidc_issuer VARCHAR;
+ALTER TABLE public.users ADD COLUMN oidc_subject VARCHAR;
+-- Partial unique index so multiple NULL pairs are allowed, enforcing uniqueness only when both present.
+CREATE UNIQUE INDEX users_oidc_issuer_subject_key ON public.users(oidc_issuer, oidc_subject)
+ WHERE oidc_issuer IS NOT NULL AND oidc_subject IS NOT NULL;
+
diff --git a/backend/internal/data/migrations/sqlite3/20250907000000_make_password_nullable.sql b/backend/internal/data/migrations/sqlite3/20250907000000_make_password_nullable.sql
new file mode 100644
index 00000000..90679de5
--- /dev/null
+++ b/backend/internal/data/migrations/sqlite3/20250907000000_make_password_nullable.sql
@@ -0,0 +1,68 @@
+-- +goose Up
+-- +goose StatementBegin
+-- SQLite doesn't support ALTER COLUMN directly, so we need to recreate the table
+-- Create a temporary table with the new schema
+CREATE TABLE users_temp (
+ id uuid not null
+ primary key,
+ created_at datetime not null,
+ updated_at datetime not null,
+ name text not null,
+ email text not null,
+ password text,
+ is_superuser bool default false not null,
+ superuser bool default false not null,
+ role text default 'user' not null,
+ activated_on datetime,
+ group_users uuid not null
+ constraint users_groups_users
+ references groups
+ on delete cascade
+);
+
+-- Copy data from the original table
+INSERT INTO users_temp SELECT * FROM users;
+
+-- Drop the original table
+DROP TABLE users;
+
+-- Rename the temporary table
+ALTER TABLE users_temp RENAME TO users;
+
+-- Recreate the unique index
+CREATE UNIQUE INDEX users_email_key on users (email);
+-- +goose StatementEnd
+
+-- +goose Down
+-- +goose StatementBegin
+-- Create the original table structure
+CREATE TABLE users_temp (
+ id uuid not null
+ primary key,
+ created_at datetime not null,
+ updated_at datetime not null,
+ name text not null,
+ email text not null,
+ password text not null,
+ is_superuser bool default false not null,
+ superuser bool default false not null,
+ role text default 'user' not null,
+ activated_on datetime,
+ group_users uuid not null
+ constraint users_groups_users
+ references groups
+ on delete cascade
+);
+
+-- Copy data from the current table (this will fail if there are NULL passwords)
+INSERT INTO users_temp SELECT * FROM users;
+
+-- Drop the current table
+DROP TABLE users;
+
+-- Rename the temporary table
+ALTER TABLE users_temp RENAME TO users;
+
+-- Recreate the unique index
+CREATE UNIQUE INDEX users_email_key on users (email);
+-- +goose StatementEnd
\ No newline at end of file
diff --git a/backend/internal/data/migrations/sqlite3/20251123000000_add_oidc_identity.sql b/backend/internal/data/migrations/sqlite3/20251123000000_add_oidc_identity.sql
new file mode 100644
index 00000000..2bee5a62
--- /dev/null
+++ b/backend/internal/data/migrations/sqlite3/20251123000000_add_oidc_identity.sql
@@ -0,0 +1,6 @@
+-- +goose Up
+-- Add OIDC identity mapping columns and unique composite index (issuer + subject)
+ALTER TABLE users ADD COLUMN oidc_issuer TEXT;
+ALTER TABLE users ADD COLUMN oidc_subject TEXT;
+CREATE UNIQUE INDEX users_oidc_issuer_subject_key ON users(oidc_issuer, oidc_subject);
+
diff --git a/backend/internal/data/repo/repo_users.go b/backend/internal/data/repo/repo_users.go
index 8007fbc0..9af394fa 100644
--- a/backend/internal/data/repo/repo_users.go
+++ b/backend/internal/data/repo/repo_users.go
@@ -19,7 +19,7 @@ type (
UserCreate struct {
Name string `json:"name"`
Email string `json:"email"`
- Password string `json:"password"`
+ Password *string `json:"password"`
IsSuperuser bool `json:"isSuperuser"`
GroupID uuid.UUID `json:"groupID"`
IsOwner bool `json:"isOwner"`
@@ -39,6 +39,8 @@ type (
GroupName string `json:"groupName"`
PasswordHash string `json:"-"`
IsOwner bool `json:"isOwner"`
+ OidcIssuer *string `json:"oidcIssuer"`
+ OidcSubject *string `json:"oidcSubject"`
}
)
@@ -48,6 +50,11 @@ var (
)
func mapUserOut(user *ent.User) UserOut {
+ var passwordHash string
+ if user.Password != nil {
+ passwordHash = *user.Password
+ }
+
return UserOut{
ID: user.ID,
Name: user.Name,
@@ -55,8 +62,10 @@ func mapUserOut(user *ent.User) UserOut {
IsSuperuser: user.IsSuperuser,
GroupID: user.Edges.Group.ID,
GroupName: user.Edges.Group.Name,
- PasswordHash: user.Password,
+ PasswordHash: passwordHash,
IsOwner: user.Role == "owner",
+ OidcIssuer: user.OidcIssuer,
+ OidcSubject: user.OidcSubject,
}
}
@@ -85,15 +94,48 @@ func (r *UserRepository) Create(ctx context.Context, usr UserCreate) (UserOut, e
role = user.RoleOwner
}
- entUser, err := r.db.User.
+ createQuery := r.db.User.
+ Create().
+ SetName(usr.Name).
+ SetEmail(usr.Email).
+ SetIsSuperuser(usr.IsSuperuser).
+ SetGroupID(usr.GroupID).
+ SetRole(role)
+
+ // Only set password if provided (non-nil)
+ if usr.Password != nil {
+ createQuery = createQuery.SetPassword(*usr.Password)
+ }
+
+ entUser, err := createQuery.Save(ctx)
+ if err != nil {
+ return UserOut{}, err
+ }
+
+ return r.GetOneID(ctx, entUser.ID)
+}
+
+func (r *UserRepository) CreateWithOIDC(ctx context.Context, usr UserCreate, issuer, subject string) (UserOut, error) {
+ role := user.RoleUser
+ if usr.IsOwner {
+ role = user.RoleOwner
+ }
+
+ createQuery := r.db.User.
Create().
SetName(usr.Name).
SetEmail(usr.Email).
- SetPassword(usr.Password).
SetIsSuperuser(usr.IsSuperuser).
SetGroupID(usr.GroupID).
SetRole(role).
- Save(ctx)
+ SetOidcIssuer(issuer).
+ SetOidcSubject(subject)
+
+ if usr.Password != nil {
+ createQuery = createQuery.SetPassword(*usr.Password)
+ }
+
+ entUser, err := createQuery.Save(ctx)
if err != nil {
return UserOut{}, err
}
@@ -133,3 +175,14 @@ func (r *UserRepository) GetSuperusers(ctx context.Context) ([]*ent.User, error)
func (r *UserRepository) ChangePassword(ctx context.Context, uid uuid.UUID, pw string) error {
return r.db.User.UpdateOneID(uid).SetPassword(pw).Exec(ctx)
}
+
+func (r *UserRepository) SetOIDCIdentity(ctx context.Context, uid uuid.UUID, issuer, subject string) error {
+ return r.db.User.UpdateOneID(uid).SetOidcIssuer(issuer).SetOidcSubject(subject).Exec(ctx)
+}
+
+func (r *UserRepository) GetOneOIDC(ctx context.Context, issuer, subject string) (UserOut, error) {
+ return mapUserOutErr(r.db.User.Query().
+ Where(user.OidcIssuerEQ(issuer), user.OidcSubjectEQ(subject)).
+ WithGroup().
+ Only(ctx))
+}
diff --git a/backend/internal/data/repo/repo_users_test.go b/backend/internal/data/repo/repo_users_test.go
index abf62580..65de5e0b 100644
--- a/backend/internal/data/repo/repo_users_test.go
+++ b/backend/internal/data/repo/repo_users_test.go
@@ -9,10 +9,11 @@ import (
)
func userFactory() UserCreate {
+ password := fk.Str(10)
return UserCreate{
Name: fk.Str(10),
Email: fk.Email(),
- Password: fk.Str(10),
+ Password: &password,
IsSuperuser: fk.Bool(),
GroupID: tGroup.ID,
}
diff --git a/backend/internal/sys/config/conf.go b/backend/internal/sys/config/conf.go
index 3efbacd1..5525e380 100644
--- a/backend/internal/sys/config/conf.go
+++ b/backend/internal/sys/config/conf.go
@@ -27,6 +27,7 @@ type Config struct {
Demo bool `yaml:"demo"`
Debug DebugConf `yaml:"debug"`
Options Options `yaml:"options"`
+ OIDC OIDCConf `yaml:"oidc"`
LabelMaker LabelMakerConf `yaml:"labelmaker"`
Thumbnail Thumbnail `yaml:"thumbnail"`
Barcode BarcodeAPIConf `yaml:"barcode"`
@@ -38,6 +39,9 @@ type Options struct {
CurrencyConfig string `yaml:"currencies"`
GithubReleaseCheck bool `yaml:"check_github_release" conf:"default:true"`
AllowAnalytics bool `yaml:"allow_analytics" conf:"default:false"`
+ AllowLocalLogin bool `yaml:"allow_local_login" conf:"default:true"`
+ TrustProxy bool `yaml:"trust_proxy" conf:"default:false"`
+ Hostname string `yaml:"hostname"`
}
type Thumbnail struct {
@@ -75,6 +79,24 @@ type LabelMakerConf struct {
BoldFontPath *string `yaml:"bold_font_path"`
}
+type OIDCConf struct {
+ Enabled bool `yaml:"enabled" conf:"default:false"`
+ IssuerURL string `yaml:"issuer_url"`
+ ClientID string `yaml:"client_id"`
+ ClientSecret string `yaml:"client_secret"`
+ Scope string `yaml:"scope" conf:"default:openid profile email"`
+ AllowedGroups string `yaml:"allowed_groups"`
+ AutoRedirect bool `yaml:"auto_redirect" conf:"default:false"`
+ VerifyEmail bool `yaml:"verify_email" conf:"default:false"`
+ GroupClaim string `yaml:"group_claim" conf:"default:groups"`
+ EmailClaim string `yaml:"email_claim" conf:"default:email"`
+ NameClaim string `yaml:"name_claim" conf:"default:name"`
+ EmailVerifiedClaim string `yaml:"email_verified_claim" conf:"default:email_verified"`
+ ButtonText string `yaml:"button_text" conf:"default:Sign in with OIDC"`
+ StateExpiry time.Duration `yaml:"state_expiry" conf:"default:10m"`
+ RequestTimeout time.Duration `yaml:"request_timeout" conf:"default:30s"`
+}
+
type BarcodeAPIConf struct {
TokenBarcodespider string `yaml:"token_barcodespider"`
}
diff --git a/docs/en/configure/index.md b/docs/en/configure/index.md
index 61aa8f18..4c6ff4db 100644
--- a/docs/en/configure/index.md
+++ b/docs/en/configure/index.md
@@ -41,6 +41,24 @@ aside: false
| HBOX_DATABASE_SSL_KEY | | sets the sslkey for a postgres connection (should be a path) |
| HBOX_DATABASE_SSL_ROOT_CERT | | sets the sslrootcert for a postgres connection (should be a path) |
| HBOX_OPTIONS_GITHUB_RELEASE_CHECK | true | check for new github releases |
+| HBOX_OPTIONS_ALLOW_LOCAL_LOGIN | true | allow users to login with username/password when OIDC is enabled |
+| HBOX_OPTIONS_TRUST_PROXY | false | trust proxy headers for determining request scheme (X-Forwarded-Proto) |
+| HBOX_OPTIONS_HOSTNAME | | override hostname used for OIDC redirect URLs and other absolute URLs |
+| HBOX_OIDC_ENABLED | false | enable OpenID Connect (OIDC) authentication |
+| HBOX_OIDC_ISSUER_URL | | OIDC provider issuer URL (required when OIDC is enabled) |
+| HBOX_OIDC_CLIENT_ID | | OIDC client ID (required when OIDC is enabled) |
+| HBOX_OIDC_CLIENT_SECRET | | OIDC client secret (required when OIDC is enabled) |
+| HBOX_OIDC_SCOPE | openid profile email | OIDC scopes to request from the provider |
+| HBOX_OIDC_ALLOWED_GROUPS | | comma-separated list of groups that are allowed to login (empty means all groups allowed) |
+| HBOX_OIDC_AUTO_REDIRECT | false | auto redirect to OIDC authentication (automatically redirects to OIDC provider, but does not disable local login. See HBOX_OPTIONS_ALLOW_LOCAL_LOGIN) |
+| HBOX_OIDC_VERIFY_EMAIL | false | require email verification from OIDC provider |
+| HBOX_OIDC_GROUP_CLAIM | groups | name of the claim in the ID token that contains user groups |
+| HBOX_OIDC_EMAIL_CLAIM | email | name of the claim in the ID token that contains user email |
+| HBOX_OIDC_NAME_CLAIM | name | name of the claim in the ID token that contains user display name |
+| HBOX_OIDC_EMAIL_VERIFIED_CLAIM | email_verified | name of the claim in the ID token that contains user email verification status |
+| HBOX_OIDC_BUTTON_TEXT | Sign in with OIDC | text displayed on the OIDC login button |
+| HBOX_OIDC_STATE_EXPIRY | 10m | how long OIDC state parameters are valid (for CSRF protection) |
+| HBOX_OIDC_REQUEST_TIMEOUT | 30s | timeout for OIDC provider requests (token exchange, userinfo, etc.) |
| HBOX_LABEL_MAKER_WIDTH | 526 | width for generated labels in pixels |
| HBOX_LABEL_MAKER_HEIGHT | 200 | height for generated labels in pixels |
| HBOX_LABEL_MAKER_PADDING | 32 | space between elements on label |
@@ -149,6 +167,38 @@ For SQLite in production:
- Monitor the file size and consider using a different database for large installations
:::
+## OIDC Configuration
+
+HomeBox supports OpenID Connect (OIDC) authentication, allowing users to login using external identity providers like Keycloak, Authentik, Google, Microsoft, etc.
+
+### Basic OIDC Setup
+
+1. **Enable OIDC**: Set `HBOX_OIDC_ENABLED=true`
+2. **Provider Configuration**: Set the required provider details:
+ - `HBOX_OIDC_ISSUER_URL`: Your OIDC provider's issuer URL
+ - `HBOX_OIDC_CLIENT_ID`: Client ID from your OIDC provider
+ - `HBOX_OIDC_CLIENT_SECRET`: Client secret from your OIDC provider
+
+3. **Configure Redirect URI**: In your OIDC provider, set the redirect URI to:
+ `https://your-homebox-domain.com/api/v1/users/login/oidc/callback`
+
+### Advanced OIDC Configuration
+
+- **Group Authorization**: Use `HBOX_OIDC_ALLOWED_GROUPS` to restrict access to specific groups
+- **Custom Claims**: Configure `HBOX_OIDC_GROUP_CLAIM`, `HBOX_OIDC_EMAIL_CLAIM`, and `HBOX_OIDC_NAME_CLAIM` if your provider uses different claim names
+- **Auto Redirect to OIDC**: Set `HBOX_OIDC_AUTO_REDIRECT=true` to automatically redirect users directly to OIDC
+- **Local Login**: Set `HBOX_OPTIONS_ALLOW_LOCAL_LOGIN=false` to completely disable username/password login
+- **Email Verification**: Set `HBOX_OIDC_VERIFY_EMAIL=true` to require email verification from the OIDC provider
+
+### Security Considerations
+
+::: warning OIDC Security
+- Store `HBOX_OIDC_CLIENT_SECRET` securely (use environment variables, not config files)
+- Use HTTPS for production deployments
+- Configure proper redirect URIs in your OIDC provider
+- Consider setting `HBOX_OIDC_ALLOWED_GROUPS` for group-based access control
+:::
+
::: tip CLI Arguments
If you're deploying without docker you can use command line arguments to configure the application. Run `homebox --help`
for more information.
@@ -186,6 +236,24 @@ OPTIONS
--options-currency-config/$HBOX_OPTIONS_CURRENCY_CONFIG <string>
--options-github-release-check/$HBOX_OPTIONS_GITHUB_RELEASE_CHECK <bool> (default: true)
--options-allow-analytics/$HBOX_OPTIONS_ALLOW_ANALYTICS <bool> (default: false)
+--options-allow-local-login/$HBOX_OPTIONS_ALLOW_LOCAL_LOGIN <bool> (default: true)
+--options-trust-proxy/$HBOX_OPTIONS_TRUST_PROXY <bool> (default: false)
+--options-hostname/$HBOX_OPTIONS_HOSTNAME <string>
+--oidc-enabled/$HBOX_OIDC_ENABLED <bool> (default: false)
+--oidc-issuer-url/$HBOX_OIDC_ISSUER_URL <string>
+--oidc-client-id/$HBOX_OIDC_CLIENT_ID <string>
+--oidc-client-secret/$HBOX_OIDC_CLIENT_SECRET <string>
+--oidc-scope/$HBOX_OIDC_SCOPE <string> (default: openid profile email)
+--oidc-allowed-groups/$HBOX_OIDC_ALLOWED_GROUPS <string>
+--oidc-auto-redirect/$HBOX_OIDC_AUTO_REDIRECT <bool> (default: false)
+--oidc-verify-email/$HBOX_OIDC_VERIFY_EMAIL <bool> (default: false)
+--oidc-group-claim/$HBOX_OIDC_GROUP_CLAIM <string> (default: groups)
+--oidc-email-claim/$HBOX_OIDC_EMAIL_CLAIM <string> (default: email)
+--oidc-name-claim/$HBOX_OIDC_NAME_CLAIM <string> (default: name)
+--oidc-email-verified-claim/$HBOX_OIDC_EMAIL_VERIFIED_CLAIM <string> (default: email_verified)
+--oidc-button-text/$HBOX_OIDC_BUTTON_TEXT <string> (default: Sign in with OIDC)
+--oidc-state-expiry/$HBOX_OIDC_STATE_EXPIRY <duration> (default: 10m)
+--oidc-request-timeout/$HBOX_OIDC_REQUEST_TIMEOUT <duration> (default: 30s)
--label-maker-width/$HBOX_LABEL_MAKER_WIDTH <int> (default: 526)
--label-maker-height/$HBOX_LABEL_MAKER_HEIGHT <int> (default: 200)
--label-maker-padding/$HBOX_LABEL_MAKER_PADDING <int> (default: 32)
diff --git a/frontend/lib/api/types/data-contracts.ts b/frontend/lib/api/types/data-contracts.ts
index 15005f70..19c853ba 100644
--- a/frontend/lib/api/types/data-contracts.ts
+++ b/frontend/lib/api/types/data-contracts.ts
@@ -862,6 +862,12 @@ export interface APISummary {
labelPrinting: boolean;
latest: Latest;
message: string;
+ oidc?: {
+ enabled: boolean;
+ autoRedirect?: boolean;
+ allowLocal?: boolean;
+ buttonText?: string;
+ };
title: string;
versions: string[];
}
diff --git a/frontend/locales/en.json b/frontend/locales/en.json
index 793d2e53..f669bebe 100644
--- a/frontend/locales/en.json
+++ b/frontend/locales/en.json
@@ -297,6 +297,7 @@
"dont_join_group": "Don't want to join a group?",
"joining_group": "You're Joining an Existing Group!",
"login": "Login",
+ "or": "or",
"register": "Register",
"remember_me": "Remember Me",
"set_email": "What's your email?",
@@ -308,6 +309,14 @@
"invalid_email": "Invalid email address",
"invalid_email_password": "Invalid email or password",
"login_success": "Logged in successfully",
+ "oidc_access_denied": "Access denied: Your account does not have the required role/group membership",
+ "oidc_auth_failed": "OIDC authentication failed",
+ "oidc_invalid_response": "Invalid OIDC response received",
+ "oidc_provider_error": "OIDC provider returned an error",
+ "oidc_security_error": "OIDC security error - possible CSRF attack",
+ "oidc_session_expired": "OIDC session has expired",
+ "oidc_token_expired": "OIDC token has expired",
+ "oidc_token_invalid": "OIDC token signature is invalid",
"problem_registering": "Problem registering user",
"user_registered": "User registered"
}
diff --git a/frontend/pages/index.vue b/frontend/pages/index.vue
index a1332fe2..f63f4e2e 100644
--- a/frontend/pages/index.vue
+++ b/frontend/pages/index.vue
@@ -41,6 +41,9 @@
const ctx = useAuthContext();
const api = usePublicApi();
+ // Use ref for OIDC error state management
+ const oidcError = ref<string | null>(null);
+ const shownErrorMessage = ref(false);
const { data: status } = useAsyncData(async () => {
const { data } = await api.status();
@@ -57,6 +60,11 @@
email.value = "[email protected]";
loginPassword.value = "demo";
}
+
+ // Auto-redirect to OIDC if autoRedirect is enabled, but not if there's an OIDC initialization error
+ if (status?.oidc?.enabled && status?.oidc?.autoRedirect && !oidcError.value && !shownErrorMessage.value) {
+ loginWithOIDC();
+ }
});
const isEvilAccentTheme = useIsThemeInList([
@@ -138,6 +146,34 @@
if (groupToken.value !== "") {
registerForm.value = true;
}
+
+ // Handle OIDC error notifications from URL parameters
+ const oidcErrorParam = route.query.oidc_error;
+ if (typeof oidcErrorParam === "string" && oidcErrorParam.startsWith("oidc_")) {
+ // Set the error state to prevent auto-redirect
+ oidcError.value = oidcErrorParam;
+ shownErrorMessage.value = true;
+
+ const translationKey = `index.toast.${oidcErrorParam}`;
+ let errorMessage = t(translationKey);
+
+ // If there are additional details, append them
+ const details = route.query.details;
+ if (typeof details === "string" && details.trim() !== "") {
+ errorMessage += `: ${details}`;
+ }
+
+ toast.error(errorMessage);
+
+ // Clean up the URL by removing the error parameters
+ const newQuery = { ...route.query };
+ delete newQuery.oidc_error;
+ delete newQuery.details;
+ router.replace({ query: newQuery });
+
+ // Clear the error state after showing the message
+ oidcError.value = null;
+ }
});
const loading = ref(false);
@@ -165,6 +201,10 @@
loading.value = false;
}
+ function loginWithOIDC() {
+ window.location.href = "/api/v1/users/login/oidc";
+ }
+
const [registerForm, toggleLogin] = useToggle();
</script>
@@ -187,7 +227,10 @@
<div>
<header
class="mx-auto p-4 sm:flex sm:items-end sm:p-6 lg:p-14"
- :class="{ 'text-accent': !isEvilAccentTheme, 'text-white': isLofiTheme }"
+ :class="{
+ 'text-accent': !isEvilAccentTheme,
+ 'text-white': isLofiTheme,
+ }"
>
<div class="z-10">
<h2 class="mt-1 flex text-4xl font-bold tracking-tight sm:text-5xl lg:text-6xl">
@@ -195,7 +238,13 @@
<AppLogo class="-mb-4 w-12" />
x
</h2>
- <p class="ml-1 text-lg" :class="{ 'text-foreground': !isEvilForegroundTheme, 'text-white': isLofiTheme }">
+ <p
+ class="ml-1 text-lg"
+ :class="{
+ 'text-foreground': !isEvilForegroundTheme,
+ 'text-white': isLofiTheme,
+ }"
+ >
{{ $t("index.tagline") }}
</p>
</div>
@@ -285,9 +334,11 @@
{{ $t("index.login") }}
</CardTitle>
</CardHeader>
- <CardContent class="flex flex-col gap-2">
+ <CardContent v-if="status?.oidc?.allowLocal !== false" class="flex flex-col gap-2">
<template v-if="status && status.demo">
- <p class="text-center text-xs italic">{{ $t("global.demo_instance") }}</p>
+ <p class="text-center text-xs italic">
+ {{ $t("global.demo_instance") }}
+ </p>
<p class="text-center text-xs">
<b>{{ $t("global.email") }}</b> [email protected]
</p>
@@ -301,17 +352,42 @@
<FormCheckbox v-model="remember" :label="$t('index.remember_me')" />
</div>
</CardContent>
- <CardFooter>
- <Button class="w-full" type="submit" :class="loading ? 'loading' : ''" :disabled="loading">
+ <CardFooter class="flex flex-col gap-2">
+ <Button
+ v-if="status?.oidc?.allowLocal !== false"
+ class="w-full"
+ type="submit"
+ :class="loading ? 'loading' : ''"
+ :disabled="loading"
+ >
{{ $t("index.login") }}
</Button>
+
+ <div
+ v-if="status?.oidc?.enabled && status?.oidc?.allowLocal !== false"
+ class="flex w-full items-center gap-2"
+ >
+ <hr class="flex-1" />
+ <span class="text-xs text-muted-foreground">{{ $t("index.or") }}</span>
+ <hr class="flex-1" />
+ </div>
+
+ <Button
+ v-if="status?.oidc?.enabled"
+ type="button"
+ variant="outline"
+ class="w-full"
+ @click="loginWithOIDC"
+ >
+ {{ status.oidc.buttonText || "Sign in with OIDC" }}
+ </Button>
</CardFooter>
</Card>
</form>
</Transition>
<div class="mt-6 text-center">
<Button
- v-if="status && status.allowRegistration"
+ v-if="status && status.allowRegistration && status?.oidc?.allowLocal !== false"
class="group"
variant="link"
data-testid="register-button"