0.0.23 • Published 6 months ago

@types/promise-pg v0.0.23

Weekly downloads
27
License
MIT
Repository
github
Last release
6 months ago

Installation

npm install --save @types/promise-pg

Summary

This package contains type definitions for promise-pg (https://bitbucket.org/lplabs/promise-pg).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/promise-pg.

index.d.ts

// Type definitions for promise-pg
// Project: https://bitbucket.org/lplabs/promise-pg
// Definitions by: Chris Charabaruk <https://github.com/coldacid>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3

/// <reference types="node" />

import * as stream from 'stream';
import * as pg from 'pg';
import * as Q from "q";

export {pg as raw};

export interface ClientConfig extends pg.ClientConfig { }

export declare function connect(connection: string): Q.Promise<Client>;
export declare function connect(connection: pg.ClientConfig): Q.Promise<Client>;

export declare function end(): Q.Promise<void>;

export interface QueryConfig extends pg.QueryConfig {
    buffer?: boolean | undefined;
}

export declare class Client {
    constructor(connection: string);
    constructor(config: ClientConfig);

    raw: pg.Client;

    connect(): Q.Promise<void>;
    end(): Q.Promise<void>;

    query(queryText: string): Query;
    query(config: QueryConfig): Query;
    query(queryText: string, values: any[]): Query;

    copyFrom(queryText: string): stream.Writable;
    copyTo(queryText: string): stream.Readable;

    pauseDrain(): void;
    resumeDrain(): void;

    public on(event: "drain", listener: () => void): Client;
    public on(event: "error", listener: (err: Error) => void): Client;
    public on(event: "notification", listener: (message: any) => void): Client;
    public on(event: "notice", listener: (message: any) => void): Client;
    public on(event: string, listener: Function): Client;

    transaction(task: () => Q.Promise<any>): Q.Promise<any>;
}

export interface QueryResult extends pg.QueryResult { }
export interface ResultBuilder extends pg.ResultBuilder { }

export declare class Query extends pg.Query {
    promise: Q.Promise<QueryResult>;
}

Additional Details

Credits

These definitions were written by Chris Charabaruk.

0.0.21

8 months ago

0.0.22

7 months ago

0.0.23

6 months ago

0.0.20

3 years ago

0.0.19

7 years ago

0.0.18

7 years ago

0.0.17

7 years ago

0.0.16

8 years ago

0.0.15

8 years ago

0.0.14-alpha

8 years ago

0.0.12-alpha

8 years ago

0.0.11-alpha

8 years ago

0.0.10-alpha

8 years ago

0.0.9-alpha

8 years ago

0.0.8-alpha

8 years ago

0.0.3-alpha

8 years ago

0.0.2-alpha

8 years ago