Skip to content

Commit

Permalink
working on cli mode
Browse files Browse the repository at this point in the history
  • Loading branch information
bookpauk committed Dec 21, 2021
1 parent bca5881 commit 41826c7
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions server/core/JembaUtils.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,33 @@
const { JembaDbThread } = require('jembadb');
const { JembaDb, JembaDbThread } = require('jembadb');
const ayncExit = new (require('./AsyncExit'))();//singleton

class JembaUtils {
constructor() {
this.dbConn = {};
}

use(connName) {
_use(connName, thread) {
let db = this.dbConn[connName];
if (!db) {
db = new JembaDbThread();
if (thread)
db = new JembaDbThread();
else
db = new JembaDb();
ayncExit.add(db.closeDb.bind(db));
this.dbConn[connName] = db;
}

return db;
}

use(connName) {
return this._use(connName);
}

useThread(connName) {
return this._use(connName, true);
}

cwd() {
return process.cwd();
}
Expand Down

0 comments on commit 41826c7

Please sign in to comment.