@@ -21,9 +21,9 @@ type DeviceRequestUpdate struct {
|
||||
mutation *DeviceRequestMutation
|
||||
}
|
||||
|
||||
// Where adds a new predicate for the DeviceRequestUpdate builder.
|
||||
// Where appends a list predicates to the DeviceRequestUpdate builder.
|
||||
func (dru *DeviceRequestUpdate) Where(ps ...predicate.DeviceRequest) *DeviceRequestUpdate {
|
||||
dru.mutation.predicates = append(dru.mutation.predicates, ps...)
|
||||
dru.mutation.Where(ps...)
|
||||
return dru
|
||||
}
|
||||
|
||||
@@ -100,6 +100,9 @@ func (dru *DeviceRequestUpdate) Save(ctx context.Context) (int, error) {
|
||||
return affected, err
|
||||
})
|
||||
for i := len(dru.hooks) - 1; i >= 0; i-- {
|
||||
if dru.hooks[i] == nil {
|
||||
return 0, fmt.Errorf("db: uninitialized hook (forgotten import db/runtime?)")
|
||||
}
|
||||
mut = dru.hooks[i](mut)
|
||||
}
|
||||
if _, err := mut.Mutate(ctx, dru.mutation); err != nil {
|
||||
@@ -225,8 +228,8 @@ func (dru *DeviceRequestUpdate) sqlSave(ctx context.Context) (n int, err error)
|
||||
if n, err = sqlgraph.UpdateNodes(ctx, dru.driver, _spec); err != nil {
|
||||
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
||||
err = &NotFoundError{devicerequest.Label}
|
||||
} else if cerr, ok := isSQLConstraintError(err); ok {
|
||||
err = cerr
|
||||
} else if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{err.Error(), err}
|
||||
}
|
||||
return 0, err
|
||||
}
|
||||
@@ -321,6 +324,9 @@ func (druo *DeviceRequestUpdateOne) Save(ctx context.Context) (*DeviceRequest, e
|
||||
return node, err
|
||||
})
|
||||
for i := len(druo.hooks) - 1; i >= 0; i-- {
|
||||
if druo.hooks[i] == nil {
|
||||
return nil, fmt.Errorf("db: uninitialized hook (forgotten import db/runtime?)")
|
||||
}
|
||||
mut = druo.hooks[i](mut)
|
||||
}
|
||||
if _, err := mut.Mutate(ctx, druo.mutation); err != nil {
|
||||
@@ -466,8 +472,8 @@ func (druo *DeviceRequestUpdateOne) sqlSave(ctx context.Context) (_node *DeviceR
|
||||
if err = sqlgraph.UpdateNode(ctx, druo.driver, _spec); err != nil {
|
||||
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
||||
err = &NotFoundError{devicerequest.Label}
|
||||
} else if cerr, ok := isSQLConstraintError(err); ok {
|
||||
err = cerr
|
||||
} else if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{err.Error(), err}
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
Reference in New Issue
Block a user