mirror of
https://github.com/ent/ent.git
synced 2026-05-22 09:31:45 +03:00
ent/doc: add custom predicate exmaple
Reviewed By: alexsn Differential Revision: D17926144 fbshipit-source-id: 5390585bf634aecfad86a729db6e633c4a7e6f5e
This commit is contained in:
committed by
Facebook Github Bot
parent
5d988870bc
commit
2c8d7fcc8b
@@ -78,3 +78,16 @@ client.Pet.
|
||||
).
|
||||
All(ctx)
|
||||
```
|
||||
|
||||
## Custom Predicates
|
||||
|
||||
Custom predicates can be useful if you want to write your own dialect-specific logic.
|
||||
|
||||
```go
|
||||
pets := client.Pet.
|
||||
Query().
|
||||
Where(predicate.Pet(func(s *sql.Selector) {
|
||||
s.Where(sql.InInts(pet.OwnerColumn, 1, 2, 3))
|
||||
})).
|
||||
AllX(ctx)
|
||||
```
|
||||
Reference in New Issue
Block a user