@rdyl/node-mysql 0.0.7 → 0.0.8
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 +1 -1
- package/dist/meta.js +13 -13
- package/package.json +1 -1
- package/types/meta.d.ts +4 -4
- package/types/type.d.ts +2 -2
package/CHANGELOG.md
CHANGED
package/dist/meta.js
CHANGED
|
@@ -36,15 +36,15 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.
|
|
39
|
+
exports.MysqlDbSchema = void 0;
|
|
40
40
|
var helper_1 = require("./helper");
|
|
41
41
|
var utils_1 = require("./utils");
|
|
42
42
|
/**
|
|
43
43
|
* @description
|
|
44
44
|
* 使用$toMap时 不返回的字段名前面需要加$
|
|
45
45
|
*/
|
|
46
|
-
var
|
|
47
|
-
function
|
|
46
|
+
var MysqlDbSchema = /** @class */ (function () {
|
|
47
|
+
function MysqlDbSchema($table, $mapExFields) {
|
|
48
48
|
if ($mapExFields === void 0) { $mapExFields = []; }
|
|
49
49
|
this.$table = $table;
|
|
50
50
|
this.$mapExFields = $mapExFields;
|
|
@@ -52,7 +52,7 @@ var DbSchema = /** @class */ (function () {
|
|
|
52
52
|
this.createTime = utils_1.Parser.easyDate();
|
|
53
53
|
this.updateTime = utils_1.Parser.easyDate();
|
|
54
54
|
}
|
|
55
|
-
Object.defineProperty(
|
|
55
|
+
Object.defineProperty(MysqlDbSchema.prototype, "$toJson", {
|
|
56
56
|
get: function () {
|
|
57
57
|
var _this = this;
|
|
58
58
|
return Object.keys(this).reduce(function (obj, key) {
|
|
@@ -67,7 +67,7 @@ var DbSchema = /** @class */ (function () {
|
|
|
67
67
|
enumerable: false,
|
|
68
68
|
configurable: true
|
|
69
69
|
});
|
|
70
|
-
Object.defineProperty(
|
|
70
|
+
Object.defineProperty(MysqlDbSchema.prototype, "$toMap", {
|
|
71
71
|
get: function () {
|
|
72
72
|
var _this = this;
|
|
73
73
|
var target = this.$toJson;
|
|
@@ -80,14 +80,14 @@ var DbSchema = /** @class */ (function () {
|
|
|
80
80
|
enumerable: false,
|
|
81
81
|
configurable: true
|
|
82
82
|
});
|
|
83
|
-
Object.defineProperty(
|
|
83
|
+
Object.defineProperty(MysqlDbSchema.prototype, "$fields", {
|
|
84
84
|
get: function () {
|
|
85
85
|
return Object.keys(this.$toJson);
|
|
86
86
|
},
|
|
87
87
|
enumerable: false,
|
|
88
88
|
configurable: true
|
|
89
89
|
});
|
|
90
|
-
|
|
90
|
+
MysqlDbSchema.prototype.$formJson = function (json) {
|
|
91
91
|
var _this = this;
|
|
92
92
|
Object.keys(json).forEach(function (k) {
|
|
93
93
|
if (Object.prototype.hasOwnProperty.call(_this, k)) {
|
|
@@ -96,7 +96,7 @@ var DbSchema = /** @class */ (function () {
|
|
|
96
96
|
}
|
|
97
97
|
});
|
|
98
98
|
};
|
|
99
|
-
|
|
99
|
+
MysqlDbSchema.prototype.$get = function () {
|
|
100
100
|
return __awaiter(this, void 0, void 0, function () {
|
|
101
101
|
var selector, res;
|
|
102
102
|
return __generator(this, function (_a) {
|
|
@@ -115,7 +115,7 @@ var DbSchema = /** @class */ (function () {
|
|
|
115
115
|
});
|
|
116
116
|
});
|
|
117
117
|
};
|
|
118
|
-
|
|
118
|
+
MysqlDbSchema.prototype.$insert = function (uniqueKey) {
|
|
119
119
|
return __awaiter(this, void 0, void 0, function () {
|
|
120
120
|
var inserter, existing, res;
|
|
121
121
|
return __generator(this, function (_a) {
|
|
@@ -147,7 +147,7 @@ var DbSchema = /** @class */ (function () {
|
|
|
147
147
|
});
|
|
148
148
|
});
|
|
149
149
|
};
|
|
150
|
-
|
|
150
|
+
MysqlDbSchema.prototype.$remove = function () {
|
|
151
151
|
return __awaiter(this, void 0, void 0, function () {
|
|
152
152
|
var deleter, user;
|
|
153
153
|
return __generator(this, function (_a) {
|
|
@@ -165,7 +165,7 @@ var DbSchema = /** @class */ (function () {
|
|
|
165
165
|
});
|
|
166
166
|
});
|
|
167
167
|
};
|
|
168
|
-
|
|
168
|
+
MysqlDbSchema.prototype.$update = function (maps) {
|
|
169
169
|
return __awaiter(this, void 0, void 0, function () {
|
|
170
170
|
var updater, user, values, affected;
|
|
171
171
|
return __generator(this, function (_a) {
|
|
@@ -196,6 +196,6 @@ var DbSchema = /** @class */ (function () {
|
|
|
196
196
|
});
|
|
197
197
|
});
|
|
198
198
|
};
|
|
199
|
-
return
|
|
199
|
+
return MysqlDbSchema;
|
|
200
200
|
}());
|
|
201
|
-
exports.
|
|
201
|
+
exports.MysqlDbSchema = MysqlDbSchema;
|
package/package.json
CHANGED
package/types/meta.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @description
|
|
3
3
|
* 使用$toMap时 不返回的字段名前面需要加$
|
|
4
4
|
*/
|
|
5
|
-
export declare class
|
|
5
|
+
export declare class MysqlDbSchema implements MysqlDbBaseType {
|
|
6
6
|
$table: string;
|
|
7
7
|
$mapExFields: string[];
|
|
8
8
|
id: number | string;
|
|
@@ -16,7 +16,7 @@ export declare class DbSchema implements DbBaseType {
|
|
|
16
16
|
get $fields(): string[];
|
|
17
17
|
$formJson(json: Record<string, unknown>): void;
|
|
18
18
|
$get(): Promise<this | null>;
|
|
19
|
-
$insert(uniqueKey?: string): Promise<
|
|
20
|
-
$remove(): Promise<
|
|
21
|
-
$update(maps: Record<string, unknown>): Promise<
|
|
19
|
+
$insert(uniqueKey?: string): Promise<MysqlDbResultStat>;
|
|
20
|
+
$remove(): Promise<MysqlDbResultStat>;
|
|
21
|
+
$update(maps: Record<string, unknown>): Promise<MysqlDbResultStat>;
|
|
22
22
|
}
|
package/types/type.d.ts
CHANGED