Skip to content

Commit 8f6e3bb

Browse files
committed
docs(graphile-postgis): lead with ORM where: shape for spatial relation examples
1 parent 6b91099 commit 8f6e3bb

1 file changed

Lines changed: 30 additions & 3 deletions

File tree

graphile/graphile-postgis/README.md

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,23 +81,50 @@ COMMENT ON COLUMN <owner_table>.<owner_col> IS
8181

8282
### Filter shapes
8383

84-
2-arg operators use the familiar `some` / `every` / `none` shape:
84+
2-arg operators use the familiar `some` / `every` / `none` shape.
85+
86+
Through the generated ORM (`where:`):
87+
88+
```ts
89+
await orm.telemedicineClinic
90+
.findMany({
91+
select: { id: true, name: true },
92+
where: { county: { some: { name: { equalTo: 'California County' } } } },
93+
})
94+
.execute();
95+
```
96+
97+
Or equivalently at the GraphQL layer (`filter:`):
8598

8699
```graphql
87100
telemedicineClinics(
88-
filter: { county: { some: { name: { eq: "California County" } } } }
101+
filter: { county: { some: { name: { equalTo: "California County" } } } }
89102
) { nodes { id name } }
90103
```
91104

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

108+
```ts
109+
await orm.telemedicineClinic
110+
.findMany({
111+
select: { id: true, name: true },
112+
where: {
113+
nearbyClinic: {
114+
distance: 5000,
115+
some: { specialty: { equalTo: 'pediatrics' } },
116+
},
117+
},
118+
})
119+
.execute();
120+
```
121+
95122
```graphql
96123
telemedicineClinics(
97124
filter: {
98125
nearbyClinic: {
99126
distance: 5000
100-
some: { specialty: { eq: "pediatrics" } }
127+
some: { specialty: { equalTo: "pediatrics" } }
101128
}
102129
}
103130
) { nodes { id name } }

0 commit comments

Comments
 (0)