Installation
npm install --save @types/pg-cursor
Summary
This package contains type definitions for pg-cursor (https://github.com/brianc/node-postgres#readme).
Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/pg-cursor.
import EventEmitter = require("events");
import { Connection, CustomTypesConfig, QueryResult } from "pg";
declare namespace Cursor {
interface CursorQueryConfig {
rowMode?: "array";
types?: CustomTypesConfig;
}
type ResultCallback<RowType> = (err: Error | undefined, rows: RowType[], result: QueryResult) => void;
}
declare class Cursor<Row = any> extends EventEmitter {
constructor(query: string, values?: any[], config?: Cursor.CursorQueryConfig);
submit: (connection: Connection) => void;
read(maxRows: number): Promise<Row[]>;
read(maxRows: number, callback: Cursor.ResultCallback<Row>): undefined;
read(maxRows: number, callback?: Cursor.ResultCallback<Row>): Promise<Row[]> | undefined;
close(): Promise<void>;
close(callback: (err: Error) => void): undefined;
close(callback?: (err: Error) => void): Promise<void> | undefined;
end(callback: () => void): void;
}
export = Cursor;
Additional Details
Credits
These definitions were written by Tiogshi Laj, and Elias Fauser.