import Validator from "./Validator"; import { Connection } from "mysql"; import Query from "./Query"; import { Request } from "express"; export default abstract class Model { static getById(id: number): Promise; static paginate(request: Request, perPage?: number): Promise; protected static select(...fields: string[]): Query; protected static update(data: { [key: string]: any; }): Query; protected static delete(): Query; protected static models(query: Query): Promise; static loadRelation(models: T[], relation: string, model: Function, localField: string): Promise; private static getFactory; protected readonly properties: ModelProperty[]; private readonly relations; id?: number; [key: string]: any; constructor(data: any); protected abstract defineProperties(): void; protected defineProperty(name: string, validator?: Validator | RegExp): void; private updateWithData; protected beforeSave(exists: boolean, connection: Connection): Promise; protected afterSave(): Promise; save(connection?: Connection, postHook?: (callback: () => Promise) => void): Promise; private saveTransaction; static get table(): string; get table(): string; exists(): Promise; delete(): Promise; validate(onlyFormat?: boolean, connection?: Connection): Promise; private cache; protected relation(name: string): T | null; } export interface ModelFactory { (data: any): T; } declare class ModelProperty { readonly name: string; private readonly validator; private val?; constructor(name: string, validator: Validator); validate(onlyFormat: boolean, connection?: Connection): Promise; get value(): T | undefined; set value(val: T | undefined); } export declare class ModelCache { private static readonly caches; static cache(instance: Model): void; static forget(instance: Model): void; static all(table: string): { [key: number]: Model; } | undefined; static get(table: string, id: number): Model | undefined; } export declare const EMAIL_REGEX: RegExp; export {};