adonis-odm
Version:
A comprehensive MongoDB ODM for AdonisJS with Lucid-style API, type-safe relationships, embedded documents, and transaction support
113 lines • 2.75 kB
TypeScript
import { SortDirection } from '../types/index.js';
/**
* QueryUtilities - Utility methods for query building and processing
*
* This class contains utility methods for sorting, pagination, selection,
* and other query building helpers.
*/
export declare class QueryUtilities {
private sortOptions;
private limitValue?;
private skipValue?;
private selectFields?;
private distinctField?;
private groupByFields;
private havingConditions;
/**
* Get current sort options
*/
getSortOptions(): Record<string, 1 | -1>;
/**
* Get current limit value
*/
getLimitValue(): number | undefined;
/**
* Get current skip value
*/
getSkipValue(): number | undefined;
/**
* Get current select fields
*/
getSelectFields(): Record<string, 0 | 1> | undefined;
/**
* Get current distinct field
*/
getDistinctField(): string | undefined;
/**
* Get current group by fields
*/
getGroupByFields(): string[];
/**
* Get current having conditions
*/
getHavingConditions(): any;
/**
* Set sort options (used for cloning)
*/
setSortOptions(options: Record<string, 1 | -1>): void;
/**
* Set limit value (used for cloning)
*/
setLimitValue(limit?: number): void;
/**
* Set skip value (used for cloning)
*/
setSkipValue(skip?: number): void;
/**
* Set select fields (used for cloning)
*/
setSelectFields(fields?: Record<string, 0 | 1>): void;
/**
* Set distinct field (used for cloning)
*/
setDistinctField(field?: string): void;
/**
* Set group by fields (used for cloning)
*/
setGroupByFields(fields: string[]): void;
/**
* Set having conditions (used for cloning)
*/
setHavingConditions(conditions: any): void;
/**
* Add a distinct field
*/
distinct(field: string): this;
/**
* Add group by fields
*/
groupBy(...fields: string[]): this;
/**
* Add having condition
*/
having(field: string, operatorOrValue: any, value?: any): this;
/**
* Add order by clause
*/
orderBy(field: string, direction?: SortDirection): this;
/**
* Set limit
*/
limit(count: number): this;
/**
* Set skip
*/
skip(count: number): this;
/**
* Alias for skip
*/
offset(count: number): this;
/**
* Set pagination
*/
forPage(page: number, perPage: number): this;
/**
* Set select fields
*/
select(fields: string[] | Record<string, 0 | 1>): this;
/**
* Clone the query utilities
*/
clone(): QueryUtilities;
}
//# sourceMappingURL=query_utilities.d.ts.map