github.com/ngocphuongnb/tetua@v0.0.7-alpha/packages/entrepository/ent/role/where.go (about) 1 // Code generated by entc, DO NOT EDIT. 2 3 package role 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.Role { 15 return predicate.Role(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.Role { 22 return predicate.Role(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.Role { 29 return predicate.Role(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.Role { 36 return predicate.Role(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.Role { 53 return predicate.Role(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.Role { 70 return predicate.Role(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.Role { 77 return predicate.Role(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.Role { 84 return predicate.Role(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.Role { 91 return predicate.Role(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.Role { 98 return predicate.Role(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.Role { 105 return predicate.Role(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.Role { 112 return predicate.Role(func(s *sql.Selector) { 113 s.Where(sql.EQ(s.C(FieldDeletedAt), v)) 114 }) 115 } 116 117 // Name applies equality check predicate on the "name" field. It's identical to NameEQ. 118 func Name(v string) predicate.Role { 119 return predicate.Role(func(s *sql.Selector) { 120 s.Where(sql.EQ(s.C(FieldName), v)) 121 }) 122 } 123 124 // Description applies equality check predicate on the "description" field. It's identical to DescriptionEQ. 125 func Description(v string) predicate.Role { 126 return predicate.Role(func(s *sql.Selector) { 127 s.Where(sql.EQ(s.C(FieldDescription), v)) 128 }) 129 } 130 131 // Root applies equality check predicate on the "root" field. It's identical to RootEQ. 132 func Root(v bool) predicate.Role { 133 return predicate.Role(func(s *sql.Selector) { 134 s.Where(sql.EQ(s.C(FieldRoot), v)) 135 }) 136 } 137 138 // CreatedAtEQ applies the EQ predicate on the "created_at" field. 139 func CreatedAtEQ(v time.Time) predicate.Role { 140 return predicate.Role(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.Role { 147 return predicate.Role(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.Role { 154 v := make([]interface{}, len(vs)) 155 for i := range v { 156 v[i] = vs[i] 157 } 158 return predicate.Role(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.Role { 171 v := make([]interface{}, len(vs)) 172 for i := range v { 173 v[i] = vs[i] 174 } 175 return predicate.Role(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.Role { 188 return predicate.Role(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.Role { 195 return predicate.Role(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.Role { 202 return predicate.Role(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.Role { 209 return predicate.Role(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.Role { 216 return predicate.Role(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.Role { 223 return predicate.Role(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.Role { 230 v := make([]interface{}, len(vs)) 231 for i := range v { 232 v[i] = vs[i] 233 } 234 return predicate.Role(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.Role { 247 v := make([]interface{}, len(vs)) 248 for i := range v { 249 v[i] = vs[i] 250 } 251 return predicate.Role(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.Role { 264 return predicate.Role(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.Role { 271 return predicate.Role(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.Role { 278 return predicate.Role(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.Role { 285 return predicate.Role(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.Role { 292 return predicate.Role(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.Role { 299 return predicate.Role(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.Role { 306 v := make([]interface{}, len(vs)) 307 for i := range v { 308 v[i] = vs[i] 309 } 310 return predicate.Role(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.Role { 323 v := make([]interface{}, len(vs)) 324 for i := range v { 325 v[i] = vs[i] 326 } 327 return predicate.Role(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.Role { 340 return predicate.Role(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.Role { 347 return predicate.Role(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.Role { 354 return predicate.Role(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.Role { 361 return predicate.Role(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.Role { 368 return predicate.Role(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.Role { 375 return predicate.Role(func(s *sql.Selector) { 376 s.Where(sql.NotNull(s.C(FieldDeletedAt))) 377 }) 378 } 379 380 // NameEQ applies the EQ predicate on the "name" field. 381 func NameEQ(v string) predicate.Role { 382 return predicate.Role(func(s *sql.Selector) { 383 s.Where(sql.EQ(s.C(FieldName), v)) 384 }) 385 } 386 387 // NameNEQ applies the NEQ predicate on the "name" field. 388 func NameNEQ(v string) predicate.Role { 389 return predicate.Role(func(s *sql.Selector) { 390 s.Where(sql.NEQ(s.C(FieldName), v)) 391 }) 392 } 393 394 // NameIn applies the In predicate on the "name" field. 395 func NameIn(vs ...string) predicate.Role { 396 v := make([]interface{}, len(vs)) 397 for i := range v { 398 v[i] = vs[i] 399 } 400 return predicate.Role(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(FieldName), v...)) 408 }) 409 } 410 411 // NameNotIn applies the NotIn predicate on the "name" field. 412 func NameNotIn(vs ...string) predicate.Role { 413 v := make([]interface{}, len(vs)) 414 for i := range v { 415 v[i] = vs[i] 416 } 417 return predicate.Role(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(FieldName), v...)) 425 }) 426 } 427 428 // NameGT applies the GT predicate on the "name" field. 429 func NameGT(v string) predicate.Role { 430 return predicate.Role(func(s *sql.Selector) { 431 s.Where(sql.GT(s.C(FieldName), v)) 432 }) 433 } 434 435 // NameGTE applies the GTE predicate on the "name" field. 436 func NameGTE(v string) predicate.Role { 437 return predicate.Role(func(s *sql.Selector) { 438 s.Where(sql.GTE(s.C(FieldName), v)) 439 }) 440 } 441 442 // NameLT applies the LT predicate on the "name" field. 443 func NameLT(v string) predicate.Role { 444 return predicate.Role(func(s *sql.Selector) { 445 s.Where(sql.LT(s.C(FieldName), v)) 446 }) 447 } 448 449 // NameLTE applies the LTE predicate on the "name" field. 450 func NameLTE(v string) predicate.Role { 451 return predicate.Role(func(s *sql.Selector) { 452 s.Where(sql.LTE(s.C(FieldName), v)) 453 }) 454 } 455 456 // NameContains applies the Contains predicate on the "name" field. 457 func NameContains(v string) predicate.Role { 458 return predicate.Role(func(s *sql.Selector) { 459 s.Where(sql.Contains(s.C(FieldName), v)) 460 }) 461 } 462 463 // NameHasPrefix applies the HasPrefix predicate on the "name" field. 464 func NameHasPrefix(v string) predicate.Role { 465 return predicate.Role(func(s *sql.Selector) { 466 s.Where(sql.HasPrefix(s.C(FieldName), v)) 467 }) 468 } 469 470 // NameHasSuffix applies the HasSuffix predicate on the "name" field. 471 func NameHasSuffix(v string) predicate.Role { 472 return predicate.Role(func(s *sql.Selector) { 473 s.Where(sql.HasSuffix(s.C(FieldName), v)) 474 }) 475 } 476 477 // NameEqualFold applies the EqualFold predicate on the "name" field. 478 func NameEqualFold(v string) predicate.Role { 479 return predicate.Role(func(s *sql.Selector) { 480 s.Where(sql.EqualFold(s.C(FieldName), v)) 481 }) 482 } 483 484 // NameContainsFold applies the ContainsFold predicate on the "name" field. 485 func NameContainsFold(v string) predicate.Role { 486 return predicate.Role(func(s *sql.Selector) { 487 s.Where(sql.ContainsFold(s.C(FieldName), v)) 488 }) 489 } 490 491 // DescriptionEQ applies the EQ predicate on the "description" field. 492 func DescriptionEQ(v string) predicate.Role { 493 return predicate.Role(func(s *sql.Selector) { 494 s.Where(sql.EQ(s.C(FieldDescription), v)) 495 }) 496 } 497 498 // DescriptionNEQ applies the NEQ predicate on the "description" field. 499 func DescriptionNEQ(v string) predicate.Role { 500 return predicate.Role(func(s *sql.Selector) { 501 s.Where(sql.NEQ(s.C(FieldDescription), v)) 502 }) 503 } 504 505 // DescriptionIn applies the In predicate on the "description" field. 506 func DescriptionIn(vs ...string) predicate.Role { 507 v := make([]interface{}, len(vs)) 508 for i := range v { 509 v[i] = vs[i] 510 } 511 return predicate.Role(func(s *sql.Selector) { 512 // if not arguments were provided, append the FALSE constants, 513 // since we can't apply "IN ()". This will make this predicate falsy. 514 if len(v) == 0 { 515 s.Where(sql.False()) 516 return 517 } 518 s.Where(sql.In(s.C(FieldDescription), v...)) 519 }) 520 } 521 522 // DescriptionNotIn applies the NotIn predicate on the "description" field. 523 func DescriptionNotIn(vs ...string) predicate.Role { 524 v := make([]interface{}, len(vs)) 525 for i := range v { 526 v[i] = vs[i] 527 } 528 return predicate.Role(func(s *sql.Selector) { 529 // if not arguments were provided, append the FALSE constants, 530 // since we can't apply "IN ()". This will make this predicate falsy. 531 if len(v) == 0 { 532 s.Where(sql.False()) 533 return 534 } 535 s.Where(sql.NotIn(s.C(FieldDescription), v...)) 536 }) 537 } 538 539 // DescriptionGT applies the GT predicate on the "description" field. 540 func DescriptionGT(v string) predicate.Role { 541 return predicate.Role(func(s *sql.Selector) { 542 s.Where(sql.GT(s.C(FieldDescription), v)) 543 }) 544 } 545 546 // DescriptionGTE applies the GTE predicate on the "description" field. 547 func DescriptionGTE(v string) predicate.Role { 548 return predicate.Role(func(s *sql.Selector) { 549 s.Where(sql.GTE(s.C(FieldDescription), v)) 550 }) 551 } 552 553 // DescriptionLT applies the LT predicate on the "description" field. 554 func DescriptionLT(v string) predicate.Role { 555 return predicate.Role(func(s *sql.Selector) { 556 s.Where(sql.LT(s.C(FieldDescription), v)) 557 }) 558 } 559 560 // DescriptionLTE applies the LTE predicate on the "description" field. 561 func DescriptionLTE(v string) predicate.Role { 562 return predicate.Role(func(s *sql.Selector) { 563 s.Where(sql.LTE(s.C(FieldDescription), v)) 564 }) 565 } 566 567 // DescriptionContains applies the Contains predicate on the "description" field. 568 func DescriptionContains(v string) predicate.Role { 569 return predicate.Role(func(s *sql.Selector) { 570 s.Where(sql.Contains(s.C(FieldDescription), v)) 571 }) 572 } 573 574 // DescriptionHasPrefix applies the HasPrefix predicate on the "description" field. 575 func DescriptionHasPrefix(v string) predicate.Role { 576 return predicate.Role(func(s *sql.Selector) { 577 s.Where(sql.HasPrefix(s.C(FieldDescription), v)) 578 }) 579 } 580 581 // DescriptionHasSuffix applies the HasSuffix predicate on the "description" field. 582 func DescriptionHasSuffix(v string) predicate.Role { 583 return predicate.Role(func(s *sql.Selector) { 584 s.Where(sql.HasSuffix(s.C(FieldDescription), v)) 585 }) 586 } 587 588 // DescriptionIsNil applies the IsNil predicate on the "description" field. 589 func DescriptionIsNil() predicate.Role { 590 return predicate.Role(func(s *sql.Selector) { 591 s.Where(sql.IsNull(s.C(FieldDescription))) 592 }) 593 } 594 595 // DescriptionNotNil applies the NotNil predicate on the "description" field. 596 func DescriptionNotNil() predicate.Role { 597 return predicate.Role(func(s *sql.Selector) { 598 s.Where(sql.NotNull(s.C(FieldDescription))) 599 }) 600 } 601 602 // DescriptionEqualFold applies the EqualFold predicate on the "description" field. 603 func DescriptionEqualFold(v string) predicate.Role { 604 return predicate.Role(func(s *sql.Selector) { 605 s.Where(sql.EqualFold(s.C(FieldDescription), v)) 606 }) 607 } 608 609 // DescriptionContainsFold applies the ContainsFold predicate on the "description" field. 610 func DescriptionContainsFold(v string) predicate.Role { 611 return predicate.Role(func(s *sql.Selector) { 612 s.Where(sql.ContainsFold(s.C(FieldDescription), v)) 613 }) 614 } 615 616 // RootEQ applies the EQ predicate on the "root" field. 617 func RootEQ(v bool) predicate.Role { 618 return predicate.Role(func(s *sql.Selector) { 619 s.Where(sql.EQ(s.C(FieldRoot), v)) 620 }) 621 } 622 623 // RootNEQ applies the NEQ predicate on the "root" field. 624 func RootNEQ(v bool) predicate.Role { 625 return predicate.Role(func(s *sql.Selector) { 626 s.Where(sql.NEQ(s.C(FieldRoot), v)) 627 }) 628 } 629 630 // RootIsNil applies the IsNil predicate on the "root" field. 631 func RootIsNil() predicate.Role { 632 return predicate.Role(func(s *sql.Selector) { 633 s.Where(sql.IsNull(s.C(FieldRoot))) 634 }) 635 } 636 637 // RootNotNil applies the NotNil predicate on the "root" field. 638 func RootNotNil() predicate.Role { 639 return predicate.Role(func(s *sql.Selector) { 640 s.Where(sql.NotNull(s.C(FieldRoot))) 641 }) 642 } 643 644 // HasPermissions applies the HasEdge predicate on the "permissions" edge. 645 func HasPermissions() predicate.Role { 646 return predicate.Role(func(s *sql.Selector) { 647 step := sqlgraph.NewStep( 648 sqlgraph.From(Table, FieldID), 649 sqlgraph.To(PermissionsTable, FieldID), 650 sqlgraph.Edge(sqlgraph.O2M, false, PermissionsTable, PermissionsColumn), 651 ) 652 sqlgraph.HasNeighbors(s, step) 653 }) 654 } 655 656 // HasPermissionsWith applies the HasEdge predicate on the "permissions" edge with a given conditions (other predicates). 657 func HasPermissionsWith(preds ...predicate.Permission) predicate.Role { 658 return predicate.Role(func(s *sql.Selector) { 659 step := sqlgraph.NewStep( 660 sqlgraph.From(Table, FieldID), 661 sqlgraph.To(PermissionsInverseTable, FieldID), 662 sqlgraph.Edge(sqlgraph.O2M, false, PermissionsTable, PermissionsColumn), 663 ) 664 sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { 665 for _, p := range preds { 666 p(s) 667 } 668 }) 669 }) 670 } 671 672 // HasUsers applies the HasEdge predicate on the "users" edge. 673 func HasUsers() predicate.Role { 674 return predicate.Role(func(s *sql.Selector) { 675 step := sqlgraph.NewStep( 676 sqlgraph.From(Table, FieldID), 677 sqlgraph.To(UsersTable, FieldID), 678 sqlgraph.Edge(sqlgraph.M2M, false, UsersTable, UsersPrimaryKey...), 679 ) 680 sqlgraph.HasNeighbors(s, step) 681 }) 682 } 683 684 // HasUsersWith applies the HasEdge predicate on the "users" edge with a given conditions (other predicates). 685 func HasUsersWith(preds ...predicate.User) predicate.Role { 686 return predicate.Role(func(s *sql.Selector) { 687 step := sqlgraph.NewStep( 688 sqlgraph.From(Table, FieldID), 689 sqlgraph.To(UsersInverseTable, FieldID), 690 sqlgraph.Edge(sqlgraph.M2M, false, UsersTable, UsersPrimaryKey...), 691 ) 692 sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { 693 for _, p := range preds { 694 p(s) 695 } 696 }) 697 }) 698 } 699 700 // And groups predicates with the AND operator between them. 701 func And(predicates ...predicate.Role) predicate.Role { 702 return predicate.Role(func(s *sql.Selector) { 703 s1 := s.Clone().SetP(nil) 704 for _, p := range predicates { 705 p(s1) 706 } 707 s.Where(s1.P()) 708 }) 709 } 710 711 // Or groups predicates with the OR operator between them. 712 func Or(predicates ...predicate.Role) predicate.Role { 713 return predicate.Role(func(s *sql.Selector) { 714 s1 := s.Clone().SetP(nil) 715 for i, p := range predicates { 716 if i > 0 { 717 s1.Or() 718 } 719 p(s1) 720 } 721 s.Where(s1.P()) 722 }) 723 } 724 725 // Not applies the not operator on the given predicate. 726 func Not(p predicate.Role) predicate.Role { 727 return predicate.Role(func(s *sql.Selector) { 728 p(s.Not()) 729 }) 730 }