entc/gen/template: allow mutating the sqlgraph.DeleteSpec by ent extensions or user templates

This commit is contained in:
Ariel Mashraki
2021-01-19 09:38:00 +02:00
committed by Ariel Mashraki
parent 63eb68a269
commit 7f5720cf92
2 changed files with 10 additions and 4 deletions

File diff suppressed because one or more lines are too long

View File

@@ -19,6 +19,12 @@ func ({{ $receiver}} *{{ $builder }}) sqlExec(ctx context.Context) (int, error)
},
},
}
{{- /* Allow mutating the sqlgraph.DeleteSpec by ent extensions or user templates.*/}}
{{- with $tmpls := matchTemplate "dialect/sql/delete/spec/*" }}
{{- range $tmpl := $tmpls }}
{{- xtemplate $tmpl $ }}
{{- end }}
{{- end }}
if ps := {{ $mutation }}.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {