entc/gen: move predicates to mutation object (#825)

This commit is contained in:
Ariel Mashraki
2020-10-07 14:22:14 +03:00
committed by GitHub
parent 4cedff2d5f
commit c2cdc52946
171 changed files with 674 additions and 720 deletions

View File

@@ -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)