doc/md: add info about using WhereInput as predicates (#2691)

* Add info about using `WhereInput` in with `.Where()`

* Update doc/md/predicates.md

Co-authored-by: Ariel Mashraki <7413593+a8m@users.noreply.github.com>

* Update tutorial-todo-gql-filter-input.md

* Update predicates.md

* Update predicates.md

* Update tutorial-todo-gql-filter-input.md

Co-authored-by: Ariel Mashraki <7413593+a8m@users.noreply.github.com>
This commit is contained in:
frederikhors
2022-06-27 13:57:11 +02:00
committed by GitHub
parent e8bf1d1cbd
commit 84b05c05cd

View File

@@ -311,6 +311,19 @@ We can use this new filtering as any other predicate:
}
```
### Usage of filter inputs as predicates
The `Filter` option lets use the generated `WhereInput`s as regular repdicates on any type of query:
```go
query := ent.Todo.Query()
query, err := input.Filter(query)
if err != nil {
return nil, err
}
return query.All(ctx)
```
---
Well done! As you can see, by changing a few lines of code our application now exposes a type-safe GraphQL filters