mythix-orm-postgresql 1.9.0 → 1.9.2
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.
|
@@ -61,6 +61,8 @@ class PostgreSQLConnection extends SQLConnectionBase {
|
|
|
61
61
|
|
|
62
62
|
throw new Errors.MythixORMConnectionTimedOutError(error);
|
|
63
63
|
}
|
|
64
|
+
|
|
65
|
+
throw error;
|
|
64
66
|
}
|
|
65
67
|
}
|
|
66
68
|
|
|
@@ -106,7 +108,8 @@ class PostgreSQLConnection extends SQLConnectionBase {
|
|
|
106
108
|
|
|
107
109
|
// Ensure that we can connect to the DB
|
|
108
110
|
let client = await this.getPoolConnection();
|
|
109
|
-
|
|
111
|
+
if (client)
|
|
112
|
+
await client.release();
|
|
110
113
|
}
|
|
111
114
|
|
|
112
115
|
async stop() {
|
|
@@ -106,6 +106,34 @@ class PostgreSQLQueryGenerator extends SQLQueryGeneratorBase {
|
|
|
106
106
|
|
|
107
107
|
return sqlOperator;
|
|
108
108
|
}
|
|
109
|
+
|
|
110
|
+
generateOrderClause(queryEngine, _options) {
|
|
111
|
+
if (!queryEngine || typeof queryEngine.getOperationContext !== 'function')
|
|
112
|
+
return '';
|
|
113
|
+
|
|
114
|
+
let context = queryEngine.getOperationContext();
|
|
115
|
+
let result = super.generateOrderClause(queryEngine, this.stackAssign(_options || {}, { rawOrder: true }));
|
|
116
|
+
|
|
117
|
+
if (Nife.isNotEmpty(result) && context.distinct) {
|
|
118
|
+
let distinctValue = context.distinct.getField(this.connection);
|
|
119
|
+
if (distinctValue) {
|
|
120
|
+
let valueStr;
|
|
121
|
+
|
|
122
|
+
if (LiteralBase.isLiteral(distinctValue))
|
|
123
|
+
valueStr = distinctValue.toString(this.connection, { isOrder: true });
|
|
124
|
+
else if (typeof distinctValue.isField === 'function' && distinctValue.isField(distinctValue) && !distinctValue.ephemeral)
|
|
125
|
+
valueStr = this.getEscapedColumnName(distinctValue.Model, distinctValue);
|
|
126
|
+
|
|
127
|
+
if (valueStr)
|
|
128
|
+
result = [ `${valueStr} ASC` ].concat(result);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
if (Nife.isEmpty(result))
|
|
133
|
+
return '';
|
|
134
|
+
|
|
135
|
+
return `ORDER BY ${result.join(',')}`;
|
|
136
|
+
}
|
|
109
137
|
}
|
|
110
138
|
|
|
111
139
|
module.exports = PostgreSQLQueryGenerator;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mythix-orm-postgresql",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.2",
|
|
4
4
|
"description": "PostgreSQL driver for Mythix ORM",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
},
|
|
34
34
|
"homepage": "https://github.com/th317erd/mythix-orm-postgresql#readme",
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"mythix-orm": "^1.11.
|
|
37
|
-
"mythix-orm-sql-base": "^1.9.
|
|
36
|
+
"mythix-orm": "^1.11.3",
|
|
37
|
+
"mythix-orm-sql-base": "^1.9.2"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"luxon": "^3.1.0",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@spothero/eslint-plugin-spothero": "github:spothero/eslint-plugin-spothero",
|
|
48
|
-
"eslint": "^8.
|
|
48
|
+
"eslint": "^8.28.0",
|
|
49
49
|
"jasmine": "^4.5.0",
|
|
50
50
|
"nyc": "^15.1.0"
|
|
51
51
|
},
|