axiodb
Version:
A blazing-fast, lightweight, and scalable nodejs package based DBMS for modern application. Supports schemas, encryption, and advanced query capabilities.
28 lines (27 loc) • 1.13 kB
TypeScript
export default class Searcher {
private data;
private isUpdated;
constructor(arr: any[], isUpdated?: boolean);
/**
* Finds items in the data array that match the given query.
* Uses worker threads to parallelize the search across multiple CPU cores.
*
* @param query - The query object containing conditions to match against items.
* @param aditionalFiled - Optional field to extract from each item for matching.
* @returns {Promise<any[]>} - A promise that resolves to an array of matching items.
*/
find(query: {
[key: string]: any;
}, additionalFiled?: string | number | undefined): Promise<any[]>;
/**
* Matches an item against a query object.
* Supports MongoDB-like operators and logical operators ($or, $and).
*
* @param item - The item to match against the query.
* @param query - The query object containing conditions.
* @returns {boolean} - True if the item matches the query, false otherwise.
*/
static matchesQuery(item: any, query: {
[key: string]: any;
}, isUpdated?: boolean): boolean;
}