mirror of
https://github.com/geekgeekrun/geekgeekrun.git
synced 2026-06-08 08:59:46 +08:00
call sqlite-plugin in run-core
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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)
|
||||
})
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user