where.go 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. // Code generated by entc, DO NOT EDIT.
  2. package group
  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.Group {
  10. return predicate.Group(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.Group {
  16. return predicate.Group(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.Group {
  22. return predicate.Group(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.Group {
  28. return predicate.Group(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.Group {
  44. return predicate.Group(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.Group {
  60. return predicate.Group(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.Group {
  66. return predicate.Group(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.Group {
  72. return predicate.Group(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.Group {
  78. return predicate.Group(func(s *sql.Selector) {
  79. s.Where(sql.LTE(s.C(FieldID), id))
  80. })
  81. }
  82. // Name applies equality check predicate on the "name" field. It's identical to NameEQ.
  83. func Name(v string) predicate.Group {
  84. return predicate.Group(func(s *sql.Selector) {
  85. s.Where(sql.EQ(s.C(FieldName), v))
  86. })
  87. }
  88. // NameEQ applies the EQ predicate on the "name" field.
  89. func NameEQ(v string) predicate.Group {
  90. return predicate.Group(func(s *sql.Selector) {
  91. s.Where(sql.EQ(s.C(FieldName), v))
  92. })
  93. }
  94. // NameNEQ applies the NEQ predicate on the "name" field.
  95. func NameNEQ(v string) predicate.Group {
  96. return predicate.Group(func(s *sql.Selector) {
  97. s.Where(sql.NEQ(s.C(FieldName), v))
  98. })
  99. }
  100. // NameIn applies the In predicate on the "name" field.
  101. func NameIn(vs ...string) predicate.Group {
  102. v := make([]interface{}, len(vs))
  103. for i := range v {
  104. v[i] = vs[i]
  105. }
  106. return predicate.Group(func(s *sql.Selector) {
  107. // if not arguments were provided, append the FALSE constants,
  108. // since we can't apply "IN ()". This will make this predicate falsy.
  109. if len(vs) == 0 {
  110. s.Where(sql.False())
  111. return
  112. }
  113. s.Where(sql.In(s.C(FieldName), v...))
  114. })
  115. }
  116. // NameNotIn applies the NotIn predicate on the "name" field.
  117. func NameNotIn(vs ...string) predicate.Group {
  118. v := make([]interface{}, len(vs))
  119. for i := range v {
  120. v[i] = vs[i]
  121. }
  122. return predicate.Group(func(s *sql.Selector) {
  123. // if not arguments were provided, append the FALSE constants,
  124. // since we can't apply "IN ()". This will make this predicate falsy.
  125. if len(vs) == 0 {
  126. s.Where(sql.False())
  127. return
  128. }
  129. s.Where(sql.NotIn(s.C(FieldName), v...))
  130. })
  131. }
  132. // NameGT applies the GT predicate on the "name" field.
  133. func NameGT(v string) predicate.Group {
  134. return predicate.Group(func(s *sql.Selector) {
  135. s.Where(sql.GT(s.C(FieldName), v))
  136. })
  137. }
  138. // NameGTE applies the GTE predicate on the "name" field.
  139. func NameGTE(v string) predicate.Group {
  140. return predicate.Group(func(s *sql.Selector) {
  141. s.Where(sql.GTE(s.C(FieldName), v))
  142. })
  143. }
  144. // NameLT applies the LT predicate on the "name" field.
  145. func NameLT(v string) predicate.Group {
  146. return predicate.Group(func(s *sql.Selector) {
  147. s.Where(sql.LT(s.C(FieldName), v))
  148. })
  149. }
  150. // NameLTE applies the LTE predicate on the "name" field.
  151. func NameLTE(v string) predicate.Group {
  152. return predicate.Group(func(s *sql.Selector) {
  153. s.Where(sql.LTE(s.C(FieldName), v))
  154. })
  155. }
  156. // NameContains applies the Contains predicate on the "name" field.
  157. func NameContains(v string) predicate.Group {
  158. return predicate.Group(func(s *sql.Selector) {
  159. s.Where(sql.Contains(s.C(FieldName), v))
  160. })
  161. }
  162. // NameHasPrefix applies the HasPrefix predicate on the "name" field.
  163. func NameHasPrefix(v string) predicate.Group {
  164. return predicate.Group(func(s *sql.Selector) {
  165. s.Where(sql.HasPrefix(s.C(FieldName), v))
  166. })
  167. }
  168. // NameHasSuffix applies the HasSuffix predicate on the "name" field.
  169. func NameHasSuffix(v string) predicate.Group {
  170. return predicate.Group(func(s *sql.Selector) {
  171. s.Where(sql.HasSuffix(s.C(FieldName), v))
  172. })
  173. }
  174. // NameEqualFold applies the EqualFold predicate on the "name" field.
  175. func NameEqualFold(v string) predicate.Group {
  176. return predicate.Group(func(s *sql.Selector) {
  177. s.Where(sql.EqualFold(s.C(FieldName), v))
  178. })
  179. }
  180. // NameContainsFold applies the ContainsFold predicate on the "name" field.
  181. func NameContainsFold(v string) predicate.Group {
  182. return predicate.Group(func(s *sql.Selector) {
  183. s.Where(sql.ContainsFold(s.C(FieldName), v))
  184. })
  185. }
  186. // HasUsers applies the HasEdge predicate on the "users" edge.
  187. func HasUsers() predicate.Group {
  188. return predicate.Group(func(s *sql.Selector) {
  189. step := sqlgraph.NewStep(
  190. sqlgraph.From(Table, FieldID),
  191. sqlgraph.To(UsersTable, FieldID),
  192. sqlgraph.Edge(sqlgraph.M2M, false, UsersTable, UsersPrimaryKey...),
  193. )
  194. sqlgraph.HasNeighbors(s, step)
  195. })
  196. }
  197. // HasUsersWith applies the HasEdge predicate on the "users" edge with a given conditions (other predicates).
  198. func HasUsersWith(preds ...predicate.User) predicate.Group {
  199. return predicate.Group(func(s *sql.Selector) {
  200. step := sqlgraph.NewStep(
  201. sqlgraph.From(Table, FieldID),
  202. sqlgraph.To(UsersInverseTable, FieldID),
  203. sqlgraph.Edge(sqlgraph.M2M, false, UsersTable, UsersPrimaryKey...),
  204. )
  205. sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
  206. for _, p := range preds {
  207. p(s)
  208. }
  209. })
  210. })
  211. }
  212. // And groups list of predicates with the AND operator between them.
  213. func And(predicates ...predicate.Group) predicate.Group {
  214. return predicate.Group(func(s *sql.Selector) {
  215. s1 := s.Clone().SetP(nil)
  216. for _, p := range predicates {
  217. p(s1)
  218. }
  219. s.Where(s1.P())
  220. })
  221. }
  222. // Or groups list of predicates with the OR operator between them.
  223. func Or(predicates ...predicate.Group) predicate.Group {
  224. return predicate.Group(func(s *sql.Selector) {
  225. s1 := s.Clone().SetP(nil)
  226. for i, p := range predicates {
  227. if i > 0 {
  228. s1.Or()
  229. }
  230. p(s1)
  231. }
  232. s.Where(s1.P())
  233. })
  234. }
  235. // Not applies the not operator on the given predicate.
  236. func Not(p predicate.Group) predicate.Group {
  237. return predicate.Group(func(s *sql.Selector) {
  238. p(s.Not())
  239. })
  240. }