|
@@ -62,26 +62,6 @@ func (lu *LabelUpdate) ClearStatus() *LabelUpdate {
|
|
return lu
|
|
return lu
|
|
}
|
|
}
|
|
|
|
|
|
-// SetDeletedAt sets the "deleted_at" field.
|
|
|
|
-func (lu *LabelUpdate) SetDeletedAt(t time.Time) *LabelUpdate {
|
|
|
|
- lu.mutation.SetDeletedAt(t)
|
|
|
|
- return lu
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
|
|
|
|
-func (lu *LabelUpdate) SetNillableDeletedAt(t *time.Time) *LabelUpdate {
|
|
|
|
- if t != nil {
|
|
|
|
- lu.SetDeletedAt(*t)
|
|
|
|
- }
|
|
|
|
- return lu
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-// ClearDeletedAt clears the value of the "deleted_at" field.
|
|
|
|
-func (lu *LabelUpdate) ClearDeletedAt() *LabelUpdate {
|
|
|
|
- lu.mutation.ClearDeletedAt()
|
|
|
|
- return lu
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
// SetType sets the "type" field.
|
|
// SetType sets the "type" field.
|
|
func (lu *LabelUpdate) SetType(i int) *LabelUpdate {
|
|
func (lu *LabelUpdate) SetType(i int) *LabelUpdate {
|
|
lu.mutation.ResetType()
|
|
lu.mutation.ResetType()
|
|
@@ -249,9 +229,7 @@ func (lu *LabelUpdate) RemoveLabelRelationships(l ...*LabelRelationship) *LabelU
|
|
|
|
|
|
// Save executes the query and returns the number of nodes affected by the update operation.
|
|
// Save executes the query and returns the number of nodes affected by the update operation.
|
|
func (lu *LabelUpdate) Save(ctx context.Context) (int, error) {
|
|
func (lu *LabelUpdate) Save(ctx context.Context) (int, error) {
|
|
- if err := lu.defaults(); err != nil {
|
|
|
|
- return 0, err
|
|
|
|
- }
|
|
|
|
|
|
+ lu.defaults()
|
|
return withHooks(ctx, lu.sqlSave, lu.mutation, lu.hooks)
|
|
return withHooks(ctx, lu.sqlSave, lu.mutation, lu.hooks)
|
|
}
|
|
}
|
|
|
|
|
|
@@ -278,15 +256,11 @@ func (lu *LabelUpdate) ExecX(ctx context.Context) {
|
|
}
|
|
}
|
|
|
|
|
|
// defaults sets the default values of the builder before save.
|
|
// defaults sets the default values of the builder before save.
|
|
-func (lu *LabelUpdate) defaults() error {
|
|
|
|
|
|
+func (lu *LabelUpdate) defaults() {
|
|
if _, ok := lu.mutation.UpdatedAt(); !ok {
|
|
if _, ok := lu.mutation.UpdatedAt(); !ok {
|
|
- if label.UpdateDefaultUpdatedAt == nil {
|
|
|
|
- return fmt.Errorf("ent: uninitialized label.UpdateDefaultUpdatedAt (forgotten import ent/runtime?)")
|
|
|
|
- }
|
|
|
|
v := label.UpdateDefaultUpdatedAt()
|
|
v := label.UpdateDefaultUpdatedAt()
|
|
lu.mutation.SetUpdatedAt(v)
|
|
lu.mutation.SetUpdatedAt(v)
|
|
}
|
|
}
|
|
- return nil
|
|
|
|
}
|
|
}
|
|
|
|
|
|
func (lu *LabelUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
|
func (lu *LabelUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
|
@@ -310,12 +284,6 @@ func (lu *LabelUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
|
if lu.mutation.StatusCleared() {
|
|
if lu.mutation.StatusCleared() {
|
|
_spec.ClearField(label.FieldStatus, field.TypeUint8)
|
|
_spec.ClearField(label.FieldStatus, field.TypeUint8)
|
|
}
|
|
}
|
|
- if value, ok := lu.mutation.DeletedAt(); ok {
|
|
|
|
- _spec.SetField(label.FieldDeletedAt, field.TypeTime, value)
|
|
|
|
- }
|
|
|
|
- if lu.mutation.DeletedAtCleared() {
|
|
|
|
- _spec.ClearField(label.FieldDeletedAt, field.TypeTime)
|
|
|
|
- }
|
|
|
|
if value, ok := lu.mutation.GetType(); ok {
|
|
if value, ok := lu.mutation.GetType(); ok {
|
|
_spec.SetField(label.FieldType, field.TypeInt, value)
|
|
_spec.SetField(label.FieldType, field.TypeInt, value)
|
|
}
|
|
}
|
|
@@ -450,26 +418,6 @@ func (luo *LabelUpdateOne) ClearStatus() *LabelUpdateOne {
|
|
return luo
|
|
return luo
|
|
}
|
|
}
|
|
|
|
|
|
-// SetDeletedAt sets the "deleted_at" field.
|
|
|
|
-func (luo *LabelUpdateOne) SetDeletedAt(t time.Time) *LabelUpdateOne {
|
|
|
|
- luo.mutation.SetDeletedAt(t)
|
|
|
|
- return luo
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
|
|
|
|
-func (luo *LabelUpdateOne) SetNillableDeletedAt(t *time.Time) *LabelUpdateOne {
|
|
|
|
- if t != nil {
|
|
|
|
- luo.SetDeletedAt(*t)
|
|
|
|
- }
|
|
|
|
- return luo
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-// ClearDeletedAt clears the value of the "deleted_at" field.
|
|
|
|
-func (luo *LabelUpdateOne) ClearDeletedAt() *LabelUpdateOne {
|
|
|
|
- luo.mutation.ClearDeletedAt()
|
|
|
|
- return luo
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
// SetType sets the "type" field.
|
|
// SetType sets the "type" field.
|
|
func (luo *LabelUpdateOne) SetType(i int) *LabelUpdateOne {
|
|
func (luo *LabelUpdateOne) SetType(i int) *LabelUpdateOne {
|
|
luo.mutation.ResetType()
|
|
luo.mutation.ResetType()
|
|
@@ -650,9 +598,7 @@ func (luo *LabelUpdateOne) Select(field string, fields ...string) *LabelUpdateOn
|
|
|
|
|
|
// Save executes the query and returns the updated Label entity.
|
|
// Save executes the query and returns the updated Label entity.
|
|
func (luo *LabelUpdateOne) Save(ctx context.Context) (*Label, error) {
|
|
func (luo *LabelUpdateOne) Save(ctx context.Context) (*Label, error) {
|
|
- if err := luo.defaults(); err != nil {
|
|
|
|
- return nil, err
|
|
|
|
- }
|
|
|
|
|
|
+ luo.defaults()
|
|
return withHooks(ctx, luo.sqlSave, luo.mutation, luo.hooks)
|
|
return withHooks(ctx, luo.sqlSave, luo.mutation, luo.hooks)
|
|
}
|
|
}
|
|
|
|
|
|
@@ -679,15 +625,11 @@ func (luo *LabelUpdateOne) ExecX(ctx context.Context) {
|
|
}
|
|
}
|
|
|
|
|
|
// defaults sets the default values of the builder before save.
|
|
// defaults sets the default values of the builder before save.
|
|
-func (luo *LabelUpdateOne) defaults() error {
|
|
|
|
|
|
+func (luo *LabelUpdateOne) defaults() {
|
|
if _, ok := luo.mutation.UpdatedAt(); !ok {
|
|
if _, ok := luo.mutation.UpdatedAt(); !ok {
|
|
- if label.UpdateDefaultUpdatedAt == nil {
|
|
|
|
- return fmt.Errorf("ent: uninitialized label.UpdateDefaultUpdatedAt (forgotten import ent/runtime?)")
|
|
|
|
- }
|
|
|
|
v := label.UpdateDefaultUpdatedAt()
|
|
v := label.UpdateDefaultUpdatedAt()
|
|
luo.mutation.SetUpdatedAt(v)
|
|
luo.mutation.SetUpdatedAt(v)
|
|
}
|
|
}
|
|
- return nil
|
|
|
|
}
|
|
}
|
|
|
|
|
|
func (luo *LabelUpdateOne) sqlSave(ctx context.Context) (_node *Label, err error) {
|
|
func (luo *LabelUpdateOne) sqlSave(ctx context.Context) (_node *Label, err error) {
|
|
@@ -728,12 +670,6 @@ func (luo *LabelUpdateOne) sqlSave(ctx context.Context) (_node *Label, err error
|
|
if luo.mutation.StatusCleared() {
|
|
if luo.mutation.StatusCleared() {
|
|
_spec.ClearField(label.FieldStatus, field.TypeUint8)
|
|
_spec.ClearField(label.FieldStatus, field.TypeUint8)
|
|
}
|
|
}
|
|
- if value, ok := luo.mutation.DeletedAt(); ok {
|
|
|
|
- _spec.SetField(label.FieldDeletedAt, field.TypeTime, value)
|
|
|
|
- }
|
|
|
|
- if luo.mutation.DeletedAtCleared() {
|
|
|
|
- _spec.ClearField(label.FieldDeletedAt, field.TypeTime)
|
|
|
|
- }
|
|
|
|
if value, ok := luo.mutation.GetType(); ok {
|
|
if value, ok := luo.mutation.GetType(); ok {
|
|
_spec.SetField(label.FieldType, field.TypeInt, value)
|
|
_spec.SetField(label.FieldType, field.TypeInt, value)
|
|
}
|
|
}
|