mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-07 03:57:06 +03:00
Switch to postgres + promises
This commit is contained in:
@@ -9,14 +9,10 @@ export class Mysql implements IDatabase {
|
||||
constructor(private config: any) {
|
||||
}
|
||||
|
||||
init() {
|
||||
init(): void {
|
||||
this.connection = new MysqlInterface(this.config);
|
||||
}
|
||||
|
||||
exec(query: string) {
|
||||
this.prepare('run', query, []);
|
||||
}
|
||||
|
||||
prepare(type: QueryType, query: string, params: any[]) {
|
||||
Logger.debug(`prepare (mysql): type: ${type}, query: ${query}, params: ${params}`);
|
||||
const queryResult = this.connection.query(query, params);
|
||||
@@ -34,16 +30,5 @@ export class Mysql implements IDatabase {
|
||||
}
|
||||
}
|
||||
|
||||
public get<TModel>(query: string, params: any[]): TModel {
|
||||
return this.prepare('get', query, params);
|
||||
}
|
||||
|
||||
public getAll<TModel>(query: string, params: any[]): TModel[] {
|
||||
return this.prepare('all', query, params);
|
||||
}
|
||||
|
||||
public run(query: string, params: any[]): void {
|
||||
this.prepare('run', query, params);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user