Skip to content

Commit

Permalink
Use logical expression in conditions (#76)
Browse files Browse the repository at this point in the history
* use logical expression

* 2.10.3
  • Loading branch information
kbarbounakis authored Oct 16, 2023
1 parent 43266e4 commit 1ead4a3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@themost/query",
"version": "2.10.2",
"version": "2.10.3",
"description": "MOST Web Framework Codename ZeroGravity - Query Module",
"main": "dist/index.cjs.js",
"module": "dist/index.esm.js",
Expand Down
4 changes: 2 additions & 2 deletions src/formatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -1226,7 +1226,7 @@ class SqlFormatter {
let ifExpression;
if (instanceOf(ifExpr, QueryExpression)) {
ifExpression = this.formatWhere(ifExpr.$where);
} else if (this.isComparison(ifExpr)) {
} else if (this.isComparison(ifExpr) || this.isLogical(ifExpr)) {
ifExpression = this.formatWhere(ifExpr);
} else {
throw new Error('Condition parameter should be an instance of query or comparison expression');
Expand Down Expand Up @@ -1255,7 +1255,7 @@ class SqlFormatter {
let caseExpression;
if (instanceOf(branch.case, QueryExpression)) {
caseExpression = this.formatWhere(branch.case.$where);
} else if (this.isComparison(branch.case)) {
} else if (this.isComparison(branch.case) || this.isLogical(branch.case)) {
caseExpression = this.formatWhere(branch.case);
} else {
throw new Error('Case expression should be an instance of query or comparison expression');
Expand Down

0 comments on commit 1ead4a3

Please sign in to comment.