multibridge
Version:
A multi-database connection framework with centralized configuration
13 lines (12 loc) • 397 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.runWithTenant = runWithTenant;
exports.getTenant = getTenant;
const async_hooks_1 = require("async_hooks");
const tenantContext = new async_hooks_1.AsyncLocalStorage();
function runWithTenant(tenant, fn) {
return tenantContext.run(tenant, fn);
}
function getTenant() {
return tenantContext.getStore();
}