where.go 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381
  1. // Code generated by entc, DO NOT EDIT.
  2. package user
  3. import (
  4. "code.osinet.fr/fgm/entdemo/ent/predicate"
  5. "github.com/facebookincubator/ent/dialect/sql"
  6. "github.com/facebookincubator/ent/dialect/sql/sqlgraph"
  7. )
  8. // ID filters vertices based on their identifier.
  9. func ID(id int) predicate.User {
  10. return predicate.User(func(s *sql.Selector) {
  11. s.Where(sql.EQ(s.C(FieldID), id))
  12. })
  13. }
  14. // IDEQ applies the EQ predicate on the ID field.
  15. func IDEQ(id int) predicate.User {
  16. return predicate.User(func(s *sql.Selector) {
  17. s.Where(sql.EQ(s.C(FieldID), id))
  18. })
  19. }
  20. // IDNEQ applies the NEQ predicate on the ID field.
  21. func IDNEQ(id int) predicate.User {
  22. return predicate.User(func(s *sql.Selector) {
  23. s.Where(sql.NEQ(s.C(FieldID), id))
  24. })
  25. }
  26. // IDIn applies the In predicate on the ID field.
  27. func IDIn(ids ...int) predicate.User {
  28. return predicate.User(func(s *sql.Selector) {
  29. // if not arguments were provided, append the FALSE constants,
  30. // since we can't apply "IN ()". This will make this predicate falsy.
  31. if len(ids) == 0 {
  32. s.Where(sql.False())
  33. return
  34. }
  35. v := make([]interface{}, len(ids))
  36. for i := range v {
  37. v[i] = ids[i]
  38. }
  39. s.Where(sql.In(s.C(FieldID), v...))
  40. })
  41. }
  42. // IDNotIn applies the NotIn predicate on the ID field.
  43. func IDNotIn(ids ...int) predicate.User {
  44. return predicate.User(func(s *sql.Selector) {
  45. // if not arguments were provided, append the FALSE constants,
  46. // since we can't apply "IN ()". This will make this predicate falsy.
  47. if len(ids) == 0 {
  48. s.Where(sql.False())
  49. return
  50. }
  51. v := make([]interface{}, len(ids))
  52. for i := range v {
  53. v[i] = ids[i]
  54. }
  55. s.Where(sql.NotIn(s.C(FieldID), v...))
  56. })
  57. }
  58. // IDGT applies the GT predicate on the ID field.
  59. func IDGT(id int) predicate.User {
  60. return predicate.User(func(s *sql.Selector) {
  61. s.Where(sql.GT(s.C(FieldID), id))
  62. })
  63. }
  64. // IDGTE applies the GTE predicate on the ID field.
  65. func IDGTE(id int) predicate.User {
  66. return predicate.User(func(s *sql.Selector) {
  67. s.Where(sql.GTE(s.C(FieldID), id))
  68. })
  69. }
  70. // IDLT applies the LT predicate on the ID field.
  71. func IDLT(id int) predicate.User {
  72. return predicate.User(func(s *sql.Selector) {
  73. s.Where(sql.LT(s.C(FieldID), id))
  74. })
  75. }
  76. // IDLTE applies the LTE predicate on the ID field.
  77. func IDLTE(id int) predicate.User {
  78. return predicate.User(func(s *sql.Selector) {
  79. s.Where(sql.LTE(s.C(FieldID), id))
  80. })
  81. }
  82. // Age applies equality check predicate on the "age" field. It's identical to AgeEQ.
  83. func Age(v int) predicate.User {
  84. return predicate.User(func(s *sql.Selector) {
  85. s.Where(sql.EQ(s.C(FieldAge), v))
  86. })
  87. }
  88. // Name applies equality check predicate on the "name" field. It's identical to NameEQ.
  89. func Name(v string) predicate.User {
  90. return predicate.User(func(s *sql.Selector) {
  91. s.Where(sql.EQ(s.C(FieldName), v))
  92. })
  93. }
  94. // AgeEQ applies the EQ predicate on the "age" field.
  95. func AgeEQ(v int) predicate.User {
  96. return predicate.User(func(s *sql.Selector) {
  97. s.Where(sql.EQ(s.C(FieldAge), v))
  98. })
  99. }
  100. // AgeNEQ applies the NEQ predicate on the "age" field.
  101. func AgeNEQ(v int) predicate.User {
  102. return predicate.User(func(s *sql.Selector) {
  103. s.Where(sql.NEQ(s.C(FieldAge), v))
  104. })
  105. }
  106. // AgeIn applies the In predicate on the "age" field.
  107. func AgeIn(vs ...int) predicate.User {
  108. v := make([]interface{}, len(vs))
  109. for i := range v {
  110. v[i] = vs[i]
  111. }
  112. return predicate.User(func(s *sql.Selector) {
  113. // if not arguments were provided, append the FALSE constants,
  114. // since we can't apply "IN ()". This will make this predicate falsy.
  115. if len(vs) == 0 {
  116. s.Where(sql.False())
  117. return
  118. }
  119. s.Where(sql.In(s.C(FieldAge), v...))
  120. })
  121. }
  122. // AgeNotIn applies the NotIn predicate on the "age" field.
  123. func AgeNotIn(vs ...int) predicate.User {
  124. v := make([]interface{}, len(vs))
  125. for i := range v {
  126. v[i] = vs[i]
  127. }
  128. return predicate.User(func(s *sql.Selector) {
  129. // if not arguments were provided, append the FALSE constants,
  130. // since we can't apply "IN ()". This will make this predicate falsy.
  131. if len(vs) == 0 {
  132. s.Where(sql.False())
  133. return
  134. }
  135. s.Where(sql.NotIn(s.C(FieldAge), v...))
  136. })
  137. }
  138. // AgeGT applies the GT predicate on the "age" field.
  139. func AgeGT(v int) predicate.User {
  140. return predicate.User(func(s *sql.Selector) {
  141. s.Where(sql.GT(s.C(FieldAge), v))
  142. })
  143. }
  144. // AgeGTE applies the GTE predicate on the "age" field.
  145. func AgeGTE(v int) predicate.User {
  146. return predicate.User(func(s *sql.Selector) {
  147. s.Where(sql.GTE(s.C(FieldAge), v))
  148. })
  149. }
  150. // AgeLT applies the LT predicate on the "age" field.
  151. func AgeLT(v int) predicate.User {
  152. return predicate.User(func(s *sql.Selector) {
  153. s.Where(sql.LT(s.C(FieldAge), v))
  154. })
  155. }
  156. // AgeLTE applies the LTE predicate on the "age" field.
  157. func AgeLTE(v int) predicate.User {
  158. return predicate.User(func(s *sql.Selector) {
  159. s.Where(sql.LTE(s.C(FieldAge), v))
  160. })
  161. }
  162. // NameEQ applies the EQ predicate on the "name" field.
  163. func NameEQ(v string) predicate.User {
  164. return predicate.User(func(s *sql.Selector) {
  165. s.Where(sql.EQ(s.C(FieldName), v))
  166. })
  167. }
  168. // NameNEQ applies the NEQ predicate on the "name" field.
  169. func NameNEQ(v string) predicate.User {
  170. return predicate.User(func(s *sql.Selector) {
  171. s.Where(sql.NEQ(s.C(FieldName), v))
  172. })
  173. }
  174. // NameIn applies the In predicate on the "name" field.
  175. func NameIn(vs ...string) predicate.User {
  176. v := make([]interface{}, len(vs))
  177. for i := range v {
  178. v[i] = vs[i]
  179. }
  180. return predicate.User(func(s *sql.Selector) {
  181. // if not arguments were provided, append the FALSE constants,
  182. // since we can't apply "IN ()". This will make this predicate falsy.
  183. if len(vs) == 0 {
  184. s.Where(sql.False())
  185. return
  186. }
  187. s.Where(sql.In(s.C(FieldName), v...))
  188. })
  189. }
  190. // NameNotIn applies the NotIn predicate on the "name" field.
  191. func NameNotIn(vs ...string) predicate.User {
  192. v := make([]interface{}, len(vs))
  193. for i := range v {
  194. v[i] = vs[i]
  195. }
  196. return predicate.User(func(s *sql.Selector) {
  197. // if not arguments were provided, append the FALSE constants,
  198. // since we can't apply "IN ()". This will make this predicate falsy.
  199. if len(vs) == 0 {
  200. s.Where(sql.False())
  201. return
  202. }
  203. s.Where(sql.NotIn(s.C(FieldName), v...))
  204. })
  205. }
  206. // NameGT applies the GT predicate on the "name" field.
  207. func NameGT(v string) predicate.User {
  208. return predicate.User(func(s *sql.Selector) {
  209. s.Where(sql.GT(s.C(FieldName), v))
  210. })
  211. }
  212. // NameGTE applies the GTE predicate on the "name" field.
  213. func NameGTE(v string) predicate.User {
  214. return predicate.User(func(s *sql.Selector) {
  215. s.Where(sql.GTE(s.C(FieldName), v))
  216. })
  217. }
  218. // NameLT applies the LT predicate on the "name" field.
  219. func NameLT(v string) predicate.User {
  220. return predicate.User(func(s *sql.Selector) {
  221. s.Where(sql.LT(s.C(FieldName), v))
  222. })
  223. }
  224. // NameLTE applies the LTE predicate on the "name" field.
  225. func NameLTE(v string) predicate.User {
  226. return predicate.User(func(s *sql.Selector) {
  227. s.Where(sql.LTE(s.C(FieldName), v))
  228. })
  229. }
  230. // NameContains applies the Contains predicate on the "name" field.
  231. func NameContains(v string) predicate.User {
  232. return predicate.User(func(s *sql.Selector) {
  233. s.Where(sql.Contains(s.C(FieldName), v))
  234. })
  235. }
  236. // NameHasPrefix applies the HasPrefix predicate on the "name" field.
  237. func NameHasPrefix(v string) predicate.User {
  238. return predicate.User(func(s *sql.Selector) {
  239. s.Where(sql.HasPrefix(s.C(FieldName), v))
  240. })
  241. }
  242. // NameHasSuffix applies the HasSuffix predicate on the "name" field.
  243. func NameHasSuffix(v string) predicate.User {
  244. return predicate.User(func(s *sql.Selector) {
  245. s.Where(sql.HasSuffix(s.C(FieldName), v))
  246. })
  247. }
  248. // NameEqualFold applies the EqualFold predicate on the "name" field.
  249. func NameEqualFold(v string) predicate.User {
  250. return predicate.User(func(s *sql.Selector) {
  251. s.Where(sql.EqualFold(s.C(FieldName), v))
  252. })
  253. }
  254. // NameContainsFold applies the ContainsFold predicate on the "name" field.
  255. func NameContainsFold(v string) predicate.User {
  256. return predicate.User(func(s *sql.Selector) {
  257. s.Where(sql.ContainsFold(s.C(FieldName), v))
  258. })
  259. }
  260. // HasCars applies the HasEdge predicate on the "cars" edge.
  261. func HasCars() predicate.User {
  262. return predicate.User(func(s *sql.Selector) {
  263. step := sqlgraph.NewStep(
  264. sqlgraph.From(Table, FieldID),
  265. sqlgraph.To(CarsTable, FieldID),
  266. sqlgraph.Edge(sqlgraph.O2M, false, CarsTable, CarsColumn),
  267. )
  268. sqlgraph.HasNeighbors(s, step)
  269. })
  270. }
  271. // HasCarsWith applies the HasEdge predicate on the "cars" edge with a given conditions (other predicates).
  272. func HasCarsWith(preds ...predicate.Car) predicate.User {
  273. return predicate.User(func(s *sql.Selector) {
  274. step := sqlgraph.NewStep(
  275. sqlgraph.From(Table, FieldID),
  276. sqlgraph.To(CarsInverseTable, FieldID),
  277. sqlgraph.Edge(sqlgraph.O2M, false, CarsTable, CarsColumn),
  278. )
  279. sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
  280. for _, p := range preds {
  281. p(s)
  282. }
  283. })
  284. })
  285. }
  286. // HasGroups applies the HasEdge predicate on the "groups" edge.
  287. func HasGroups() predicate.User {
  288. return predicate.User(func(s *sql.Selector) {
  289. step := sqlgraph.NewStep(
  290. sqlgraph.From(Table, FieldID),
  291. sqlgraph.To(GroupsTable, FieldID),
  292. sqlgraph.Edge(sqlgraph.M2M, true, GroupsTable, GroupsPrimaryKey...),
  293. )
  294. sqlgraph.HasNeighbors(s, step)
  295. })
  296. }
  297. // HasGroupsWith applies the HasEdge predicate on the "groups" edge with a given conditions (other predicates).
  298. func HasGroupsWith(preds ...predicate.Group) predicate.User {
  299. return predicate.User(func(s *sql.Selector) {
  300. step := sqlgraph.NewStep(
  301. sqlgraph.From(Table, FieldID),
  302. sqlgraph.To(GroupsInverseTable, FieldID),
  303. sqlgraph.Edge(sqlgraph.M2M, true, GroupsTable, GroupsPrimaryKey...),
  304. )
  305. sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
  306. for _, p := range preds {
  307. p(s)
  308. }
  309. })
  310. })
  311. }
  312. // And groups list of predicates with the AND operator between them.
  313. func And(predicates ...predicate.User) predicate.User {
  314. return predicate.User(func(s *sql.Selector) {
  315. s1 := s.Clone().SetP(nil)
  316. for _, p := range predicates {
  317. p(s1)
  318. }
  319. s.Where(s1.P())
  320. })
  321. }
  322. // Or groups list of predicates with the OR operator between them.
  323. func Or(predicates ...predicate.User) predicate.User {
  324. return predicate.User(func(s *sql.Selector) {
  325. s1 := s.Clone().SetP(nil)
  326. for i, p := range predicates {
  327. if i > 0 {
  328. s1.Or()
  329. }
  330. p(s1)
  331. }
  332. s.Where(s1.P())
  333. })
  334. }
  335. // Not applies the not operator on the given predicate.
  336. func Not(p predicate.User) predicate.User {
  337. return predicate.User(func(s *sql.Selector) {
  338. p(s.Not())
  339. })
  340. }