import { ConnectionHelper } from "./connection_helper"; import { ISelectQuery, ICountQuery, IInsertQuery, IUpdateQuery, IRemoveQuery, ITransactionQuery, IDataBase, EVENT, IPlugin, IIntersectQuery, IDbInfo, TMiddleware } from "../common"; import { JsStoreMap } from "./map"; export declare class Connection extends ConnectionHelper { constructor(worker?: Worker); /** * initiate DataBase * * @param {IDataBase} dataBase * @returns * @memberof Connection */ initDb(dataBase: IDataBase): Promise; /** * drop dataBase * * @returns * @memberof Connection */ dropDb(): Promise; /** * select data from table * * @template T * @param {ISelectQuery} query * @returns * @memberof Connection */ select(query: ISelectQuery): Promise; /** * get no of record from table * * @param {ICountQuery} query * @returns * @memberof Connection */ count(query: ICountQuery): Promise; /** * insert data into table * * @template T * @param {IInsertQuery} query * @returns * @memberof Connection */ insert(query: IInsertQuery): Promise; /** * update data into table * * @param {IUpdateQuery} query * @returns * @memberof Connection */ update(query: IUpdateQuery): Promise; /** * remove data from table * * @param {IRemoveQuery} query * @returns * @memberof Connection */ remove(query: IRemoveQuery): Promise; /** * delete all data from table * * @param {string} tableName * @returns * @memberof Connection */ clear(tableName: string): Promise; /** * set log status * * @param {boolean} status * @memberof Connection */ set logStatus(status: boolean); /** * open database * * @param {string} dbName * @returns * @memberof Connection */ openDb(dbName: string, version?: any): Promise; /** * returns list of database created * * @returns * @memberof Connection */ getDbList(): Promise<[IDbInfo]>; /** * stores data in the key value format * * @memberof Connection */ Map: JsStoreMap; /** * get the value from keystore table * * @template T * @param {string} key * @returns * @memberof Connection */ get(key: string): Promise; /** * set the value in keystore table * * @param {string} key * @param {*} value * @returns * @memberof Connection */ set(key: string, value: any): Promise; /** * terminate the connection * * @returns * @memberof Connection */ terminate(): Promise; /** * execute transaction * * @template T * @param {ITransactionQuery} query * @returns * @memberof Connection */ transaction(query: ITransactionQuery): Promise; on(event: EVENT, eventCallBack: Function): void; off(event: EVENT, eventCallBack: Function): void; union(query: ISelectQuery[]): Promise; intersect(query: IIntersectQuery): Promise; addPlugin(plugin: IPlugin, params?: any): any; addMiddleware(middleware: TMiddleware | string, forWorker: boolean): Promise; /** * import scripts in jsstore web worker. * Scripts method can be called using transaction api. * * @param {...string[]} urls * @returns * @memberof Connection */ importScripts(...urls: string[]): Promise; }