axiodb
Version:
A blazing-fast, lightweight, and scalable nodejs package based DBMS for modern application. Supports schemas, encryption, and advanced query capabilities.
27 lines (26 loc) • 1.06 kB
TypeScript
export default class Searcher {
private data;
constructor(arr: any[]);
/**
* 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;
}, aditionalFiled?: 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;
}): boolean;
}