@axiosleo/orm-mysql 0.5.3 → 0.5.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/README.md +2 -2
- package/index.d.ts +6 -4
- package/package.json +3 -2
- package/src/builder.js +4 -2
package/README.md
CHANGED
|
@@ -156,7 +156,7 @@ Hook.post(async (options, result) => {
|
|
|
156
156
|
```javascript
|
|
157
157
|
const { TransactionHandler, createPromiseClient } = require("@axiosleo/orm-mysql");
|
|
158
158
|
|
|
159
|
-
const conn = createPromiseClient({
|
|
159
|
+
const conn = await createPromiseClient({
|
|
160
160
|
host: process.env.MYSQL_HOST,
|
|
161
161
|
port: process.env.MYSQL_PORT,
|
|
162
162
|
user: process.env.MYSQL_USER,
|
|
@@ -200,4 +200,4 @@ try {
|
|
|
200
200
|
This project is open-sourced software licensed under the [MIT](LICENSE).
|
|
201
201
|
|
|
202
202
|
|
|
203
|
-
[](https://app.fossa.com/projects/git%2Bgithub.com%2FAxiosLeo%2Fnode-orm-mysql?ref=badge_large)
|
|
203
|
+
[](https://app.fossa.com/projects/git%2Bgithub.com%2FAxiosLeo%2Fnode-orm-mysql?ref=badge_large)
|
package/index.d.ts
CHANGED
|
@@ -144,12 +144,14 @@ export declare class TransactionOperator extends QueryOperator {
|
|
|
144
144
|
append(suffix: string): this;
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
+
export type TransactionLevel = 'READ UNCOMMITTED' | 'RU'
|
|
148
|
+
| 'READ COMMITTED' | 'RC'
|
|
149
|
+
| 'REPEATABLE READ' | 'RR'
|
|
150
|
+
| 'SERIALIZABLE' | 'S';
|
|
151
|
+
|
|
147
152
|
export declare class TransactionHandler {
|
|
148
153
|
constructor(conn: PromiseConnection, options?: {
|
|
149
|
-
level:
|
|
150
|
-
| 'READ COMMITTED' | 'RC'
|
|
151
|
-
| 'REPEATABLE READ' | 'RR'
|
|
152
|
-
| 'SERIALIZABLE' | 'S'
|
|
154
|
+
level: TransactionLevel
|
|
153
155
|
});
|
|
154
156
|
|
|
155
157
|
query(options: QueryOptions): Promise<any>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axiosleo/orm-mysql",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.5",
|
|
4
4
|
"description": "MySQL ORM tool",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mysql",
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"mm": "^3.2.0",
|
|
38
38
|
"mocha": "^9.1.3",
|
|
39
39
|
"mocha-sinon": "^2.1.2",
|
|
40
|
+
"nyc": "^15.1.0",
|
|
40
41
|
"pre-commit": "^1.2.2",
|
|
41
42
|
"sinon": "^9.0.2",
|
|
42
43
|
"typescript": "^4.3.2"
|
|
@@ -47,4 +48,4 @@
|
|
|
47
48
|
"lint"
|
|
48
49
|
]
|
|
49
50
|
}
|
|
50
|
-
}
|
|
51
|
+
}
|
package/src/builder.js
CHANGED
|
@@ -193,8 +193,10 @@ class Builder {
|
|
|
193
193
|
}
|
|
194
194
|
|
|
195
195
|
_buildContidionIn(condition, isNot = false) {
|
|
196
|
-
if (
|
|
197
|
-
throw new Error('Value must be
|
|
196
|
+
if (Array.isArray(condition.value) && !condition.value.length) {
|
|
197
|
+
throw new Error('Value must not be empty for "IN" condition');
|
|
198
|
+
} else if (!Array.isArray(condition.value) && !(condition.value instanceof Query)) {
|
|
199
|
+
throw new Error('Value must be an array or sub-query for "IN" condition');
|
|
198
200
|
}
|
|
199
201
|
if (condition.key.indexOf('$') !== -1) {
|
|
200
202
|
let res = this._buildConditionValues(condition.value);
|