@mikro-orm/knex 6.0.0-dev.204 → 6.0.0-dev.206
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/AbstractSqlConnection.d.ts +14 -0
- package/AbstractSqlConnection.js +18 -0
- package/package.json +2 -2
|
@@ -10,8 +10,22 @@ export declare abstract class AbstractSqlConnection extends Connection {
|
|
|
10
10
|
/** @inheritDoc */
|
|
11
11
|
connect(): void | Promise<void>;
|
|
12
12
|
getKnex(): Knex;
|
|
13
|
+
/**
|
|
14
|
+
* @inheritDoc
|
|
15
|
+
*/
|
|
13
16
|
close(force?: boolean): Promise<void>;
|
|
17
|
+
/**
|
|
18
|
+
* @inheritDoc
|
|
19
|
+
*/
|
|
14
20
|
isConnected(): Promise<boolean>;
|
|
21
|
+
/**
|
|
22
|
+
* @inheritDoc
|
|
23
|
+
*/
|
|
24
|
+
checkConnection(): Promise<{
|
|
25
|
+
ok: boolean;
|
|
26
|
+
reason?: string;
|
|
27
|
+
error?: Error;
|
|
28
|
+
}>;
|
|
15
29
|
transactional<T>(cb: (trx: Transaction<Knex.Transaction>) => Promise<T>, options?: {
|
|
16
30
|
isolationLevel?: IsolationLevel;
|
|
17
31
|
readOnly?: boolean;
|
package/AbstractSqlConnection.js
CHANGED
|
@@ -26,10 +26,16 @@ class AbstractSqlConnection extends core_1.Connection {
|
|
|
26
26
|
}
|
|
27
27
|
return this.client;
|
|
28
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* @inheritDoc
|
|
31
|
+
*/
|
|
29
32
|
async close(force) {
|
|
30
33
|
await super.close(force);
|
|
31
34
|
await this.getKnex().destroy();
|
|
32
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* @inheritDoc
|
|
38
|
+
*/
|
|
33
39
|
async isConnected() {
|
|
34
40
|
try {
|
|
35
41
|
await this.getKnex().raw('select 1');
|
|
@@ -39,6 +45,18 @@ class AbstractSqlConnection extends core_1.Connection {
|
|
|
39
45
|
return false;
|
|
40
46
|
}
|
|
41
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* @inheritDoc
|
|
50
|
+
*/
|
|
51
|
+
async checkConnection() {
|
|
52
|
+
try {
|
|
53
|
+
await this.getKnex().raw('select 1');
|
|
54
|
+
return { ok: true };
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
return { ok: false, reason: error.message, error };
|
|
58
|
+
}
|
|
59
|
+
}
|
|
42
60
|
async transactional(cb, options = {}) {
|
|
43
61
|
const trx = await this.begin(options);
|
|
44
62
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/knex",
|
|
3
|
-
"version": "6.0.0-dev.
|
|
3
|
+
"version": "6.0.0-dev.206",
|
|
4
4
|
"description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.mjs",
|
|
@@ -66,6 +66,6 @@
|
|
|
66
66
|
"@mikro-orm/core": "^5.9.2"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
|
-
"@mikro-orm/core": "6.0.0-dev.
|
|
69
|
+
"@mikro-orm/core": "6.0.0-dev.206"
|
|
70
70
|
}
|
|
71
71
|
}
|