mysql-simple-query
Advanced tools
Comparing version 1.0.14 to 1.0.15
@@ -12,2 +12,3 @@ const dbQuery = require('./util/dbQuery'); | ||
this.whereBetweenStatement = {}; | ||
this.whereCondition = null; | ||
this.whereLikeCondition = null; | ||
@@ -41,5 +42,9 @@ this.groupByStatement = ''; | ||
where(key, value) { | ||
where(key, value, condition) { | ||
this.whereStatement[key] = value; | ||
this.whereConditionUsed = true; | ||
if (condition) { | ||
this.whereCondition = condition; | ||
} | ||
} | ||
@@ -61,3 +66,3 @@ | ||
if (!isEmpty(this.whereStatement)) { | ||
return dbQuery.parseWhere(this.whereStatement); | ||
return dbQuery.parseWhere(this.whereStatement, this.whereCondition); | ||
} | ||
@@ -64,0 +69,0 @@ |
@@ -42,3 +42,3 @@ const select = select => { | ||
const parseWhere = whereObject => { | ||
const parseWhere = (whereObject, orStatement = false) => { | ||
let whereStatement = []; | ||
@@ -51,2 +51,6 @@ | ||
if (orStatement) { | ||
return `WHERE ${whereStatement.join(' OR ')}`; | ||
} | ||
return `WHERE ${whereStatement.join(' AND ')}`; | ||
@@ -53,0 +57,0 @@ }; |
{ | ||
"name": "mysql-simple-query", | ||
"version": "1.0.14", | ||
"version": "1.0.15", | ||
"description": "Simple query wrapper for mysql-promise to make querying, inserting, updating, and deleting easier for developers.", | ||
@@ -5,0 +5,0 @@ "main": "mysqlSimpleQuery.js", |
@@ -13,2 +13,3 @@ const dbQuery = require('./util/dbQuery'); | ||
this.whereBetweenStatement = {}; | ||
this.whereCondition = null; | ||
this.whereLikeCondition = null; | ||
@@ -42,5 +43,9 @@ this.groupByStatement = ''; | ||
where(key, value) { | ||
where(key, value, condition) { | ||
this.whereStatement[key] = value; | ||
this.whereConditionUsed = true; | ||
if (condition) { | ||
this.whereCondition = condition; | ||
} | ||
} | ||
@@ -62,3 +67,3 @@ | ||
if(!isEmpty(this.whereStatement)) { | ||
return dbQuery.parseWhere(this.whereStatement); | ||
return dbQuery.parseWhere(this.whereStatement, this.whereCondition); | ||
} | ||
@@ -65,0 +70,0 @@ |
@@ -47,3 +47,3 @@ const select = (select) => { | ||
const parseWhere = (whereObject) => { | ||
const parseWhere = (whereObject, orStatement = false) => { | ||
let whereStatement = []; | ||
@@ -56,2 +56,6 @@ | ||
if (orStatement) { | ||
return `WHERE ${whereStatement.join(' OR ')}`; | ||
} | ||
return `WHERE ${whereStatement.join(' AND ')}`; | ||
@@ -58,0 +62,0 @@ }; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
30105
768