Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 30 additions & 3 deletions graphile/graphile-postgis/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,23 +81,50 @@ COMMENT ON COLUMN <owner_table>.<owner_col> IS

### Filter shapes

2-arg operators use the familiar `some` / `every` / `none` shape:
2-arg operators use the familiar `some` / `every` / `none` shape.

Through the generated ORM (`where:`):

```ts
await orm.telemedicineClinic
.findMany({
select: { id: true, name: true },
where: { county: { some: { name: { equalTo: 'California County' } } } },
})
.execute();
```

Or equivalently at the GraphQL layer (`filter:`):

```graphql
telemedicineClinics(
filter: { county: { some: { name: { eq: "California County" } } } }
filter: { county: { some: { name: { equalTo: "California County" } } } }
) { nodes { id name } }
```

`st_dwithin` takes its distance at the relation level (it parametrises
the join, not the joined row):

```ts
await orm.telemedicineClinic
.findMany({
select: { id: true, name: true },
where: {
nearbyClinic: {
distance: 5000,
some: { specialty: { equalTo: 'pediatrics' } },
},
},
})
.execute();
```

```graphql
telemedicineClinics(
filter: {
nearbyClinic: {
distance: 5000
some: { specialty: { eq: "pediatrics" } }
some: { specialty: { equalTo: "pediatrics" } }
}
}
) { nodes { id name } }
Expand Down
Loading