Fake Mirrors
    Preparing search index...

    Interface DatabaseConnector

    Defines the public contract for a database connector.

    The connector is responsible for establishing and managing the lifecycle of the database connection.

    interface DatabaseConnector {
        close(): Promise<void>;
        connect(): Promise<void>;
        getConnection<T>(): T;
    }

    Implemented by

    • Gracefully closes a connection to the database.

      This method should be called during application shutdown to ensure all pending operations are completed and resources are released.

      Returns Promise<void>

      BootstrapError If the connection cannot be closed properly.

    • Establishes a connection to the database.

      This method should be called during application bootstrap to ensure the connection is ready before any operations are performed.

      Returns Promise<void>

      BootstrapError If the database connection cannot be established.

    • Retrieves the underlying database connection.

      This method uses a type assertion to return the connection as the requested type. It is the caller's responsibility to ensure the correct type is used.

      Type Parameters

      • T

        The expected type of the database connection.

      Returns T

      The database connection cast to type T.