@joktec/mysql 0.0.68 → 0.0.70
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/LICENSE +22 -22
- package/README.md +118 -118
- package/bin/generate-entity.sh +189 -189
- package/dist/__tests__/mysql.utils.spec.d.ts +1 -1
- package/dist/__tests__/mysql.utils.spec.js +25 -25
- package/dist/index.d.ts +10 -10
- package/dist/index.js +28 -28
- package/dist/models/index.d.ts +3 -3
- package/dist/models/index.js +19 -19
- package/dist/models/mysql.model.d.ts +6 -6
- package/dist/models/mysql.model.js +35 -35
- package/dist/models/mysql.request.d.ts +10 -10
- package/dist/models/mysql.request.js +2 -2
- package/dist/models/mysql.response.d.ts +3 -3
- package/dist/models/mysql.response.js +2 -2
- package/dist/mysql.client.d.ts +8 -8
- package/dist/mysql.client.js +2 -2
- package/dist/mysql.config.d.ts +34 -34
- package/dist/mysql.config.js +119 -119
- package/dist/mysql.exception.d.ts +5 -5
- package/dist/mysql.exception.js +35 -35
- package/dist/mysql.module.d.ts +2 -2
- package/dist/mysql.module.js +22 -22
- package/dist/mysql.repo.d.ts +22 -22
- package/dist/mysql.repo.js +118 -118
- package/dist/mysql.service.d.ts +12 -12
- package/dist/mysql.service.js +81 -81
- package/dist/mysql.utils.d.ts +6 -6
- package/dist/mysql.utils.js +49 -49
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
package/dist/mysql.config.js
CHANGED
|
@@ -1,120 +1,120 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.MysqlConfig = exports.Dialect = exports.MysqlSlaveConfig = void 0;
|
|
13
|
-
const core_1 = require("@joktec/core");
|
|
14
|
-
const lodash_1 = require("lodash");
|
|
15
|
-
class MysqlSlaveConfig {
|
|
16
|
-
constructor(props) {
|
|
17
|
-
Object.assign(this, Object.assign({}, props));
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
__decorate([
|
|
21
|
-
(0, core_1.IsString)(),
|
|
22
|
-
(0, core_1.IsNotEmpty)(),
|
|
23
|
-
__metadata("design:type", String)
|
|
24
|
-
], MysqlSlaveConfig.prototype, "host", void 0);
|
|
25
|
-
__decorate([
|
|
26
|
-
(0, core_1.IsInt)(),
|
|
27
|
-
(0, core_1.IsNotEmpty)(),
|
|
28
|
-
__metadata("design:type", Number)
|
|
29
|
-
], MysqlSlaveConfig.prototype, "port", void 0);
|
|
30
|
-
__decorate([
|
|
31
|
-
(0, core_1.IsString)(),
|
|
32
|
-
(0, core_1.IsNotEmpty)(),
|
|
33
|
-
__metadata("design:type", String)
|
|
34
|
-
], MysqlSlaveConfig.prototype, "username", void 0);
|
|
35
|
-
__decorate([
|
|
36
|
-
(0, core_1.IsString)(),
|
|
37
|
-
(0, core_1.IsNotEmpty)(),
|
|
38
|
-
__metadata("design:type", String)
|
|
39
|
-
], MysqlSlaveConfig.prototype, "password", void 0);
|
|
40
|
-
__decorate([
|
|
41
|
-
(0, core_1.IsString)(),
|
|
42
|
-
(0, core_1.IsNotEmpty)(),
|
|
43
|
-
__metadata("design:type", String)
|
|
44
|
-
], MysqlSlaveConfig.prototype, "database", void 0);
|
|
45
|
-
exports.MysqlSlaveConfig = MysqlSlaveConfig;
|
|
46
|
-
var Dialect;
|
|
47
|
-
(function (Dialect) {
|
|
48
|
-
Dialect["MYSQL"] = "mysql";
|
|
49
|
-
Dialect["POSTGRES"] = "postgres";
|
|
50
|
-
Dialect["SQLITE"] = "sqlite";
|
|
51
|
-
Dialect["MARIADB"] = "mariadb";
|
|
52
|
-
Dialect["MSSQL"] = "mssql";
|
|
53
|
-
Dialect["DB2"] = "db2";
|
|
54
|
-
Dialect["SNOWFLAKE"] = "snowflake";
|
|
55
|
-
Dialect["ORACLE"] = "oracle";
|
|
56
|
-
})(Dialect = exports.Dialect || (exports.Dialect = {}));
|
|
57
|
-
class MysqlConfig extends core_1.ClientConfig {
|
|
58
|
-
constructor(props) {
|
|
59
|
-
var _a;
|
|
60
|
-
super(props);
|
|
61
|
-
Object.assign(this, Object.assign(Object.assign({}, props), { dialect: (props === null || props === void 0 ? void 0 : props.dialect) || Dialect.MYSQL, host: (props === null || props === void 0 ? void 0 : props.host) || 'localhost', port: (0, core_1.toInt)(props === null || props === void 0 ? void 0 : props.port, 3306), connectTimeout: (0, core_1.toInt)(props === null || props === void 0 ? void 0 : props.connectTimeout, 20000), slaves: [] }));
|
|
62
|
-
if ((_a = props === null || props === void 0 ? void 0 : props.slaves) === null || _a === void 0 ? void 0 : _a.length) {
|
|
63
|
-
const masterConfig = (0, lodash_1.pick)(props, ['host', 'port', 'username', 'password', 'database']);
|
|
64
|
-
this.slaves = props.slaves.map(slave => new MysqlSlaveConfig(Object.assign(Object.assign({}, masterConfig), slave)));
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
__decorate([
|
|
69
|
-
(0, core_1.IsString)(),
|
|
70
|
-
(0, core_1.IsNotEmpty)(),
|
|
71
|
-
__metadata("design:type", String)
|
|
72
|
-
], MysqlConfig.prototype, "dialect", void 0);
|
|
73
|
-
__decorate([
|
|
74
|
-
(0, core_1.IsString)(),
|
|
75
|
-
(0, core_1.IsNotEmpty)(),
|
|
76
|
-
__metadata("design:type", String)
|
|
77
|
-
], MysqlConfig.prototype, "host", void 0);
|
|
78
|
-
__decorate([
|
|
79
|
-
(0, core_1.IsInt)(),
|
|
80
|
-
(0, core_1.IsNotEmpty)(),
|
|
81
|
-
__metadata("design:type", Number)
|
|
82
|
-
], MysqlConfig.prototype, "port", void 0);
|
|
83
|
-
__decorate([
|
|
84
|
-
(0, core_1.IsString)(),
|
|
85
|
-
(0, core_1.IsNotEmpty)(),
|
|
86
|
-
__metadata("design:type", String)
|
|
87
|
-
], MysqlConfig.prototype, "username", void 0);
|
|
88
|
-
__decorate([
|
|
89
|
-
(0, core_1.IsString)(),
|
|
90
|
-
(0, core_1.IsNotEmpty)(),
|
|
91
|
-
__metadata("design:type", String)
|
|
92
|
-
], MysqlConfig.prototype, "password", void 0);
|
|
93
|
-
__decorate([
|
|
94
|
-
(0, core_1.IsString)(),
|
|
95
|
-
(0, core_1.IsNotEmpty)(),
|
|
96
|
-
__metadata("design:type", String)
|
|
97
|
-
], MysqlConfig.prototype, "database", void 0);
|
|
98
|
-
__decorate([
|
|
99
|
-
(0, core_1.IsString)(),
|
|
100
|
-
(0, core_1.IsOptional)(),
|
|
101
|
-
__metadata("design:type", String)
|
|
102
|
-
], MysqlConfig.prototype, "charset", void 0);
|
|
103
|
-
__decorate([
|
|
104
|
-
(0, core_1.IsString)(),
|
|
105
|
-
(0, core_1.IsOptional)(),
|
|
106
|
-
__metadata("design:type", String)
|
|
107
|
-
], MysqlConfig.prototype, "timezone", void 0);
|
|
108
|
-
__decorate([
|
|
109
|
-
(0, core_1.IsInt)(),
|
|
110
|
-
(0, core_1.IsOptional)(),
|
|
111
|
-
__metadata("design:type", Number)
|
|
112
|
-
], MysqlConfig.prototype, "connectTimeout", void 0);
|
|
113
|
-
__decorate([
|
|
114
|
-
(0, core_1.IsArray)(),
|
|
115
|
-
(0, core_1.IsTypes)([MysqlSlaveConfig], { each: true }),
|
|
116
|
-
(0, core_1.IsOptional)(),
|
|
117
|
-
__metadata("design:type", Array)
|
|
118
|
-
], MysqlConfig.prototype, "slaves", void 0);
|
|
119
|
-
exports.MysqlConfig = MysqlConfig;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.MysqlConfig = exports.Dialect = exports.MysqlSlaveConfig = void 0;
|
|
13
|
+
const core_1 = require("@joktec/core");
|
|
14
|
+
const lodash_1 = require("lodash");
|
|
15
|
+
class MysqlSlaveConfig {
|
|
16
|
+
constructor(props) {
|
|
17
|
+
Object.assign(this, Object.assign({}, props));
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
__decorate([
|
|
21
|
+
(0, core_1.IsString)(),
|
|
22
|
+
(0, core_1.IsNotEmpty)(),
|
|
23
|
+
__metadata("design:type", String)
|
|
24
|
+
], MysqlSlaveConfig.prototype, "host", void 0);
|
|
25
|
+
__decorate([
|
|
26
|
+
(0, core_1.IsInt)(),
|
|
27
|
+
(0, core_1.IsNotEmpty)(),
|
|
28
|
+
__metadata("design:type", Number)
|
|
29
|
+
], MysqlSlaveConfig.prototype, "port", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
(0, core_1.IsString)(),
|
|
32
|
+
(0, core_1.IsNotEmpty)(),
|
|
33
|
+
__metadata("design:type", String)
|
|
34
|
+
], MysqlSlaveConfig.prototype, "username", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, core_1.IsString)(),
|
|
37
|
+
(0, core_1.IsNotEmpty)(),
|
|
38
|
+
__metadata("design:type", String)
|
|
39
|
+
], MysqlSlaveConfig.prototype, "password", void 0);
|
|
40
|
+
__decorate([
|
|
41
|
+
(0, core_1.IsString)(),
|
|
42
|
+
(0, core_1.IsNotEmpty)(),
|
|
43
|
+
__metadata("design:type", String)
|
|
44
|
+
], MysqlSlaveConfig.prototype, "database", void 0);
|
|
45
|
+
exports.MysqlSlaveConfig = MysqlSlaveConfig;
|
|
46
|
+
var Dialect;
|
|
47
|
+
(function (Dialect) {
|
|
48
|
+
Dialect["MYSQL"] = "mysql";
|
|
49
|
+
Dialect["POSTGRES"] = "postgres";
|
|
50
|
+
Dialect["SQLITE"] = "sqlite";
|
|
51
|
+
Dialect["MARIADB"] = "mariadb";
|
|
52
|
+
Dialect["MSSQL"] = "mssql";
|
|
53
|
+
Dialect["DB2"] = "db2";
|
|
54
|
+
Dialect["SNOWFLAKE"] = "snowflake";
|
|
55
|
+
Dialect["ORACLE"] = "oracle";
|
|
56
|
+
})(Dialect = exports.Dialect || (exports.Dialect = {}));
|
|
57
|
+
class MysqlConfig extends core_1.ClientConfig {
|
|
58
|
+
constructor(props) {
|
|
59
|
+
var _a;
|
|
60
|
+
super(props);
|
|
61
|
+
Object.assign(this, Object.assign(Object.assign({}, props), { dialect: (props === null || props === void 0 ? void 0 : props.dialect) || Dialect.MYSQL, host: (props === null || props === void 0 ? void 0 : props.host) || 'localhost', port: (0, core_1.toInt)(props === null || props === void 0 ? void 0 : props.port, 3306), connectTimeout: (0, core_1.toInt)(props === null || props === void 0 ? void 0 : props.connectTimeout, 20000), slaves: [] }));
|
|
62
|
+
if ((_a = props === null || props === void 0 ? void 0 : props.slaves) === null || _a === void 0 ? void 0 : _a.length) {
|
|
63
|
+
const masterConfig = (0, lodash_1.pick)(props, ['host', 'port', 'username', 'password', 'database']);
|
|
64
|
+
this.slaves = props.slaves.map(slave => new MysqlSlaveConfig(Object.assign(Object.assign({}, masterConfig), slave)));
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
__decorate([
|
|
69
|
+
(0, core_1.IsString)(),
|
|
70
|
+
(0, core_1.IsNotEmpty)(),
|
|
71
|
+
__metadata("design:type", String)
|
|
72
|
+
], MysqlConfig.prototype, "dialect", void 0);
|
|
73
|
+
__decorate([
|
|
74
|
+
(0, core_1.IsString)(),
|
|
75
|
+
(0, core_1.IsNotEmpty)(),
|
|
76
|
+
__metadata("design:type", String)
|
|
77
|
+
], MysqlConfig.prototype, "host", void 0);
|
|
78
|
+
__decorate([
|
|
79
|
+
(0, core_1.IsInt)(),
|
|
80
|
+
(0, core_1.IsNotEmpty)(),
|
|
81
|
+
__metadata("design:type", Number)
|
|
82
|
+
], MysqlConfig.prototype, "port", void 0);
|
|
83
|
+
__decorate([
|
|
84
|
+
(0, core_1.IsString)(),
|
|
85
|
+
(0, core_1.IsNotEmpty)(),
|
|
86
|
+
__metadata("design:type", String)
|
|
87
|
+
], MysqlConfig.prototype, "username", void 0);
|
|
88
|
+
__decorate([
|
|
89
|
+
(0, core_1.IsString)(),
|
|
90
|
+
(0, core_1.IsNotEmpty)(),
|
|
91
|
+
__metadata("design:type", String)
|
|
92
|
+
], MysqlConfig.prototype, "password", void 0);
|
|
93
|
+
__decorate([
|
|
94
|
+
(0, core_1.IsString)(),
|
|
95
|
+
(0, core_1.IsNotEmpty)(),
|
|
96
|
+
__metadata("design:type", String)
|
|
97
|
+
], MysqlConfig.prototype, "database", void 0);
|
|
98
|
+
__decorate([
|
|
99
|
+
(0, core_1.IsString)(),
|
|
100
|
+
(0, core_1.IsOptional)(),
|
|
101
|
+
__metadata("design:type", String)
|
|
102
|
+
], MysqlConfig.prototype, "charset", void 0);
|
|
103
|
+
__decorate([
|
|
104
|
+
(0, core_1.IsString)(),
|
|
105
|
+
(0, core_1.IsOptional)(),
|
|
106
|
+
__metadata("design:type", String)
|
|
107
|
+
], MysqlConfig.prototype, "timezone", void 0);
|
|
108
|
+
__decorate([
|
|
109
|
+
(0, core_1.IsInt)(),
|
|
110
|
+
(0, core_1.IsOptional)(),
|
|
111
|
+
__metadata("design:type", Number)
|
|
112
|
+
], MysqlConfig.prototype, "connectTimeout", void 0);
|
|
113
|
+
__decorate([
|
|
114
|
+
(0, core_1.IsArray)(),
|
|
115
|
+
(0, core_1.IsTypes)([MysqlSlaveConfig], { each: true }),
|
|
116
|
+
(0, core_1.IsOptional)(),
|
|
117
|
+
__metadata("design:type", Array)
|
|
118
|
+
], MysqlConfig.prototype, "slaves", void 0);
|
|
119
|
+
exports.MysqlConfig = MysqlConfig;
|
|
120
120
|
//# sourceMappingURL=mysql.config.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { InternalServerException } from '@joktec/core';
|
|
2
|
-
export declare class MysqlException extends InternalServerException {
|
|
3
|
-
constructor(msg: string, error: any);
|
|
4
|
-
}
|
|
5
|
-
export declare const MysqlCatch: MethodDecorator;
|
|
1
|
+
import { InternalServerException } from '@joktec/core';
|
|
2
|
+
export declare class MysqlException extends InternalServerException {
|
|
3
|
+
constructor(msg: string, error: any);
|
|
4
|
+
}
|
|
5
|
+
export declare const MysqlCatch: MethodDecorator;
|
|
6
6
|
//# sourceMappingURL=mysql.exception.d.ts.map
|
package/dist/mysql.exception.js
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MysqlCatch = exports.MysqlException = void 0;
|
|
4
|
-
const core_1 = require("@joktec/core");
|
|
5
|
-
const lodash_1 = require("lodash");
|
|
6
|
-
class MysqlException extends core_1.InternalServerException {
|
|
7
|
-
constructor(msg = 'MYSQL_EXCEPTION', error) {
|
|
8
|
-
super(msg, error);
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
exports.MysqlException = MysqlException;
|
|
12
|
-
exports.MysqlCatch = (0, core_1.BaseMethodDecorator)(async (options) => {
|
|
13
|
-
const { method, args } = options;
|
|
14
|
-
try {
|
|
15
|
-
return await method(...args);
|
|
16
|
-
}
|
|
17
|
-
catch (err) {
|
|
18
|
-
if (err.errors && Array.isArray(err.errors)) {
|
|
19
|
-
const formatError = {};
|
|
20
|
-
err.errors.map(errItem => {
|
|
21
|
-
if (!formatError.hasOwnProperty(errItem.path)) {
|
|
22
|
-
formatError[errItem.path] = [];
|
|
23
|
-
}
|
|
24
|
-
formatError[errItem.path].push(errItem.message);
|
|
25
|
-
});
|
|
26
|
-
throw new core_1.ValidateException(formatError);
|
|
27
|
-
}
|
|
28
|
-
if (err.parent || err.original) {
|
|
29
|
-
const parent = err.parent || err.original;
|
|
30
|
-
const msg = (0, lodash_1.snakeCase)(err.message).toUpperCase();
|
|
31
|
-
throw new MysqlException(msg, parent);
|
|
32
|
-
}
|
|
33
|
-
throw new MysqlException(err.message, err);
|
|
34
|
-
}
|
|
35
|
-
});
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MysqlCatch = exports.MysqlException = void 0;
|
|
4
|
+
const core_1 = require("@joktec/core");
|
|
5
|
+
const lodash_1 = require("lodash");
|
|
6
|
+
class MysqlException extends core_1.InternalServerException {
|
|
7
|
+
constructor(msg = 'MYSQL_EXCEPTION', error) {
|
|
8
|
+
super(msg, error);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.MysqlException = MysqlException;
|
|
12
|
+
exports.MysqlCatch = (0, core_1.BaseMethodDecorator)(async (options) => {
|
|
13
|
+
const { method, args } = options;
|
|
14
|
+
try {
|
|
15
|
+
return await method(...args);
|
|
16
|
+
}
|
|
17
|
+
catch (err) {
|
|
18
|
+
if (err.errors && Array.isArray(err.errors)) {
|
|
19
|
+
const formatError = {};
|
|
20
|
+
err.errors.map(errItem => {
|
|
21
|
+
if (!formatError.hasOwnProperty(errItem.path)) {
|
|
22
|
+
formatError[errItem.path] = [];
|
|
23
|
+
}
|
|
24
|
+
formatError[errItem.path].push(errItem.message);
|
|
25
|
+
});
|
|
26
|
+
throw new core_1.ValidateException(formatError);
|
|
27
|
+
}
|
|
28
|
+
if (err.parent || err.original) {
|
|
29
|
+
const parent = err.parent || err.original;
|
|
30
|
+
const msg = (0, lodash_1.snakeCase)(err.message).toUpperCase();
|
|
31
|
+
throw new MysqlException(msg, parent);
|
|
32
|
+
}
|
|
33
|
+
throw new MysqlException(err.message, err);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
36
|
//# sourceMappingURL=mysql.exception.js.map
|
package/dist/mysql.module.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare class MysqlModule {
|
|
2
|
-
}
|
|
1
|
+
export declare class MysqlModule {
|
|
2
|
+
}
|
|
3
3
|
//# sourceMappingURL=mysql.module.d.ts.map
|
package/dist/mysql.module.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.MysqlModule = void 0;
|
|
10
|
-
const core_1 = require("@joktec/core");
|
|
11
|
-
const mysql_service_1 = require("./mysql.service");
|
|
12
|
-
let MysqlModule = class MysqlModule {
|
|
13
|
-
};
|
|
14
|
-
MysqlModule = __decorate([
|
|
15
|
-
(0, core_1.Global)(),
|
|
16
|
-
(0, core_1.Module)({
|
|
17
|
-
imports: [],
|
|
18
|
-
providers: [mysql_service_1.MysqlService],
|
|
19
|
-
exports: [mysql_service_1.MysqlService],
|
|
20
|
-
})
|
|
21
|
-
], MysqlModule);
|
|
22
|
-
exports.MysqlModule = MysqlModule;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.MysqlModule = void 0;
|
|
10
|
+
const core_1 = require("@joktec/core");
|
|
11
|
+
const mysql_service_1 = require("./mysql.service");
|
|
12
|
+
let MysqlModule = class MysqlModule {
|
|
13
|
+
};
|
|
14
|
+
MysqlModule = __decorate([
|
|
15
|
+
(0, core_1.Global)(),
|
|
16
|
+
(0, core_1.Module)({
|
|
17
|
+
imports: [],
|
|
18
|
+
providers: [mysql_service_1.MysqlService],
|
|
19
|
+
exports: [mysql_service_1.MysqlService],
|
|
20
|
+
})
|
|
21
|
+
], MysqlModule);
|
|
22
|
+
exports.MysqlModule = MysqlModule;
|
|
23
23
|
//# sourceMappingURL=mysql.module.js.map
|
package/dist/mysql.repo.d.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { ICondition, OnModuleInit } from '@joktec/core';
|
|
2
|
-
import { IMysqlRepository } from './mysql.client';
|
|
3
|
-
import { MysqlService } from './mysql.service';
|
|
4
|
-
import { Model, ModelCtor } from 'sequelize-typescript';
|
|
5
|
-
import { IMysqlRequest, MysqlId } from './models';
|
|
6
|
-
export declare abstract class MysqlRepo<T extends Model<T>, ID = MysqlId> implements IMysqlRepository<T, ID>, OnModuleInit {
|
|
7
|
-
protected mysqlService: MysqlService;
|
|
8
|
-
protected model: ModelCtor<T>;
|
|
9
|
-
protected conId: string;
|
|
10
|
-
protected constructor(mysqlService: MysqlService, model: ModelCtor<T>, conId?: string);
|
|
11
|
-
onModuleInit(): Promise<void>;
|
|
12
|
-
find(query: IMysqlRequest<T>): Promise<T[]>;
|
|
13
|
-
count(query: IMysqlRequest<T>): Promise<number>;
|
|
14
|
-
findOne(query: IMysqlRequest<T>): Promise<T>;
|
|
15
|
-
create(body: T): Promise<T>;
|
|
16
|
-
update(condition: ICondition<T>, body: Partial<T>): Promise<T>;
|
|
17
|
-
delete(condition: ICondition<T>, opts?: {
|
|
18
|
-
force?: boolean;
|
|
19
|
-
userId?: ID;
|
|
20
|
-
}): Promise<T>;
|
|
21
|
-
upsert(condition: ICondition<T>, body: Partial<T>): Promise<T>;
|
|
22
|
-
}
|
|
1
|
+
import { ICondition, OnModuleInit } from '@joktec/core';
|
|
2
|
+
import { IMysqlRepository } from './mysql.client';
|
|
3
|
+
import { MysqlService } from './mysql.service';
|
|
4
|
+
import { Model, ModelCtor } from 'sequelize-typescript';
|
|
5
|
+
import { IMysqlRequest, MysqlId } from './models';
|
|
6
|
+
export declare abstract class MysqlRepo<T extends Model<T>, ID = MysqlId> implements IMysqlRepository<T, ID>, OnModuleInit {
|
|
7
|
+
protected mysqlService: MysqlService;
|
|
8
|
+
protected model: ModelCtor<T>;
|
|
9
|
+
protected conId: string;
|
|
10
|
+
protected constructor(mysqlService: MysqlService, model: ModelCtor<T>, conId?: string);
|
|
11
|
+
onModuleInit(): Promise<void>;
|
|
12
|
+
find(query: IMysqlRequest<T>): Promise<T[]>;
|
|
13
|
+
count(query: IMysqlRequest<T>): Promise<number>;
|
|
14
|
+
findOne(query: IMysqlRequest<T>): Promise<T>;
|
|
15
|
+
create(body: T): Promise<T>;
|
|
16
|
+
update(condition: ICondition<T>, body: Partial<T>): Promise<T>;
|
|
17
|
+
delete(condition: ICondition<T>, opts?: {
|
|
18
|
+
force?: boolean;
|
|
19
|
+
userId?: ID;
|
|
20
|
+
}): Promise<T>;
|
|
21
|
+
upsert(condition: ICondition<T>, body: Partial<T>): Promise<T>;
|
|
22
|
+
}
|
|
23
23
|
//# sourceMappingURL=mysql.repo.d.ts.map
|