import { OrderDirection } from '@cashfarm/lang/lib'; import { CriteriaEnabled } from '../criteria'; import { IField, Table } from '../mapping'; import { FieldOrSelector } from '../types'; export interface IQuery extends CriteriaEnabled> { /** * Defines the set of fields that will be selected from the table. * * @param {string[]} fields An array of field names * @returns {Criteria} * * @memberOf Criteria */ select(fieldListSelector: (table: TTable) => IField[]): IQuery; /** * Appends `field` to the list of ordering fields. * * @param {string} field * @param {OrderDirection} direction * @returns {Criteria} * * @memberOf Query */ orderBy(field: FieldOrSelector, direction: OrderDirection): IQuery; orderBy(field: [FieldOrSelector, OrderDirection], ...otherFields: Array<[FieldOrSelector, OrderDirection]>): IQuery; /** * Sets the list of grouping fields. * * @param {...string[]} fields * @returns * * @memberOf Query */ groupBy(fields: FieldOrSelector[]): IQuery; groupBy(...fields: FieldOrSelector[]): IQuery; /** * Sets the limit of items returned * * @param {number} limit * @returns * * @memberOf Query */ limit(limit: number): IQuery; /** * Sets the index of the first item to be returned * * @param {number} offset * @returns * * @memberOf Query */ offset(offset: number): IQuery; /** * Clears the list of ordering fields * * @returns {Criteria} * * @memberOf Query */ clearSelect(): IQuery; /** * Clears the list of ordering fields * * @returns {Criteria} * * @memberOf Query */ clearOrderBy(): IQuery; /** * Clears the list of grouping fields * * @returns {Criteria} * * @memberOf Query */ clearGroupBy(): IQuery; /** * Clears the limit option * * @returns {Criteria} * * @memberOf Query */ clearLimit(): IQuery; /** * Clears the offset option * * @returns {Criteria} * * @memberOf Query */ clearOffset(): IQuery; toString(): string; }