Skip to content

Commit 6fe0383

Browse files
dependabot[bot]flovilmart
authored andcommitted
Bump flow-bin from 0.83.0 to 0.91.0 (parse-community#5302)
* Bump flow-bin from 0.83.0 to 0.91.0 Bumps [flow-bin](https://github.com/flowtype/flow-bin) from 0.83.0 to 0.91.0. - [Release notes](https://github.com/flowtype/flow-bin/releases) - [Commits](flow/flow-bin@v0.83.0...v0.91.0) Signed-off-by: dependabot[bot] <[email protected]> * fix flow issue
1 parent 8a7d063 commit 6fe0383

File tree

3 files changed

+38
-34
lines changed

3 files changed

+38
-34
lines changed

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"deep-diff": "1.0.2",
5858
"eslint": "^5.0.0",
5959
"eslint-plugin-flowtype": "^3.0.0",
60-
"flow-bin": "0.83.0",
60+
"flow-bin": "0.91.0",
6161
"gaze": "1.1.3",
6262
"husky": "^1.0.0-rc.13",
6363
"jasmine": "3.1.0",

src/Adapters/Storage/Postgres/PostgresStorageAdapter.js

Lines changed: 34 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1963,12 +1963,14 @@ export class PostgresStorageAdapter implements StorageAdapter {
19631963
const wherePattern =
19641964
where.pattern.length > 0 ? `WHERE ${where.pattern}` : '';
19651965
const qs = `SELECT count(*) FROM $1:name ${wherePattern}`;
1966-
return this._client.one(qs, values, a => +a.count).catch(error => {
1967-
if (error.code !== PostgresRelationDoesNotExistError) {
1968-
throw error;
1969-
}
1970-
return 0;
1971-
});
1966+
return this._client
1967+
.one(qs, values, a => +a.count)
1968+
.catch(error => {
1969+
if (error.code !== PostgresRelationDoesNotExistError) {
1970+
throw error;
1971+
}
1972+
return 0;
1973+
});
19721974
}
19731975

19741976
distinct(
@@ -2093,32 +2095,34 @@ export class PostgresStorageAdapter implements StorageAdapter {
20932095
index += 1;
20942096
continue;
20952097
}
2096-
if (value.$sum) {
2097-
if (typeof value.$sum === 'string') {
2098-
columns.push(`SUM($${index}:name) AS $${index + 1}:name`);
2099-
values.push(transformAggregateField(value.$sum), field);
2098+
if (typeof value === 'object') {
2099+
if (value.$sum) {
2100+
if (typeof value.$sum === 'string') {
2101+
columns.push(`SUM($${index}:name) AS $${index + 1}:name`);
2102+
values.push(transformAggregateField(value.$sum), field);
2103+
index += 2;
2104+
} else {
2105+
countField = field;
2106+
columns.push(`COUNT(*) AS $${index}:name`);
2107+
values.push(field);
2108+
index += 1;
2109+
}
2110+
}
2111+
if (value.$max) {
2112+
columns.push(`MAX($${index}:name) AS $${index + 1}:name`);
2113+
values.push(transformAggregateField(value.$max), field);
2114+
index += 2;
2115+
}
2116+
if (value.$min) {
2117+
columns.push(`MIN($${index}:name) AS $${index + 1}:name`);
2118+
values.push(transformAggregateField(value.$min), field);
2119+
index += 2;
2120+
}
2121+
if (value.$avg) {
2122+
columns.push(`AVG($${index}:name) AS $${index + 1}:name`);
2123+
values.push(transformAggregateField(value.$avg), field);
21002124
index += 2;
2101-
} else {
2102-
countField = field;
2103-
columns.push(`COUNT(*) AS $${index}:name`);
2104-
values.push(field);
2105-
index += 1;
21062125
}
2107-
}
2108-
if (value.$max) {
2109-
columns.push(`MAX($${index}:name) AS $${index + 1}:name`);
2110-
values.push(transformAggregateField(value.$max), field);
2111-
index += 2;
2112-
}
2113-
if (value.$min) {
2114-
columns.push(`MIN($${index}:name) AS $${index + 1}:name`);
2115-
values.push(transformAggregateField(value.$min), field);
2116-
index += 2;
2117-
}
2118-
if (value.$avg) {
2119-
columns.push(`AVG($${index}:name) AS $${index + 1}:name`);
2120-
values.push(transformAggregateField(value.$avg), field);
2121-
index += 2;
21222126
}
21232127
}
21242128
} else {

0 commit comments

Comments
 (0)