@bee.js/node 0.0.35 → 0.0.36

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.
Files changed (2) hide show
  1. package/beehive.js +25 -0
  2. package/package.json +1 -1
package/beehive.js CHANGED
@@ -243,6 +243,31 @@ module.exports = function hive(req = {}, res = {}, model = null) {
243
243
  return this
244
244
  },
245
245
 
246
+ whereIn: function(field, array = []) {
247
+ array = array
248
+ .map(row => {
249
+ let val = row[field]
250
+
251
+ switch (model.schema[field].type) {
252
+ case "char":
253
+ case "varchar":
254
+ case "text":
255
+ case "string":
256
+ return `'${val}'`
257
+ case "guid":
258
+ case "uuid":
259
+ return val ? beeTools.guidToBin(val) : null
260
+ default:
261
+ return val
262
+ }
263
+ })
264
+ .join(",")
265
+
266
+ script[0]['where'].push(`${model.table}.${field} IN(${array})`)
267
+
268
+ return this
269
+ },
270
+
246
271
  binds: function(...params) {
247
272
 
248
273
  params.map(bind=> script[0]['binds'].push(bind))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bee.js/node",
3
- "version": "0.0.35",
3
+ "version": "0.0.36",
4
4
  "description": "A JavaScript framework for making Node.js API´s",
5
5
  "main": "index.js",
6
6
  "scripts": {