@rdyl/node-mysql 0.0.4 → 0.0.5

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/CHANGELOG.md CHANGED
@@ -1,4 +1,4 @@
1
- ## 0.0.3 (2025-04-08)
1
+ ## 0.0.5 (2025-04-10)
2
2
 
3
3
 
4
4
 
package/dist/meta.js CHANGED
@@ -48,7 +48,7 @@ var DbSchema = /** @class */ (function () {
48
48
  if ($mapExFields === void 0) { $mapExFields = []; }
49
49
  this.$table = $table;
50
50
  this.$mapExFields = $mapExFields;
51
- this.id = '';
51
+ this.id = "";
52
52
  this.createTime = utils_1.Parser.easyDate();
53
53
  this.updateTime = utils_1.Parser.easyDate();
54
54
  }
@@ -56,7 +56,7 @@ var DbSchema = /** @class */ (function () {
56
56
  get: function () {
57
57
  var _this = this;
58
58
  return Object.keys(this).reduce(function (obj, key) {
59
- if (!key.startsWith('$') &&
59
+ if (!key.startsWith("$") &&
60
60
  Object.prototype.hasOwnProperty.call(_this, key)) {
61
61
  // @ts-ignore
62
62
  obj[key] = _this[key];
@@ -129,7 +129,7 @@ var DbSchema = /** @class */ (function () {
129
129
  existing = (_a.sent())[0];
130
130
  // @ts-ignore
131
131
  if (existing && existing.length > 0) {
132
- return [2 /*return*/, 'exist'];
132
+ return [2 /*return*/, "exist"];
133
133
  }
134
134
  _a.label = 2;
135
135
  case 2: return [4 /*yield*/, inserter.result()];
@@ -137,10 +137,10 @@ var DbSchema = /** @class */ (function () {
137
137
  res = _a.sent();
138
138
  if (res.filter(function (e) { return e !== -1; }).length > 0) {
139
139
  this.id = res[0];
140
- return [2 /*return*/, 'ok'];
140
+ return [2 /*return*/, "ok"];
141
141
  }
142
142
  else {
143
- return [2 /*return*/, 'fail'];
143
+ return [2 /*return*/, "fail"];
144
144
  }
145
145
  return [2 /*return*/];
146
146
  }
@@ -160,7 +160,7 @@ var DbSchema = /** @class */ (function () {
160
160
  if (!user) return [3 /*break*/, 3];
161
161
  return [4 /*yield*/, deleter.removeById(this.id)];
162
162
  case 2: return [2 /*return*/, _a.sent()];
163
- case 3: return [2 /*return*/, 'exist'];
163
+ case 3: return [2 /*return*/, "exist"];
164
164
  }
165
165
  });
166
166
  });
@@ -177,21 +177,21 @@ var DbSchema = /** @class */ (function () {
177
177
  user = _a.sent();
178
178
  if (!user) return [3 /*break*/, 3];
179
179
  values = Object.fromEntries(Object.keys(maps)
180
- .filter(function (n) { return !['id', 'createTime', 'updateTime'].includes(n); })
180
+ .filter(function (n) { return !["id", "createTime", "updateTime"].includes(n); })
181
181
  .map(function (k) { return [k, maps[k]]; }));
182
182
  updater.setFields(values);
183
183
  updater.select({
184
- field: 'id',
184
+ field: "id",
185
185
  value: user.id,
186
186
  });
187
187
  return [4 /*yield*/, updater.result()];
188
188
  case 2:
189
189
  affected = _a.sent();
190
190
  if (affected > 0) {
191
- return [2 /*return*/, 'ok'];
191
+ return [2 /*return*/, "ok"];
192
192
  }
193
- return [2 /*return*/, 'fail'];
194
- case 3: return [2 /*return*/, 'exist'];
193
+ return [2 /*return*/, "fail"];
194
+ case 3: return [2 /*return*/, "exist"];
195
195
  }
196
196
  });
197
197
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rdyl/node-mysql",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "types": "types/index.d.ts",
package/types/meta.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import { DbBaseType, DbResultStat } from './interface';
2
1
  /**
3
2
  * @description
4
3
  * 使用$toMap时 不返回的字段名前面需要加$
@@ -0,0 +1,9 @@
1
+ type DbId = number | string;
2
+
3
+ interface DbBaseType {
4
+ id: DbId;
5
+ createTime: string;
6
+ updateTime: string;
7
+ }
8
+
9
+ type DbResultStat = "exist" | "ok" | "fail";