UNPKG

@naturalcycles/db-lib

Version:

Lowest Common Denominator API to supported Databases

26 lines (25 loc) 868 B
import { ObjectWithId } from '@naturalcycles/js-lib'; import { DBSaveBatchOperation } from '../../db.model'; import { FileDBPersistencePlugin } from './file.db.model'; export interface LocalFilePersistencePluginCfg { /** * @default ./tmp/localdb */ storagePath: string; /** * @default true */ gzip: boolean; } /** * Persists in local filesystem as ndjson. */ export declare class LocalFilePersistencePlugin implements FileDBPersistencePlugin { constructor(cfg?: Partial<LocalFilePersistencePluginCfg>); cfg: LocalFilePersistencePluginCfg; ping(): Promise<void>; getTables(): Promise<string[]>; loadFile<ROW extends ObjectWithId>(table: string): Promise<ROW[]>; saveFiles(ops: DBSaveBatchOperation<any>[]): Promise<void>; saveFile<ROW extends ObjectWithId>(table: string, rows: ROW[]): Promise<void>; }