github.com/ngocphuongnb/tetua@v0.0.7-alpha/packages/entrepository/ent/permission/where.go (about) 1 // Code generated by entc, DO NOT EDIT. 2 3 package permission 4 5 import ( 6 "time" 7 8 "entgo.io/ent/dialect/sql" 9 "entgo.io/ent/dialect/sql/sqlgraph" 10 "github.com/ngocphuongnb/tetua/packages/entrepository/ent/predicate" 11 ) 12 13 // ID filters vertices based on their ID field. 14 func ID(id int) predicate.Permission { 15 return predicate.Permission(func(s *sql.Selector) { 16 s.Where(sql.EQ(s.C(FieldID), id)) 17 }) 18 } 19 20 // IDEQ applies the EQ predicate on the ID field. 21 func IDEQ(id int) predicate.Permission { 22 return predicate.Permission(func(s *sql.Selector) { 23 s.Where(sql.EQ(s.C(FieldID), id)) 24 }) 25 } 26 27 // IDNEQ applies the NEQ predicate on the ID field. 28 func IDNEQ(id int) predicate.Permission { 29 return predicate.Permission(func(s *sql.Selector) { 30 s.Where(sql.NEQ(s.C(FieldID), id)) 31 }) 32 } 33 34 // IDIn applies the In predicate on the ID field. 35 func IDIn(ids ...int) predicate.Permission { 36 return predicate.Permission(func(s *sql.Selector) { 37 // if not arguments were provided, append the FALSE constants, 38 // since we can't apply "IN ()". This will make this predicate falsy. 39 if len(ids) == 0 { 40 s.Where(sql.False()) 41 return 42 } 43 v := make([]interface{}, len(ids)) 44 for i := range v { 45 v[i] = ids[i] 46 } 47 s.Where(sql.In(s.C(FieldID), v...)) 48 }) 49 } 50 51 // IDNotIn applies the NotIn predicate on the ID field. 52 func IDNotIn(ids ...int) predicate.Permission { 53 return predicate.Permission(func(s *sql.Selector) { 54 // if not arguments were provided, append the FALSE constants, 55 // since we can't apply "IN ()". This will make this predicate falsy. 56 if len(ids) == 0 { 57 s.Where(sql.False()) 58 return 59 } 60 v := make([]interface{}, len(ids)) 61 for i := range v { 62 v[i] = ids[i] 63 } 64 s.Where(sql.NotIn(s.C(FieldID), v...)) 65 }) 66 } 67 68 // IDGT applies the GT predicate on the ID field. 69 func IDGT(id int) predicate.Permission { 70 return predicate.Permission(func(s *sql.Selector) { 71 s.Where(sql.GT(s.C(FieldID), id)) 72 }) 73 } 74 75 // IDGTE applies the GTE predicate on the ID field. 76 func IDGTE(id int) predicate.Permission { 77 return predicate.Permission(func(s *sql.Selector) { 78 s.Where(sql.GTE(s.C(FieldID), id)) 79 }) 80 } 81 82 // IDLT applies the LT predicate on the ID field. 83 func IDLT(id int) predicate.Permission { 84 return predicate.Permission(func(s *sql.Selector) { 85 s.Where(sql.LT(s.C(FieldID), id)) 86 }) 87 } 88 89 // IDLTE applies the LTE predicate on the ID field. 90 func IDLTE(id int) predicate.Permission { 91 return predicate.Permission(func(s *sql.Selector) { 92 s.Where(sql.LTE(s.C(FieldID), id)) 93 }) 94 } 95 96 // CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ. 97 func CreatedAt(v time.Time) predicate.Permission { 98 return predicate.Permission(func(s *sql.Selector) { 99 s.Where(sql.EQ(s.C(FieldCreatedAt), v)) 100 }) 101 } 102 103 // UpdatedAt applies equality check predicate on the "updated_at" field. It's identical to UpdatedAtEQ. 104 func UpdatedAt(v time.Time) predicate.Permission { 105 return predicate.Permission(func(s *sql.Selector) { 106 s.Where(sql.EQ(s.C(FieldUpdatedAt), v)) 107 }) 108 } 109 110 // DeletedAt applies equality check predicate on the "deleted_at" field. It's identical to DeletedAtEQ. 111 func DeletedAt(v time.Time) predicate.Permission { 112 return predicate.Permission(func(s *sql.Selector) { 113 s.Where(sql.EQ(s.C(FieldDeletedAt), v)) 114 }) 115 } 116 117 // RoleID applies equality check predicate on the "role_id" field. It's identical to RoleIDEQ. 118 func RoleID(v int) predicate.Permission { 119 return predicate.Permission(func(s *sql.Selector) { 120 s.Where(sql.EQ(s.C(FieldRoleID), v)) 121 }) 122 } 123 124 // Action applies equality check predicate on the "action" field. It's identical to ActionEQ. 125 func Action(v string) predicate.Permission { 126 return predicate.Permission(func(s *sql.Selector) { 127 s.Where(sql.EQ(s.C(FieldAction), v)) 128 }) 129 } 130 131 // Value applies equality check predicate on the "value" field. It's identical to ValueEQ. 132 func Value(v string) predicate.Permission { 133 return predicate.Permission(func(s *sql.Selector) { 134 s.Where(sql.EQ(s.C(FieldValue), v)) 135 }) 136 } 137 138 // CreatedAtEQ applies the EQ predicate on the "created_at" field. 139 func CreatedAtEQ(v time.Time) predicate.Permission { 140 return predicate.Permission(func(s *sql.Selector) { 141 s.Where(sql.EQ(s.C(FieldCreatedAt), v)) 142 }) 143 } 144 145 // CreatedAtNEQ applies the NEQ predicate on the "created_at" field. 146 func CreatedAtNEQ(v time.Time) predicate.Permission { 147 return predicate.Permission(func(s *sql.Selector) { 148 s.Where(sql.NEQ(s.C(FieldCreatedAt), v)) 149 }) 150 } 151 152 // CreatedAtIn applies the In predicate on the "created_at" field. 153 func CreatedAtIn(vs ...time.Time) predicate.Permission { 154 v := make([]interface{}, len(vs)) 155 for i := range v { 156 v[i] = vs[i] 157 } 158 return predicate.Permission(func(s *sql.Selector) { 159 // if not arguments were provided, append the FALSE constants, 160 // since we can't apply "IN ()". This will make this predicate falsy. 161 if len(v) == 0 { 162 s.Where(sql.False()) 163 return 164 } 165 s.Where(sql.In(s.C(FieldCreatedAt), v...)) 166 }) 167 } 168 169 // CreatedAtNotIn applies the NotIn predicate on the "created_at" field. 170 func CreatedAtNotIn(vs ...time.Time) predicate.Permission { 171 v := make([]interface{}, len(vs)) 172 for i := range v { 173 v[i] = vs[i] 174 } 175 return predicate.Permission(func(s *sql.Selector) { 176 // if not arguments were provided, append the FALSE constants, 177 // since we can't apply "IN ()". This will make this predicate falsy. 178 if len(v) == 0 { 179 s.Where(sql.False()) 180 return 181 } 182 s.Where(sql.NotIn(s.C(FieldCreatedAt), v...)) 183 }) 184 } 185 186 // CreatedAtGT applies the GT predicate on the "created_at" field. 187 func CreatedAtGT(v time.Time) predicate.Permission { 188 return predicate.Permission(func(s *sql.Selector) { 189 s.Where(sql.GT(s.C(FieldCreatedAt), v)) 190 }) 191 } 192 193 // CreatedAtGTE applies the GTE predicate on the "created_at" field. 194 func CreatedAtGTE(v time.Time) predicate.Permission { 195 return predicate.Permission(func(s *sql.Selector) { 196 s.Where(sql.GTE(s.C(FieldCreatedAt), v)) 197 }) 198 } 199 200 // CreatedAtLT applies the LT predicate on the "created_at" field. 201 func CreatedAtLT(v time.Time) predicate.Permission { 202 return predicate.Permission(func(s *sql.Selector) { 203 s.Where(sql.LT(s.C(FieldCreatedAt), v)) 204 }) 205 } 206 207 // CreatedAtLTE applies the LTE predicate on the "created_at" field. 208 func CreatedAtLTE(v time.Time) predicate.Permission { 209 return predicate.Permission(func(s *sql.Selector) { 210 s.Where(sql.LTE(s.C(FieldCreatedAt), v)) 211 }) 212 } 213 214 // UpdatedAtEQ applies the EQ predicate on the "updated_at" field. 215 func UpdatedAtEQ(v time.Time) predicate.Permission { 216 return predicate.Permission(func(s *sql.Selector) { 217 s.Where(sql.EQ(s.C(FieldUpdatedAt), v)) 218 }) 219 } 220 221 // UpdatedAtNEQ applies the NEQ predicate on the "updated_at" field. 222 func UpdatedAtNEQ(v time.Time) predicate.Permission { 223 return predicate.Permission(func(s *sql.Selector) { 224 s.Where(sql.NEQ(s.C(FieldUpdatedAt), v)) 225 }) 226 } 227 228 // UpdatedAtIn applies the In predicate on the "updated_at" field. 229 func UpdatedAtIn(vs ...time.Time) predicate.Permission { 230 v := make([]interface{}, len(vs)) 231 for i := range v { 232 v[i] = vs[i] 233 } 234 return predicate.Permission(func(s *sql.Selector) { 235 // if not arguments were provided, append the FALSE constants, 236 // since we can't apply "IN ()". This will make this predicate falsy. 237 if len(v) == 0 { 238 s.Where(sql.False()) 239 return 240 } 241 s.Where(sql.In(s.C(FieldUpdatedAt), v...)) 242 }) 243 } 244 245 // UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field. 246 func UpdatedAtNotIn(vs ...time.Time) predicate.Permission { 247 v := make([]interface{}, len(vs)) 248 for i := range v { 249 v[i] = vs[i] 250 } 251 return predicate.Permission(func(s *sql.Selector) { 252 // if not arguments were provided, append the FALSE constants, 253 // since we can't apply "IN ()". This will make this predicate falsy. 254 if len(v) == 0 { 255 s.Where(sql.False()) 256 return 257 } 258 s.Where(sql.NotIn(s.C(FieldUpdatedAt), v...)) 259 }) 260 } 261 262 // UpdatedAtGT applies the GT predicate on the "updated_at" field. 263 func UpdatedAtGT(v time.Time) predicate.Permission { 264 return predicate.Permission(func(s *sql.Selector) { 265 s.Where(sql.GT(s.C(FieldUpdatedAt), v)) 266 }) 267 } 268 269 // UpdatedAtGTE applies the GTE predicate on the "updated_at" field. 270 func UpdatedAtGTE(v time.Time) predicate.Permission { 271 return predicate.Permission(func(s *sql.Selector) { 272 s.Where(sql.GTE(s.C(FieldUpdatedAt), v)) 273 }) 274 } 275 276 // UpdatedAtLT applies the LT predicate on the "updated_at" field. 277 func UpdatedAtLT(v time.Time) predicate.Permission { 278 return predicate.Permission(func(s *sql.Selector) { 279 s.Where(sql.LT(s.C(FieldUpdatedAt), v)) 280 }) 281 } 282 283 // UpdatedAtLTE applies the LTE predicate on the "updated_at" field. 284 func UpdatedAtLTE(v time.Time) predicate.Permission { 285 return predicate.Permission(func(s *sql.Selector) { 286 s.Where(sql.LTE(s.C(FieldUpdatedAt), v)) 287 }) 288 } 289 290 // DeletedAtEQ applies the EQ predicate on the "deleted_at" field. 291 func DeletedAtEQ(v time.Time) predicate.Permission { 292 return predicate.Permission(func(s *sql.Selector) { 293 s.Where(sql.EQ(s.C(FieldDeletedAt), v)) 294 }) 295 } 296 297 // DeletedAtNEQ applies the NEQ predicate on the "deleted_at" field. 298 func DeletedAtNEQ(v time.Time) predicate.Permission { 299 return predicate.Permission(func(s *sql.Selector) { 300 s.Where(sql.NEQ(s.C(FieldDeletedAt), v)) 301 }) 302 } 303 304 // DeletedAtIn applies the In predicate on the "deleted_at" field. 305 func DeletedAtIn(vs ...time.Time) predicate.Permission { 306 v := make([]interface{}, len(vs)) 307 for i := range v { 308 v[i] = vs[i] 309 } 310 return predicate.Permission(func(s *sql.Selector) { 311 // if not arguments were provided, append the FALSE constants, 312 // since we can't apply "IN ()". This will make this predicate falsy. 313 if len(v) == 0 { 314 s.Where(sql.False()) 315 return 316 } 317 s.Where(sql.In(s.C(FieldDeletedAt), v...)) 318 }) 319 } 320 321 // DeletedAtNotIn applies the NotIn predicate on the "deleted_at" field. 322 func DeletedAtNotIn(vs ...time.Time) predicate.Permission { 323 v := make([]interface{}, len(vs)) 324 for i := range v { 325 v[i] = vs[i] 326 } 327 return predicate.Permission(func(s *sql.Selector) { 328 // if not arguments were provided, append the FALSE constants, 329 // since we can't apply "IN ()". This will make this predicate falsy. 330 if len(v) == 0 { 331 s.Where(sql.False()) 332 return 333 } 334 s.Where(sql.NotIn(s.C(FieldDeletedAt), v...)) 335 }) 336 } 337 338 // DeletedAtGT applies the GT predicate on the "deleted_at" field. 339 func DeletedAtGT(v time.Time) predicate.Permission { 340 return predicate.Permission(func(s *sql.Selector) { 341 s.Where(sql.GT(s.C(FieldDeletedAt), v)) 342 }) 343 } 344 345 // DeletedAtGTE applies the GTE predicate on the "deleted_at" field. 346 func DeletedAtGTE(v time.Time) predicate.Permission { 347 return predicate.Permission(func(s *sql.Selector) { 348 s.Where(sql.GTE(s.C(FieldDeletedAt), v)) 349 }) 350 } 351 352 // DeletedAtLT applies the LT predicate on the "deleted_at" field. 353 func DeletedAtLT(v time.Time) predicate.Permission { 354 return predicate.Permission(func(s *sql.Selector) { 355 s.Where(sql.LT(s.C(FieldDeletedAt), v)) 356 }) 357 } 358 359 // DeletedAtLTE applies the LTE predicate on the "deleted_at" field. 360 func DeletedAtLTE(v time.Time) predicate.Permission { 361 return predicate.Permission(func(s *sql.Selector) { 362 s.Where(sql.LTE(s.C(FieldDeletedAt), v)) 363 }) 364 } 365 366 // DeletedAtIsNil applies the IsNil predicate on the "deleted_at" field. 367 func DeletedAtIsNil() predicate.Permission { 368 return predicate.Permission(func(s *sql.Selector) { 369 s.Where(sql.IsNull(s.C(FieldDeletedAt))) 370 }) 371 } 372 373 // DeletedAtNotNil applies the NotNil predicate on the "deleted_at" field. 374 func DeletedAtNotNil() predicate.Permission { 375 return predicate.Permission(func(s *sql.Selector) { 376 s.Where(sql.NotNull(s.C(FieldDeletedAt))) 377 }) 378 } 379 380 // RoleIDEQ applies the EQ predicate on the "role_id" field. 381 func RoleIDEQ(v int) predicate.Permission { 382 return predicate.Permission(func(s *sql.Selector) { 383 s.Where(sql.EQ(s.C(FieldRoleID), v)) 384 }) 385 } 386 387 // RoleIDNEQ applies the NEQ predicate on the "role_id" field. 388 func RoleIDNEQ(v int) predicate.Permission { 389 return predicate.Permission(func(s *sql.Selector) { 390 s.Where(sql.NEQ(s.C(FieldRoleID), v)) 391 }) 392 } 393 394 // RoleIDIn applies the In predicate on the "role_id" field. 395 func RoleIDIn(vs ...int) predicate.Permission { 396 v := make([]interface{}, len(vs)) 397 for i := range v { 398 v[i] = vs[i] 399 } 400 return predicate.Permission(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(FieldRoleID), v...)) 408 }) 409 } 410 411 // RoleIDNotIn applies the NotIn predicate on the "role_id" field. 412 func RoleIDNotIn(vs ...int) predicate.Permission { 413 v := make([]interface{}, len(vs)) 414 for i := range v { 415 v[i] = vs[i] 416 } 417 return predicate.Permission(func(s *sql.Selector) { 418 // if not arguments were provided, append the FALSE constants, 419 // since we can't apply "IN ()". This will make this predicate falsy. 420 if len(v) == 0 { 421 s.Where(sql.False()) 422 return 423 } 424 s.Where(sql.NotIn(s.C(FieldRoleID), v...)) 425 }) 426 } 427 428 // ActionEQ applies the EQ predicate on the "action" field. 429 func ActionEQ(v string) predicate.Permission { 430 return predicate.Permission(func(s *sql.Selector) { 431 s.Where(sql.EQ(s.C(FieldAction), v)) 432 }) 433 } 434 435 // ActionNEQ applies the NEQ predicate on the "action" field. 436 func ActionNEQ(v string) predicate.Permission { 437 return predicate.Permission(func(s *sql.Selector) { 438 s.Where(sql.NEQ(s.C(FieldAction), v)) 439 }) 440 } 441 442 // ActionIn applies the In predicate on the "action" field. 443 func ActionIn(vs ...string) predicate.Permission { 444 v := make([]interface{}, len(vs)) 445 for i := range v { 446 v[i] = vs[i] 447 } 448 return predicate.Permission(func(s *sql.Selector) { 449 // if not arguments were provided, append the FALSE constants, 450 // since we can't apply "IN ()". This will make this predicate falsy. 451 if len(v) == 0 { 452 s.Where(sql.False()) 453 return 454 } 455 s.Where(sql.In(s.C(FieldAction), v...)) 456 }) 457 } 458 459 // ActionNotIn applies the NotIn predicate on the "action" field. 460 func ActionNotIn(vs ...string) predicate.Permission { 461 v := make([]interface{}, len(vs)) 462 for i := range v { 463 v[i] = vs[i] 464 } 465 return predicate.Permission(func(s *sql.Selector) { 466 // if not arguments were provided, append the FALSE constants, 467 // since we can't apply "IN ()". This will make this predicate falsy. 468 if len(v) == 0 { 469 s.Where(sql.False()) 470 return 471 } 472 s.Where(sql.NotIn(s.C(FieldAction), v...)) 473 }) 474 } 475 476 // ActionGT applies the GT predicate on the "action" field. 477 func ActionGT(v string) predicate.Permission { 478 return predicate.Permission(func(s *sql.Selector) { 479 s.Where(sql.GT(s.C(FieldAction), v)) 480 }) 481 } 482 483 // ActionGTE applies the GTE predicate on the "action" field. 484 func ActionGTE(v string) predicate.Permission { 485 return predicate.Permission(func(s *sql.Selector) { 486 s.Where(sql.GTE(s.C(FieldAction), v)) 487 }) 488 } 489 490 // ActionLT applies the LT predicate on the "action" field. 491 func ActionLT(v string) predicate.Permission { 492 return predicate.Permission(func(s *sql.Selector) { 493 s.Where(sql.LT(s.C(FieldAction), v)) 494 }) 495 } 496 497 // ActionLTE applies the LTE predicate on the "action" field. 498 func ActionLTE(v string) predicate.Permission { 499 return predicate.Permission(func(s *sql.Selector) { 500 s.Where(sql.LTE(s.C(FieldAction), v)) 501 }) 502 } 503 504 // ActionContains applies the Contains predicate on the "action" field. 505 func ActionContains(v string) predicate.Permission { 506 return predicate.Permission(func(s *sql.Selector) { 507 s.Where(sql.Contains(s.C(FieldAction), v)) 508 }) 509 } 510 511 // ActionHasPrefix applies the HasPrefix predicate on the "action" field. 512 func ActionHasPrefix(v string) predicate.Permission { 513 return predicate.Permission(func(s *sql.Selector) { 514 s.Where(sql.HasPrefix(s.C(FieldAction), v)) 515 }) 516 } 517 518 // ActionHasSuffix applies the HasSuffix predicate on the "action" field. 519 func ActionHasSuffix(v string) predicate.Permission { 520 return predicate.Permission(func(s *sql.Selector) { 521 s.Where(sql.HasSuffix(s.C(FieldAction), v)) 522 }) 523 } 524 525 // ActionEqualFold applies the EqualFold predicate on the "action" field. 526 func ActionEqualFold(v string) predicate.Permission { 527 return predicate.Permission(func(s *sql.Selector) { 528 s.Where(sql.EqualFold(s.C(FieldAction), v)) 529 }) 530 } 531 532 // ActionContainsFold applies the ContainsFold predicate on the "action" field. 533 func ActionContainsFold(v string) predicate.Permission { 534 return predicate.Permission(func(s *sql.Selector) { 535 s.Where(sql.ContainsFold(s.C(FieldAction), v)) 536 }) 537 } 538 539 // ValueEQ applies the EQ predicate on the "value" field. 540 func ValueEQ(v string) predicate.Permission { 541 return predicate.Permission(func(s *sql.Selector) { 542 s.Where(sql.EQ(s.C(FieldValue), v)) 543 }) 544 } 545 546 // ValueNEQ applies the NEQ predicate on the "value" field. 547 func ValueNEQ(v string) predicate.Permission { 548 return predicate.Permission(func(s *sql.Selector) { 549 s.Where(sql.NEQ(s.C(FieldValue), v)) 550 }) 551 } 552 553 // ValueIn applies the In predicate on the "value" field. 554 func ValueIn(vs ...string) predicate.Permission { 555 v := make([]interface{}, len(vs)) 556 for i := range v { 557 v[i] = vs[i] 558 } 559 return predicate.Permission(func(s *sql.Selector) { 560 // if not arguments were provided, append the FALSE constants, 561 // since we can't apply "IN ()". This will make this predicate falsy. 562 if len(v) == 0 { 563 s.Where(sql.False()) 564 return 565 } 566 s.Where(sql.In(s.C(FieldValue), v...)) 567 }) 568 } 569 570 // ValueNotIn applies the NotIn predicate on the "value" field. 571 func ValueNotIn(vs ...string) predicate.Permission { 572 v := make([]interface{}, len(vs)) 573 for i := range v { 574 v[i] = vs[i] 575 } 576 return predicate.Permission(func(s *sql.Selector) { 577 // if not arguments were provided, append the FALSE constants, 578 // since we can't apply "IN ()". This will make this predicate falsy. 579 if len(v) == 0 { 580 s.Where(sql.False()) 581 return 582 } 583 s.Where(sql.NotIn(s.C(FieldValue), v...)) 584 }) 585 } 586 587 // ValueGT applies the GT predicate on the "value" field. 588 func ValueGT(v string) predicate.Permission { 589 return predicate.Permission(func(s *sql.Selector) { 590 s.Where(sql.GT(s.C(FieldValue), v)) 591 }) 592 } 593 594 // ValueGTE applies the GTE predicate on the "value" field. 595 func ValueGTE(v string) predicate.Permission { 596 return predicate.Permission(func(s *sql.Selector) { 597 s.Where(sql.GTE(s.C(FieldValue), v)) 598 }) 599 } 600 601 // ValueLT applies the LT predicate on the "value" field. 602 func ValueLT(v string) predicate.Permission { 603 return predicate.Permission(func(s *sql.Selector) { 604 s.Where(sql.LT(s.C(FieldValue), v)) 605 }) 606 } 607 608 // ValueLTE applies the LTE predicate on the "value" field. 609 func ValueLTE(v string) predicate.Permission { 610 return predicate.Permission(func(s *sql.Selector) { 611 s.Where(sql.LTE(s.C(FieldValue), v)) 612 }) 613 } 614 615 // ValueContains applies the Contains predicate on the "value" field. 616 func ValueContains(v string) predicate.Permission { 617 return predicate.Permission(func(s *sql.Selector) { 618 s.Where(sql.Contains(s.C(FieldValue), v)) 619 }) 620 } 621 622 // ValueHasPrefix applies the HasPrefix predicate on the "value" field. 623 func ValueHasPrefix(v string) predicate.Permission { 624 return predicate.Permission(func(s *sql.Selector) { 625 s.Where(sql.HasPrefix(s.C(FieldValue), v)) 626 }) 627 } 628 629 // ValueHasSuffix applies the HasSuffix predicate on the "value" field. 630 func ValueHasSuffix(v string) predicate.Permission { 631 return predicate.Permission(func(s *sql.Selector) { 632 s.Where(sql.HasSuffix(s.C(FieldValue), v)) 633 }) 634 } 635 636 // ValueEqualFold applies the EqualFold predicate on the "value" field. 637 func ValueEqualFold(v string) predicate.Permission { 638 return predicate.Permission(func(s *sql.Selector) { 639 s.Where(sql.EqualFold(s.C(FieldValue), v)) 640 }) 641 } 642 643 // ValueContainsFold applies the ContainsFold predicate on the "value" field. 644 func ValueContainsFold(v string) predicate.Permission { 645 return predicate.Permission(func(s *sql.Selector) { 646 s.Where(sql.ContainsFold(s.C(FieldValue), v)) 647 }) 648 } 649 650 // HasRole applies the HasEdge predicate on the "role" edge. 651 func HasRole() predicate.Permission { 652 return predicate.Permission(func(s *sql.Selector) { 653 step := sqlgraph.NewStep( 654 sqlgraph.From(Table, FieldID), 655 sqlgraph.To(RoleTable, FieldID), 656 sqlgraph.Edge(sqlgraph.M2O, true, RoleTable, RoleColumn), 657 ) 658 sqlgraph.HasNeighbors(s, step) 659 }) 660 } 661 662 // HasRoleWith applies the HasEdge predicate on the "role" edge with a given conditions (other predicates). 663 func HasRoleWith(preds ...predicate.Role) predicate.Permission { 664 return predicate.Permission(func(s *sql.Selector) { 665 step := sqlgraph.NewStep( 666 sqlgraph.From(Table, FieldID), 667 sqlgraph.To(RoleInverseTable, FieldID), 668 sqlgraph.Edge(sqlgraph.M2O, true, RoleTable, RoleColumn), 669 ) 670 sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { 671 for _, p := range preds { 672 p(s) 673 } 674 }) 675 }) 676 } 677 678 // And groups predicates with the AND operator between them. 679 func And(predicates ...predicate.Permission) predicate.Permission { 680 return predicate.Permission(func(s *sql.Selector) { 681 s1 := s.Clone().SetP(nil) 682 for _, p := range predicates { 683 p(s1) 684 } 685 s.Where(s1.P()) 686 }) 687 } 688 689 // Or groups predicates with the OR operator between them. 690 func Or(predicates ...predicate.Permission) predicate.Permission { 691 return predicate.Permission(func(s *sql.Selector) { 692 s1 := s.Clone().SetP(nil) 693 for i, p := range predicates { 694 if i > 0 { 695 s1.Or() 696 } 697 p(s1) 698 } 699 s.Where(s1.P()) 700 }) 701 } 702 703 // Not applies the not operator on the given predicate. 704 func Not(p predicate.Permission) predicate.Permission { 705 return predicate.Permission(func(s *sql.Selector) { 706 p(s.Not()) 707 }) 708 }