mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 14:20:12 +00:00
[pg-copy-streams] New module
This commit is contained in:
20
types/pg-copy-streams/index.d.ts
vendored
Normal file
20
types/pg-copy-streams/index.d.ts
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
// Type definitions for pg-copy-streams 1.2
|
||||
// Project: https://github.com/brianc/node-pg-copy-streams
|
||||
// Definitions by: Brian Crowell <https://github.com/fluggo>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import { Submittable, Connection } from "pg";
|
||||
import { Transform, TransformOptions } from "stream";
|
||||
|
||||
export function from(txt: string, options?: TransformOptions): CopyStreamQuery;
|
||||
export function to(txt: string, options?: TransformOptions): CopyToStreamQuery;
|
||||
|
||||
export class CopyStreamQuery extends Transform implements Submittable {
|
||||
submit(connection: Connection): void;
|
||||
}
|
||||
|
||||
export class CopyToStreamQuery extends Transform implements Submittable {
|
||||
submit(connection: Connection): void;
|
||||
}
|
||||
19
types/pg-copy-streams/pg-copy-streams-tests.ts
Normal file
19
types/pg-copy-streams/pg-copy-streams-tests.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { Client } from "pg";
|
||||
import { from, to } from "pg-copy-streams";
|
||||
|
||||
const client = new Client('fake-config-string');
|
||||
|
||||
const copyStream = client.query(from('copy data from stdin;'));
|
||||
|
||||
copyStream.write('', err => {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
return;
|
||||
}
|
||||
|
||||
copyStream.end();
|
||||
});
|
||||
|
||||
const readStream = client.query(to('copy data to stdout;'));
|
||||
|
||||
readStream.pipe(process.stdout);
|
||||
23
types/pg-copy-streams/tsconfig.json
Normal file
23
types/pg-copy-streams/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"pg-copy-streams-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/pg-copy-streams/tslint.json
Normal file
1
types/pg-copy-streams/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user