where.go 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514
  1. // Code generated by entc, DO NOT EDIT.
  2. package todo
  3. import (
  4. "time"
  5. "todo/ent/predicate"
  6. "entgo.io/ent/dialect/sql"
  7. "entgo.io/ent/dialect/sql/sqlgraph"
  8. )
  9. // ID filters vertices based on their ID field.
  10. func ID(id int) predicate.Todo {
  11. return predicate.Todo(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.Todo {
  17. return predicate.Todo(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.Todo {
  23. return predicate.Todo(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.Todo {
  29. return predicate.Todo(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.Todo {
  45. return predicate.Todo(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.Todo {
  61. return predicate.Todo(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.Todo {
  67. return predicate.Todo(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.Todo {
  73. return predicate.Todo(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.Todo {
  79. return predicate.Todo(func(s *sql.Selector) {
  80. s.Where(sql.LTE(s.C(FieldID), id))
  81. })
  82. }
  83. // Text applies equality check predicate on the "text" field. It's identical to TextEQ.
  84. func Text(v string) predicate.Todo {
  85. return predicate.Todo(func(s *sql.Selector) {
  86. s.Where(sql.EQ(s.C(FieldText), v))
  87. })
  88. }
  89. // CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ.
  90. func CreatedAt(v time.Time) predicate.Todo {
  91. return predicate.Todo(func(s *sql.Selector) {
  92. s.Where(sql.EQ(s.C(FieldCreatedAt), v))
  93. })
  94. }
  95. // Priority applies equality check predicate on the "priority" field. It's identical to PriorityEQ.
  96. func Priority(v int) predicate.Todo {
  97. return predicate.Todo(func(s *sql.Selector) {
  98. s.Where(sql.EQ(s.C(FieldPriority), v))
  99. })
  100. }
  101. // TextEQ applies the EQ predicate on the "text" field.
  102. func TextEQ(v string) predicate.Todo {
  103. return predicate.Todo(func(s *sql.Selector) {
  104. s.Where(sql.EQ(s.C(FieldText), v))
  105. })
  106. }
  107. // TextNEQ applies the NEQ predicate on the "text" field.
  108. func TextNEQ(v string) predicate.Todo {
  109. return predicate.Todo(func(s *sql.Selector) {
  110. s.Where(sql.NEQ(s.C(FieldText), v))
  111. })
  112. }
  113. // TextIn applies the In predicate on the "text" field.
  114. func TextIn(vs ...string) predicate.Todo {
  115. v := make([]interface{}, len(vs))
  116. for i := range v {
  117. v[i] = vs[i]
  118. }
  119. return predicate.Todo(func(s *sql.Selector) {
  120. // if not arguments were provided, append the FALSE constants,
  121. // since we can't apply "IN ()". This will make this predicate falsy.
  122. if len(v) == 0 {
  123. s.Where(sql.False())
  124. return
  125. }
  126. s.Where(sql.In(s.C(FieldText), v...))
  127. })
  128. }
  129. // TextNotIn applies the NotIn predicate on the "text" field.
  130. func TextNotIn(vs ...string) predicate.Todo {
  131. v := make([]interface{}, len(vs))
  132. for i := range v {
  133. v[i] = vs[i]
  134. }
  135. return predicate.Todo(func(s *sql.Selector) {
  136. // if not arguments were provided, append the FALSE constants,
  137. // since we can't apply "IN ()". This will make this predicate falsy.
  138. if len(v) == 0 {
  139. s.Where(sql.False())
  140. return
  141. }
  142. s.Where(sql.NotIn(s.C(FieldText), v...))
  143. })
  144. }
  145. // TextGT applies the GT predicate on the "text" field.
  146. func TextGT(v string) predicate.Todo {
  147. return predicate.Todo(func(s *sql.Selector) {
  148. s.Where(sql.GT(s.C(FieldText), v))
  149. })
  150. }
  151. // TextGTE applies the GTE predicate on the "text" field.
  152. func TextGTE(v string) predicate.Todo {
  153. return predicate.Todo(func(s *sql.Selector) {
  154. s.Where(sql.GTE(s.C(FieldText), v))
  155. })
  156. }
  157. // TextLT applies the LT predicate on the "text" field.
  158. func TextLT(v string) predicate.Todo {
  159. return predicate.Todo(func(s *sql.Selector) {
  160. s.Where(sql.LT(s.C(FieldText), v))
  161. })
  162. }
  163. // TextLTE applies the LTE predicate on the "text" field.
  164. func TextLTE(v string) predicate.Todo {
  165. return predicate.Todo(func(s *sql.Selector) {
  166. s.Where(sql.LTE(s.C(FieldText), v))
  167. })
  168. }
  169. // TextContains applies the Contains predicate on the "text" field.
  170. func TextContains(v string) predicate.Todo {
  171. return predicate.Todo(func(s *sql.Selector) {
  172. s.Where(sql.Contains(s.C(FieldText), v))
  173. })
  174. }
  175. // TextHasPrefix applies the HasPrefix predicate on the "text" field.
  176. func TextHasPrefix(v string) predicate.Todo {
  177. return predicate.Todo(func(s *sql.Selector) {
  178. s.Where(sql.HasPrefix(s.C(FieldText), v))
  179. })
  180. }
  181. // TextHasSuffix applies the HasSuffix predicate on the "text" field.
  182. func TextHasSuffix(v string) predicate.Todo {
  183. return predicate.Todo(func(s *sql.Selector) {
  184. s.Where(sql.HasSuffix(s.C(FieldText), v))
  185. })
  186. }
  187. // TextEqualFold applies the EqualFold predicate on the "text" field.
  188. func TextEqualFold(v string) predicate.Todo {
  189. return predicate.Todo(func(s *sql.Selector) {
  190. s.Where(sql.EqualFold(s.C(FieldText), v))
  191. })
  192. }
  193. // TextContainsFold applies the ContainsFold predicate on the "text" field.
  194. func TextContainsFold(v string) predicate.Todo {
  195. return predicate.Todo(func(s *sql.Selector) {
  196. s.Where(sql.ContainsFold(s.C(FieldText), v))
  197. })
  198. }
  199. // CreatedAtEQ applies the EQ predicate on the "created_at" field.
  200. func CreatedAtEQ(v time.Time) predicate.Todo {
  201. return predicate.Todo(func(s *sql.Selector) {
  202. s.Where(sql.EQ(s.C(FieldCreatedAt), v))
  203. })
  204. }
  205. // CreatedAtNEQ applies the NEQ predicate on the "created_at" field.
  206. func CreatedAtNEQ(v time.Time) predicate.Todo {
  207. return predicate.Todo(func(s *sql.Selector) {
  208. s.Where(sql.NEQ(s.C(FieldCreatedAt), v))
  209. })
  210. }
  211. // CreatedAtIn applies the In predicate on the "created_at" field.
  212. func CreatedAtIn(vs ...time.Time) predicate.Todo {
  213. v := make([]interface{}, len(vs))
  214. for i := range v {
  215. v[i] = vs[i]
  216. }
  217. return predicate.Todo(func(s *sql.Selector) {
  218. // if not arguments were provided, append the FALSE constants,
  219. // since we can't apply "IN ()". This will make this predicate falsy.
  220. if len(v) == 0 {
  221. s.Where(sql.False())
  222. return
  223. }
  224. s.Where(sql.In(s.C(FieldCreatedAt), v...))
  225. })
  226. }
  227. // CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
  228. func CreatedAtNotIn(vs ...time.Time) predicate.Todo {
  229. v := make([]interface{}, len(vs))
  230. for i := range v {
  231. v[i] = vs[i]
  232. }
  233. return predicate.Todo(func(s *sql.Selector) {
  234. // if not arguments were provided, append the FALSE constants,
  235. // since we can't apply "IN ()". This will make this predicate falsy.
  236. if len(v) == 0 {
  237. s.Where(sql.False())
  238. return
  239. }
  240. s.Where(sql.NotIn(s.C(FieldCreatedAt), v...))
  241. })
  242. }
  243. // CreatedAtGT applies the GT predicate on the "created_at" field.
  244. func CreatedAtGT(v time.Time) predicate.Todo {
  245. return predicate.Todo(func(s *sql.Selector) {
  246. s.Where(sql.GT(s.C(FieldCreatedAt), v))
  247. })
  248. }
  249. // CreatedAtGTE applies the GTE predicate on the "created_at" field.
  250. func CreatedAtGTE(v time.Time) predicate.Todo {
  251. return predicate.Todo(func(s *sql.Selector) {
  252. s.Where(sql.GTE(s.C(FieldCreatedAt), v))
  253. })
  254. }
  255. // CreatedAtLT applies the LT predicate on the "created_at" field.
  256. func CreatedAtLT(v time.Time) predicate.Todo {
  257. return predicate.Todo(func(s *sql.Selector) {
  258. s.Where(sql.LT(s.C(FieldCreatedAt), v))
  259. })
  260. }
  261. // CreatedAtLTE applies the LTE predicate on the "created_at" field.
  262. func CreatedAtLTE(v time.Time) predicate.Todo {
  263. return predicate.Todo(func(s *sql.Selector) {
  264. s.Where(sql.LTE(s.C(FieldCreatedAt), v))
  265. })
  266. }
  267. // StatusEQ applies the EQ predicate on the "status" field.
  268. func StatusEQ(v Status) predicate.Todo {
  269. return predicate.Todo(func(s *sql.Selector) {
  270. s.Where(sql.EQ(s.C(FieldStatus), v))
  271. })
  272. }
  273. // StatusNEQ applies the NEQ predicate on the "status" field.
  274. func StatusNEQ(v Status) predicate.Todo {
  275. return predicate.Todo(func(s *sql.Selector) {
  276. s.Where(sql.NEQ(s.C(FieldStatus), v))
  277. })
  278. }
  279. // StatusIn applies the In predicate on the "status" field.
  280. func StatusIn(vs ...Status) predicate.Todo {
  281. v := make([]interface{}, len(vs))
  282. for i := range v {
  283. v[i] = vs[i]
  284. }
  285. return predicate.Todo(func(s *sql.Selector) {
  286. // if not arguments were provided, append the FALSE constants,
  287. // since we can't apply "IN ()". This will make this predicate falsy.
  288. if len(v) == 0 {
  289. s.Where(sql.False())
  290. return
  291. }
  292. s.Where(sql.In(s.C(FieldStatus), v...))
  293. })
  294. }
  295. // StatusNotIn applies the NotIn predicate on the "status" field.
  296. func StatusNotIn(vs ...Status) predicate.Todo {
  297. v := make([]interface{}, len(vs))
  298. for i := range v {
  299. v[i] = vs[i]
  300. }
  301. return predicate.Todo(func(s *sql.Selector) {
  302. // if not arguments were provided, append the FALSE constants,
  303. // since we can't apply "IN ()". This will make this predicate falsy.
  304. if len(v) == 0 {
  305. s.Where(sql.False())
  306. return
  307. }
  308. s.Where(sql.NotIn(s.C(FieldStatus), v...))
  309. })
  310. }
  311. // PriorityEQ applies the EQ predicate on the "priority" field.
  312. func PriorityEQ(v int) predicate.Todo {
  313. return predicate.Todo(func(s *sql.Selector) {
  314. s.Where(sql.EQ(s.C(FieldPriority), v))
  315. })
  316. }
  317. // PriorityNEQ applies the NEQ predicate on the "priority" field.
  318. func PriorityNEQ(v int) predicate.Todo {
  319. return predicate.Todo(func(s *sql.Selector) {
  320. s.Where(sql.NEQ(s.C(FieldPriority), v))
  321. })
  322. }
  323. // PriorityIn applies the In predicate on the "priority" field.
  324. func PriorityIn(vs ...int) predicate.Todo {
  325. v := make([]interface{}, len(vs))
  326. for i := range v {
  327. v[i] = vs[i]
  328. }
  329. return predicate.Todo(func(s *sql.Selector) {
  330. // if not arguments were provided, append the FALSE constants,
  331. // since we can't apply "IN ()". This will make this predicate falsy.
  332. if len(v) == 0 {
  333. s.Where(sql.False())
  334. return
  335. }
  336. s.Where(sql.In(s.C(FieldPriority), v...))
  337. })
  338. }
  339. // PriorityNotIn applies the NotIn predicate on the "priority" field.
  340. func PriorityNotIn(vs ...int) predicate.Todo {
  341. v := make([]interface{}, len(vs))
  342. for i := range v {
  343. v[i] = vs[i]
  344. }
  345. return predicate.Todo(func(s *sql.Selector) {
  346. // if not arguments were provided, append the FALSE constants,
  347. // since we can't apply "IN ()". This will make this predicate falsy.
  348. if len(v) == 0 {
  349. s.Where(sql.False())
  350. return
  351. }
  352. s.Where(sql.NotIn(s.C(FieldPriority), v...))
  353. })
  354. }
  355. // PriorityGT applies the GT predicate on the "priority" field.
  356. func PriorityGT(v int) predicate.Todo {
  357. return predicate.Todo(func(s *sql.Selector) {
  358. s.Where(sql.GT(s.C(FieldPriority), v))
  359. })
  360. }
  361. // PriorityGTE applies the GTE predicate on the "priority" field.
  362. func PriorityGTE(v int) predicate.Todo {
  363. return predicate.Todo(func(s *sql.Selector) {
  364. s.Where(sql.GTE(s.C(FieldPriority), v))
  365. })
  366. }
  367. // PriorityLT applies the LT predicate on the "priority" field.
  368. func PriorityLT(v int) predicate.Todo {
  369. return predicate.Todo(func(s *sql.Selector) {
  370. s.Where(sql.LT(s.C(FieldPriority), v))
  371. })
  372. }
  373. // PriorityLTE applies the LTE predicate on the "priority" field.
  374. func PriorityLTE(v int) predicate.Todo {
  375. return predicate.Todo(func(s *sql.Selector) {
  376. s.Where(sql.LTE(s.C(FieldPriority), v))
  377. })
  378. }
  379. // HasChildren applies the HasEdge predicate on the "children" edge.
  380. func HasChildren() predicate.Todo {
  381. return predicate.Todo(func(s *sql.Selector) {
  382. step := sqlgraph.NewStep(
  383. sqlgraph.From(Table, FieldID),
  384. sqlgraph.To(ChildrenTable, FieldID),
  385. sqlgraph.Edge(sqlgraph.O2M, true, ChildrenTable, ChildrenColumn),
  386. )
  387. sqlgraph.HasNeighbors(s, step)
  388. })
  389. }
  390. // HasChildrenWith applies the HasEdge predicate on the "children" edge with a given conditions (other predicates).
  391. func HasChildrenWith(preds ...predicate.Todo) predicate.Todo {
  392. return predicate.Todo(func(s *sql.Selector) {
  393. step := sqlgraph.NewStep(
  394. sqlgraph.From(Table, FieldID),
  395. sqlgraph.To(Table, FieldID),
  396. sqlgraph.Edge(sqlgraph.O2M, true, ChildrenTable, ChildrenColumn),
  397. )
  398. sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
  399. for _, p := range preds {
  400. p(s)
  401. }
  402. })
  403. })
  404. }
  405. // HasParent applies the HasEdge predicate on the "parent" edge.
  406. func HasParent() predicate.Todo {
  407. return predicate.Todo(func(s *sql.Selector) {
  408. step := sqlgraph.NewStep(
  409. sqlgraph.From(Table, FieldID),
  410. sqlgraph.To(ParentTable, FieldID),
  411. sqlgraph.Edge(sqlgraph.M2O, false, ParentTable, ParentColumn),
  412. )
  413. sqlgraph.HasNeighbors(s, step)
  414. })
  415. }
  416. // HasParentWith applies the HasEdge predicate on the "parent" edge with a given conditions (other predicates).
  417. func HasParentWith(preds ...predicate.Todo) predicate.Todo {
  418. return predicate.Todo(func(s *sql.Selector) {
  419. step := sqlgraph.NewStep(
  420. sqlgraph.From(Table, FieldID),
  421. sqlgraph.To(Table, FieldID),
  422. sqlgraph.Edge(sqlgraph.M2O, false, ParentTable, ParentColumn),
  423. )
  424. sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
  425. for _, p := range preds {
  426. p(s)
  427. }
  428. })
  429. })
  430. }
  431. // And groups predicates with the AND operator between them.
  432. func And(predicates ...predicate.Todo) predicate.Todo {
  433. return predicate.Todo(func(s *sql.Selector) {
  434. s1 := s.Clone().SetP(nil)
  435. for _, p := range predicates {
  436. p(s1)
  437. }
  438. s.Where(s1.P())
  439. })
  440. }
  441. // Or groups predicates with the OR operator between them.
  442. func Or(predicates ...predicate.Todo) predicate.Todo {
  443. return predicate.Todo(func(s *sql.Selector) {
  444. s1 := s.Clone().SetP(nil)
  445. for i, p := range predicates {
  446. if i > 0 {
  447. s1.Or()
  448. }
  449. p(s1)
  450. }
  451. s.Where(s1.P())
  452. })
  453. }
  454. // Not applies the not operator on the given predicate.
  455. func Not(p predicate.Todo) predicate.Todo {
  456. return predicate.Todo(func(s *sql.Selector) {
  457. p(s.Not())
  458. })
  459. }