Skip to content

Commit 21a5af6

Browse files
committed
fix: add implementation for buildGroupBy
Signed-off-by: Muhammad Aaqil <aaqilcs102@gmail.com>
1 parent 807e70b commit 21a5af6

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

lib/sql.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,6 +1260,16 @@ SQLConnector.prototype.buildFields = function(model, data, excludeIds) {
12601260
return this._buildFieldsForKeys(model, data, keys, excludeIds);
12611261
};
12621262

1263+
/**
1264+
* Build a part of query for group by
1265+
* @param {String[]} groupBy Array of column names to be grouped by
1266+
* @returns a part of query for group by as a string
1267+
*/
1268+
SQLConnector.prototype.buildGroupBy = function(groupBy) {
1269+
const groupByColumns = Object.keys(groupBy);
1270+
return 'GROUP BY ' + groupByColumns.join(',');
1271+
};
1272+
12631273
/**
12641274
* Build an array of fields for the database operation from data array
12651275
* @param {String} model Model name

0 commit comments

Comments
 (0)