Skip to content

Commit

Permalink
feat(graphile-utils): Type update on addPgTableOrderByPlugin (#629)
Browse files Browse the repository at this point in the history
Co-authored-by: Benjie Gillam <benjie@jemjie.com>
  • Loading branch information
hansololai and benjie committed Jul 22, 2020
1 parent 5ab659c commit 91dbf6f
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions packages/graphile-utils/src/makeAddPgTableOrderByPlugin.ts
@@ -1,8 +1,15 @@
// BELOW HERE, IMPORTS ARE ONLY TYPES (not values)
import { SQL } from "graphile-build-pg";
import { SQL, QueryBuilder } from "graphile-build-pg";
import { Build, Plugin } from "graphile-build";

type OrderSpec = [string | SQL, boolean] | [string | SQL, boolean, boolean];
type OrderBySpecIdentity =
| string
| SQL
| ((options: { queryBuilder: QueryBuilder }) => SQL);

type OrderSpec =
| [OrderBySpecIdentity, boolean]
| [OrderBySpecIdentity, boolean, boolean];
export interface MakeAddPgTableOrderByPluginOrders {
[orderByEnumValue: string]: {
value: {
Expand Down Expand Up @@ -47,7 +54,7 @@ export default function makeAddPgTableOrderByPlugin(

export function orderByAscDesc(
baseName: string,
columnOrSqlFragment: string | SQL,
columnOrSqlFragment: OrderBySpecIdentity,
unique = false
): MakeAddPgTableOrderByPluginOrders {
return {
Expand Down

0 comments on commit 91dbf6f

Please sign in to comment.