graphile-utils
Version:
Utilities to help with building graphile-build plugins
24 lines (23 loc) • 1.13 kB
TypeScript
import type { SQL, QueryBuilder } from "graphile-build-pg";
import type { Build, Plugin } from "graphile-build";
declare type OrderBySpecIdentity = string | SQL | ((options: {
queryBuilder: QueryBuilder;
}) => SQL);
declare type OrderSpec = [OrderBySpecIdentity, boolean] | [OrderBySpecIdentity, boolean, boolean];
export interface MakeAddPgTableOrderByPluginOrders {
[orderByEnumValue: string]: {
value: {
alias?: string;
specs: Array<OrderSpec>;
unique: boolean;
};
};
}
export default function makeAddPgTableOrderByPlugin(schemaName: string, tableName: string, ordersGenerator: (build: Build) => MakeAddPgTableOrderByPluginOrders, hint?: string): Plugin;
export declare type NullsSortMethod = "first" | "last" | "first-iff-ascending" | "last-iff-ascending" | undefined;
export interface OrderByAscDescOptions {
unique?: boolean;
nulls?: NullsSortMethod;
}
export declare function orderByAscDesc(baseName: string, columnOrSqlFragment: OrderBySpecIdentity, uniqueOrOptions?: boolean | OrderByAscDescOptions): MakeAddPgTableOrderByPluginOrders;
export {};