happy-sql 2.0.4 → 2.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/ChangeLog
CHANGED
|
@@ -134,6 +134,13 @@ const flattenJoins = (node, joins = []) => {
|
|
|
134
134
|
};
|
|
135
135
|
|
|
136
136
|
export const convertFrom = ({expr, whereClause}) => {
|
|
137
|
+
const fromArgs = [];
|
|
138
|
+
|
|
139
|
+
if (whereClause)
|
|
140
|
+
fromArgs.push(callExpression(identifier('where'), [
|
|
141
|
+
convertCondition(whereClause.expr),
|
|
142
|
+
]));
|
|
143
|
+
|
|
137
144
|
if (expr.type === 'join_expr') {
|
|
138
145
|
const parts = flattenJoins(expr);
|
|
139
146
|
return callExpression(identifier('from'), parts);
|
|
@@ -142,16 +149,11 @@ export const convertFrom = ({expr, whereClause}) => {
|
|
|
142
149
|
if (expr.type === 'alias')
|
|
143
150
|
return callExpression(identifier('from'), [
|
|
144
151
|
convertAlias(expr),
|
|
152
|
+
...fromArgs,
|
|
145
153
|
]);
|
|
146
154
|
|
|
147
|
-
|
|
155
|
+
return callExpression(identifier('from'), [
|
|
148
156
|
identifier(expr.name),
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
if (whereClause)
|
|
152
|
-
fromArgs.push(callExpression(identifier('where'), [
|
|
153
|
-
convertCondition(whereClause.expr),
|
|
154
|
-
]));
|
|
155
|
-
|
|
156
|
-
return callExpression(identifier('from'), fromArgs);
|
|
157
|
+
...fromArgs,
|
|
158
|
+
]);
|
|
157
159
|
};
|