mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
entc/gen: move predicates to mutation object (#825)
This commit is contained in:
@@ -22,14 +22,13 @@ import (
|
||||
// UserUpdate is the builder for updating User entities.
|
||||
type UserUpdate struct {
|
||||
config
|
||||
hooks []Hook
|
||||
mutation *UserMutation
|
||||
predicates []predicate.User
|
||||
hooks []Hook
|
||||
mutation *UserMutation
|
||||
}
|
||||
|
||||
// Where adds a new predicate for the builder.
|
||||
func (uu *UserUpdate) Where(ps ...predicate.User) *UserUpdate {
|
||||
uu.predicates = append(uu.predicates, ps...)
|
||||
uu.mutation.predicates = append(uu.mutation.predicates, ps...)
|
||||
return uu
|
||||
}
|
||||
|
||||
@@ -215,7 +214,7 @@ func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
},
|
||||
},
|
||||
}
|
||||
if ps := uu.predicates; len(ps) > 0 {
|
||||
if ps := uu.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
|
||||
Reference in New Issue
Block a user