@naturalcycles/db-lib
Version:
Lowest Common Denominator API to supported Databases
26 lines (25 loc) • 1.27 kB
TypeScript
import type { StringMap } from '@naturalcycles/js-lib/types';
import type { ReadableTyped } from '@naturalcycles/nodejs-lib/stream';
import type { CommonDBCreateOptions } from '../db.model.js';
import type { CommonKeyValueDB, IncrementTuple, KeyValueDBTuple } from '../kv/commonKeyValueDB.js';
export interface InMemoryKeyValueDBCfg {
}
export declare class InMemoryKeyValueDB implements CommonKeyValueDB {
cfg: InMemoryKeyValueDBCfg;
constructor(cfg?: InMemoryKeyValueDBCfg);
support: {
count?: boolean;
increment?: boolean;
};
data: StringMap<StringMap<any>>;
ping(): Promise<void>;
createTable(_table: string, _opt?: CommonDBCreateOptions): Promise<void>;
deleteByIds(table: string, ids: string[]): Promise<void>;
getByIds(table: string, ids: string[]): Promise<KeyValueDBTuple[]>;
saveBatch(table: string, entries: KeyValueDBTuple[]): Promise<void>;
streamIds(table: string, limit?: number): ReadableTyped<string>;
streamValues(table: string, limit?: number): ReadableTyped<Buffer>;
streamEntries(table: string, limit?: number): ReadableTyped<KeyValueDBTuple>;
count(table: string): Promise<number>;
incrementBatch(table: string, entries: IncrementTuple[]): Promise<IncrementTuple[]>;
}