blow-query
Version:
Programmatically build queries which can be returned as JSON Object and used to fetch data from many sources.
33 lines (32 loc) • 1.36 kB
TypeScript
import { QueryRaw, QuerySort, QueryWhere } from './interfaces';
export declare class Query {
protected _where: QueryWhere;
protected _limit: number;
protected _skip: number;
protected _sort: QuerySort;
protected _select: string[];
constructor(query?: QueryRaw | Query);
protected _addCondition(field: string, condition: string, value: any): Query;
protected _sortItem(field: any, direction: any): QuerySort;
equal(field: string, value: any): Query;
notEqual(field: string, value: any): Query;
lessThan(field: string, value: any): Query;
lessThanOrEqual(field: string, value: any): Query;
greaterThan(field: string, value: any): Query;
greaterThanOrEqual(field: string, value: any): Query;
containedIn(field: string, values: any[]): Query;
notContainedIn(field: string, values: any[]): Query;
regex(field: string, value: RegExp): Query;
contains(field: string, value: string): Query;
startsWith(field: string, value: string): Query;
endsWith(field: string, value: string): Query;
ascending(field: string): Query;
descending(field: string): Query;
skip(skip: number): Query;
limit(limit: number): Query;
select(fields: string[] | string): Query;
or(query: Query): Query;
toJSON(): QueryRaw;
static create(): Query;
static from(input: any): Query;
}