Skip to content

Commit 91dbf6f

Browse files
hansololaibenjie
andauthored
feat(graphile-utils): Type update on addPgTableOrderByPlugin (#629)
Co-authored-by: Benjie Gillam <[email protected]>
1 parent 5ab659c commit 91dbf6f

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

packages/graphile-utils/src/makeAddPgTableOrderByPlugin.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
// BELOW HERE, IMPORTS ARE ONLY TYPES (not values)
2-
import { SQL } from "graphile-build-pg";
2+
import { SQL, QueryBuilder } from "graphile-build-pg";
33
import { Build, Plugin } from "graphile-build";
44

5-
type OrderSpec = [string | SQL, boolean] | [string | SQL, boolean, boolean];
5+
type OrderBySpecIdentity =
6+
| string
7+
| SQL
8+
| ((options: { queryBuilder: QueryBuilder }) => SQL);
9+
10+
type OrderSpec =
11+
| [OrderBySpecIdentity, boolean]
12+
| [OrderBySpecIdentity, boolean, boolean];
613
export interface MakeAddPgTableOrderByPluginOrders {
714
[orderByEnumValue: string]: {
815
value: {
@@ -47,7 +54,7 @@ export default function makeAddPgTableOrderByPlugin(
4754

4855
export function orderByAscDesc(
4956
baseName: string,
50-
columnOrSqlFragment: string | SQL,
57+
columnOrSqlFragment: OrderBySpecIdentity,
5158
unique = false
5259
): MakeAddPgTableOrderByPluginOrders {
5360
return {

0 commit comments

Comments
 (0)