Skip to content

Commit ee9af2b

Browse files
committed
feat: endAt
1 parent dfe4b8e commit ee9af2b

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

packages/firestore/lib/modular/query.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,11 @@ export declare function deleteDoc<AppModelType, DbModelType extends DocumentData
332332
*/
333333
export declare function endAt(...fieldValues: unknown[]): QueryEndAtConstraint;
334334

335+
/**
336+
* reates a QueryEndAtConstraint that modifies the result set to end at the provided document (inclusive).
337+
* The end position is relative to the order of the query. The document must contain all of the fields provided in the orderBy of the query.
338+
* @param snapshot
339+
*/
335340
export function endAt<AppModelType, DbModelType extends DocumentData>(
336341
snapshot: DocumentSnapshot<AppModelType, DbModelType>,
337342
): QueryEndAtConstraint;

packages/firestore/lib/modular/query.js

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -133,19 +133,11 @@ export function startAfter(...docOrFields) {
133133
* Creates a QueryEndAtConstraint that modifies the result set to end at the provided fields relative to the order of the query.
134134
* The order of the field values must match the order of the order by clauses of the query.
135135
*
136-
* @param {*} fieldValues
136+
* @param {*} ...args Can be either a DocumentSnapshot or an array of field values.
137137
*/
138138

139-
export function endAt(...fieldValues) {
140-
return new QueryConstraint('endAt', ...fieldValues);
141-
}
142-
143-
/**
144-
* @param {DocumentSnapshot} snapshot
145-
* @returns {QueryEndAtConstraint}
146-
*/
147-
export function endAt(snapshot) {
148-
return new QueryConstraint('endAt', snapshot);
139+
export function endAt(...args) {
140+
return new QueryConstraint('endAt', ...args);
149141
}
150142

151143
/**

0 commit comments

Comments
 (0)