@types/tedious-connection-pool
TypeScript icon, indicating that this package has built-in type declarations

1.0.6 • Public • Published

Installation

npm install --save @types/tedious-connection-pool

Summary

This package contains type definitions for tedious-connection-pool (https://github.com/tediousjs/tedious-connection-pool).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/tedious-connection-pool.

index.d.ts

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

import events = require("events");
import tedious = require("tedious");

declare namespace tcp {
    /**
     * Extends Tedious Connection with release function
     */
    class PooledConnection extends tedious.Connection {
        /**
         * If the connection is issued from a connection pool returns the connection to the pool.
         */
        release(): void;
    }

    /**
     * Provides a connection or an error
     * @param err error if any
     * @param connection issued from the pool
     */
    type ConnectionCallback = (err: Error, connection: PooledConnection) => void;

    /**
     *  Pool Configuration interface
     */
    interface PoolConfig {
        /**
         * Minimum concurrent connections
         */
        min?: number | undefined;

        /**
         * Maximum concurrent connections
         */
        max?: number | undefined;

        /**
         * Defines if logging is activated
         */
        log?: boolean | undefined;

        /**
         * Idle timeout
         */
        idleTimeout?: number | undefined;

        /**
         * Retry delay
         */
        retryDelay?: number | undefined;

        /**
         * Acquire timeout
         */
        acquireTimeout?: number | undefined;
    }
}

/**
 * Tedious Connection Pool Class
 */
declare class tcp extends events.EventEmitter {
    /**
     * Connection Pool constructor
     * @param poolConfig the pool configuration
     * @param connectionConfig the connection configuration
     */
    constructor(poolConfig: tcp.PoolConfig, connectionConfig: tedious.ConnectionConfig);

    /**
     * acquires a connection from the pool
     * @param callback invoked when the connection is retrieved and ready
     */
    acquire(callback: tcp.ConnectionCallback): void;

    /**
     * closes opened connections
     */
    drain(): void;
}

export = tcp;

Additional Details

Credits

These definitions were written by Cyprien Autexier.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/tedious-connection-pool

Weekly Downloads

486

Version

1.0.6

License

MIT

Unpacked Size

6.66 kB

Total Files

5

Last publish

Collaborators

  • types