mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
ent: add AND operator for type predicates
Reviewed By: alexsn Differential Revision: D16668249 fbshipit-source-id: 1554c3af9779fd551a90218c604d23b5bf8b8c6b
This commit is contained in:
committed by
Facebook Github Bot
parent
4565455ee4
commit
2fd1b728f3
@@ -466,7 +466,18 @@ func AddressHasSuffix(v string) predicate.User {
|
||||
)
|
||||
}
|
||||
|
||||
// Or groups list of predicates with the or operator between them.
|
||||
// And groups list of predicates with the AND operator between them.
|
||||
func And(predicates ...predicate.User) predicate.User {
|
||||
return predicate.User(
|
||||
func(s *sql.Selector) {
|
||||
for _, p := range predicates {
|
||||
p(s)
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
// Or groups list of predicates with the OR operator between them.
|
||||
func Or(predicates ...predicate.User) predicate.User {
|
||||
return predicate.User(
|
||||
func(s *sql.Selector) {
|
||||
|
||||
@@ -109,7 +109,18 @@ func IDNotIn(ids ...int) predicate.Group {
|
||||
)
|
||||
}
|
||||
|
||||
// Or groups list of predicates with the or operator between them.
|
||||
// And groups list of predicates with the AND operator between them.
|
||||
func And(predicates ...predicate.Group) predicate.Group {
|
||||
return predicate.Group(
|
||||
func(s *sql.Selector) {
|
||||
for _, p := range predicates {
|
||||
p(s)
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
// Or groups list of predicates with the OR operator between them.
|
||||
func Or(predicates ...predicate.Group) predicate.Group {
|
||||
return predicate.Group(
|
||||
func(s *sql.Selector) {
|
||||
|
||||
@@ -109,7 +109,18 @@ func IDNotIn(ids ...int) predicate.Pet {
|
||||
)
|
||||
}
|
||||
|
||||
// Or groups list of predicates with the or operator between them.
|
||||
// And groups list of predicates with the AND operator between them.
|
||||
func And(predicates ...predicate.Pet) predicate.Pet {
|
||||
return predicate.Pet(
|
||||
func(s *sql.Selector) {
|
||||
for _, p := range predicates {
|
||||
p(s)
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
// Or groups list of predicates with the OR operator between them.
|
||||
func Or(predicates ...predicate.Pet) predicate.Pet {
|
||||
return predicate.Pet(
|
||||
func(s *sql.Selector) {
|
||||
|
||||
@@ -567,7 +567,18 @@ func BufferNotIn(vs ...[]byte) predicate.User {
|
||||
)
|
||||
}
|
||||
|
||||
// Or groups list of predicates with the or operator between them.
|
||||
// And groups list of predicates with the AND operator between them.
|
||||
func And(predicates ...predicate.User) predicate.User {
|
||||
return predicate.User(
|
||||
func(s *sql.Selector) {
|
||||
for _, p := range predicates {
|
||||
p(s)
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
// Or groups list of predicates with the OR operator between them.
|
||||
func Or(predicates ...predicate.User) predicate.User {
|
||||
return predicate.User(
|
||||
func(s *sql.Selector) {
|
||||
|
||||
Reference in New Issue
Block a user