mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-07 20:17:02 +03:00
Switch to postgres + promises
This commit is contained in:
@@ -12,7 +12,7 @@ export class Sqlite implements IDatabase {
|
||||
{
|
||||
}
|
||||
|
||||
prepare(type: QueryType, query: string, params: any[]) {
|
||||
async prepare(type: QueryType, query: string, params: any[]) {
|
||||
const preparedQuery = this.db.prepare(query);
|
||||
|
||||
switch (type) {
|
||||
@@ -29,20 +29,6 @@ export class Sqlite implements IDatabase {
|
||||
}
|
||||
}
|
||||
|
||||
get<TModel>(query: string, params: any[]): TModel {
|
||||
return this.prepare('get', query, params);
|
||||
}
|
||||
getAll<TModel>(query: string, params: any[]): TModel[] {
|
||||
return this.prepare('all', query, params);
|
||||
}
|
||||
run(query: string, params: any[]): void {
|
||||
this.prepare('run', query, params);
|
||||
}
|
||||
|
||||
exec(query: string) {
|
||||
return this.db.exec(query);
|
||||
}
|
||||
|
||||
init() {
|
||||
// Make dirs if required
|
||||
if (!fs.existsSync(path.join(this.config.dbPath, "../"))) {
|
||||
|
||||
Reference in New Issue
Block a user