where.go 9.7 KB

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