call sqlite-plugin in run-core

This commit is contained in:
geekgeekrun
2024-03-17 16:15:31 +08:00
parent 6649691025
commit ed822d7cc4
6 changed files with 49 additions and 12 deletions

View File

@@ -2,6 +2,7 @@
"name": "@geekgeekrun/sqlite-plugin",
"version": "0.0.1",
"description": "",
"main": "dist/index.js",
"dependencies": {
"reflect-metadata": "^0.2.1",
"sqlite3": "^5.1.7",

View File

@@ -33,7 +33,18 @@ async function initDb() {
return appDataSource.initialize();
}
(async () => {
const a = await initDb();
console.log(a);
})();
export default class SqlitePlugin {
initPromise: Promise<DataSource>
constructor () {
this.initPromise = initDb()
}
apply (hooks) {
hooks.userInfoResponse.tapPromise(
'SqlitePlugin',
(userInfo) => new Promise((resolve, reject) => {
console.log(userInfo)
})
)
}
}