mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
ent/gen: remove unnecessary if block in IN predicates (#2758)
This commit is contained in:
@@ -41,14 +41,6 @@ in the LICENSE file in the root directory of this source tree.
|
||||
{{- $arg := $.Scope.Arg -}}
|
||||
{{- $storage := $.Scope.Storage -}}
|
||||
func(s *sql.Selector) {
|
||||
{{- if $op.Variadic }}
|
||||
// if not arguments were provided, append the FALSE constants,
|
||||
// since we can't apply "IN ()". This will make this predicate falsy.
|
||||
if len({{ $arg }}) == 0 {
|
||||
s.Where(sql.False())
|
||||
return
|
||||
}
|
||||
{{- end }}
|
||||
s.Where(sql.{{ call $storage.OpCode $op }}(s.C({{ $f.Constant }}){{ if not $op.Niladic }}, {{ $arg }}{{ if $op.Variadic }}...{{ end }}{{ end }}))
|
||||
}
|
||||
{{- end }}
|
||||
|
||||
Reference in New Issue
Block a user