forest-express-sequelize
Version:
Official Express/Sequelize Liana for Forest
14 lines (12 loc) • 401 B
JavaScript
/**
* @param {import("../databases").ConnectionManager} connectionManager
* @param {(connection: import("sequelize").Sequelize) => Promise<void>} testCallback
*/
async function runWithConnection(connectionManager, testCallback) {
try {
await testCallback(connectionManager.createConnection());
} finally {
connectionManager.closeConnection();
}
}
module.exports = runWithConnection;