@storehouse/sequelize - v2.0.0
    Preparing search index...

    Function getConnection

    • Retrieves a Sequelize connection instance from a manager in the registry.

      Parameters

      • registry: Registry

        The Storehouse registry containing registered managers

      • OptionalmanagerName: string

        Optional name of the manager. If omitted, uses the default manager

      Returns Sequelize

      The Sequelize connection instance

      If the manager is not found in the registry

      If the connection is not an instance of Sequelize

      const sequelize = getConnection(registry, 'primary-db');
      const [results] = await sequelize.query('SELECT * FROM users WHERE active = ?', {
      replacements: [true],
      type: QueryTypes.SELECT
      });