libpg-query
Version:
The real PostgreSQL query parser
35 lines (34 loc) • 1.11 kB
TypeScript
/**
* DO NOT MODIFY MANUALLY — this is generated from the templates dir
*
* To make changes, edit the files in the templates/ directory and run:
* npm run copy:templates
*/
export * from "@pgsql/types";
export interface SqlErrorDetails {
message: string;
cursorPosition: number;
fileName?: string;
functionName?: string;
lineNumber?: number;
context?: string;
}
export interface SqlErrorFormatOptions {
showPosition?: boolean;
showQuery?: boolean;
color?: boolean;
maxQueryLength?: number;
}
export declare class SqlError extends Error {
sqlDetails?: SqlErrorDetails;
constructor(message: string, details?: SqlErrorDetails);
}
export declare function formatSqlError(error: Error & {
sqlDetails?: SqlErrorDetails;
}, query: string, options?: SqlErrorFormatOptions): string;
export declare function hasSqlDetails(error: any): error is Error & {
sqlDetails: SqlErrorDetails;
};
export declare function loadModule(): Promise<void>;
export declare const parse: (query: string) => Promise<any>;
export declare function parseSync(query: string): any;