@synatic/noql
Advanced tools
Comparing version 2.0.2 to 2.0.3
@@ -137,2 +137,6 @@ const _allowableFunctions = require('./MongoFunctions'); | ||
/** | ||
* | ||
* @param expr | ||
*/ | ||
function isAllowableType(expr) { | ||
@@ -139,0 +143,0 @@ if (expr.type === 'function' && expr.args) { |
@@ -10,3 +10,3 @@ const _allowableFunctions = require('../MongoFunctions'); | ||
* @param {import('../types').Expression} expressionPart - the expression to turn into a value | ||
* @param {function} [groupByColumnParserFn] - the group by parser function passed to manage group by clauses | ||
* @param {Function} [groupByColumnParserFn] - the group by parser function passed to manage group by clauses | ||
* @param {number} [depth] - the depth of the expression allowing for dynamic field names | ||
@@ -59,3 +59,3 @@ * @returns {string|undefined|*} | ||
* @param {import('../types').Expression} expr - the ast expression | ||
* @param {function} [groupByColumnParserFn] - the group by parser function passed to manage group by clauses | ||
* @param {Function} [groupByColumnParserFn] - the group by parser function passed to manage group by clauses | ||
* @param {number} [depth] - the depth of the expression allowing for dynamic field names | ||
@@ -62,0 +62,0 @@ * @returns {*} |
@@ -13,2 +13,6 @@ const _allowableFunctions = require('../MongoFunctions'); | ||
/** | ||
* | ||
* @param column | ||
*/ | ||
function getAggrFunctionsForColumn(column) { | ||
@@ -15,0 +19,0 @@ const potentialFuncs = []; |
@@ -11,2 +11,18 @@ const {parseSQLtoAST} = require('./parseSQLtoAST'); | ||
/** | ||
* The version of the parser | ||
* | ||
* @type {string} | ||
* @readonly | ||
* @static | ||
* @memberof SQLParser | ||
* @example | ||
* const {SQLParser} = require('@synatic/noql); | ||
* console.log(SQLParser.VERSION); | ||
* // 2.0.2 | ||
*/ | ||
static get VERSION() { | ||
return require('../package.json').version; | ||
} | ||
/** | ||
* Parses sql to either a query or aggregate | ||
@@ -17,2 +33,14 @@ * | ||
* @returns {import('./types').ParsedQueryOrAggregate} | ||
* @throws | ||
* @memberof SQLParser | ||
* @example | ||
* const {SQLParser} = require('@synatic/noql'); | ||
* const sql = 'SELECT * FROM users WHERE age > 18'; | ||
* const parsed = SQLParser.parseSQL(sql); | ||
* console.log(parsed); | ||
* // { | ||
* // collection: 'users', | ||
* // query: { age: { $gt: 18 } }, | ||
* // projection: { _id: 0 }, | ||
* // } | ||
*/ | ||
@@ -19,0 +47,0 @@ static parseSQL(sql, options = {}) { |
{ | ||
"name": "@synatic/noql", | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"description": "Convert SQL statements to mongo queries or aggregates", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -29,3 +29,3 @@ # NoQL - Not Only SQL | ||
await client.connect(); | ||
const db = client.db('sql-to-mongo-test'); | ||
const db = client.db('noql-test'); | ||
@@ -32,0 +32,0 @@ const parsedSQL = SQLParser.parseSQL('select id from `films` limit 10'); |
Sorry, the diff of this file is too big to display
220116
5136