DefinitelyTyped/types/pg-query-stream/index.d.ts
Ian Liu Rodrigues f0af8db482 [pg] Client.query now accepts Submittables
This commit creates a new interface on @types/pg called Submittable
following the description on node-postgres API doc, which says:

> client.query with a Submittable
>
> If you pass an object to client.query and the object has a .submit
> function on it, the client will pass it's PostgreSQL server connection
> to the object and delegate query dispatching to the supplied object
> [...]

and uses the new interface as argument type to Client.query and
Pool.query. This allows the usage of pg-copy-streams package.
2018-06-27 09:52:19 -03:00

27 lines
745 B
TypeScript

// Type definitions for pg-query-stream 1.0
// Project: https://github.com/brianc/node-pg-query-stream
// Definitions by: António Marques <https://github.com/asmarques>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
import stream = require("stream");
import pg = require("pg");
declare namespace QueryStream {
interface Options {
highWaterMark?: number;
batchSize?: number;
}
}
declare class QueryStream extends stream.Readable implements pg.Submittable {
batchSize: number;
text: string;
values?: any[];
constructor(text: string, values?: any[], options?: QueryStream.Options);
submit(connection: pg.Connection): void;
}
export = QueryStream;