jeefo-mysql
Advanced tools
Comparing version 0.0.50 to 0.0.51
16
index.js
/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. | ||
* File Name : index.js | ||
* Created at : 2021-10-09 | ||
* Updated at : 2022-03-24 | ||
* Updated at : 2022-03-25 | ||
* Author : jeefo | ||
@@ -261,7 +261,13 @@ * Purpose : | ||
for (let [key, value] of Object.entries(where)) { | ||
if (is.object(value) && !(value instanceof Date)) { | ||
value = JSON.stringify(value); | ||
if (Array.isArray(value)) { | ||
const placeholders = value.map(() => '?').join(", "); | ||
values.push(...value); | ||
conditions.push(`${mysql.escapeId(key)} IN(${placeholders})`); | ||
} else { | ||
if (is.object(value) && !(value instanceof Date)) { | ||
value = JSON.stringify(value); | ||
} | ||
values.push(value); | ||
conditions.push(`${mysql.escapeId(key)} = ?`); | ||
} | ||
values.push(value); | ||
conditions.push(`${mysql.escapeId(key)} = ?`); | ||
} | ||
@@ -268,0 +274,0 @@ |
{ | ||
"name": "jeefo-mysql", | ||
"version": "0.0.50", | ||
"version": "0.0.51", | ||
"description": "Very simple MySQL connection instances for each table. I had annoyed enough for MySQL Deadlocks.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
11696
263