mm_dao 1.8.1 → 1.8.2

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/dao.js CHANGED
@@ -2,6 +2,7 @@ const path = require('path');
2
2
  const Item = require('mm_machine').Mod;
3
3
  const { string, array, date, file } = require('mm_helper');
4
4
  const { getRet } = require('mm_ret');
5
+ const dbAdmin = require('mm_dbs');
5
6
 
6
7
  /**
7
8
  * Sql操作驱动类
@@ -166,9 +167,6 @@ Dao.prototype._getInject = function (key) {
166
167
  if (value !== undefined && value !== null && value !== '') {
167
168
  return value;
168
169
  }
169
- if (this.parent && this.parent.config) {
170
- return this.parent.config[key];
171
- }
172
170
  return undefined;
173
171
  };
174
172
 
@@ -718,14 +716,7 @@ Dao.prototype.getParam = async function (db, field) {
718
716
  */
719
717
  Dao.prototype._getFieldsFromCache = function (cg) {
720
718
  var lt = [];
721
- // 方案B:db 池改为可选注入(config.get_db_pool 返回等价数据库池注册表),未配置则跳过缓存读取
722
- var get_db_pool = this._getInject('get_db_pool');
723
- var db_pool = typeof get_db_pool === 'function' ? get_db_pool() : null;
724
- if (!db_pool) {
725
- this.log('warn', '未配置 get_db_pool,跳过字段缓存读取');
726
- return lt;
727
- }
728
- var pool = db_pool['sys'];
719
+ var pool = dbAdmin('os');
729
720
  if (pool) {
730
721
  var dt = pool.get(cg.table);
731
722
  if (dt && dt.config) {
package/lib/manager.js CHANGED
@@ -39,11 +39,6 @@ class DaoManager extends Manager {
39
39
  user_id: "user_id",
40
40
  token: "x-auth-token",
41
41
  },
42
- /**
43
- * 数据库池获取函数(可选注入,返回数据库池注册表;未配置则驱动跳过字段缓存)
44
- * @type {Function|null}
45
- */
46
- get_db_pool: null,
47
42
  /**
48
43
  * 用户路径(导出目录优先,替代原全局 config 的 user_path)
49
44
  * @type {string}
@@ -115,7 +110,6 @@ DaoManager.prototype.add = function (config) {
115
110
  var drive = new this.Drive(
116
111
  {
117
112
  dict: this.config.dict,
118
- get_db_pool: this.config.get_db_pool,
119
113
  user_path: this.config.user_path,
120
114
  static_path: this.config.static_path,
121
115
  run_path: this.config.run_path,
package/package.json CHANGED
@@ -1,64 +1,65 @@
1
- {
2
- "name": "mm_dao",
3
- "version": "1.8.1",
4
- "description": "一个通用的SQL帮助类,支持通过切换db_type实现对不同数据库的操作,包括MySQL和SQLite等;另提供 manager.js/drive.js 的SQL模板管理器(融合自 mm_os com/sql,基于 mm_corejs,内置管理器池,无全局/原型扩展依赖)",
5
- "main": "index.js",
6
- "scripts": {
7
- "start": "node tests/test.js",
8
- "test": "node tests/test.js",
9
- "lint": "eslint . --config eslint.config.js",
10
- "lint:fix": "eslint . --config eslint.config.js --fix",
11
- "lint:check": "eslint . --config eslint.config.js --max-warnings 0"
12
- },
13
- "repository": {
14
- "type": "git",
15
- "url": "git+https://gitee.com/qiuwenwu91/mm_dao.git"
16
- },
17
- "keywords": [
18
- "mm_mod",
19
- "mm_infra",
20
- "mm_runtime",
21
- "sql",
22
- "mysql",
23
- "sql server",
24
- "sqlite",
25
- "database",
26
- "async",
27
- "await",
28
- "promise",
29
- "add",
30
- "del",
31
- "set",
32
- "get",
33
- "query",
34
- "run",
35
- "exec",
36
- "orm",
37
- "多数据库",
38
- "database-adapter"
39
- ],
40
- "layer": "port",
41
- "group": "repo",
42
- "author": "邱文武",
43
- "license": "ISC",
44
- "bugs": {
45
- "url": "https://gitee.com/qiuwenwu91/mm_dao/issues"
46
- },
47
- "homepage": "https://gitee.com/qiuwenwu91/mm_dao#readme",
48
- "engines": {
49
- "node": ">=12.0.0"
50
- },
51
- "dependencies": {
52
- "mm_corejs": "^1.1.4",
53
- "mm_machine": "^3.5.4",
54
- "mm_helper": "^1.0.0",
55
- "mm_excel": "^1.2.4",
56
- "mm_ret": "^1.4.8",
57
- "mm_sql": "^1.8.0"
58
- },
59
- "devDependencies": {
60
- "eslint": "^10.9.1",
61
- "eslint-plugin-jsdoc": "^64.2.1",
62
- "mm_eslint": "^1.7.7"
63
- }
64
- }
1
+ {
2
+ "name": "mm_dao",
3
+ "version": "1.8.2",
4
+ "description": "一个通用的SQL帮助类,支持通过切换db_type实现对不同数据库的操作,包括MySQL和SQLite等;另提供 manager.js/drive.js 的SQL模板管理器(融合自 mm_os com/sql,基于 mm_corejs,内置管理器池,无全局/原型扩展依赖)",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "start": "node tests/test.js",
8
+ "test": "node tests/test.js",
9
+ "lint": "eslint . --config eslint.config.js",
10
+ "lint:fix": "eslint . --config eslint.config.js --fix",
11
+ "lint:check": "eslint . --config eslint.config.js --max-warnings 0"
12
+ },
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://gitee.com/qiuwenwu91/mm_dao.git"
16
+ },
17
+ "keywords": [
18
+ "mm_mod",
19
+ "mm_infra",
20
+ "mm_runtime",
21
+ "sql",
22
+ "mysql",
23
+ "sql server",
24
+ "sqlite",
25
+ "database",
26
+ "async",
27
+ "await",
28
+ "promise",
29
+ "add",
30
+ "del",
31
+ "set",
32
+ "get",
33
+ "query",
34
+ "run",
35
+ "exec",
36
+ "orm",
37
+ "多数据库",
38
+ "database-adapter"
39
+ ],
40
+ "layer": "infra",
41
+ "group": "repo",
42
+ "author": "邱文武",
43
+ "license": "ISC",
44
+ "bugs": {
45
+ "url": "https://gitee.com/qiuwenwu91/mm_dao/issues"
46
+ },
47
+ "homepage": "https://gitee.com/qiuwenwu91/mm_dao#readme",
48
+ "engines": {
49
+ "node": ">=12.0.0"
50
+ },
51
+ "dependencies": {
52
+ "mm_corejs": "^1.1.4",
53
+ "mm_dbs": "^1.0.1",
54
+ "mm_excel": "^1.2.4",
55
+ "mm_helper": "^1.0.0",
56
+ "mm_machine": "^3.5.4",
57
+ "mm_ret": "^1.4.8",
58
+ "mm_sql": "^1.8.0"
59
+ },
60
+ "devDependencies": {
61
+ "eslint": "^10.9.1",
62
+ "eslint-plugin-jsdoc": "^64.2.1",
63
+ "mm_eslint": "^1.7.7"
64
+ }
65
+ }