// Code generated by ent, DO NOT EDIT. package ent import ( "context" "errors" "fmt" "time" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/Wei-Shaw/sub2api/ent/predicate" "github.com/Wei-Shaw/sub2api/ent/soraaccount" ) // SoraAccountUpdate is the builder for updating SoraAccount entities. type SoraAccountUpdate struct { config hooks []Hook mutation *SoraAccountMutation } // Where appends a list predicates to the SoraAccountUpdate builder. func (_u *SoraAccountUpdate) Where(ps ...predicate.SoraAccount) *SoraAccountUpdate { _u.mutation.Where(ps...) return _u } // SetUpdatedAt sets the "updated_at" field. func (_u *SoraAccountUpdate) SetUpdatedAt(v time.Time) *SoraAccountUpdate { _u.mutation.SetUpdatedAt(v) return _u } // SetAccountID sets the "account_id" field. func (_u *SoraAccountUpdate) SetAccountID(v int64) *SoraAccountUpdate { _u.mutation.ResetAccountID() _u.mutation.SetAccountID(v) return _u } // SetNillableAccountID sets the "account_id" field if the given value is not nil. func (_u *SoraAccountUpdate) SetNillableAccountID(v *int64) *SoraAccountUpdate { if v != nil { _u.SetAccountID(*v) } return _u } // AddAccountID adds value to the "account_id" field. func (_u *SoraAccountUpdate) AddAccountID(v int64) *SoraAccountUpdate { _u.mutation.AddAccountID(v) return _u } // SetAccessToken sets the "access_token" field. func (_u *SoraAccountUpdate) SetAccessToken(v string) *SoraAccountUpdate { _u.mutation.SetAccessToken(v) return _u } // SetNillableAccessToken sets the "access_token" field if the given value is not nil. func (_u *SoraAccountUpdate) SetNillableAccessToken(v *string) *SoraAccountUpdate { if v != nil { _u.SetAccessToken(*v) } return _u } // ClearAccessToken clears the value of the "access_token" field. func (_u *SoraAccountUpdate) ClearAccessToken() *SoraAccountUpdate { _u.mutation.ClearAccessToken() return _u } // SetSessionToken sets the "session_token" field. func (_u *SoraAccountUpdate) SetSessionToken(v string) *SoraAccountUpdate { _u.mutation.SetSessionToken(v) return _u } // SetNillableSessionToken sets the "session_token" field if the given value is not nil. func (_u *SoraAccountUpdate) SetNillableSessionToken(v *string) *SoraAccountUpdate { if v != nil { _u.SetSessionToken(*v) } return _u } // ClearSessionToken clears the value of the "session_token" field. func (_u *SoraAccountUpdate) ClearSessionToken() *SoraAccountUpdate { _u.mutation.ClearSessionToken() return _u } // SetRefreshToken sets the "refresh_token" field. func (_u *SoraAccountUpdate) SetRefreshToken(v string) *SoraAccountUpdate { _u.mutation.SetRefreshToken(v) return _u } // SetNillableRefreshToken sets the "refresh_token" field if the given value is not nil. func (_u *SoraAccountUpdate) SetNillableRefreshToken(v *string) *SoraAccountUpdate { if v != nil { _u.SetRefreshToken(*v) } return _u } // ClearRefreshToken clears the value of the "refresh_token" field. func (_u *SoraAccountUpdate) ClearRefreshToken() *SoraAccountUpdate { _u.mutation.ClearRefreshToken() return _u } // SetClientID sets the "client_id" field. func (_u *SoraAccountUpdate) SetClientID(v string) *SoraAccountUpdate { _u.mutation.SetClientID(v) return _u } // SetNillableClientID sets the "client_id" field if the given value is not nil. func (_u *SoraAccountUpdate) SetNillableClientID(v *string) *SoraAccountUpdate { if v != nil { _u.SetClientID(*v) } return _u } // ClearClientID clears the value of the "client_id" field. func (_u *SoraAccountUpdate) ClearClientID() *SoraAccountUpdate { _u.mutation.ClearClientID() return _u } // SetEmail sets the "email" field. func (_u *SoraAccountUpdate) SetEmail(v string) *SoraAccountUpdate { _u.mutation.SetEmail(v) return _u } // SetNillableEmail sets the "email" field if the given value is not nil. func (_u *SoraAccountUpdate) SetNillableEmail(v *string) *SoraAccountUpdate { if v != nil { _u.SetEmail(*v) } return _u } // ClearEmail clears the value of the "email" field. func (_u *SoraAccountUpdate) ClearEmail() *SoraAccountUpdate { _u.mutation.ClearEmail() return _u } // SetUsername sets the "username" field. func (_u *SoraAccountUpdate) SetUsername(v string) *SoraAccountUpdate { _u.mutation.SetUsername(v) return _u } // SetNillableUsername sets the "username" field if the given value is not nil. func (_u *SoraAccountUpdate) SetNillableUsername(v *string) *SoraAccountUpdate { if v != nil { _u.SetUsername(*v) } return _u } // ClearUsername clears the value of the "username" field. func (_u *SoraAccountUpdate) ClearUsername() *SoraAccountUpdate { _u.mutation.ClearUsername() return _u } // SetRemark sets the "remark" field. func (_u *SoraAccountUpdate) SetRemark(v string) *SoraAccountUpdate { _u.mutation.SetRemark(v) return _u } // SetNillableRemark sets the "remark" field if the given value is not nil. func (_u *SoraAccountUpdate) SetNillableRemark(v *string) *SoraAccountUpdate { if v != nil { _u.SetRemark(*v) } return _u } // ClearRemark clears the value of the "remark" field. func (_u *SoraAccountUpdate) ClearRemark() *SoraAccountUpdate { _u.mutation.ClearRemark() return _u } // SetUseCount sets the "use_count" field. func (_u *SoraAccountUpdate) SetUseCount(v int) *SoraAccountUpdate { _u.mutation.ResetUseCount() _u.mutation.SetUseCount(v) return _u } // SetNillableUseCount sets the "use_count" field if the given value is not nil. func (_u *SoraAccountUpdate) SetNillableUseCount(v *int) *SoraAccountUpdate { if v != nil { _u.SetUseCount(*v) } return _u } // AddUseCount adds value to the "use_count" field. func (_u *SoraAccountUpdate) AddUseCount(v int) *SoraAccountUpdate { _u.mutation.AddUseCount(v) return _u } // SetPlanType sets the "plan_type" field. func (_u *SoraAccountUpdate) SetPlanType(v string) *SoraAccountUpdate { _u.mutation.SetPlanType(v) return _u } // SetNillablePlanType sets the "plan_type" field if the given value is not nil. func (_u *SoraAccountUpdate) SetNillablePlanType(v *string) *SoraAccountUpdate { if v != nil { _u.SetPlanType(*v) } return _u } // ClearPlanType clears the value of the "plan_type" field. func (_u *SoraAccountUpdate) ClearPlanType() *SoraAccountUpdate { _u.mutation.ClearPlanType() return _u } // SetPlanTitle sets the "plan_title" field. func (_u *SoraAccountUpdate) SetPlanTitle(v string) *SoraAccountUpdate { _u.mutation.SetPlanTitle(v) return _u } // SetNillablePlanTitle sets the "plan_title" field if the given value is not nil. func (_u *SoraAccountUpdate) SetNillablePlanTitle(v *string) *SoraAccountUpdate { if v != nil { _u.SetPlanTitle(*v) } return _u } // ClearPlanTitle clears the value of the "plan_title" field. func (_u *SoraAccountUpdate) ClearPlanTitle() *SoraAccountUpdate { _u.mutation.ClearPlanTitle() return _u } // SetSubscriptionEnd sets the "subscription_end" field. func (_u *SoraAccountUpdate) SetSubscriptionEnd(v time.Time) *SoraAccountUpdate { _u.mutation.SetSubscriptionEnd(v) return _u } // SetNillableSubscriptionEnd sets the "subscription_end" field if the given value is not nil. func (_u *SoraAccountUpdate) SetNillableSubscriptionEnd(v *time.Time) *SoraAccountUpdate { if v != nil { _u.SetSubscriptionEnd(*v) } return _u } // ClearSubscriptionEnd clears the value of the "subscription_end" field. func (_u *SoraAccountUpdate) ClearSubscriptionEnd() *SoraAccountUpdate { _u.mutation.ClearSubscriptionEnd() return _u } // SetSoraSupported sets the "sora_supported" field. func (_u *SoraAccountUpdate) SetSoraSupported(v bool) *SoraAccountUpdate { _u.mutation.SetSoraSupported(v) return _u } // SetNillableSoraSupported sets the "sora_supported" field if the given value is not nil. func (_u *SoraAccountUpdate) SetNillableSoraSupported(v *bool) *SoraAccountUpdate { if v != nil { _u.SetSoraSupported(*v) } return _u } // SetSoraInviteCode sets the "sora_invite_code" field. func (_u *SoraAccountUpdate) SetSoraInviteCode(v string) *SoraAccountUpdate { _u.mutation.SetSoraInviteCode(v) return _u } // SetNillableSoraInviteCode sets the "sora_invite_code" field if the given value is not nil. func (_u *SoraAccountUpdate) SetNillableSoraInviteCode(v *string) *SoraAccountUpdate { if v != nil { _u.SetSoraInviteCode(*v) } return _u } // ClearSoraInviteCode clears the value of the "sora_invite_code" field. func (_u *SoraAccountUpdate) ClearSoraInviteCode() *SoraAccountUpdate { _u.mutation.ClearSoraInviteCode() return _u } // SetSoraRedeemedCount sets the "sora_redeemed_count" field. func (_u *SoraAccountUpdate) SetSoraRedeemedCount(v int) *SoraAccountUpdate { _u.mutation.ResetSoraRedeemedCount() _u.mutation.SetSoraRedeemedCount(v) return _u } // SetNillableSoraRedeemedCount sets the "sora_redeemed_count" field if the given value is not nil. func (_u *SoraAccountUpdate) SetNillableSoraRedeemedCount(v *int) *SoraAccountUpdate { if v != nil { _u.SetSoraRedeemedCount(*v) } return _u } // AddSoraRedeemedCount adds value to the "sora_redeemed_count" field. func (_u *SoraAccountUpdate) AddSoraRedeemedCount(v int) *SoraAccountUpdate { _u.mutation.AddSoraRedeemedCount(v) return _u } // SetSoraRemainingCount sets the "sora_remaining_count" field. func (_u *SoraAccountUpdate) SetSoraRemainingCount(v int) *SoraAccountUpdate { _u.mutation.ResetSoraRemainingCount() _u.mutation.SetSoraRemainingCount(v) return _u } // SetNillableSoraRemainingCount sets the "sora_remaining_count" field if the given value is not nil. func (_u *SoraAccountUpdate) SetNillableSoraRemainingCount(v *int) *SoraAccountUpdate { if v != nil { _u.SetSoraRemainingCount(*v) } return _u } // AddSoraRemainingCount adds value to the "sora_remaining_count" field. func (_u *SoraAccountUpdate) AddSoraRemainingCount(v int) *SoraAccountUpdate { _u.mutation.AddSoraRemainingCount(v) return _u } // SetSoraTotalCount sets the "sora_total_count" field. func (_u *SoraAccountUpdate) SetSoraTotalCount(v int) *SoraAccountUpdate { _u.mutation.ResetSoraTotalCount() _u.mutation.SetSoraTotalCount(v) return _u } // SetNillableSoraTotalCount sets the "sora_total_count" field if the given value is not nil. func (_u *SoraAccountUpdate) SetNillableSoraTotalCount(v *int) *SoraAccountUpdate { if v != nil { _u.SetSoraTotalCount(*v) } return _u } // AddSoraTotalCount adds value to the "sora_total_count" field. func (_u *SoraAccountUpdate) AddSoraTotalCount(v int) *SoraAccountUpdate { _u.mutation.AddSoraTotalCount(v) return _u } // SetSoraCooldownUntil sets the "sora_cooldown_until" field. func (_u *SoraAccountUpdate) SetSoraCooldownUntil(v time.Time) *SoraAccountUpdate { _u.mutation.SetSoraCooldownUntil(v) return _u } // SetNillableSoraCooldownUntil sets the "sora_cooldown_until" field if the given value is not nil. func (_u *SoraAccountUpdate) SetNillableSoraCooldownUntil(v *time.Time) *SoraAccountUpdate { if v != nil { _u.SetSoraCooldownUntil(*v) } return _u } // ClearSoraCooldownUntil clears the value of the "sora_cooldown_until" field. func (_u *SoraAccountUpdate) ClearSoraCooldownUntil() *SoraAccountUpdate { _u.mutation.ClearSoraCooldownUntil() return _u } // SetCooledUntil sets the "cooled_until" field. func (_u *SoraAccountUpdate) SetCooledUntil(v time.Time) *SoraAccountUpdate { _u.mutation.SetCooledUntil(v) return _u } // SetNillableCooledUntil sets the "cooled_until" field if the given value is not nil. func (_u *SoraAccountUpdate) SetNillableCooledUntil(v *time.Time) *SoraAccountUpdate { if v != nil { _u.SetCooledUntil(*v) } return _u } // ClearCooledUntil clears the value of the "cooled_until" field. func (_u *SoraAccountUpdate) ClearCooledUntil() *SoraAccountUpdate { _u.mutation.ClearCooledUntil() return _u } // SetImageEnabled sets the "image_enabled" field. func (_u *SoraAccountUpdate) SetImageEnabled(v bool) *SoraAccountUpdate { _u.mutation.SetImageEnabled(v) return _u } // SetNillableImageEnabled sets the "image_enabled" field if the given value is not nil. func (_u *SoraAccountUpdate) SetNillableImageEnabled(v *bool) *SoraAccountUpdate { if v != nil { _u.SetImageEnabled(*v) } return _u } // SetVideoEnabled sets the "video_enabled" field. func (_u *SoraAccountUpdate) SetVideoEnabled(v bool) *SoraAccountUpdate { _u.mutation.SetVideoEnabled(v) return _u } // SetNillableVideoEnabled sets the "video_enabled" field if the given value is not nil. func (_u *SoraAccountUpdate) SetNillableVideoEnabled(v *bool) *SoraAccountUpdate { if v != nil { _u.SetVideoEnabled(*v) } return _u } // SetImageConcurrency sets the "image_concurrency" field. func (_u *SoraAccountUpdate) SetImageConcurrency(v int) *SoraAccountUpdate { _u.mutation.ResetImageConcurrency() _u.mutation.SetImageConcurrency(v) return _u } // SetNillableImageConcurrency sets the "image_concurrency" field if the given value is not nil. func (_u *SoraAccountUpdate) SetNillableImageConcurrency(v *int) *SoraAccountUpdate { if v != nil { _u.SetImageConcurrency(*v) } return _u } // AddImageConcurrency adds value to the "image_concurrency" field. func (_u *SoraAccountUpdate) AddImageConcurrency(v int) *SoraAccountUpdate { _u.mutation.AddImageConcurrency(v) return _u } // SetVideoConcurrency sets the "video_concurrency" field. func (_u *SoraAccountUpdate) SetVideoConcurrency(v int) *SoraAccountUpdate { _u.mutation.ResetVideoConcurrency() _u.mutation.SetVideoConcurrency(v) return _u } // SetNillableVideoConcurrency sets the "video_concurrency" field if the given value is not nil. func (_u *SoraAccountUpdate) SetNillableVideoConcurrency(v *int) *SoraAccountUpdate { if v != nil { _u.SetVideoConcurrency(*v) } return _u } // AddVideoConcurrency adds value to the "video_concurrency" field. func (_u *SoraAccountUpdate) AddVideoConcurrency(v int) *SoraAccountUpdate { _u.mutation.AddVideoConcurrency(v) return _u } // SetIsExpired sets the "is_expired" field. func (_u *SoraAccountUpdate) SetIsExpired(v bool) *SoraAccountUpdate { _u.mutation.SetIsExpired(v) return _u } // SetNillableIsExpired sets the "is_expired" field if the given value is not nil. func (_u *SoraAccountUpdate) SetNillableIsExpired(v *bool) *SoraAccountUpdate { if v != nil { _u.SetIsExpired(*v) } return _u } // Mutation returns the SoraAccountMutation object of the builder. func (_u *SoraAccountUpdate) Mutation() *SoraAccountMutation { return _u.mutation } // Save executes the query and returns the number of nodes affected by the update operation. func (_u *SoraAccountUpdate) 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 (_u *SoraAccountUpdate) SaveX(ctx context.Context) int { affected, err := _u.Save(ctx) if err != nil { panic(err) } return affected } // Exec executes the query. func (_u *SoraAccountUpdate) Exec(ctx context.Context) error { _, err := _u.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. func (_u *SoraAccountUpdate) ExecX(ctx context.Context) { if err := _u.Exec(ctx); err != nil { panic(err) } } // defaults sets the default values of the builder before save. func (_u *SoraAccountUpdate) defaults() { if _, ok := _u.mutation.UpdatedAt(); !ok { v := soraaccount.UpdateDefaultUpdatedAt() _u.mutation.SetUpdatedAt(v) } } func (_u *SoraAccountUpdate) sqlSave(ctx context.Context) (_node int, err error) { _spec := sqlgraph.NewUpdateSpec(soraaccount.Table, soraaccount.Columns, sqlgraph.NewFieldSpec(soraaccount.FieldID, field.TypeInt64)) if ps := _u.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if value, ok := _u.mutation.UpdatedAt(); ok { _spec.SetField(soraaccount.FieldUpdatedAt, field.TypeTime, value) } if value, ok := _u.mutation.AccountID(); ok { _spec.SetField(soraaccount.FieldAccountID, field.TypeInt64, value) } if value, ok := _u.mutation.AddedAccountID(); ok { _spec.AddField(soraaccount.FieldAccountID, field.TypeInt64, value) } if value, ok := _u.mutation.AccessToken(); ok { _spec.SetField(soraaccount.FieldAccessToken, field.TypeString, value) } if _u.mutation.AccessTokenCleared() { _spec.ClearField(soraaccount.FieldAccessToken, field.TypeString) } if value, ok := _u.mutation.SessionToken(); ok { _spec.SetField(soraaccount.FieldSessionToken, field.TypeString, value) } if _u.mutation.SessionTokenCleared() { _spec.ClearField(soraaccount.FieldSessionToken, field.TypeString) } if value, ok := _u.mutation.RefreshToken(); ok { _spec.SetField(soraaccount.FieldRefreshToken, field.TypeString, value) } if _u.mutation.RefreshTokenCleared() { _spec.ClearField(soraaccount.FieldRefreshToken, field.TypeString) } if value, ok := _u.mutation.ClientID(); ok { _spec.SetField(soraaccount.FieldClientID, field.TypeString, value) } if _u.mutation.ClientIDCleared() { _spec.ClearField(soraaccount.FieldClientID, field.TypeString) } if value, ok := _u.mutation.Email(); ok { _spec.SetField(soraaccount.FieldEmail, field.TypeString, value) } if _u.mutation.EmailCleared() { _spec.ClearField(soraaccount.FieldEmail, field.TypeString) } if value, ok := _u.mutation.Username(); ok { _spec.SetField(soraaccount.FieldUsername, field.TypeString, value) } if _u.mutation.UsernameCleared() { _spec.ClearField(soraaccount.FieldUsername, field.TypeString) } if value, ok := _u.mutation.Remark(); ok { _spec.SetField(soraaccount.FieldRemark, field.TypeString, value) } if _u.mutation.RemarkCleared() { _spec.ClearField(soraaccount.FieldRemark, field.TypeString) } if value, ok := _u.mutation.UseCount(); ok { _spec.SetField(soraaccount.FieldUseCount, field.TypeInt, value) } if value, ok := _u.mutation.AddedUseCount(); ok { _spec.AddField(soraaccount.FieldUseCount, field.TypeInt, value) } if value, ok := _u.mutation.PlanType(); ok { _spec.SetField(soraaccount.FieldPlanType, field.TypeString, value) } if _u.mutation.PlanTypeCleared() { _spec.ClearField(soraaccount.FieldPlanType, field.TypeString) } if value, ok := _u.mutation.PlanTitle(); ok { _spec.SetField(soraaccount.FieldPlanTitle, field.TypeString, value) } if _u.mutation.PlanTitleCleared() { _spec.ClearField(soraaccount.FieldPlanTitle, field.TypeString) } if value, ok := _u.mutation.SubscriptionEnd(); ok { _spec.SetField(soraaccount.FieldSubscriptionEnd, field.TypeTime, value) } if _u.mutation.SubscriptionEndCleared() { _spec.ClearField(soraaccount.FieldSubscriptionEnd, field.TypeTime) } if value, ok := _u.mutation.SoraSupported(); ok { _spec.SetField(soraaccount.FieldSoraSupported, field.TypeBool, value) } if value, ok := _u.mutation.SoraInviteCode(); ok { _spec.SetField(soraaccount.FieldSoraInviteCode, field.TypeString, value) } if _u.mutation.SoraInviteCodeCleared() { _spec.ClearField(soraaccount.FieldSoraInviteCode, field.TypeString) } if value, ok := _u.mutation.SoraRedeemedCount(); ok { _spec.SetField(soraaccount.FieldSoraRedeemedCount, field.TypeInt, value) } if value, ok := _u.mutation.AddedSoraRedeemedCount(); ok { _spec.AddField(soraaccount.FieldSoraRedeemedCount, field.TypeInt, value) } if value, ok := _u.mutation.SoraRemainingCount(); ok { _spec.SetField(soraaccount.FieldSoraRemainingCount, field.TypeInt, value) } if value, ok := _u.mutation.AddedSoraRemainingCount(); ok { _spec.AddField(soraaccount.FieldSoraRemainingCount, field.TypeInt, value) } if value, ok := _u.mutation.SoraTotalCount(); ok { _spec.SetField(soraaccount.FieldSoraTotalCount, field.TypeInt, value) } if value, ok := _u.mutation.AddedSoraTotalCount(); ok { _spec.AddField(soraaccount.FieldSoraTotalCount, field.TypeInt, value) } if value, ok := _u.mutation.SoraCooldownUntil(); ok { _spec.SetField(soraaccount.FieldSoraCooldownUntil, field.TypeTime, value) } if _u.mutation.SoraCooldownUntilCleared() { _spec.ClearField(soraaccount.FieldSoraCooldownUntil, field.TypeTime) } if value, ok := _u.mutation.CooledUntil(); ok { _spec.SetField(soraaccount.FieldCooledUntil, field.TypeTime, value) } if _u.mutation.CooledUntilCleared() { _spec.ClearField(soraaccount.FieldCooledUntil, field.TypeTime) } if value, ok := _u.mutation.ImageEnabled(); ok { _spec.SetField(soraaccount.FieldImageEnabled, field.TypeBool, value) } if value, ok := _u.mutation.VideoEnabled(); ok { _spec.SetField(soraaccount.FieldVideoEnabled, field.TypeBool, value) } if value, ok := _u.mutation.ImageConcurrency(); ok { _spec.SetField(soraaccount.FieldImageConcurrency, field.TypeInt, value) } if value, ok := _u.mutation.AddedImageConcurrency(); ok { _spec.AddField(soraaccount.FieldImageConcurrency, field.TypeInt, value) } if value, ok := _u.mutation.VideoConcurrency(); ok { _spec.SetField(soraaccount.FieldVideoConcurrency, field.TypeInt, value) } if value, ok := _u.mutation.AddedVideoConcurrency(); ok { _spec.AddField(soraaccount.FieldVideoConcurrency, field.TypeInt, value) } if value, ok := _u.mutation.IsExpired(); ok { _spec.SetField(soraaccount.FieldIsExpired, field.TypeBool, value) } if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{soraaccount.Label} } else if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return 0, err } _u.mutation.done = true return _node, nil } // SoraAccountUpdateOne is the builder for updating a single SoraAccount entity. type SoraAccountUpdateOne struct { config fields []string hooks []Hook mutation *SoraAccountMutation } // SetUpdatedAt sets the "updated_at" field. func (_u *SoraAccountUpdateOne) SetUpdatedAt(v time.Time) *SoraAccountUpdateOne { _u.mutation.SetUpdatedAt(v) return _u } // SetAccountID sets the "account_id" field. func (_u *SoraAccountUpdateOne) SetAccountID(v int64) *SoraAccountUpdateOne { _u.mutation.ResetAccountID() _u.mutation.SetAccountID(v) return _u } // SetNillableAccountID sets the "account_id" field if the given value is not nil. func (_u *SoraAccountUpdateOne) SetNillableAccountID(v *int64) *SoraAccountUpdateOne { if v != nil { _u.SetAccountID(*v) } return _u } // AddAccountID adds value to the "account_id" field. func (_u *SoraAccountUpdateOne) AddAccountID(v int64) *SoraAccountUpdateOne { _u.mutation.AddAccountID(v) return _u } // SetAccessToken sets the "access_token" field. func (_u *SoraAccountUpdateOne) SetAccessToken(v string) *SoraAccountUpdateOne { _u.mutation.SetAccessToken(v) return _u } // SetNillableAccessToken sets the "access_token" field if the given value is not nil. func (_u *SoraAccountUpdateOne) SetNillableAccessToken(v *string) *SoraAccountUpdateOne { if v != nil { _u.SetAccessToken(*v) } return _u } // ClearAccessToken clears the value of the "access_token" field. func (_u *SoraAccountUpdateOne) ClearAccessToken() *SoraAccountUpdateOne { _u.mutation.ClearAccessToken() return _u } // SetSessionToken sets the "session_token" field. func (_u *SoraAccountUpdateOne) SetSessionToken(v string) *SoraAccountUpdateOne { _u.mutation.SetSessionToken(v) return _u } // SetNillableSessionToken sets the "session_token" field if the given value is not nil. func (_u *SoraAccountUpdateOne) SetNillableSessionToken(v *string) *SoraAccountUpdateOne { if v != nil { _u.SetSessionToken(*v) } return _u } // ClearSessionToken clears the value of the "session_token" field. func (_u *SoraAccountUpdateOne) ClearSessionToken() *SoraAccountUpdateOne { _u.mutation.ClearSessionToken() return _u } // SetRefreshToken sets the "refresh_token" field. func (_u *SoraAccountUpdateOne) SetRefreshToken(v string) *SoraAccountUpdateOne { _u.mutation.SetRefreshToken(v) return _u } // SetNillableRefreshToken sets the "refresh_token" field if the given value is not nil. func (_u *SoraAccountUpdateOne) SetNillableRefreshToken(v *string) *SoraAccountUpdateOne { if v != nil { _u.SetRefreshToken(*v) } return _u } // ClearRefreshToken clears the value of the "refresh_token" field. func (_u *SoraAccountUpdateOne) ClearRefreshToken() *SoraAccountUpdateOne { _u.mutation.ClearRefreshToken() return _u } // SetClientID sets the "client_id" field. func (_u *SoraAccountUpdateOne) SetClientID(v string) *SoraAccountUpdateOne { _u.mutation.SetClientID(v) return _u } // SetNillableClientID sets the "client_id" field if the given value is not nil. func (_u *SoraAccountUpdateOne) SetNillableClientID(v *string) *SoraAccountUpdateOne { if v != nil { _u.SetClientID(*v) } return _u } // ClearClientID clears the value of the "client_id" field. func (_u *SoraAccountUpdateOne) ClearClientID() *SoraAccountUpdateOne { _u.mutation.ClearClientID() return _u } // SetEmail sets the "email" field. func (_u *SoraAccountUpdateOne) SetEmail(v string) *SoraAccountUpdateOne { _u.mutation.SetEmail(v) return _u } // SetNillableEmail sets the "email" field if the given value is not nil. func (_u *SoraAccountUpdateOne) SetNillableEmail(v *string) *SoraAccountUpdateOne { if v != nil { _u.SetEmail(*v) } return _u } // ClearEmail clears the value of the "email" field. func (_u *SoraAccountUpdateOne) ClearEmail() *SoraAccountUpdateOne { _u.mutation.ClearEmail() return _u } // SetUsername sets the "username" field. func (_u *SoraAccountUpdateOne) SetUsername(v string) *SoraAccountUpdateOne { _u.mutation.SetUsername(v) return _u } // SetNillableUsername sets the "username" field if the given value is not nil. func (_u *SoraAccountUpdateOne) SetNillableUsername(v *string) *SoraAccountUpdateOne { if v != nil { _u.SetUsername(*v) } return _u } // ClearUsername clears the value of the "username" field. func (_u *SoraAccountUpdateOne) ClearUsername() *SoraAccountUpdateOne { _u.mutation.ClearUsername() return _u } // SetRemark sets the "remark" field. func (_u *SoraAccountUpdateOne) SetRemark(v string) *SoraAccountUpdateOne { _u.mutation.SetRemark(v) return _u } // SetNillableRemark sets the "remark" field if the given value is not nil. func (_u *SoraAccountUpdateOne) SetNillableRemark(v *string) *SoraAccountUpdateOne { if v != nil { _u.SetRemark(*v) } return _u } // ClearRemark clears the value of the "remark" field. func (_u *SoraAccountUpdateOne) ClearRemark() *SoraAccountUpdateOne { _u.mutation.ClearRemark() return _u } // SetUseCount sets the "use_count" field. func (_u *SoraAccountUpdateOne) SetUseCount(v int) *SoraAccountUpdateOne { _u.mutation.ResetUseCount() _u.mutation.SetUseCount(v) return _u } // SetNillableUseCount sets the "use_count" field if the given value is not nil. func (_u *SoraAccountUpdateOne) SetNillableUseCount(v *int) *SoraAccountUpdateOne { if v != nil { _u.SetUseCount(*v) } return _u } // AddUseCount adds value to the "use_count" field. func (_u *SoraAccountUpdateOne) AddUseCount(v int) *SoraAccountUpdateOne { _u.mutation.AddUseCount(v) return _u } // SetPlanType sets the "plan_type" field. func (_u *SoraAccountUpdateOne) SetPlanType(v string) *SoraAccountUpdateOne { _u.mutation.SetPlanType(v) return _u } // SetNillablePlanType sets the "plan_type" field if the given value is not nil. func (_u *SoraAccountUpdateOne) SetNillablePlanType(v *string) *SoraAccountUpdateOne { if v != nil { _u.SetPlanType(*v) } return _u } // ClearPlanType clears the value of the "plan_type" field. func (_u *SoraAccountUpdateOne) ClearPlanType() *SoraAccountUpdateOne { _u.mutation.ClearPlanType() return _u } // SetPlanTitle sets the "plan_title" field. func (_u *SoraAccountUpdateOne) SetPlanTitle(v string) *SoraAccountUpdateOne { _u.mutation.SetPlanTitle(v) return _u } // SetNillablePlanTitle sets the "plan_title" field if the given value is not nil. func (_u *SoraAccountUpdateOne) SetNillablePlanTitle(v *string) *SoraAccountUpdateOne { if v != nil { _u.SetPlanTitle(*v) } return _u } // ClearPlanTitle clears the value of the "plan_title" field. func (_u *SoraAccountUpdateOne) ClearPlanTitle() *SoraAccountUpdateOne { _u.mutation.ClearPlanTitle() return _u } // SetSubscriptionEnd sets the "subscription_end" field. func (_u *SoraAccountUpdateOne) SetSubscriptionEnd(v time.Time) *SoraAccountUpdateOne { _u.mutation.SetSubscriptionEnd(v) return _u } // SetNillableSubscriptionEnd sets the "subscription_end" field if the given value is not nil. func (_u *SoraAccountUpdateOne) SetNillableSubscriptionEnd(v *time.Time) *SoraAccountUpdateOne { if v != nil { _u.SetSubscriptionEnd(*v) } return _u } // ClearSubscriptionEnd clears the value of the "subscription_end" field. func (_u *SoraAccountUpdateOne) ClearSubscriptionEnd() *SoraAccountUpdateOne { _u.mutation.ClearSubscriptionEnd() return _u } // SetSoraSupported sets the "sora_supported" field. func (_u *SoraAccountUpdateOne) SetSoraSupported(v bool) *SoraAccountUpdateOne { _u.mutation.SetSoraSupported(v) return _u } // SetNillableSoraSupported sets the "sora_supported" field if the given value is not nil. func (_u *SoraAccountUpdateOne) SetNillableSoraSupported(v *bool) *SoraAccountUpdateOne { if v != nil { _u.SetSoraSupported(*v) } return _u } // SetSoraInviteCode sets the "sora_invite_code" field. func (_u *SoraAccountUpdateOne) SetSoraInviteCode(v string) *SoraAccountUpdateOne { _u.mutation.SetSoraInviteCode(v) return _u } // SetNillableSoraInviteCode sets the "sora_invite_code" field if the given value is not nil. func (_u *SoraAccountUpdateOne) SetNillableSoraInviteCode(v *string) *SoraAccountUpdateOne { if v != nil { _u.SetSoraInviteCode(*v) } return _u } // ClearSoraInviteCode clears the value of the "sora_invite_code" field. func (_u *SoraAccountUpdateOne) ClearSoraInviteCode() *SoraAccountUpdateOne { _u.mutation.ClearSoraInviteCode() return _u } // SetSoraRedeemedCount sets the "sora_redeemed_count" field. func (_u *SoraAccountUpdateOne) SetSoraRedeemedCount(v int) *SoraAccountUpdateOne { _u.mutation.ResetSoraRedeemedCount() _u.mutation.SetSoraRedeemedCount(v) return _u } // SetNillableSoraRedeemedCount sets the "sora_redeemed_count" field if the given value is not nil. func (_u *SoraAccountUpdateOne) SetNillableSoraRedeemedCount(v *int) *SoraAccountUpdateOne { if v != nil { _u.SetSoraRedeemedCount(*v) } return _u } // AddSoraRedeemedCount adds value to the "sora_redeemed_count" field. func (_u *SoraAccountUpdateOne) AddSoraRedeemedCount(v int) *SoraAccountUpdateOne { _u.mutation.AddSoraRedeemedCount(v) return _u } // SetSoraRemainingCount sets the "sora_remaining_count" field. func (_u *SoraAccountUpdateOne) SetSoraRemainingCount(v int) *SoraAccountUpdateOne { _u.mutation.ResetSoraRemainingCount() _u.mutation.SetSoraRemainingCount(v) return _u } // SetNillableSoraRemainingCount sets the "sora_remaining_count" field if the given value is not nil. func (_u *SoraAccountUpdateOne) SetNillableSoraRemainingCount(v *int) *SoraAccountUpdateOne { if v != nil { _u.SetSoraRemainingCount(*v) } return _u } // AddSoraRemainingCount adds value to the "sora_remaining_count" field. func (_u *SoraAccountUpdateOne) AddSoraRemainingCount(v int) *SoraAccountUpdateOne { _u.mutation.AddSoraRemainingCount(v) return _u } // SetSoraTotalCount sets the "sora_total_count" field. func (_u *SoraAccountUpdateOne) SetSoraTotalCount(v int) *SoraAccountUpdateOne { _u.mutation.ResetSoraTotalCount() _u.mutation.SetSoraTotalCount(v) return _u } // SetNillableSoraTotalCount sets the "sora_total_count" field if the given value is not nil. func (_u *SoraAccountUpdateOne) SetNillableSoraTotalCount(v *int) *SoraAccountUpdateOne { if v != nil { _u.SetSoraTotalCount(*v) } return _u } // AddSoraTotalCount adds value to the "sora_total_count" field. func (_u *SoraAccountUpdateOne) AddSoraTotalCount(v int) *SoraAccountUpdateOne { _u.mutation.AddSoraTotalCount(v) return _u } // SetSoraCooldownUntil sets the "sora_cooldown_until" field. func (_u *SoraAccountUpdateOne) SetSoraCooldownUntil(v time.Time) *SoraAccountUpdateOne { _u.mutation.SetSoraCooldownUntil(v) return _u } // SetNillableSoraCooldownUntil sets the "sora_cooldown_until" field if the given value is not nil. func (_u *SoraAccountUpdateOne) SetNillableSoraCooldownUntil(v *time.Time) *SoraAccountUpdateOne { if v != nil { _u.SetSoraCooldownUntil(*v) } return _u } // ClearSoraCooldownUntil clears the value of the "sora_cooldown_until" field. func (_u *SoraAccountUpdateOne) ClearSoraCooldownUntil() *SoraAccountUpdateOne { _u.mutation.ClearSoraCooldownUntil() return _u } // SetCooledUntil sets the "cooled_until" field. func (_u *SoraAccountUpdateOne) SetCooledUntil(v time.Time) *SoraAccountUpdateOne { _u.mutation.SetCooledUntil(v) return _u } // SetNillableCooledUntil sets the "cooled_until" field if the given value is not nil. func (_u *SoraAccountUpdateOne) SetNillableCooledUntil(v *time.Time) *SoraAccountUpdateOne { if v != nil { _u.SetCooledUntil(*v) } return _u } // ClearCooledUntil clears the value of the "cooled_until" field. func (_u *SoraAccountUpdateOne) ClearCooledUntil() *SoraAccountUpdateOne { _u.mutation.ClearCooledUntil() return _u } // SetImageEnabled sets the "image_enabled" field. func (_u *SoraAccountUpdateOne) SetImageEnabled(v bool) *SoraAccountUpdateOne { _u.mutation.SetImageEnabled(v) return _u } // SetNillableImageEnabled sets the "image_enabled" field if the given value is not nil. func (_u *SoraAccountUpdateOne) SetNillableImageEnabled(v *bool) *SoraAccountUpdateOne { if v != nil { _u.SetImageEnabled(*v) } return _u } // SetVideoEnabled sets the "video_enabled" field. func (_u *SoraAccountUpdateOne) SetVideoEnabled(v bool) *SoraAccountUpdateOne { _u.mutation.SetVideoEnabled(v) return _u } // SetNillableVideoEnabled sets the "video_enabled" field if the given value is not nil. func (_u *SoraAccountUpdateOne) SetNillableVideoEnabled(v *bool) *SoraAccountUpdateOne { if v != nil { _u.SetVideoEnabled(*v) } return _u } // SetImageConcurrency sets the "image_concurrency" field. func (_u *SoraAccountUpdateOne) SetImageConcurrency(v int) *SoraAccountUpdateOne { _u.mutation.ResetImageConcurrency() _u.mutation.SetImageConcurrency(v) return _u } // SetNillableImageConcurrency sets the "image_concurrency" field if the given value is not nil. func (_u *SoraAccountUpdateOne) SetNillableImageConcurrency(v *int) *SoraAccountUpdateOne { if v != nil { _u.SetImageConcurrency(*v) } return _u } // AddImageConcurrency adds value to the "image_concurrency" field. func (_u *SoraAccountUpdateOne) AddImageConcurrency(v int) *SoraAccountUpdateOne { _u.mutation.AddImageConcurrency(v) return _u } // SetVideoConcurrency sets the "video_concurrency" field. func (_u *SoraAccountUpdateOne) SetVideoConcurrency(v int) *SoraAccountUpdateOne { _u.mutation.ResetVideoConcurrency() _u.mutation.SetVideoConcurrency(v) return _u } // SetNillableVideoConcurrency sets the "video_concurrency" field if the given value is not nil. func (_u *SoraAccountUpdateOne) SetNillableVideoConcurrency(v *int) *SoraAccountUpdateOne { if v != nil { _u.SetVideoConcurrency(*v) } return _u } // AddVideoConcurrency adds value to the "video_concurrency" field. func (_u *SoraAccountUpdateOne) AddVideoConcurrency(v int) *SoraAccountUpdateOne { _u.mutation.AddVideoConcurrency(v) return _u } // SetIsExpired sets the "is_expired" field. func (_u *SoraAccountUpdateOne) SetIsExpired(v bool) *SoraAccountUpdateOne { _u.mutation.SetIsExpired(v) return _u } // SetNillableIsExpired sets the "is_expired" field if the given value is not nil. func (_u *SoraAccountUpdateOne) SetNillableIsExpired(v *bool) *SoraAccountUpdateOne { if v != nil { _u.SetIsExpired(*v) } return _u } // Mutation returns the SoraAccountMutation object of the builder. func (_u *SoraAccountUpdateOne) Mutation() *SoraAccountMutation { return _u.mutation } // Where appends a list predicates to the SoraAccountUpdate builder. func (_u *SoraAccountUpdateOne) Where(ps ...predicate.SoraAccount) *SoraAccountUpdateOne { _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 (_u *SoraAccountUpdateOne) Select(field string, fields ...string) *SoraAccountUpdateOne { _u.fields = append([]string{field}, fields...) return _u } // Save executes the query and returns the updated SoraAccount entity. func (_u *SoraAccountUpdateOne) Save(ctx context.Context) (*SoraAccount, error) { _u.defaults() return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks) } // SaveX is like Save, but panics if an error occurs. func (_u *SoraAccountUpdateOne) SaveX(ctx context.Context) *SoraAccount { node, err := _u.Save(ctx) if err != nil { panic(err) } return node } // Exec executes the query on the entity. func (_u *SoraAccountUpdateOne) Exec(ctx context.Context) error { _, err := _u.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. func (_u *SoraAccountUpdateOne) ExecX(ctx context.Context) { if err := _u.Exec(ctx); err != nil { panic(err) } } // defaults sets the default values of the builder before save. func (_u *SoraAccountUpdateOne) defaults() { if _, ok := _u.mutation.UpdatedAt(); !ok { v := soraaccount.UpdateDefaultUpdatedAt() _u.mutation.SetUpdatedAt(v) } } func (_u *SoraAccountUpdateOne) sqlSave(ctx context.Context) (_node *SoraAccount, err error) { _spec := sqlgraph.NewUpdateSpec(soraaccount.Table, soraaccount.Columns, sqlgraph.NewFieldSpec(soraaccount.FieldID, field.TypeInt64)) id, ok := _u.mutation.ID() if !ok { return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "SoraAccount.id" for update`)} } _spec.Node.ID.Value = id if fields := _u.fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) _spec.Node.Columns = append(_spec.Node.Columns, soraaccount.FieldID) for _, f := range fields { if !soraaccount.ValidColumn(f) { return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} } if f != soraaccount.FieldID { _spec.Node.Columns = append(_spec.Node.Columns, f) } } } if ps := _u.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if value, ok := _u.mutation.UpdatedAt(); ok { _spec.SetField(soraaccount.FieldUpdatedAt, field.TypeTime, value) } if value, ok := _u.mutation.AccountID(); ok { _spec.SetField(soraaccount.FieldAccountID, field.TypeInt64, value) } if value, ok := _u.mutation.AddedAccountID(); ok { _spec.AddField(soraaccount.FieldAccountID, field.TypeInt64, value) } if value, ok := _u.mutation.AccessToken(); ok { _spec.SetField(soraaccount.FieldAccessToken, field.TypeString, value) } if _u.mutation.AccessTokenCleared() { _spec.ClearField(soraaccount.FieldAccessToken, field.TypeString) } if value, ok := _u.mutation.SessionToken(); ok { _spec.SetField(soraaccount.FieldSessionToken, field.TypeString, value) } if _u.mutation.SessionTokenCleared() { _spec.ClearField(soraaccount.FieldSessionToken, field.TypeString) } if value, ok := _u.mutation.RefreshToken(); ok { _spec.SetField(soraaccount.FieldRefreshToken, field.TypeString, value) } if _u.mutation.RefreshTokenCleared() { _spec.ClearField(soraaccount.FieldRefreshToken, field.TypeString) } if value, ok := _u.mutation.ClientID(); ok { _spec.SetField(soraaccount.FieldClientID, field.TypeString, value) } if _u.mutation.ClientIDCleared() { _spec.ClearField(soraaccount.FieldClientID, field.TypeString) } if value, ok := _u.mutation.Email(); ok { _spec.SetField(soraaccount.FieldEmail, field.TypeString, value) } if _u.mutation.EmailCleared() { _spec.ClearField(soraaccount.FieldEmail, field.TypeString) } if value, ok := _u.mutation.Username(); ok { _spec.SetField(soraaccount.FieldUsername, field.TypeString, value) } if _u.mutation.UsernameCleared() { _spec.ClearField(soraaccount.FieldUsername, field.TypeString) } if value, ok := _u.mutation.Remark(); ok { _spec.SetField(soraaccount.FieldRemark, field.TypeString, value) } if _u.mutation.RemarkCleared() { _spec.ClearField(soraaccount.FieldRemark, field.TypeString) } if value, ok := _u.mutation.UseCount(); ok { _spec.SetField(soraaccount.FieldUseCount, field.TypeInt, value) } if value, ok := _u.mutation.AddedUseCount(); ok { _spec.AddField(soraaccount.FieldUseCount, field.TypeInt, value) } if value, ok := _u.mutation.PlanType(); ok { _spec.SetField(soraaccount.FieldPlanType, field.TypeString, value) } if _u.mutation.PlanTypeCleared() { _spec.ClearField(soraaccount.FieldPlanType, field.TypeString) } if value, ok := _u.mutation.PlanTitle(); ok { _spec.SetField(soraaccount.FieldPlanTitle, field.TypeString, value) } if _u.mutation.PlanTitleCleared() { _spec.ClearField(soraaccount.FieldPlanTitle, field.TypeString) } if value, ok := _u.mutation.SubscriptionEnd(); ok { _spec.SetField(soraaccount.FieldSubscriptionEnd, field.TypeTime, value) } if _u.mutation.SubscriptionEndCleared() { _spec.ClearField(soraaccount.FieldSubscriptionEnd, field.TypeTime) } if value, ok := _u.mutation.SoraSupported(); ok { _spec.SetField(soraaccount.FieldSoraSupported, field.TypeBool, value) } if value, ok := _u.mutation.SoraInviteCode(); ok { _spec.SetField(soraaccount.FieldSoraInviteCode, field.TypeString, value) } if _u.mutation.SoraInviteCodeCleared() { _spec.ClearField(soraaccount.FieldSoraInviteCode, field.TypeString) } if value, ok := _u.mutation.SoraRedeemedCount(); ok { _spec.SetField(soraaccount.FieldSoraRedeemedCount, field.TypeInt, value) } if value, ok := _u.mutation.AddedSoraRedeemedCount(); ok { _spec.AddField(soraaccount.FieldSoraRedeemedCount, field.TypeInt, value) } if value, ok := _u.mutation.SoraRemainingCount(); ok { _spec.SetField(soraaccount.FieldSoraRemainingCount, field.TypeInt, value) } if value, ok := _u.mutation.AddedSoraRemainingCount(); ok { _spec.AddField(soraaccount.FieldSoraRemainingCount, field.TypeInt, value) } if value, ok := _u.mutation.SoraTotalCount(); ok { _spec.SetField(soraaccount.FieldSoraTotalCount, field.TypeInt, value) } if value, ok := _u.mutation.AddedSoraTotalCount(); ok { _spec.AddField(soraaccount.FieldSoraTotalCount, field.TypeInt, value) } if value, ok := _u.mutation.SoraCooldownUntil(); ok { _spec.SetField(soraaccount.FieldSoraCooldownUntil, field.TypeTime, value) } if _u.mutation.SoraCooldownUntilCleared() { _spec.ClearField(soraaccount.FieldSoraCooldownUntil, field.TypeTime) } if value, ok := _u.mutation.CooledUntil(); ok { _spec.SetField(soraaccount.FieldCooledUntil, field.TypeTime, value) } if _u.mutation.CooledUntilCleared() { _spec.ClearField(soraaccount.FieldCooledUntil, field.TypeTime) } if value, ok := _u.mutation.ImageEnabled(); ok { _spec.SetField(soraaccount.FieldImageEnabled, field.TypeBool, value) } if value, ok := _u.mutation.VideoEnabled(); ok { _spec.SetField(soraaccount.FieldVideoEnabled, field.TypeBool, value) } if value, ok := _u.mutation.ImageConcurrency(); ok { _spec.SetField(soraaccount.FieldImageConcurrency, field.TypeInt, value) } if value, ok := _u.mutation.AddedImageConcurrency(); ok { _spec.AddField(soraaccount.FieldImageConcurrency, field.TypeInt, value) } if value, ok := _u.mutation.VideoConcurrency(); ok { _spec.SetField(soraaccount.FieldVideoConcurrency, field.TypeInt, value) } if value, ok := _u.mutation.AddedVideoConcurrency(); ok { _spec.AddField(soraaccount.FieldVideoConcurrency, field.TypeInt, value) } if value, ok := _u.mutation.IsExpired(); ok { _spec.SetField(soraaccount.FieldIsExpired, field.TypeBool, value) } _node = &SoraAccount{config: _u.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{soraaccount.Label} } else if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } _u.mutation.done = true return _node, nil }