ent/gen: remove unnecessary if block in IN predicates (#2758)

This commit is contained in:
Ariel Mashraki
2022-07-15 10:30:23 +03:00
committed by GitHub
parent 1c6ba55f9c
commit 047b804dcd
95 changed files with 0 additions and 3512 deletions

View File

@@ -125,12 +125,6 @@ func NameIn(vs ...string) predicate.File {
v[i] = vs[i]
}
return predicate.File(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.In(s.C(FieldName), v...))
})
}
@@ -142,12 +136,6 @@ func NameNotIn(vs ...string) predicate.File {
v[i] = vs[i]
}
return predicate.File(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.NotIn(s.C(FieldName), v...))
})
}
@@ -250,12 +238,6 @@ func ParentIDIn(vs ...int) predicate.File {
v[i] = vs[i]
}
return predicate.File(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.In(s.C(FieldParentID), v...))
})
}
@@ -267,12 +249,6 @@ func ParentIDNotIn(vs ...int) predicate.File {
v[i] = vs[i]
}
return predicate.File(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.NotIn(s.C(FieldParentID), v...))
})
}