mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
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.
27 lines
745 B
TypeScript
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;
|