UNPKG

@configurator/ravendb

Version:
45 lines 1.49 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.GroupByDocumentQuery = void 0; const Exceptions_1 = require("../../Exceptions"); const FilterFactory_1 = require("../Queries/FilterFactory"); class GroupByDocumentQuery { constructor(query) { this._query = query; } selectKey(fieldName = null, projectedName = null) { this._query._groupByKey(fieldName, projectedName); return this; } selectSum(field, ...fields) { if (!field) { (0, Exceptions_1.throwError)("InvalidArgumentException", "Field cannot be null"); } this._query._groupBySum(field.fieldName, field.projectedName); if (!fields || !fields.length) { return this._query; } for (const f of fields) { this._query._groupBySum(f.fieldName, f.projectedName); } return this._query; } selectCount(projectedName = "count") { this._query._groupByCount(projectedName); return this._query; } filter(builder, limit) { limit ?? (limit = Number.MAX_SAFE_INTEGER); const mode = this._query.setFilterMode(true); try { const f = new FilterFactory_1.FilterFactory(this._query, limit); builder(f); } finally { mode.dispose(); } return this; } } exports.GroupByDocumentQuery = GroupByDocumentQuery; //# sourceMappingURL=GroupByDocumentQuery.js.map