mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
259 lines
6.8 KiB
Go
259 lines
6.8 KiB
Go
// Copyright 2019-present Facebook Inc. All rights reserved.
|
|
// This source code is licensed under the Apache 2.0 license found
|
|
// in the LICENSE file in the root directory of this source tree.
|
|
|
|
// Code generated by entc, DO NOT EDIT.
|
|
|
|
package user
|
|
|
|
import (
|
|
"entgo.io/ent/dialect/sql"
|
|
"entgo.io/ent/examples/version/ent/predicate"
|
|
)
|
|
|
|
// ID filters vertices based on their ID field.
|
|
func ID(id int) predicate.User {
|
|
return predicate.User(func(s *sql.Selector) {
|
|
s.Where(sql.EQ(s.C(FieldID), id))
|
|
})
|
|
}
|
|
|
|
// IDEQ applies the EQ predicate on the ID field.
|
|
func IDEQ(id int) predicate.User {
|
|
return predicate.User(func(s *sql.Selector) {
|
|
s.Where(sql.EQ(s.C(FieldID), id))
|
|
})
|
|
}
|
|
|
|
// IDNEQ applies the NEQ predicate on the ID field.
|
|
func IDNEQ(id int) predicate.User {
|
|
return predicate.User(func(s *sql.Selector) {
|
|
s.Where(sql.NEQ(s.C(FieldID), id))
|
|
})
|
|
}
|
|
|
|
// IDIn applies the In predicate on the ID field.
|
|
func IDIn(ids ...int) predicate.User {
|
|
return predicate.User(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(ids) == 0 {
|
|
s.Where(sql.False())
|
|
return
|
|
}
|
|
v := make([]interface{}, len(ids))
|
|
for i := range v {
|
|
v[i] = ids[i]
|
|
}
|
|
s.Where(sql.In(s.C(FieldID), v...))
|
|
})
|
|
}
|
|
|
|
// IDNotIn applies the NotIn predicate on the ID field.
|
|
func IDNotIn(ids ...int) predicate.User {
|
|
return predicate.User(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(ids) == 0 {
|
|
s.Where(sql.False())
|
|
return
|
|
}
|
|
v := make([]interface{}, len(ids))
|
|
for i := range v {
|
|
v[i] = ids[i]
|
|
}
|
|
s.Where(sql.NotIn(s.C(FieldID), v...))
|
|
})
|
|
}
|
|
|
|
// IDGT applies the GT predicate on the ID field.
|
|
func IDGT(id int) predicate.User {
|
|
return predicate.User(func(s *sql.Selector) {
|
|
s.Where(sql.GT(s.C(FieldID), id))
|
|
})
|
|
}
|
|
|
|
// IDGTE applies the GTE predicate on the ID field.
|
|
func IDGTE(id int) predicate.User {
|
|
return predicate.User(func(s *sql.Selector) {
|
|
s.Where(sql.GTE(s.C(FieldID), id))
|
|
})
|
|
}
|
|
|
|
// IDLT applies the LT predicate on the ID field.
|
|
func IDLT(id int) predicate.User {
|
|
return predicate.User(func(s *sql.Selector) {
|
|
s.Where(sql.LT(s.C(FieldID), id))
|
|
})
|
|
}
|
|
|
|
// IDLTE applies the LTE predicate on the ID field.
|
|
func IDLTE(id int) predicate.User {
|
|
return predicate.User(func(s *sql.Selector) {
|
|
s.Where(sql.LTE(s.C(FieldID), id))
|
|
})
|
|
}
|
|
|
|
// Version applies equality check predicate on the "version" field. It's identical to VersionEQ.
|
|
func Version(v int64) predicate.User {
|
|
return predicate.User(func(s *sql.Selector) {
|
|
s.Where(sql.EQ(s.C(FieldVersion), v))
|
|
})
|
|
}
|
|
|
|
// VersionEQ applies the EQ predicate on the "version" field.
|
|
func VersionEQ(v int64) predicate.User {
|
|
return predicate.User(func(s *sql.Selector) {
|
|
s.Where(sql.EQ(s.C(FieldVersion), v))
|
|
})
|
|
}
|
|
|
|
// VersionNEQ applies the NEQ predicate on the "version" field.
|
|
func VersionNEQ(v int64) predicate.User {
|
|
return predicate.User(func(s *sql.Selector) {
|
|
s.Where(sql.NEQ(s.C(FieldVersion), v))
|
|
})
|
|
}
|
|
|
|
// VersionIn applies the In predicate on the "version" field.
|
|
func VersionIn(vs ...int64) predicate.User {
|
|
v := make([]interface{}, len(vs))
|
|
for i := range v {
|
|
v[i] = vs[i]
|
|
}
|
|
return predicate.User(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(FieldVersion), v...))
|
|
})
|
|
}
|
|
|
|
// VersionNotIn applies the NotIn predicate on the "version" field.
|
|
func VersionNotIn(vs ...int64) predicate.User {
|
|
v := make([]interface{}, len(vs))
|
|
for i := range v {
|
|
v[i] = vs[i]
|
|
}
|
|
return predicate.User(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(FieldVersion), v...))
|
|
})
|
|
}
|
|
|
|
// VersionGT applies the GT predicate on the "version" field.
|
|
func VersionGT(v int64) predicate.User {
|
|
return predicate.User(func(s *sql.Selector) {
|
|
s.Where(sql.GT(s.C(FieldVersion), v))
|
|
})
|
|
}
|
|
|
|
// VersionGTE applies the GTE predicate on the "version" field.
|
|
func VersionGTE(v int64) predicate.User {
|
|
return predicate.User(func(s *sql.Selector) {
|
|
s.Where(sql.GTE(s.C(FieldVersion), v))
|
|
})
|
|
}
|
|
|
|
// VersionLT applies the LT predicate on the "version" field.
|
|
func VersionLT(v int64) predicate.User {
|
|
return predicate.User(func(s *sql.Selector) {
|
|
s.Where(sql.LT(s.C(FieldVersion), v))
|
|
})
|
|
}
|
|
|
|
// VersionLTE applies the LTE predicate on the "version" field.
|
|
func VersionLTE(v int64) predicate.User {
|
|
return predicate.User(func(s *sql.Selector) {
|
|
s.Where(sql.LTE(s.C(FieldVersion), v))
|
|
})
|
|
}
|
|
|
|
// StatusEQ applies the EQ predicate on the "status" field.
|
|
func StatusEQ(v Status) predicate.User {
|
|
return predicate.User(func(s *sql.Selector) {
|
|
s.Where(sql.EQ(s.C(FieldStatus), v))
|
|
})
|
|
}
|
|
|
|
// StatusNEQ applies the NEQ predicate on the "status" field.
|
|
func StatusNEQ(v Status) predicate.User {
|
|
return predicate.User(func(s *sql.Selector) {
|
|
s.Where(sql.NEQ(s.C(FieldStatus), v))
|
|
})
|
|
}
|
|
|
|
// StatusIn applies the In predicate on the "status" field.
|
|
func StatusIn(vs ...Status) predicate.User {
|
|
v := make([]interface{}, len(vs))
|
|
for i := range v {
|
|
v[i] = vs[i]
|
|
}
|
|
return predicate.User(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(FieldStatus), v...))
|
|
})
|
|
}
|
|
|
|
// StatusNotIn applies the NotIn predicate on the "status" field.
|
|
func StatusNotIn(vs ...Status) predicate.User {
|
|
v := make([]interface{}, len(vs))
|
|
for i := range v {
|
|
v[i] = vs[i]
|
|
}
|
|
return predicate.User(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(FieldStatus), v...))
|
|
})
|
|
}
|
|
|
|
// And groups predicates with the AND operator between them.
|
|
func And(predicates ...predicate.User) predicate.User {
|
|
return predicate.User(func(s *sql.Selector) {
|
|
s1 := s.Clone().SetP(nil)
|
|
for _, p := range predicates {
|
|
p(s1)
|
|
}
|
|
s.Where(s1.P())
|
|
})
|
|
}
|
|
|
|
// Or groups predicates with the OR operator between them.
|
|
func Or(predicates ...predicate.User) predicate.User {
|
|
return predicate.User(func(s *sql.Selector) {
|
|
s1 := s.Clone().SetP(nil)
|
|
for i, p := range predicates {
|
|
if i > 0 {
|
|
s1.Or()
|
|
}
|
|
p(s1)
|
|
}
|
|
s.Where(s1.P())
|
|
})
|
|
}
|
|
|
|
// Not applies the not operator on the given predicate.
|
|
func Not(p predicate.User) predicate.User {
|
|
return predicate.User(func(s *sql.Selector) {
|
|
p(s.Not())
|
|
})
|
|
}
|