From fec607da20ca784b66f25f3ee4ad5ba6223d976c Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Fri, 11 Sep 2020 15:15:15 +0200 Subject: [PATCH] ModelQuery: add offset parameter to union() --- src/db/ModelQuery.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/db/ModelQuery.ts b/src/db/ModelQuery.ts index 7ac5da3..fad6252 100644 --- a/src/db/ModelQuery.ts +++ b/src/db/ModelQuery.ts @@ -124,7 +124,7 @@ export default class ModelQuery implements WhereFieldConsumer, sortBy: string, direction: SortDirection = 'ASC', raw: boolean = false, limit?: number): this { + public union(query: ModelQuery, sortBy: string, direction: SortDirection = 'ASC', raw: boolean = false, limit?: number, offset?: number): this { if (this.type !== QueryType.SELECT) throw new Error('Union queries are only implemented with SELECT.'); this._union = { @@ -132,6 +132,7 @@ export default class ModelQuery implements WhereFieldConsumer implements WhereFieldConsumer { +export interface WhereFieldConsumer { where(field: string, value: string | Date | ModelQuery | any, test?: WhereTest, operator?: WhereOperator): this; groupWhere(setter: (query: WhereFieldConsumer) => void, operator?: WhereOperator): this; @@ -463,4 +465,5 @@ type ModelQueryUnion = { sortBy: string, direction: SortDirection, limit?: number, + offset?: number, };