-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Snowflake107
committed
Feb 3, 2021
1 parent
09f9557
commit ce0f253
Showing
4 changed files
with
104 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,17 @@ | ||
const Database = require("./Database"); | ||
const db = new Database("json.sqlite", { | ||
path: "./", | ||
table: "json" | ||
}); | ||
|
||
module.exports = () => db; | ||
// lazy load db to make only one instance for static | ||
let db; | ||
|
||
/** | ||
* Satic quick.db | ||
* @returns {Database} | ||
*/ | ||
module.exports = () => { | ||
if (!db) db = new Database("json.sqlite", { | ||
path: "./", | ||
table: "json" | ||
}); | ||
|
||
return db; | ||
}; |