|
@@ -172,6 +172,12 @@ func (cuu *CreditUsageUpdate) AddOrganizationID(u int64) *CreditUsageUpdate {
|
|
|
return cuu
|
|
|
}
|
|
|
|
|
|
+// ClearOrganizationID clears the value of the "organization_id" field.
|
|
|
+func (cuu *CreditUsageUpdate) ClearOrganizationID() *CreditUsageUpdate {
|
|
|
+ cuu.mutation.ClearOrganizationID()
|
|
|
+ return cuu
|
|
|
+}
|
|
|
+
|
|
|
// SetNid sets the "nid" field.
|
|
|
func (cuu *CreditUsageUpdate) SetNid(u uint64) *CreditUsageUpdate {
|
|
|
cuu.mutation.ResetNid()
|
|
@@ -280,11 +286,6 @@ func (cuu *CreditUsageUpdate) check() error {
|
|
|
return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "CreditUsage.status": %w`, err)}
|
|
|
}
|
|
|
}
|
|
|
- if v, ok := cuu.mutation.OrganizationID(); ok {
|
|
|
- if err := creditusage.OrganizationIDValidator(v); err != nil {
|
|
|
- return &ValidationError{Name: "organization_id", err: fmt.Errorf(`ent: validator failed for field "CreditUsage.organization_id": %w`, err)}
|
|
|
- }
|
|
|
- }
|
|
|
if v, ok := cuu.mutation.Reason(); ok {
|
|
|
if err := creditusage.ReasonValidator(v); err != nil {
|
|
|
return &ValidationError{Name: "reason", err: fmt.Errorf(`ent: validator failed for field "CreditUsage.reason": %w`, err)}
|
|
@@ -352,6 +353,9 @@ func (cuu *CreditUsageUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
|
|
if value, ok := cuu.mutation.AddedOrganizationID(); ok {
|
|
|
_spec.AddField(creditusage.FieldOrganizationID, field.TypeUint64, value)
|
|
|
}
|
|
|
+ if cuu.mutation.OrganizationIDCleared() {
|
|
|
+ _spec.ClearField(creditusage.FieldOrganizationID, field.TypeUint64)
|
|
|
+ }
|
|
|
if value, ok := cuu.mutation.Nid(); ok {
|
|
|
_spec.SetField(creditusage.FieldNid, field.TypeUint64, value)
|
|
|
}
|
|
@@ -528,6 +532,12 @@ func (cuuo *CreditUsageUpdateOne) AddOrganizationID(u int64) *CreditUsageUpdateO
|
|
|
return cuuo
|
|
|
}
|
|
|
|
|
|
+// ClearOrganizationID clears the value of the "organization_id" field.
|
|
|
+func (cuuo *CreditUsageUpdateOne) ClearOrganizationID() *CreditUsageUpdateOne {
|
|
|
+ cuuo.mutation.ClearOrganizationID()
|
|
|
+ return cuuo
|
|
|
+}
|
|
|
+
|
|
|
// SetNid sets the "nid" field.
|
|
|
func (cuuo *CreditUsageUpdateOne) SetNid(u uint64) *CreditUsageUpdateOne {
|
|
|
cuuo.mutation.ResetNid()
|
|
@@ -649,11 +659,6 @@ func (cuuo *CreditUsageUpdateOne) check() error {
|
|
|
return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "CreditUsage.status": %w`, err)}
|
|
|
}
|
|
|
}
|
|
|
- if v, ok := cuuo.mutation.OrganizationID(); ok {
|
|
|
- if err := creditusage.OrganizationIDValidator(v); err != nil {
|
|
|
- return &ValidationError{Name: "organization_id", err: fmt.Errorf(`ent: validator failed for field "CreditUsage.organization_id": %w`, err)}
|
|
|
- }
|
|
|
- }
|
|
|
if v, ok := cuuo.mutation.Reason(); ok {
|
|
|
if err := creditusage.ReasonValidator(v); err != nil {
|
|
|
return &ValidationError{Name: "reason", err: fmt.Errorf(`ent: validator failed for field "CreditUsage.reason": %w`, err)}
|
|
@@ -738,6 +743,9 @@ func (cuuo *CreditUsageUpdateOne) sqlSave(ctx context.Context) (_node *CreditUsa
|
|
|
if value, ok := cuuo.mutation.AddedOrganizationID(); ok {
|
|
|
_spec.AddField(creditusage.FieldOrganizationID, field.TypeUint64, value)
|
|
|
}
|
|
|
+ if cuuo.mutation.OrganizationIDCleared() {
|
|
|
+ _spec.ClearField(creditusage.FieldOrganizationID, field.TypeUint64)
|
|
|
+ }
|
|
|
if value, ok := cuuo.mutation.Nid(); ok {
|
|
|
_spec.SetField(creditusage.FieldNid, field.TypeUint64, value)
|
|
|
}
|