-
-
Notifications
You must be signed in to change notification settings - Fork 263
/
where.go
463 lines (373 loc) · 14.9 KB
/
where.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
// Code generated by ent, DO NOT EDIT.
package token
import (
"time"
"entgo.io/ent/dialect/sql"
uuid "github.com/gofrs/uuid/v5"
"github.com/suyuan32/simple-admin-core/rpc/ent/predicate"
)
// ID filters vertices based on their ID field.
func ID(id uuid.UUID) predicate.Token {
return predicate.Token(sql.FieldEQ(FieldID, id))
}
// IDEQ applies the EQ predicate on the ID field.
func IDEQ(id uuid.UUID) predicate.Token {
return predicate.Token(sql.FieldEQ(FieldID, id))
}
// IDNEQ applies the NEQ predicate on the ID field.
func IDNEQ(id uuid.UUID) predicate.Token {
return predicate.Token(sql.FieldNEQ(FieldID, id))
}
// IDIn applies the In predicate on the ID field.
func IDIn(ids ...uuid.UUID) predicate.Token {
return predicate.Token(sql.FieldIn(FieldID, ids...))
}
// IDNotIn applies the NotIn predicate on the ID field.
func IDNotIn(ids ...uuid.UUID) predicate.Token {
return predicate.Token(sql.FieldNotIn(FieldID, ids...))
}
// IDGT applies the GT predicate on the ID field.
func IDGT(id uuid.UUID) predicate.Token {
return predicate.Token(sql.FieldGT(FieldID, id))
}
// IDGTE applies the GTE predicate on the ID field.
func IDGTE(id uuid.UUID) predicate.Token {
return predicate.Token(sql.FieldGTE(FieldID, id))
}
// IDLT applies the LT predicate on the ID field.
func IDLT(id uuid.UUID) predicate.Token {
return predicate.Token(sql.FieldLT(FieldID, id))
}
// IDLTE applies the LTE predicate on the ID field.
func IDLTE(id uuid.UUID) predicate.Token {
return predicate.Token(sql.FieldLTE(FieldID, id))
}
// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ.
func CreatedAt(v time.Time) predicate.Token {
return predicate.Token(sql.FieldEQ(FieldCreatedAt, v))
}
// UpdatedAt applies equality check predicate on the "updated_at" field. It's identical to UpdatedAtEQ.
func UpdatedAt(v time.Time) predicate.Token {
return predicate.Token(sql.FieldEQ(FieldUpdatedAt, v))
}
// Status applies equality check predicate on the "status" field. It's identical to StatusEQ.
func Status(v uint8) predicate.Token {
return predicate.Token(sql.FieldEQ(FieldStatus, v))
}
// UUID applies equality check predicate on the "uuid" field. It's identical to UUIDEQ.
func UUID(v uuid.UUID) predicate.Token {
return predicate.Token(sql.FieldEQ(FieldUUID, v))
}
// Token applies equality check predicate on the "token" field. It's identical to TokenEQ.
func Token(v string) predicate.Token {
return predicate.Token(sql.FieldEQ(FieldToken, v))
}
// Source applies equality check predicate on the "source" field. It's identical to SourceEQ.
func Source(v string) predicate.Token {
return predicate.Token(sql.FieldEQ(FieldSource, v))
}
// ExpiredAt applies equality check predicate on the "expired_at" field. It's identical to ExpiredAtEQ.
func ExpiredAt(v time.Time) predicate.Token {
return predicate.Token(sql.FieldEQ(FieldExpiredAt, v))
}
// CreatedAtEQ applies the EQ predicate on the "created_at" field.
func CreatedAtEQ(v time.Time) predicate.Token {
return predicate.Token(sql.FieldEQ(FieldCreatedAt, v))
}
// CreatedAtNEQ applies the NEQ predicate on the "created_at" field.
func CreatedAtNEQ(v time.Time) predicate.Token {
return predicate.Token(sql.FieldNEQ(FieldCreatedAt, v))
}
// CreatedAtIn applies the In predicate on the "created_at" field.
func CreatedAtIn(vs ...time.Time) predicate.Token {
return predicate.Token(sql.FieldIn(FieldCreatedAt, vs...))
}
// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
func CreatedAtNotIn(vs ...time.Time) predicate.Token {
return predicate.Token(sql.FieldNotIn(FieldCreatedAt, vs...))
}
// CreatedAtGT applies the GT predicate on the "created_at" field.
func CreatedAtGT(v time.Time) predicate.Token {
return predicate.Token(sql.FieldGT(FieldCreatedAt, v))
}
// CreatedAtGTE applies the GTE predicate on the "created_at" field.
func CreatedAtGTE(v time.Time) predicate.Token {
return predicate.Token(sql.FieldGTE(FieldCreatedAt, v))
}
// CreatedAtLT applies the LT predicate on the "created_at" field.
func CreatedAtLT(v time.Time) predicate.Token {
return predicate.Token(sql.FieldLT(FieldCreatedAt, v))
}
// CreatedAtLTE applies the LTE predicate on the "created_at" field.
func CreatedAtLTE(v time.Time) predicate.Token {
return predicate.Token(sql.FieldLTE(FieldCreatedAt, v))
}
// UpdatedAtEQ applies the EQ predicate on the "updated_at" field.
func UpdatedAtEQ(v time.Time) predicate.Token {
return predicate.Token(sql.FieldEQ(FieldUpdatedAt, v))
}
// UpdatedAtNEQ applies the NEQ predicate on the "updated_at" field.
func UpdatedAtNEQ(v time.Time) predicate.Token {
return predicate.Token(sql.FieldNEQ(FieldUpdatedAt, v))
}
// UpdatedAtIn applies the In predicate on the "updated_at" field.
func UpdatedAtIn(vs ...time.Time) predicate.Token {
return predicate.Token(sql.FieldIn(FieldUpdatedAt, vs...))
}
// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
func UpdatedAtNotIn(vs ...time.Time) predicate.Token {
return predicate.Token(sql.FieldNotIn(FieldUpdatedAt, vs...))
}
// UpdatedAtGT applies the GT predicate on the "updated_at" field.
func UpdatedAtGT(v time.Time) predicate.Token {
return predicate.Token(sql.FieldGT(FieldUpdatedAt, v))
}
// UpdatedAtGTE applies the GTE predicate on the "updated_at" field.
func UpdatedAtGTE(v time.Time) predicate.Token {
return predicate.Token(sql.FieldGTE(FieldUpdatedAt, v))
}
// UpdatedAtLT applies the LT predicate on the "updated_at" field.
func UpdatedAtLT(v time.Time) predicate.Token {
return predicate.Token(sql.FieldLT(FieldUpdatedAt, v))
}
// UpdatedAtLTE applies the LTE predicate on the "updated_at" field.
func UpdatedAtLTE(v time.Time) predicate.Token {
return predicate.Token(sql.FieldLTE(FieldUpdatedAt, v))
}
// StatusEQ applies the EQ predicate on the "status" field.
func StatusEQ(v uint8) predicate.Token {
return predicate.Token(sql.FieldEQ(FieldStatus, v))
}
// StatusNEQ applies the NEQ predicate on the "status" field.
func StatusNEQ(v uint8) predicate.Token {
return predicate.Token(sql.FieldNEQ(FieldStatus, v))
}
// StatusIn applies the In predicate on the "status" field.
func StatusIn(vs ...uint8) predicate.Token {
return predicate.Token(sql.FieldIn(FieldStatus, vs...))
}
// StatusNotIn applies the NotIn predicate on the "status" field.
func StatusNotIn(vs ...uint8) predicate.Token {
return predicate.Token(sql.FieldNotIn(FieldStatus, vs...))
}
// StatusGT applies the GT predicate on the "status" field.
func StatusGT(v uint8) predicate.Token {
return predicate.Token(sql.FieldGT(FieldStatus, v))
}
// StatusGTE applies the GTE predicate on the "status" field.
func StatusGTE(v uint8) predicate.Token {
return predicate.Token(sql.FieldGTE(FieldStatus, v))
}
// StatusLT applies the LT predicate on the "status" field.
func StatusLT(v uint8) predicate.Token {
return predicate.Token(sql.FieldLT(FieldStatus, v))
}
// StatusLTE applies the LTE predicate on the "status" field.
func StatusLTE(v uint8) predicate.Token {
return predicate.Token(sql.FieldLTE(FieldStatus, v))
}
// StatusIsNil applies the IsNil predicate on the "status" field.
func StatusIsNil() predicate.Token {
return predicate.Token(sql.FieldIsNull(FieldStatus))
}
// StatusNotNil applies the NotNil predicate on the "status" field.
func StatusNotNil() predicate.Token {
return predicate.Token(sql.FieldNotNull(FieldStatus))
}
// UUIDEQ applies the EQ predicate on the "uuid" field.
func UUIDEQ(v uuid.UUID) predicate.Token {
return predicate.Token(sql.FieldEQ(FieldUUID, v))
}
// UUIDNEQ applies the NEQ predicate on the "uuid" field.
func UUIDNEQ(v uuid.UUID) predicate.Token {
return predicate.Token(sql.FieldNEQ(FieldUUID, v))
}
// UUIDIn applies the In predicate on the "uuid" field.
func UUIDIn(vs ...uuid.UUID) predicate.Token {
return predicate.Token(sql.FieldIn(FieldUUID, vs...))
}
// UUIDNotIn applies the NotIn predicate on the "uuid" field.
func UUIDNotIn(vs ...uuid.UUID) predicate.Token {
return predicate.Token(sql.FieldNotIn(FieldUUID, vs...))
}
// UUIDGT applies the GT predicate on the "uuid" field.
func UUIDGT(v uuid.UUID) predicate.Token {
return predicate.Token(sql.FieldGT(FieldUUID, v))
}
// UUIDGTE applies the GTE predicate on the "uuid" field.
func UUIDGTE(v uuid.UUID) predicate.Token {
return predicate.Token(sql.FieldGTE(FieldUUID, v))
}
// UUIDLT applies the LT predicate on the "uuid" field.
func UUIDLT(v uuid.UUID) predicate.Token {
return predicate.Token(sql.FieldLT(FieldUUID, v))
}
// UUIDLTE applies the LTE predicate on the "uuid" field.
func UUIDLTE(v uuid.UUID) predicate.Token {
return predicate.Token(sql.FieldLTE(FieldUUID, v))
}
// TokenEQ applies the EQ predicate on the "token" field.
func TokenEQ(v string) predicate.Token {
return predicate.Token(sql.FieldEQ(FieldToken, v))
}
// TokenNEQ applies the NEQ predicate on the "token" field.
func TokenNEQ(v string) predicate.Token {
return predicate.Token(sql.FieldNEQ(FieldToken, v))
}
// TokenIn applies the In predicate on the "token" field.
func TokenIn(vs ...string) predicate.Token {
return predicate.Token(sql.FieldIn(FieldToken, vs...))
}
// TokenNotIn applies the NotIn predicate on the "token" field.
func TokenNotIn(vs ...string) predicate.Token {
return predicate.Token(sql.FieldNotIn(FieldToken, vs...))
}
// TokenGT applies the GT predicate on the "token" field.
func TokenGT(v string) predicate.Token {
return predicate.Token(sql.FieldGT(FieldToken, v))
}
// TokenGTE applies the GTE predicate on the "token" field.
func TokenGTE(v string) predicate.Token {
return predicate.Token(sql.FieldGTE(FieldToken, v))
}
// TokenLT applies the LT predicate on the "token" field.
func TokenLT(v string) predicate.Token {
return predicate.Token(sql.FieldLT(FieldToken, v))
}
// TokenLTE applies the LTE predicate on the "token" field.
func TokenLTE(v string) predicate.Token {
return predicate.Token(sql.FieldLTE(FieldToken, v))
}
// TokenContains applies the Contains predicate on the "token" field.
func TokenContains(v string) predicate.Token {
return predicate.Token(sql.FieldContains(FieldToken, v))
}
// TokenHasPrefix applies the HasPrefix predicate on the "token" field.
func TokenHasPrefix(v string) predicate.Token {
return predicate.Token(sql.FieldHasPrefix(FieldToken, v))
}
// TokenHasSuffix applies the HasSuffix predicate on the "token" field.
func TokenHasSuffix(v string) predicate.Token {
return predicate.Token(sql.FieldHasSuffix(FieldToken, v))
}
// TokenEqualFold applies the EqualFold predicate on the "token" field.
func TokenEqualFold(v string) predicate.Token {
return predicate.Token(sql.FieldEqualFold(FieldToken, v))
}
// TokenContainsFold applies the ContainsFold predicate on the "token" field.
func TokenContainsFold(v string) predicate.Token {
return predicate.Token(sql.FieldContainsFold(FieldToken, v))
}
// SourceEQ applies the EQ predicate on the "source" field.
func SourceEQ(v string) predicate.Token {
return predicate.Token(sql.FieldEQ(FieldSource, v))
}
// SourceNEQ applies the NEQ predicate on the "source" field.
func SourceNEQ(v string) predicate.Token {
return predicate.Token(sql.FieldNEQ(FieldSource, v))
}
// SourceIn applies the In predicate on the "source" field.
func SourceIn(vs ...string) predicate.Token {
return predicate.Token(sql.FieldIn(FieldSource, vs...))
}
// SourceNotIn applies the NotIn predicate on the "source" field.
func SourceNotIn(vs ...string) predicate.Token {
return predicate.Token(sql.FieldNotIn(FieldSource, vs...))
}
// SourceGT applies the GT predicate on the "source" field.
func SourceGT(v string) predicate.Token {
return predicate.Token(sql.FieldGT(FieldSource, v))
}
// SourceGTE applies the GTE predicate on the "source" field.
func SourceGTE(v string) predicate.Token {
return predicate.Token(sql.FieldGTE(FieldSource, v))
}
// SourceLT applies the LT predicate on the "source" field.
func SourceLT(v string) predicate.Token {
return predicate.Token(sql.FieldLT(FieldSource, v))
}
// SourceLTE applies the LTE predicate on the "source" field.
func SourceLTE(v string) predicate.Token {
return predicate.Token(sql.FieldLTE(FieldSource, v))
}
// SourceContains applies the Contains predicate on the "source" field.
func SourceContains(v string) predicate.Token {
return predicate.Token(sql.FieldContains(FieldSource, v))
}
// SourceHasPrefix applies the HasPrefix predicate on the "source" field.
func SourceHasPrefix(v string) predicate.Token {
return predicate.Token(sql.FieldHasPrefix(FieldSource, v))
}
// SourceHasSuffix applies the HasSuffix predicate on the "source" field.
func SourceHasSuffix(v string) predicate.Token {
return predicate.Token(sql.FieldHasSuffix(FieldSource, v))
}
// SourceEqualFold applies the EqualFold predicate on the "source" field.
func SourceEqualFold(v string) predicate.Token {
return predicate.Token(sql.FieldEqualFold(FieldSource, v))
}
// SourceContainsFold applies the ContainsFold predicate on the "source" field.
func SourceContainsFold(v string) predicate.Token {
return predicate.Token(sql.FieldContainsFold(FieldSource, v))
}
// ExpiredAtEQ applies the EQ predicate on the "expired_at" field.
func ExpiredAtEQ(v time.Time) predicate.Token {
return predicate.Token(sql.FieldEQ(FieldExpiredAt, v))
}
// ExpiredAtNEQ applies the NEQ predicate on the "expired_at" field.
func ExpiredAtNEQ(v time.Time) predicate.Token {
return predicate.Token(sql.FieldNEQ(FieldExpiredAt, v))
}
// ExpiredAtIn applies the In predicate on the "expired_at" field.
func ExpiredAtIn(vs ...time.Time) predicate.Token {
return predicate.Token(sql.FieldIn(FieldExpiredAt, vs...))
}
// ExpiredAtNotIn applies the NotIn predicate on the "expired_at" field.
func ExpiredAtNotIn(vs ...time.Time) predicate.Token {
return predicate.Token(sql.FieldNotIn(FieldExpiredAt, vs...))
}
// ExpiredAtGT applies the GT predicate on the "expired_at" field.
func ExpiredAtGT(v time.Time) predicate.Token {
return predicate.Token(sql.FieldGT(FieldExpiredAt, v))
}
// ExpiredAtGTE applies the GTE predicate on the "expired_at" field.
func ExpiredAtGTE(v time.Time) predicate.Token {
return predicate.Token(sql.FieldGTE(FieldExpiredAt, v))
}
// ExpiredAtLT applies the LT predicate on the "expired_at" field.
func ExpiredAtLT(v time.Time) predicate.Token {
return predicate.Token(sql.FieldLT(FieldExpiredAt, v))
}
// ExpiredAtLTE applies the LTE predicate on the "expired_at" field.
func ExpiredAtLTE(v time.Time) predicate.Token {
return predicate.Token(sql.FieldLTE(FieldExpiredAt, v))
}
// And groups predicates with the AND operator between them.
func And(predicates ...predicate.Token) predicate.Token {
return predicate.Token(func(s *sql.Selector) {
s1 := s.Clone().SetP(nil)
for _, p := range predicates {
p(s1)
}
s.Where(s1.P())
})
}
// Or groups predicates with the OR operator between them.
func Or(predicates ...predicate.Token) predicate.Token {
return predicate.Token(func(s *sql.Selector) {
s1 := s.Clone().SetP(nil)
for i, p := range predicates {
if i > 0 {
s1.Or()
}
p(s1)
}
s.Where(s1.P())
})
}
// Not applies the not operator on the given predicate.
func Not(p predicate.Token) predicate.Token {
return predicate.Token(func(s *sql.Selector) {
p(s.Not())
})
}