mm_mysql 2.4.9 → 2.5.1
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/index.js +18 -0
- package/package.json +4 -4
package/index.js
CHANGED
|
@@ -433,6 +433,24 @@ Mysql.prototype.db = function () {
|
|
|
433
433
|
return new DB(this);
|
|
434
434
|
};
|
|
435
435
|
|
|
436
|
+
/**
|
|
437
|
+
* 获取表管理器(语法糖,等同于 db().new(name, key))
|
|
438
|
+
* @param {string} name 表名
|
|
439
|
+
* @param {string} key 主键字段名
|
|
440
|
+
* @returns {object} DB表管理器实例
|
|
441
|
+
*/
|
|
442
|
+
Mysql.prototype.table = function (name, key) {
|
|
443
|
+
if (typeof name !== 'string' || name.trim() === '') {
|
|
444
|
+
throw new TypeError('name must be non-empty string');
|
|
445
|
+
}
|
|
446
|
+
var db = this.db();
|
|
447
|
+
db.table = name;
|
|
448
|
+
if (key) {
|
|
449
|
+
db.key = key;
|
|
450
|
+
}
|
|
451
|
+
return db;
|
|
452
|
+
};
|
|
453
|
+
|
|
436
454
|
/**
|
|
437
455
|
* 初始化MySQL服务(保持兼容性)
|
|
438
456
|
* @returns {Promise<void>}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mm_mysql",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.1",
|
|
4
4
|
"description": "这是超级美眉mysql帮助函数模块,用于便捷操作mysql,使用await方式,可以避免嵌套函数",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"mm_expand": "^2.
|
|
7
|
+
"mm_expand": "^2.5.1",
|
|
8
8
|
"mysql2": "^3.23.2",
|
|
9
9
|
"sqlstring": "^2.3.3"
|
|
10
10
|
},
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"node": ">=12.0.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"eslint": "^10.8.
|
|
40
|
-
"eslint-plugin-jsdoc": "^
|
|
39
|
+
"eslint": "^10.8.1",
|
|
40
|
+
"eslint-plugin-jsdoc": "^64.0.1",
|
|
41
41
|
"mm_eslint": "^1.7.5"
|
|
42
42
|
}
|
|
43
43
|
}
|