|
@@ -68,6 +68,12 @@ func (cbu *CreditBalanceUpdate) SetNillableUserID(s *string) *CreditBalanceUpdat
|
|
|
return cbu
|
|
|
}
|
|
|
|
|
|
+// ClearUserID clears the value of the "user_id" field.
|
|
|
+func (cbu *CreditBalanceUpdate) ClearUserID() *CreditBalanceUpdate {
|
|
|
+ cbu.mutation.ClearUserID()
|
|
|
+ return cbu
|
|
|
+}
|
|
|
+
|
|
|
// SetBalance sets the "balance" field.
|
|
|
func (cbu *CreditBalanceUpdate) SetBalance(f float32) *CreditBalanceUpdate {
|
|
|
cbu.mutation.ResetBalance()
|
|
@@ -192,11 +198,6 @@ func (cbu *CreditBalanceUpdate) defaults() error {
|
|
|
|
|
|
// check runs all checks and user-defined validators on the builder.
|
|
|
func (cbu *CreditBalanceUpdate) check() error {
|
|
|
- if v, ok := cbu.mutation.UserID(); ok {
|
|
|
- if err := creditbalance.UserIDValidator(v); err != nil {
|
|
|
- return &ValidationError{Name: "user_id", err: fmt.Errorf(`ent: validator failed for field "CreditBalance.user_id": %w`, err)}
|
|
|
- }
|
|
|
- }
|
|
|
if v, ok := cbu.mutation.Status(); ok {
|
|
|
if err := creditbalance.StatusValidator(v); err != nil {
|
|
|
return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "CreditBalance.status": %w`, err)}
|
|
@@ -229,6 +230,9 @@ func (cbu *CreditBalanceUpdate) sqlSave(ctx context.Context) (n int, err error)
|
|
|
if value, ok := cbu.mutation.UserID(); ok {
|
|
|
_spec.SetField(creditbalance.FieldUserID, field.TypeString, value)
|
|
|
}
|
|
|
+ if cbu.mutation.UserIDCleared() {
|
|
|
+ _spec.ClearField(creditbalance.FieldUserID, field.TypeString)
|
|
|
+ }
|
|
|
if value, ok := cbu.mutation.Balance(); ok {
|
|
|
_spec.SetField(creditbalance.FieldBalance, field.TypeFloat32, value)
|
|
|
}
|
|
@@ -313,6 +317,12 @@ func (cbuo *CreditBalanceUpdateOne) SetNillableUserID(s *string) *CreditBalanceU
|
|
|
return cbuo
|
|
|
}
|
|
|
|
|
|
+// ClearUserID clears the value of the "user_id" field.
|
|
|
+func (cbuo *CreditBalanceUpdateOne) ClearUserID() *CreditBalanceUpdateOne {
|
|
|
+ cbuo.mutation.ClearUserID()
|
|
|
+ return cbuo
|
|
|
+}
|
|
|
+
|
|
|
// SetBalance sets the "balance" field.
|
|
|
func (cbuo *CreditBalanceUpdateOne) SetBalance(f float32) *CreditBalanceUpdateOne {
|
|
|
cbuo.mutation.ResetBalance()
|
|
@@ -450,11 +460,6 @@ func (cbuo *CreditBalanceUpdateOne) defaults() error {
|
|
|
|
|
|
// check runs all checks and user-defined validators on the builder.
|
|
|
func (cbuo *CreditBalanceUpdateOne) check() error {
|
|
|
- if v, ok := cbuo.mutation.UserID(); ok {
|
|
|
- if err := creditbalance.UserIDValidator(v); err != nil {
|
|
|
- return &ValidationError{Name: "user_id", err: fmt.Errorf(`ent: validator failed for field "CreditBalance.user_id": %w`, err)}
|
|
|
- }
|
|
|
- }
|
|
|
if v, ok := cbuo.mutation.Status(); ok {
|
|
|
if err := creditbalance.StatusValidator(v); err != nil {
|
|
|
return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "CreditBalance.status": %w`, err)}
|
|
@@ -504,6 +509,9 @@ func (cbuo *CreditBalanceUpdateOne) sqlSave(ctx context.Context) (_node *CreditB
|
|
|
if value, ok := cbuo.mutation.UserID(); ok {
|
|
|
_spec.SetField(creditbalance.FieldUserID, field.TypeString, value)
|
|
|
}
|
|
|
+ if cbuo.mutation.UserIDCleared() {
|
|
|
+ _spec.ClearField(creditbalance.FieldUserID, field.TypeString)
|
|
|
+ }
|
|
|
if value, ok := cbuo.mutation.Balance(); ok {
|
|
|
_spec.SetField(creditbalance.FieldBalance, field.TypeFloat32, value)
|
|
|
}
|