import { XCondition, XExpression, RowObjectFrom, XRowset, InputObject, Sort, SortObject, Condition, RowObject, Executor } from '../core'; import { FetchRelations } from './data-types'; import { Entity, EntityConstructor, EntityInstance, ToEntity } from './entity'; import { DbContext } from './db-context'; export declare class Queryable implements AsyncIterable { protected context: DbContext; constructor(context: DbContext, Ctr?: EntityConstructor>, rowset?: XRowset); private get mgr(); private _rowset; private _metadata?; private _includes?; private _withDetail; private _sql?; private get sql(); private _tableMetadata?; protected get executor(): Executor; /** * 异步迭代器,延迟查询的关键点 */ [Symbol.asyncIterator](): AsyncIterator; skip(count: number): this; take(count: number): this; fork(rowset: XRowset): Queryable; /** * 过滤数据并返回一个新的Queryable */ filter(condition: (p: XRowset) => XCondition): this; count(): Queryable<{ count: number; }>; sort(sorts: (p: XRowset) => Sort[] | SortObject): this; /** * 添加过滤条件,并限定返回头一条记录 */ find(filter: (p: XRowset) => XCondition): this; union(...queries: Queryable[]): this; /** * 返回一个新的类型 */ map(results: (p: XRowset) => G): Queryable>; groupBy(results: (p: XRowset) => G, groups: (p: XRowset) => XExpression[], having?: (p: XRowset) => Condition): Queryable>; join(entity: EntityConstructor, on: (left: XRowset, right: XRowset) => Condition, results: (left: XRowset, right: XRowset) => G): Queryable>; /** * 查询关联导航属性 */ include(props: FetchRelations): this; /** * 同时返回明细属性 * 即被标记为明细属性的导航属性 */ withDetail(): this; private getSqlForExecute; private loadRelations; /** * 执行查询并将结果转换为数组,并获取所有数据返回一个数组 */ fetchAll(): Promise[]>; /** * 执行查询,并获取第一行记录 */ fetchFirst(): Promise>; }