Skip to content

Commit b0afc0b

Browse files
committed
chore: Update readme
1 parent 71d2b1a commit b0afc0b

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

README.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,10 @@ type PostFilter {
128128
views_gt: Int
129129
views_gte: Int
130130
user_id: ID
131+
id_neq: ID
132+
title_neq: ID
133+
views_neq: Int
134+
user_id_neq: ID
131135
}
132136
type ListMetadata {
133137
count: Int!
@@ -139,7 +143,7 @@ By convention, json-graphql-server expects all entities to have an `id` field th
139143

140144
For every field named `*_id`, json-graphql-server creates a two-way relationship, to let you fetch related entities from both sides. For instance, the presence of the `user_id` field in the `posts` entity leads to the ability to fetch the related `User` for a `Post` - and the related `Posts` for a `User`.
141145

142-
The `all*` queries accept parameters to let you sort, paginate, and filter the list of results. You can filter by any field, not just the primary key. For instance, you can get the posts written by user `123`. Json-graphql-server also adds a full-text query field named `q`, and created range filter fields for numeric and date fields. The detail of all available filters can be seen in the generated `*Filter` type.
146+
The `all*` queries accept parameters to let you sort, paginate, and filter the list of results. You can filter by any field, not just the primary key. For instance, you can get the posts written by user `123`. Json-graphql-server also adds a full-text query field named `q`, and created range filter fields for numeric and date fields. All types (excluding booleans and arrays) get a not equal filter. The detail of all available filters can be seen in the generated `*Filter` type.
143147

144148
## GraphQL Usage
145149

@@ -360,6 +364,32 @@ Here is how you can use the queries and mutations generated for your data, using
360364
</pre>
361365
</td>
362366
</tr>
367+
<tr>
368+
<td>
369+
<pre>
370+
// all fields (except boolean and array) get not equal filters
371+
// -lt, _lte, -gt, and _gte
372+
{
373+
allPosts(filter: { title_neq: "Lorem Ipsum" }) {
374+
title
375+
views
376+
}
377+
}
378+
</pre>
379+
</td>
380+
<td>
381+
<pre>
382+
{
383+
"data": {
384+
"allPosts": [
385+
{ "title": "Some Other Title", views: 254 },
386+
]
387+
}
388+
}
389+
</pre>
390+
</td>
391+
</tr>
392+
363393
<tr>
364394
<td>
365395
<pre>

0 commit comments

Comments
 (0)