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:
@@ -20,14 +20,13 @@ import (
|
||||
// NodeUpdate is the builder for updating Node entities.
|
||||
type NodeUpdate struct {
|
||||
config
|
||||
hooks []Hook
|
||||
mutation *NodeMutation
|
||||
predicates []predicate.Node
|
||||
hooks []Hook
|
||||
mutation *NodeMutation
|
||||
}
|
||||
|
||||
// Where adds a new predicate for the builder.
|
||||
func (nu *NodeUpdate) Where(ps ...predicate.Node) *NodeUpdate {
|
||||
nu.predicates = append(nu.predicates, ps...)
|
||||
nu.mutation.predicates = append(nu.mutation.predicates, ps...)
|
||||
return nu
|
||||
}
|
||||
|
||||
@@ -175,7 +174,7 @@ func (nu *NodeUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
},
|
||||
},
|
||||
}
|
||||
if ps := nu.predicates; len(ps) > 0 {
|
||||
if ps := nu.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