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 (
|
||||
// NodeDelete is the builder for deleting a Node entity.
|
||||
type NodeDelete struct {
|
||||
config
|
||||
hooks []Hook
|
||||
mutation *NodeMutation
|
||||
predicates []predicate.Node
|
||||
hooks []Hook
|
||||
mutation *NodeMutation
|
||||
}
|
||||
|
||||
// Where adds a new predicate to the delete builder.
|
||||
func (nd *NodeDelete) Where(ps ...predicate.Node) *NodeDelete {
|
||||
nd.predicates = append(nd.predicates, ps...)
|
||||
nd.mutation.predicates = append(nd.mutation.predicates, ps...)
|
||||
return nd
|
||||
}
|
||||
|
||||
@@ -79,7 +78,7 @@ func (nd *NodeDelete) sqlExec(ctx context.Context) (int, error) {
|
||||
},
|
||||
},
|
||||
}
|
||||
if ps := nd.predicates; len(ps) > 0 {
|
||||
if ps := nd.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