UNPKG

@riao/dbal

Version:
30 lines (29 loc) 1.03 kB
import { DatabaseDriver, DatabaseQueryOptions, DatabaseQueryResult, DatabaseQueryTypes } from '../database'; import { RepositoryInit, RepositoryOptions } from './repository-options'; export declare class Repository { protected driver: DatabaseDriver; protected isReady: null | boolean; protected logFn: (...args: any[]) => void; protected logEnabled: boolean; constructor(options: RepositoryOptions); init(options: RepositoryInit): void; /** * Set the repository driver to run queries on * * @param driver Driver to set */ setDriver(driver: DatabaseDriver): void; /** * Check if the database is ready, and throw an error if it's not */ readyCheck(): void; setLog(log: (...args: any[]) => void): void; startLog(): this; stopLog(): this; /** * Check & query the database * * @param query Query to run */ query(query: DatabaseQueryOptions | DatabaseQueryTypes): Promise<DatabaseQueryResult>; }