ent/doc: add custom predicate exmaple

Reviewed By: alexsn

Differential Revision: D17926144

fbshipit-source-id: 5390585bf634aecfad86a729db6e633c4a7e6f5e
This commit is contained in:
Ariel Mashraki
2019-10-15 06:41:29 -07:00
committed by Facebook Github Bot
parent 5d988870bc
commit 2c8d7fcc8b
2 changed files with 56 additions and 43 deletions

View File

@@ -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)
```