zet-lib 1.0.94 → 1.0.95

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.
package/lib/connection.js CHANGED
@@ -48,7 +48,7 @@ const orderByFn = (obj) => {
48
48
 
49
49
  const whereFn = (obj) => {
50
50
  const where = obj.where || {}
51
- //[{field:"your_field",option:"=>",value:"12",operator:"AND",type:"text,json,date"}]
51
+ //[{field:"your_field",option:"=>",value:"12",operator:"AND",type:"text,json,date, inline"}]
52
52
  const whereArray = obj.whereArray || []
53
53
  let increment = 1
54
54
  let arr = [],
@@ -83,6 +83,9 @@ const whereFn = (obj) => {
83
83
  } else {
84
84
  if (type == 'json') {
85
85
  wherequery += andOr + ` JSON_CONTAINS(${field}, '"${item.value}"' ,'$') ${operator}`
86
+ } else if (type == 'inline') {
87
+ //select * from attendance where employee_id = 4803 and date IN ('2023-12-21','2023-12-22')
88
+ wherequery += andOr + ` ${field} ${item.value} ${operator}`
86
89
  } else {
87
90
  if (item.option.includes('{{value}}')) {
88
91
  item.option = item.option.replace('{{value}}', `$${increment}`)
@@ -96,6 +99,7 @@ const whereFn = (obj) => {
96
99
  if (item.option == '=') {
97
100
  itemValue = Util.replaceAll(itemValue + '', '%', '')
98
101
  }
102
+
99
103
  arr.push(itemValue)
100
104
  }
101
105
  }
@@ -130,7 +134,7 @@ connection.results = async (obj) => {
130
134
  const arr = whereObj.arr
131
135
  const sql = `SELECT ${select} FROM "${table}" ${join} ${wheres} ${statement} ${orderBy} ${limit} ${offset}`
132
136
  /*console.log(sql)
133
- console.log(arr);*/
137
+ console.log(arr);*/
134
138
  try {
135
139
  const result = await pool.query(sql, arr.length ? arr : values.length ? values : null)
136
140
  return !result.rows ? [] : result.rows
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zet-lib",
3
- "version": "1.0.94",
3
+ "version": "1.0.95",
4
4
  "description": "zet is a library that part of zet generator.",
5
5
  "engines": {
6
6
  "node": ">=18"