huddle-record
Version:
Record is a Object-Relational Mapping (ORM) TypeScript plugin that makes it easy to work with data.
22 lines (21 loc) • 826 B
TypeScript
import type Repository from './repository.js';
import QueryOperator from '../../src/orm/enums/queryOperator.js';
export default class Query<T> {
private repository;
private key;
private queryResult;
constructor(repository: Repository<T>, key: string);
private setup;
where(field: string | Function, operator?: QueryOperator | any, value?: any): Query<T>;
orWhere(field: string | Function, operator?: QueryOperator | any, value?: any): Query<T>;
get(): T[];
first(amount?: number): T | null;
last(amount?: number): T | null;
limit(amount?: number): Query<T>;
update(data: object): T | T[] | null;
delete(): void;
exists(): boolean;
count(): number;
filterDuplicates(items: T[]): T[];
orderBy(field: string | Function, direction?: 'asc' | 'desc'): Query<T>;
}