import WSBaseStorage from '../storage/BaseStorage'; import { Where } from '../types/Websocket'; interface IModel { toString(): string; toJSON(): Record; save(): Promise>; update(data: Record): Promise; remove(): Promise; get(): Promise>; } export default abstract class BaseModel implements IModel { static storage: WSBaseStorage; protected static table: string; namespace: string; abstract toString(): string; id: string; private fetched; /** * @type { Record } * @description 自定义属性 * @example { "key": "value" } */ properties: Record; constructor(id: string, namespace?: string); setProperty(...args: Array): Promise; getProperty(...args: Array): Promise; /** * Fetch the data from the storage */ get(): Promise; abstract merge(data: BaseModel): void; toDBData(): { namespace: string; uuid: string; }; static init(this: T, _data: Record): InstanceType; get uuid(): string; get storage(): WSBaseStorage; save(): Promise; remove(): Promise; abstract update(data: Record): Promise; static get(this: T, id: string, namespace?: string): Promise>; static save(this: T, data: Record): Promise>; static update(this: T, id: string, data: Record, namespace?: string): Promise; static remove(id: string, namespace?: string): Promise; static find(this: T, where: Where): Promise[]>; static exists(id: string, namespace?: string): Promise; toJSON(): Record; } export {};