mm_mysql 2.3.6 → 2.3.7

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/db.js +6 -6
  2. package/package.json +2 -2
package/db.js CHANGED
@@ -27,7 +27,7 @@ class DB extends Sql {
27
27
  * 获取上级
28
28
  * @returns {object} 返回上级管理器
29
29
  */
30
- this.parent = function () {
30
+ this.getParent = function () {
31
31
  return mysql;
32
32
  };
33
33
  }
@@ -53,7 +53,7 @@ DB.prototype._createTimeoutPromise = function (timeout, message) {
53
53
  * @returns {string} 数据库
54
54
  */
55
55
  DB.prototype.database = function () {
56
- return this.parent().config.database;
56
+ return this.getParent().config.database;
57
57
  };
58
58
 
59
59
  /**
@@ -63,7 +63,7 @@ DB.prototype.database = function () {
63
63
  * @returns {object} 返回管理器
64
64
  */
65
65
  DB.prototype.new = function (table, key) {
66
- const db = this.parent().db();
66
+ const db = this.getParent().db();
67
67
  db.table = table;
68
68
  if (key) {
69
69
  db.key = key;
@@ -80,7 +80,7 @@ DB.prototype.new = function (table, key) {
80
80
  */
81
81
  DB.prototype.getConn = async function() {
82
82
  try {
83
- return await this.parent().getConn();
83
+ return await this.getParent().getConn();
84
84
  } catch (error) {
85
85
  this.log('error', '获取连接失败', error);
86
86
  // 返回null作为默认值,保持返回值类型一致
@@ -94,7 +94,7 @@ DB.prototype.getConn = async function() {
94
94
  */
95
95
  DB.prototype.start = async function() {
96
96
  try {
97
- return await this.parent().beginTransaction();
97
+ return await this.getParent().beginTransaction();
98
98
  } catch (error) {
99
99
  this.log('error', '开始事务失败', error);
100
100
  // 返回null作为默认值,保持返回值类型一致
@@ -153,7 +153,7 @@ DB.prototype.transaction = async function(callback) {
153
153
  }
154
154
 
155
155
  try {
156
- return await this.parent().transaction(callback);
156
+ return await this.getParent().transaction(callback);
157
157
  } catch (error) {
158
158
  this.log('error', '事务执行失败', error);
159
159
  // 返回null作为默认值,保持返回值类型一致
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "mm_mysql",
3
- "version": "2.3.6",
3
+ "version": "2.3.7",
4
4
  "description": "这是超级美眉mysql帮助函数模块,用于便捷操作mysql,使用await方式,可以避免嵌套函数",
5
5
  "main": "index.js",
6
6
  "dependencies": {
7
- "mm_expand": "^2.1.9",
7
+ "mm_expand": "^2.2.8",
8
8
  "mysql2": "^3.22.0",
9
9
  "sqlstring": "^2.3.3"
10
10
  },