Skip to content

Commit 7237603

Browse files
committed
update CLI section of README
1 parent da2c199 commit 7237603

File tree

1 file changed

+33
-25
lines changed

1 file changed

+33
-25
lines changed

README.md

Lines changed: 33 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,25 @@ Also see the [Production Considerations](https://www.graphile.org/postgraphile/p
2525

2626
### CLI
2727

28-
``` bash
29-
postgraphile --append-plugins `pwd`/path/to/this/plugin/index.js
28+
```bash
29+
yarn add postgraphile
30+
yarn add postgraphile-plugin-connection-filter
31+
npx postgraphile --append-plugins postgraphile-plugin-connection-filter
3032
```
3133

3234
### Library
3335

34-
``` js
36+
```js
3537
const express = require("express");
3638
const { postgraphile } = require("postgraphile");
37-
const PostGraphileConnectionFilterPlugin = require("postgraphile-plugin-connection-filter");
39+
const ConnectionFilterPlugin = require("postgraphile-plugin-connection-filter");
3840

3941
const app = express();
4042

4143
app.use(
4244
postgraphile(pgConfig, schema, {
4345
graphiql: true,
44-
appendPlugins: [PostGraphileConnectionFilterPlugin],
46+
appendPlugins: [ConnectionFilterPlugin],
4547
})
4648
);
4749

@@ -131,7 +133,7 @@ The following filter operators are exposed by default:
131133

132134
<summary>Null values</summary>
133135

134-
``` graphql
136+
```graphql
135137
query {
136138
allPosts(filter: {
137139
body: { isNull: true }
@@ -147,7 +149,7 @@ query {
147149

148150
<summary>Non-null values</summary>
149151

150-
``` graphql
152+
```graphql
151153
query {
152154
allPosts(filter: {
153155
body: { isNull: false }
@@ -163,7 +165,7 @@ query {
163165

164166
<summary>Comparison operator with scalar input</summary>
165167

166-
``` graphql
168+
```graphql
167169
query {
168170
allPosts(filter: {
169171
createdAt: { greaterThan: "2016-01-01" }
@@ -179,7 +181,7 @@ query {
179181

180182
<summary>Comparison operator with array input</summary>
181183

182-
``` graphql
184+
```graphql
183185
query {
184186
allPosts(filter: {
185187
authorId: { in: [1, 2] }
@@ -197,7 +199,7 @@ query {
197199

198200
Note: Objects with multiple keys are interpreted with an implicit `AND` between the conditions.
199201

200-
``` graphql
202+
```graphql
201203
query {
202204
allPosts(filter: {
203205
body: { isNull: false },
@@ -214,7 +216,7 @@ query {
214216

215217
<summary>Logical operator</summary>
216218

217-
``` graphql
219+
```graphql
218220
query {
219221
allPosts(filter: {
220222
or: [
@@ -233,7 +235,7 @@ query {
233235

234236
<summary>Compound logic</summary>
235237

236-
``` graphql
238+
```graphql
237239
query {
238240
allPosts(filter: {
239241
not: {
@@ -254,7 +256,7 @@ query {
254256

255257
<summary>Relations: Nested</summary>
256258

257-
``` graphql
259+
```graphql
258260
query {
259261
allPeople(filter: {
260262
firstName: { startsWith:"John" }
@@ -282,7 +284,7 @@ query {
282284

283285
> Requires `connectionFilterRelations: true`
284286
285-
``` graphql
287+
```graphql
286288
query {
287289
allPosts(filter: {
288290
personByAuthorId: { createdAt: { greaterThan: "2018-01-01" } }
@@ -300,7 +302,7 @@ query {
300302

301303
> Requires `connectionFilterRelations: true`
302304
303-
``` graphql
305+
```graphql
304306
query {
305307
allPeople(filter: {
306308
accountByPersonId: { status: { equalTo: ACTIVE } }
@@ -332,7 +334,7 @@ When using PostGraphile as a library, the following plugin options can be passed
332334

333335
Restrict filtering to specific operators:
334336

335-
``` js
337+
```js
336338
postgraphile(pgConfig, schema, {
337339
graphileBuildOptions: {
338340
connectionFilterAllowedOperators: [
@@ -362,7 +364,7 @@ For a full list of the available operators, see the Comparison Operators table a
362364

363365
Restrict filtering to specific field types:
364366

365-
``` js
367+
```js
366368
postgraphile(pgConfig, schema, {
367369
graphileBuildOptions: {
368370
connectionFilterAllowedFieldTypes: ["String", "Int"],
@@ -378,9 +380,11 @@ The available field types will depend on your database schema.
378380

379381
<summary>connectionFilterComputedColumns</summary>
380382

383+
TODO: VERIFY THAT THE TEST FOR THIS IS ACTUALLY WORKING!
384+
381385
Enable/disable filtering by computed columns:
382386

383-
``` js
387+
```js
384388
postgraphile(pgConfig, schema, {
385389
graphileBuildOptions: {
386390
connectionFilterComputedColumns: false, // default: true
@@ -394,9 +398,11 @@ postgraphile(pgConfig, schema, {
394398

395399
<summary>connectionFilterLists</summary>
396400

401+
TODO: VERIFY THAT THE TEST FOR THIS IS ACTUALLY WORKING!
402+
397403
Enable/disable filtering on List fields:
398404

399-
``` js
405+
```js
400406
postgraphile(pgConfig, schema, {
401407
graphileBuildOptions: {
402408
connectionFilterLists: false, // default: true
@@ -412,7 +418,7 @@ postgraphile(pgConfig, schema, {
412418

413419
Use alternative names (e.g. `eq`, `ne`) for operators:
414420

415-
``` js
421+
```js
416422
postgraphile(pgConfig, schema, {
417423
graphileBuildOptions: {
418424
connectionFilterOperatorNames: {
@@ -431,7 +437,7 @@ postgraphile(pgConfig, schema, {
431437

432438
Enable/disable filtering on related fields:
433439

434-
``` js
440+
```js
435441
postgraphile(pgConfig, schema, {
436442
graphileBuildOptions: {
437443
connectionFilterRelations: true, // default: false
@@ -445,9 +451,11 @@ postgraphile(pgConfig, schema, {
445451

446452
<summary>connectionFilterSetofFunctions</summary>
447453

454+
TODO: VERIFY THAT THE TEST FOR THIS IS ACTUALLY WORKING!
455+
448456
Enable/disable filtering on functions that return `setof`:
449457

450-
``` js
458+
```js
451459
postgraphile(pgConfig, schema, {
452460
graphileBuildOptions: {
453461
connectionFilterSetofFunctions: false, // default: true
@@ -463,7 +471,7 @@ postgraphile(pgConfig, schema, {
463471

464472
Allow/forbid `null` literals in input:
465473

466-
``` js
474+
```js
467475
postgraphile(pgConfig, schema, {
468476
graphileBuildOptions: {
469477
connectionFilterAllowNullInput: true, // default: false
@@ -482,7 +490,7 @@ When `true`, passing `null` as a field value is equivalent to omitting the field
482490

483491
Allow/forbid empty objects (`{}`) in input:
484492

485-
``` js
493+
```js
486494
postgraphile(pgConfig, schema, {
487495
graphileBuildOptions: {
488496
connectionFilterAllowEmptyObjectInput: true, // default: false
@@ -498,7 +506,7 @@ When `true`, passing `{}` as a field value is equivalent to omitting the field.
498506
## Development
499507

500508
To establish a test environment, create an empty Postgres database (e.g. `graphile_build_test`) and set a `TEST_DATABASE_URL` environment variable with your connection string (e.g. `postgres://localhost:5432/graphile_build_test`). Ensure that `psql` is installed locally and then run:
501-
``` bash
509+
```bash
502510
yarn
503511
npm run test
504512
```

0 commit comments

Comments
 (0)