Skip to content

Commit 389414a

Browse files
committed
Merge remote-tracking branch 'origin/master'
# Conflicts: # src/data/store/extract-query-options.js
2 parents 5e946fb + 717edcb commit 389414a

File tree

6 files changed

+38
-1
lines changed

6 files changed

+38
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "backendless",
3-
"version": "4.1.8",
3+
"version": "4.2.0",
44
"description": "Backendless JavaScript SDK for Node.js and the browser",
55
"browser": "dist/backendless.js",
66
"main": "lib/index.js",

src/data/query-builder.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,16 @@ export default class DataQueryBuilder {
6363
return this
6464
}
6565

66+
getHavingClause() {
67+
return this._query.havingClause
68+
}
69+
70+
setHavingClause(havingClause) {
71+
this._query.havingClause = havingClause
72+
73+
return this
74+
}
75+
6676
getSortBy() {
6777
return this._query.getOption('sortBy')
6878
}
@@ -73,6 +83,16 @@ export default class DataQueryBuilder {
7383
return this
7484
}
7585

86+
getGroupBy() {
87+
return this._query.getOption('groupBy')
88+
}
89+
90+
setGroupBy(groupBy) {
91+
this._query.setOption('groupBy', Utils.castArray(groupBy))
92+
93+
return this
94+
}
95+
7696
getRelated() {
7797
return this._query.getOption('relations')
7898
}

src/data/query.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export default class DataQuery {
44

55
this.properties = args.properties || []
66
this.condition = args.condition || null
7+
this.havingClause = args.havingClause || null
78
this.options = args.options || null
89
this.url = args.url || null
910
}

src/data/store/extract-query-options.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ export function extractQueryOptions(options) {
3030
}
3131
}
3232

33+
if (options.groupBy) {
34+
if (Utils.isString(options.groupBy)) {
35+
params.push('groupBy=' + encodeURIComponent(options.groupBy))
36+
} else if (Utils.isArray(options.groupBy)) {
37+
params.push('groupBy=' + Utils.encodeArrayToUriComponent(options.groupBy))
38+
}
39+
}
40+
3341
if (Utils.isNumber(options.relationsDepth)) {
3442
params.push('relationsDepth=' + options.relationsDepth)
3543
}

src/data/store/find.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ export function findUtil(className, Model, dataQuery, asyncHandler) {
2828
query.push('where=' + encodeURIComponent(dataQuery.condition))
2929
}
3030

31+
if (dataQuery.havingClause) {
32+
query.push('having=' + encodeURIComponent(dataQuery.havingClause))
33+
}
34+
3135
if (dataQuery.properties && dataQuery.properties.length) {
3236
query.push('props=' + Utils.encodeArrayToUriComponent(dataQuery.properties))
3337
}

src/data/store/relations.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,10 @@ export function loadRelations(parentObjectId, queryBuilder, asyncHandler) {
110110
query.push('where=' + encodeURIComponent(dataQuery.condition))
111111
}
112112

113+
if (dataQuery.havingClause) {
114+
query.push('having=' + encodeURIComponent(dataQuery.havingClause))
115+
}
116+
113117
let url = Urls.dataTableObjectRelation(this.className, parentObjectId, relationName)
114118

115119
if (asyncHandler) {

0 commit comments

Comments
 (0)