UNPKG

zustand-storage

Version:

A universal solution combining @aivron/sync-storage and zust-api for React (web & desktop). It merges local persistence with a Zustand-inspired API to provide core storage operations, bulk actions, JSON support, TTL, and integrated React hooks.

47 lines (40 loc) 1.77 kB
// src/database/IDatabaseClient.ts export interface DatabaseClient { /** * Establishes a connection to the database. */ connect(): Promise<void>; /** * Closes the database connection. */ disconnect(): Promise<void>; /** * Finds records in the specified collection/table matching the query. * @param collectionOrTable - The name of the collection (MongoDB) or table (PostgreSQL). * @param query - An object representing query filters. * @returns A promise resolving to an array of records. */ find(collectionOrTable: string, query: object): Promise<any[]>; /** * Inserts a record into the specified collection/table. * @param collectionOrTable - The name of the collection/table. * @param data - The data to insert. * @returns A promise resolving to the inserted record. */ insert(collectionOrTable: string, data: object): Promise<any>; /** * Updates records in the specified collection/table that match the query. * @param collectionOrTable - The name of the collection/table. * @param query - An object representing query filters. * @param update - An object representing the update data. * @returns A promise resolving to the update result. */ update(collectionOrTable: string, query: object, update: object): Promise<any>; /** * Deletes records in the specified collection/table that match the query. * @param collectionOrTable - The name of the collection/table. * @param query - An object representing query filters. * @returns A promise resolving to the deletion result. */ delete(collectionOrTable: string, query: object): Promise<any>; }