mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
dialect/sql: make sql.In() with empty args fallback to False() (#2735)
* dialect/sql/builder: make sql.In() with empty args fallback to False() * fix indent * added comment * remove the equilvalent logic in the codegen side * comment fix, run go generate
This commit is contained in:
@@ -18,12 +18,6 @@ in the LICENSE file in the root directory of this source tree.
|
||||
{{- $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
|
||||
}
|
||||
v := make([]interface{}, len({{ $arg }}))
|
||||
for i := range v {
|
||||
v[i] = {{ $arg }}[i]
|
||||
|
||||
Reference in New Issue
Block a user