@push.rocks/smartdata
Version:
An advanced library for NoSQL data organization and manipulation using TypeScript with support for MongoDB, data validation, collections, and custom data types.
35 lines (34 loc) • 1.1 kB
TypeScript
import { SmartdataDb } from './smartdata.classes.db.js';
/**
* EasyStore allows the storage of easy objects. It also allows easy sharing of the object between different instances
*/
export declare class EasyStore<T> {
smartdataDbRef: SmartdataDb;
nameId: string;
private easyStoreClass;
constructor(nameIdArg: string, smnartdataDbRefArg: SmartdataDb);
private easyStorePromise;
private getEasyStore;
/**
* reads all keyValue pairs at once and returns them
*/
readAll(): Promise<Partial<T>>;
/**
* reads a keyValueFile from disk
*/
readKey(keyArg: keyof T): Promise<Partial<T>[keyof T]>;
/**
* writes a specific key to the keyValueStore
*/
writeKey<TKey extends keyof T>(keyArg: TKey, valueArg: T[TKey]): Promise<void>;
deleteKey(keyArg: keyof T): Promise<void>;
/**
* writes all keyValue pairs in the object argument
*/
writeAll(keyValueObject: Partial<T>): Promise<void>;
/**
* wipes a key value store from disk
*/
wipe(): Promise<void>;
cleanUpEphermal(): Promise<void>;
}