entc/gen/template: clone modifiers if enabled (#4189)

Fixed https://github.com/ent/ent/issues/4026
This commit is contained in:
Ariel Mashraki
2024-08-23 11:55:49 +03:00
committed by GitHub
parent 057c0ee063
commit 459b772567
29 changed files with 87 additions and 56 deletions

View File

@@ -295,6 +295,9 @@ func ({{ $receiver }} *{{ $builder }}) Clone() *{{ $builder }} {
// clone intermediate query.
{{ $.Storage }}: {{ $receiver }}.{{ $.Storage }}.Clone(),
path: {{ $receiver }}.path,
{{- if $.FeatureEnabled "sql/modifier" }}
modifiers: append([]func(*sql.Selector){}, {{ $receiver }}.modifiers...),
{{- end }}
}
}