where.go 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742
  1. // Code generated by entc, DO NOT EDIT.
  2. package user
  3. import (
  4. "code.osinet.fr/fgm/go__ent_demo/ent/predicate"
  5. "entgo.io/ent/dialect/sql"
  6. "entgo.io/ent/dialect/sql/sqlgraph"
  7. )
  8. // ID filters vertices based on their ID field.
  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. // Password applies equality check predicate on the "password" field. It's identical to PasswordEQ.
  95. func Password(v string) predicate.User {
  96. return predicate.User(func(s *sql.Selector) {
  97. s.Where(sql.EQ(s.C(FieldPassword), v))
  98. })
  99. }
  100. // SpouseID applies equality check predicate on the "spouse_id" field. It's identical to SpouseIDEQ.
  101. func SpouseID(v int) predicate.User {
  102. return predicate.User(func(s *sql.Selector) {
  103. s.Where(sql.EQ(s.C(FieldSpouseID), v))
  104. })
  105. }
  106. // AgeEQ applies the EQ predicate on the "age" field.
  107. func AgeEQ(v int) predicate.User {
  108. return predicate.User(func(s *sql.Selector) {
  109. s.Where(sql.EQ(s.C(FieldAge), v))
  110. })
  111. }
  112. // AgeNEQ applies the NEQ predicate on the "age" field.
  113. func AgeNEQ(v int) predicate.User {
  114. return predicate.User(func(s *sql.Selector) {
  115. s.Where(sql.NEQ(s.C(FieldAge), v))
  116. })
  117. }
  118. // AgeIn applies the In predicate on the "age" field.
  119. func AgeIn(vs ...int) predicate.User {
  120. v := make([]interface{}, len(vs))
  121. for i := range v {
  122. v[i] = vs[i]
  123. }
  124. return predicate.User(func(s *sql.Selector) {
  125. // if not arguments were provided, append the FALSE constants,
  126. // since we can't apply "IN ()". This will make this predicate falsy.
  127. if len(v) == 0 {
  128. s.Where(sql.False())
  129. return
  130. }
  131. s.Where(sql.In(s.C(FieldAge), v...))
  132. })
  133. }
  134. // AgeNotIn applies the NotIn predicate on the "age" field.
  135. func AgeNotIn(vs ...int) predicate.User {
  136. v := make([]interface{}, len(vs))
  137. for i := range v {
  138. v[i] = vs[i]
  139. }
  140. return predicate.User(func(s *sql.Selector) {
  141. // if not arguments were provided, append the FALSE constants,
  142. // since we can't apply "IN ()". This will make this predicate falsy.
  143. if len(v) == 0 {
  144. s.Where(sql.False())
  145. return
  146. }
  147. s.Where(sql.NotIn(s.C(FieldAge), v...))
  148. })
  149. }
  150. // AgeGT applies the GT predicate on the "age" field.
  151. func AgeGT(v int) predicate.User {
  152. return predicate.User(func(s *sql.Selector) {
  153. s.Where(sql.GT(s.C(FieldAge), v))
  154. })
  155. }
  156. // AgeGTE applies the GTE predicate on the "age" field.
  157. func AgeGTE(v int) predicate.User {
  158. return predicate.User(func(s *sql.Selector) {
  159. s.Where(sql.GTE(s.C(FieldAge), v))
  160. })
  161. }
  162. // AgeLT applies the LT predicate on the "age" field.
  163. func AgeLT(v int) predicate.User {
  164. return predicate.User(func(s *sql.Selector) {
  165. s.Where(sql.LT(s.C(FieldAge), v))
  166. })
  167. }
  168. // AgeLTE applies the LTE predicate on the "age" field.
  169. func AgeLTE(v int) predicate.User {
  170. return predicate.User(func(s *sql.Selector) {
  171. s.Where(sql.LTE(s.C(FieldAge), v))
  172. })
  173. }
  174. // NameEQ applies the EQ predicate on the "name" field.
  175. func NameEQ(v string) predicate.User {
  176. return predicate.User(func(s *sql.Selector) {
  177. s.Where(sql.EQ(s.C(FieldName), v))
  178. })
  179. }
  180. // NameNEQ applies the NEQ predicate on the "name" field.
  181. func NameNEQ(v string) predicate.User {
  182. return predicate.User(func(s *sql.Selector) {
  183. s.Where(sql.NEQ(s.C(FieldName), v))
  184. })
  185. }
  186. // NameIn applies the In predicate on the "name" field.
  187. func NameIn(vs ...string) predicate.User {
  188. v := make([]interface{}, len(vs))
  189. for i := range v {
  190. v[i] = vs[i]
  191. }
  192. return predicate.User(func(s *sql.Selector) {
  193. // if not arguments were provided, append the FALSE constants,
  194. // since we can't apply "IN ()". This will make this predicate falsy.
  195. if len(v) == 0 {
  196. s.Where(sql.False())
  197. return
  198. }
  199. s.Where(sql.In(s.C(FieldName), v...))
  200. })
  201. }
  202. // NameNotIn applies the NotIn predicate on the "name" field.
  203. func NameNotIn(vs ...string) predicate.User {
  204. v := make([]interface{}, len(vs))
  205. for i := range v {
  206. v[i] = vs[i]
  207. }
  208. return predicate.User(func(s *sql.Selector) {
  209. // if not arguments were provided, append the FALSE constants,
  210. // since we can't apply "IN ()". This will make this predicate falsy.
  211. if len(v) == 0 {
  212. s.Where(sql.False())
  213. return
  214. }
  215. s.Where(sql.NotIn(s.C(FieldName), v...))
  216. })
  217. }
  218. // NameGT applies the GT predicate on the "name" field.
  219. func NameGT(v string) predicate.User {
  220. return predicate.User(func(s *sql.Selector) {
  221. s.Where(sql.GT(s.C(FieldName), v))
  222. })
  223. }
  224. // NameGTE applies the GTE predicate on the "name" field.
  225. func NameGTE(v string) predicate.User {
  226. return predicate.User(func(s *sql.Selector) {
  227. s.Where(sql.GTE(s.C(FieldName), v))
  228. })
  229. }
  230. // NameLT applies the LT predicate on the "name" field.
  231. func NameLT(v string) predicate.User {
  232. return predicate.User(func(s *sql.Selector) {
  233. s.Where(sql.LT(s.C(FieldName), v))
  234. })
  235. }
  236. // NameLTE applies the LTE predicate on the "name" field.
  237. func NameLTE(v string) predicate.User {
  238. return predicate.User(func(s *sql.Selector) {
  239. s.Where(sql.LTE(s.C(FieldName), v))
  240. })
  241. }
  242. // NameContains applies the Contains predicate on the "name" field.
  243. func NameContains(v string) predicate.User {
  244. return predicate.User(func(s *sql.Selector) {
  245. s.Where(sql.Contains(s.C(FieldName), v))
  246. })
  247. }
  248. // NameHasPrefix applies the HasPrefix predicate on the "name" field.
  249. func NameHasPrefix(v string) predicate.User {
  250. return predicate.User(func(s *sql.Selector) {
  251. s.Where(sql.HasPrefix(s.C(FieldName), v))
  252. })
  253. }
  254. // NameHasSuffix applies the HasSuffix predicate on the "name" field.
  255. func NameHasSuffix(v string) predicate.User {
  256. return predicate.User(func(s *sql.Selector) {
  257. s.Where(sql.HasSuffix(s.C(FieldName), v))
  258. })
  259. }
  260. // NameEqualFold applies the EqualFold predicate on the "name" field.
  261. func NameEqualFold(v string) predicate.User {
  262. return predicate.User(func(s *sql.Selector) {
  263. s.Where(sql.EqualFold(s.C(FieldName), v))
  264. })
  265. }
  266. // NameContainsFold applies the ContainsFold predicate on the "name" field.
  267. func NameContainsFold(v string) predicate.User {
  268. return predicate.User(func(s *sql.Selector) {
  269. s.Where(sql.ContainsFold(s.C(FieldName), v))
  270. })
  271. }
  272. // PasswordEQ applies the EQ predicate on the "password" field.
  273. func PasswordEQ(v string) predicate.User {
  274. return predicate.User(func(s *sql.Selector) {
  275. s.Where(sql.EQ(s.C(FieldPassword), v))
  276. })
  277. }
  278. // PasswordNEQ applies the NEQ predicate on the "password" field.
  279. func PasswordNEQ(v string) predicate.User {
  280. return predicate.User(func(s *sql.Selector) {
  281. s.Where(sql.NEQ(s.C(FieldPassword), v))
  282. })
  283. }
  284. // PasswordIn applies the In predicate on the "password" field.
  285. func PasswordIn(vs ...string) predicate.User {
  286. v := make([]interface{}, len(vs))
  287. for i := range v {
  288. v[i] = vs[i]
  289. }
  290. return predicate.User(func(s *sql.Selector) {
  291. // if not arguments were provided, append the FALSE constants,
  292. // since we can't apply "IN ()". This will make this predicate falsy.
  293. if len(v) == 0 {
  294. s.Where(sql.False())
  295. return
  296. }
  297. s.Where(sql.In(s.C(FieldPassword), v...))
  298. })
  299. }
  300. // PasswordNotIn applies the NotIn predicate on the "password" field.
  301. func PasswordNotIn(vs ...string) predicate.User {
  302. v := make([]interface{}, len(vs))
  303. for i := range v {
  304. v[i] = vs[i]
  305. }
  306. return predicate.User(func(s *sql.Selector) {
  307. // if not arguments were provided, append the FALSE constants,
  308. // since we can't apply "IN ()". This will make this predicate falsy.
  309. if len(v) == 0 {
  310. s.Where(sql.False())
  311. return
  312. }
  313. s.Where(sql.NotIn(s.C(FieldPassword), v...))
  314. })
  315. }
  316. // PasswordGT applies the GT predicate on the "password" field.
  317. func PasswordGT(v string) predicate.User {
  318. return predicate.User(func(s *sql.Selector) {
  319. s.Where(sql.GT(s.C(FieldPassword), v))
  320. })
  321. }
  322. // PasswordGTE applies the GTE predicate on the "password" field.
  323. func PasswordGTE(v string) predicate.User {
  324. return predicate.User(func(s *sql.Selector) {
  325. s.Where(sql.GTE(s.C(FieldPassword), v))
  326. })
  327. }
  328. // PasswordLT applies the LT predicate on the "password" field.
  329. func PasswordLT(v string) predicate.User {
  330. return predicate.User(func(s *sql.Selector) {
  331. s.Where(sql.LT(s.C(FieldPassword), v))
  332. })
  333. }
  334. // PasswordLTE applies the LTE predicate on the "password" field.
  335. func PasswordLTE(v string) predicate.User {
  336. return predicate.User(func(s *sql.Selector) {
  337. s.Where(sql.LTE(s.C(FieldPassword), v))
  338. })
  339. }
  340. // PasswordContains applies the Contains predicate on the "password" field.
  341. func PasswordContains(v string) predicate.User {
  342. return predicate.User(func(s *sql.Selector) {
  343. s.Where(sql.Contains(s.C(FieldPassword), v))
  344. })
  345. }
  346. // PasswordHasPrefix applies the HasPrefix predicate on the "password" field.
  347. func PasswordHasPrefix(v string) predicate.User {
  348. return predicate.User(func(s *sql.Selector) {
  349. s.Where(sql.HasPrefix(s.C(FieldPassword), v))
  350. })
  351. }
  352. // PasswordHasSuffix applies the HasSuffix predicate on the "password" field.
  353. func PasswordHasSuffix(v string) predicate.User {
  354. return predicate.User(func(s *sql.Selector) {
  355. s.Where(sql.HasSuffix(s.C(FieldPassword), v))
  356. })
  357. }
  358. // PasswordIsNil applies the IsNil predicate on the "password" field.
  359. func PasswordIsNil() predicate.User {
  360. return predicate.User(func(s *sql.Selector) {
  361. s.Where(sql.IsNull(s.C(FieldPassword)))
  362. })
  363. }
  364. // PasswordNotNil applies the NotNil predicate on the "password" field.
  365. func PasswordNotNil() predicate.User {
  366. return predicate.User(func(s *sql.Selector) {
  367. s.Where(sql.NotNull(s.C(FieldPassword)))
  368. })
  369. }
  370. // PasswordEqualFold applies the EqualFold predicate on the "password" field.
  371. func PasswordEqualFold(v string) predicate.User {
  372. return predicate.User(func(s *sql.Selector) {
  373. s.Where(sql.EqualFold(s.C(FieldPassword), v))
  374. })
  375. }
  376. // PasswordContainsFold applies the ContainsFold predicate on the "password" field.
  377. func PasswordContainsFold(v string) predicate.User {
  378. return predicate.User(func(s *sql.Selector) {
  379. s.Where(sql.ContainsFold(s.C(FieldPassword), v))
  380. })
  381. }
  382. // SizeEQ applies the EQ predicate on the "size" field.
  383. func SizeEQ(v Size) predicate.User {
  384. return predicate.User(func(s *sql.Selector) {
  385. s.Where(sql.EQ(s.C(FieldSize), v))
  386. })
  387. }
  388. // SizeNEQ applies the NEQ predicate on the "size" field.
  389. func SizeNEQ(v Size) predicate.User {
  390. return predicate.User(func(s *sql.Selector) {
  391. s.Where(sql.NEQ(s.C(FieldSize), v))
  392. })
  393. }
  394. // SizeIn applies the In predicate on the "size" field.
  395. func SizeIn(vs ...Size) predicate.User {
  396. v := make([]interface{}, len(vs))
  397. for i := range v {
  398. v[i] = vs[i]
  399. }
  400. return predicate.User(func(s *sql.Selector) {
  401. // if not arguments were provided, append the FALSE constants,
  402. // since we can't apply "IN ()". This will make this predicate falsy.
  403. if len(v) == 0 {
  404. s.Where(sql.False())
  405. return
  406. }
  407. s.Where(sql.In(s.C(FieldSize), v...))
  408. })
  409. }
  410. // SizeNotIn applies the NotIn predicate on the "size" field.
  411. func SizeNotIn(vs ...Size) predicate.User {
  412. v := make([]interface{}, len(vs))
  413. for i := range v {
  414. v[i] = vs[i]
  415. }
  416. return predicate.User(func(s *sql.Selector) {
  417. // if not arguments were provided, append the FALSE constants,
  418. // since we can't apply "IN ()". This will make this predicate falsy.
  419. if len(v) == 0 {
  420. s.Where(sql.False())
  421. return
  422. }
  423. s.Where(sql.NotIn(s.C(FieldSize), v...))
  424. })
  425. }
  426. // SpouseIDEQ applies the EQ predicate on the "spouse_id" field.
  427. func SpouseIDEQ(v int) predicate.User {
  428. return predicate.User(func(s *sql.Selector) {
  429. s.Where(sql.EQ(s.C(FieldSpouseID), v))
  430. })
  431. }
  432. // SpouseIDNEQ applies the NEQ predicate on the "spouse_id" field.
  433. func SpouseIDNEQ(v int) predicate.User {
  434. return predicate.User(func(s *sql.Selector) {
  435. s.Where(sql.NEQ(s.C(FieldSpouseID), v))
  436. })
  437. }
  438. // SpouseIDIn applies the In predicate on the "spouse_id" field.
  439. func SpouseIDIn(vs ...int) predicate.User {
  440. v := make([]interface{}, len(vs))
  441. for i := range v {
  442. v[i] = vs[i]
  443. }
  444. return predicate.User(func(s *sql.Selector) {
  445. // if not arguments were provided, append the FALSE constants,
  446. // since we can't apply "IN ()". This will make this predicate falsy.
  447. if len(v) == 0 {
  448. s.Where(sql.False())
  449. return
  450. }
  451. s.Where(sql.In(s.C(FieldSpouseID), v...))
  452. })
  453. }
  454. // SpouseIDNotIn applies the NotIn predicate on the "spouse_id" field.
  455. func SpouseIDNotIn(vs ...int) predicate.User {
  456. v := make([]interface{}, len(vs))
  457. for i := range v {
  458. v[i] = vs[i]
  459. }
  460. return predicate.User(func(s *sql.Selector) {
  461. // if not arguments were provided, append the FALSE constants,
  462. // since we can't apply "IN ()". This will make this predicate falsy.
  463. if len(v) == 0 {
  464. s.Where(sql.False())
  465. return
  466. }
  467. s.Where(sql.NotIn(s.C(FieldSpouseID), v...))
  468. })
  469. }
  470. // SpouseIDIsNil applies the IsNil predicate on the "spouse_id" field.
  471. func SpouseIDIsNil() predicate.User {
  472. return predicate.User(func(s *sql.Selector) {
  473. s.Where(sql.IsNull(s.C(FieldSpouseID)))
  474. })
  475. }
  476. // SpouseIDNotNil applies the NotNil predicate on the "spouse_id" field.
  477. func SpouseIDNotNil() predicate.User {
  478. return predicate.User(func(s *sql.Selector) {
  479. s.Where(sql.NotNull(s.C(FieldSpouseID)))
  480. })
  481. }
  482. // HasCars applies the HasEdge predicate on the "cars" edge.
  483. func HasCars() predicate.User {
  484. return predicate.User(func(s *sql.Selector) {
  485. step := sqlgraph.NewStep(
  486. sqlgraph.From(Table, FieldID),
  487. sqlgraph.To(CarsTable, FieldID),
  488. sqlgraph.Edge(sqlgraph.O2M, false, CarsTable, CarsColumn),
  489. )
  490. sqlgraph.HasNeighbors(s, step)
  491. })
  492. }
  493. // HasCarsWith applies the HasEdge predicate on the "cars" edge with a given conditions (other predicates).
  494. func HasCarsWith(preds ...predicate.Car) predicate.User {
  495. return predicate.User(func(s *sql.Selector) {
  496. step := sqlgraph.NewStep(
  497. sqlgraph.From(Table, FieldID),
  498. sqlgraph.To(CarsInverseTable, FieldID),
  499. sqlgraph.Edge(sqlgraph.O2M, false, CarsTable, CarsColumn),
  500. )
  501. sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
  502. for _, p := range preds {
  503. p(s)
  504. }
  505. })
  506. })
  507. }
  508. // HasGroups applies the HasEdge predicate on the "groups" edge.
  509. func HasGroups() predicate.User {
  510. return predicate.User(func(s *sql.Selector) {
  511. step := sqlgraph.NewStep(
  512. sqlgraph.From(Table, FieldID),
  513. sqlgraph.To(GroupsTable, FieldID),
  514. sqlgraph.Edge(sqlgraph.M2M, true, GroupsTable, GroupsPrimaryKey...),
  515. )
  516. sqlgraph.HasNeighbors(s, step)
  517. })
  518. }
  519. // HasGroupsWith applies the HasEdge predicate on the "groups" edge with a given conditions (other predicates).
  520. func HasGroupsWith(preds ...predicate.Group) predicate.User {
  521. return predicate.User(func(s *sql.Selector) {
  522. step := sqlgraph.NewStep(
  523. sqlgraph.From(Table, FieldID),
  524. sqlgraph.To(GroupsInverseTable, FieldID),
  525. sqlgraph.Edge(sqlgraph.M2M, true, GroupsTable, GroupsPrimaryKey...),
  526. )
  527. sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
  528. for _, p := range preds {
  529. p(s)
  530. }
  531. })
  532. })
  533. }
  534. // HasSpouse applies the HasEdge predicate on the "spouse" edge.
  535. func HasSpouse() predicate.User {
  536. return predicate.User(func(s *sql.Selector) {
  537. step := sqlgraph.NewStep(
  538. sqlgraph.From(Table, FieldID),
  539. sqlgraph.To(SpouseTable, FieldID),
  540. sqlgraph.Edge(sqlgraph.O2O, false, SpouseTable, SpouseColumn),
  541. )
  542. sqlgraph.HasNeighbors(s, step)
  543. })
  544. }
  545. // HasSpouseWith applies the HasEdge predicate on the "spouse" edge with a given conditions (other predicates).
  546. func HasSpouseWith(preds ...predicate.User) predicate.User {
  547. return predicate.User(func(s *sql.Selector) {
  548. step := sqlgraph.NewStep(
  549. sqlgraph.From(Table, FieldID),
  550. sqlgraph.To(Table, FieldID),
  551. sqlgraph.Edge(sqlgraph.O2O, false, SpouseTable, SpouseColumn),
  552. )
  553. sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
  554. for _, p := range preds {
  555. p(s)
  556. }
  557. })
  558. })
  559. }
  560. // HasFollowers applies the HasEdge predicate on the "followers" edge.
  561. func HasFollowers() predicate.User {
  562. return predicate.User(func(s *sql.Selector) {
  563. step := sqlgraph.NewStep(
  564. sqlgraph.From(Table, FieldID),
  565. sqlgraph.To(FollowersTable, FieldID),
  566. sqlgraph.Edge(sqlgraph.M2M, true, FollowersTable, FollowersPrimaryKey...),
  567. )
  568. sqlgraph.HasNeighbors(s, step)
  569. })
  570. }
  571. // HasFollowersWith applies the HasEdge predicate on the "followers" edge with a given conditions (other predicates).
  572. func HasFollowersWith(preds ...predicate.User) predicate.User {
  573. return predicate.User(func(s *sql.Selector) {
  574. step := sqlgraph.NewStep(
  575. sqlgraph.From(Table, FieldID),
  576. sqlgraph.To(Table, FieldID),
  577. sqlgraph.Edge(sqlgraph.M2M, true, FollowersTable, FollowersPrimaryKey...),
  578. )
  579. sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
  580. for _, p := range preds {
  581. p(s)
  582. }
  583. })
  584. })
  585. }
  586. // HasFollowing applies the HasEdge predicate on the "following" edge.
  587. func HasFollowing() predicate.User {
  588. return predicate.User(func(s *sql.Selector) {
  589. step := sqlgraph.NewStep(
  590. sqlgraph.From(Table, FieldID),
  591. sqlgraph.To(FollowingTable, FieldID),
  592. sqlgraph.Edge(sqlgraph.M2M, false, FollowingTable, FollowingPrimaryKey...),
  593. )
  594. sqlgraph.HasNeighbors(s, step)
  595. })
  596. }
  597. // HasFollowingWith applies the HasEdge predicate on the "following" edge with a given conditions (other predicates).
  598. func HasFollowingWith(preds ...predicate.User) predicate.User {
  599. return predicate.User(func(s *sql.Selector) {
  600. step := sqlgraph.NewStep(
  601. sqlgraph.From(Table, FieldID),
  602. sqlgraph.To(Table, FieldID),
  603. sqlgraph.Edge(sqlgraph.M2M, false, FollowingTable, FollowingPrimaryKey...),
  604. )
  605. sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
  606. for _, p := range preds {
  607. p(s)
  608. }
  609. })
  610. })
  611. }
  612. // HasFriends applies the HasEdge predicate on the "friends" edge.
  613. func HasFriends() predicate.User {
  614. return predicate.User(func(s *sql.Selector) {
  615. step := sqlgraph.NewStep(
  616. sqlgraph.From(Table, FieldID),
  617. sqlgraph.To(FriendsTable, FieldID),
  618. sqlgraph.Edge(sqlgraph.M2M, false, FriendsTable, FriendsPrimaryKey...),
  619. )
  620. sqlgraph.HasNeighbors(s, step)
  621. })
  622. }
  623. // HasFriendsWith applies the HasEdge predicate on the "friends" edge with a given conditions (other predicates).
  624. func HasFriendsWith(preds ...predicate.User) predicate.User {
  625. return predicate.User(func(s *sql.Selector) {
  626. step := sqlgraph.NewStep(
  627. sqlgraph.From(Table, FieldID),
  628. sqlgraph.To(Table, FieldID),
  629. sqlgraph.Edge(sqlgraph.M2M, false, FriendsTable, FriendsPrimaryKey...),
  630. )
  631. sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
  632. for _, p := range preds {
  633. p(s)
  634. }
  635. })
  636. })
  637. }
  638. // And groups predicates with the AND operator between them.
  639. func And(predicates ...predicate.User) predicate.User {
  640. return predicate.User(func(s *sql.Selector) {
  641. s1 := s.Clone().SetP(nil)
  642. for _, p := range predicates {
  643. p(s1)
  644. }
  645. s.Where(s1.P())
  646. })
  647. }
  648. // Or groups predicates with the OR operator between them.
  649. func Or(predicates ...predicate.User) predicate.User {
  650. return predicate.User(func(s *sql.Selector) {
  651. s1 := s.Clone().SetP(nil)
  652. for i, p := range predicates {
  653. if i > 0 {
  654. s1.Or()
  655. }
  656. p(s1)
  657. }
  658. s.Where(s1.P())
  659. })
  660. }
  661. // Not applies the not operator on the given predicate.
  662. func Not(p predicate.User) predicate.User {
  663. return predicate.User(func(s *sql.Selector) {
  664. p(s.Not())
  665. })
  666. }