simplification
This commit is contained in:
parent
de5c397ed3
commit
d504f892c0
@ -16,19 +16,13 @@ export abstract class DatabaseModel {
|
|||||||
this.data.id = val;
|
this.data.id = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async get<T extends DatabaseModel> (
|
public constructor (id) {
|
||||||
id: number,
|
this.id = id;
|
||||||
constructor: new () => T
|
|
||||||
): Promise<T> {
|
|
||||||
const dbm = (new constructor);
|
|
||||||
dbm.id = id;
|
|
||||||
await dbm.read ();
|
|
||||||
return dbm;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract get(key: string): string|number|boolean;
|
public abstract get(key: string): string|number|boolean;
|
||||||
public abstract set(key: string, value: string|number|boolean);
|
public abstract set(key: string, value: string|number|boolean);
|
||||||
|
|
||||||
public abstract read(): Promise<void>;
|
public abstract async read(): Promise<void>;
|
||||||
public abstract write(): Promise<void>;
|
public abstract async write(): Promise<void>;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user