Connection manager to manage database connections.

interface ConnectionManagerContract {
    connections: Map<string, ConnectionNode>;
    add(connectionName, config): void;
    close(connectionName): Promise<void>;
    closeAll(): Promise<void>;
    connect(connectionName): void;
    get(connectionName): ConnectionNode;
    has(connectionName): boolean;
    isConnected(connectionName): boolean;
}

Properties

connections: Map<string, ConnectionNode>

List of registered connections.

Methods

  • Close a connection.

    Parameters

    • connectionName: string

    Returns Promise<void>

  • Initiate a connection. It is a noop if the connection is already initiated.

    Parameters

    • connectionName: string

    Returns void

  • Returns whether the connection is managed by the manager.

    Parameters

    • connectionName: string

    Returns boolean

  • Returns whether the connection is connected.

    Parameters

    • connectionName: string

    Returns boolean