firesage
Version:
🔥 Extremely High Precision Typescript Wrapper for Firestore Web, Providing Unparalleled Type Safe and Dev Experience
23 lines (22 loc) • 789 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.orderBy = void 0;
var firestore_1 = require("firebase/firestore");
/**
* Creates a {@link QueryConstraint} that sorts the query result by the
* specified field, optionally in descending order instead of ascending.
*
* @param fieldPath - The field to sort by.
* @param directionStr - Optional direction to sort by ('asc' or 'desc'). If
* not specified, order will be ascending.
* @returns The created {@link Query}.
*/
var orderBy = function (fieldPath, directionStr) {
return {
type: 'orderBy',
fieldPath: fieldPath,
directionStr: directionStr,
ref: (0, firestore_1.orderBy)(fieldPath, directionStr),
};
};
exports.orderBy = orderBy;