node-sql-parser
Advanced tools
Comparing version 1.7.7 to 1.7.8
@@ -21,6 +21,11 @@ "use strict"; | ||
length, | ||
suffix | ||
suffix, | ||
scale | ||
} = definition || {}; | ||
let result = dataType; | ||
if (length) result += `(${length})`; | ||
if (length) { | ||
result += `(${[length, scale].filter(_util.hasVal).join(', ')})`; | ||
} | ||
if (suffix && suffix.length) result += ` ${suffix.join(' ')}`; | ||
@@ -27,0 +32,0 @@ return result; |
@@ -24,6 +24,12 @@ "use strict"; | ||
dataType, | ||
parentheses | ||
parentheses, | ||
scale | ||
} = target; | ||
let str = ''; | ||
if (length) str = parentheses ? `(${length})` : length; | ||
if (length) { | ||
str = scale ? `${length}, ${scale}` : length; | ||
} | ||
if (parentheses) str = `(${str})`; | ||
let prefix = (0, _expr.exprToSQL)(expression); | ||
@@ -30,0 +36,0 @@ let symbolChar = '::'; |
@@ -16,2 +16,6 @@ "use strict"; | ||
/** | ||
* @param {Array} values | ||
* @return {string} | ||
*/ | ||
function valuesToSQL(values) { | ||
@@ -18,0 +22,0 @@ if (values.type === 'select') return (0, _select.selectToSQL)(values); |
@@ -18,2 +18,16 @@ "use strict"; | ||
/** | ||
* @param {Object} stmt | ||
* @param {?Array} stmt.with | ||
* @param {?Array} stmt.options | ||
* @param {?string} stmt.distinct | ||
* @param {?Array|string} stmt.columns | ||
* @param {?Array} stmt.from | ||
* @param {?Object} stmt.where | ||
* @param {?Array} stmt.groupby | ||
* @param {?Object} stmt.having | ||
* @param {?Array} stmt.orderby | ||
* @param {?Array} stmt.limit | ||
* @return {string} | ||
*/ | ||
function selectToSQL(stmt) { | ||
@@ -20,0 +34,0 @@ const { |
@@ -14,2 +14,6 @@ "use strict"; | ||
/** | ||
* @param {Array} sets | ||
* @return {string} | ||
*/ | ||
function setToSQL(sets) { | ||
@@ -16,0 +20,0 @@ if (!sets || sets.length === 0) return ''; |
@@ -10,2 +10,5 @@ "use strict"; | ||
/** | ||
* @param {Array<Object>} withExpr | ||
*/ | ||
function withToSql(withExpr) { | ||
@@ -12,0 +15,0 @@ if (!withExpr || withExpr.length === 0) return; |
{ | ||
"name": "node-sql-parser", | ||
"version": "1.7.7", | ||
"version": "1.7.8", | ||
"description": "simple node sql parser", | ||
@@ -59,3 +59,3 @@ "main": "index.js", | ||
"coveralls": "^3.0.6", | ||
"eslint": "^6.1.0", | ||
"eslint": "^6.8.0", | ||
"eslint-config-airbnb-base": "^14.0.0", | ||
@@ -62,0 +62,0 @@ "eslint-config-strict": "^14.0.1", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
2615606
92964