dborm-mysql 2.0.0 → 2.1.0

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/base/dbORM.js +10 -3
  2. package/package.json +1 -1
package/base/dbORM.js CHANGED
@@ -158,23 +158,30 @@ let dbFunss = (config) => {
158
158
  listSql = initSessionSql + ';' + listSql;
159
159
  countSql = initSessionSql + ';' + countSql;
160
160
  }
161
- let list, count;
161
+ let querys = []
162
162
  if(returnFields.includes('list')){
163
- list = await db.query(listSql, listParams, connection).then(res => {
163
+ let list = db.query(listSql, listParams, connection).then(res => {
164
164
  if(initSessionSql){
165
165
  res = res[1];
166
166
  }
167
167
  return dbUtil.convert2RamFieldName(tableName, res);
168
168
  });
169
+ querys.push(list);
170
+ } else {
171
+ querys.push(Promise.resolve(null));
169
172
  }
170
173
  if(returnFields.includes('count')){
171
- count = await db.query(countSql, countParams, connection).then(res => {
174
+ let count = db.query(countSql, countParams, connection).then(res => {
172
175
  if(initSessionSql){
173
176
  res = res[1];
174
177
  }
175
178
  return res[0].count;
176
179
  });
180
+ querys.push(count);
181
+ } else {
182
+ querys.push(Promise.resolve(null));
177
183
  }
184
+ let [list,count] = await Promise.all(querys);
178
185
  return {list, count};
179
186
  };
180
187
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dborm-mysql",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "a NodeJs ORM for mysql",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",