sedentary-pg 0.0.51 → 0.0.52
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/dist/cjs/pgdb.js +5 -1
- package/dist/es/pgdb.js +5 -1
- package/package.json +2 -2
package/dist/cjs/pgdb.js
CHANGED
|
@@ -116,7 +116,11 @@ class PGDB extends sedentary_1.DB {
|
|
|
116
116
|
const oidPK = {};
|
|
117
117
|
try {
|
|
118
118
|
const forUpdate = lock ? " FOR UPDATE" : "";
|
|
119
|
-
const orderBy = order && order.length
|
|
119
|
+
const orderBy = order && order.length
|
|
120
|
+
? ` ORDER BY ${(typeof order === "string" ? [order] : order)
|
|
121
|
+
.map(_ => (_.startsWith("-") ? `${table.findAttribute(_.substring(1)).fieldName} DESC` : table.findAttribute(_).fieldName))
|
|
122
|
+
.join(",")}`
|
|
123
|
+
: "";
|
|
120
124
|
const limitTo = typeof limit === "number" ? ` LIMIT ${limit}` : "";
|
|
121
125
|
const query = `SELECT *, tableoid FROM ${tableName}${where ? ` WHERE ${where}` : ""}${orderBy}${limitTo}${forUpdate}`;
|
|
122
126
|
this.log(query);
|
package/dist/es/pgdb.js
CHANGED
|
@@ -111,7 +111,11 @@ export class PGDB extends DB {
|
|
|
111
111
|
const oidPK = {};
|
|
112
112
|
try {
|
|
113
113
|
const forUpdate = lock ? " FOR UPDATE" : "";
|
|
114
|
-
const orderBy = order && order.length
|
|
114
|
+
const orderBy = order && order.length
|
|
115
|
+
? ` ORDER BY ${(typeof order === "string" ? [order] : order)
|
|
116
|
+
.map(_ => (_.startsWith("-") ? `${table.findAttribute(_.substring(1)).fieldName} DESC` : table.findAttribute(_).fieldName))
|
|
117
|
+
.join(",")}`
|
|
118
|
+
: "";
|
|
115
119
|
const limitTo = typeof limit === "number" ? ` LIMIT ${limit}` : "";
|
|
116
120
|
const query = `SELECT *, tableoid FROM ${tableName}${where ? ` WHERE ${where}` : ""}${orderBy}${limitTo}${forUpdate}`;
|
|
117
121
|
this.log(query);
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"@types/pg": "8.6.5",
|
|
10
10
|
"pg": "8.8.0",
|
|
11
11
|
"pg-format": "1.0.4",
|
|
12
|
-
"sedentary": "0.0.
|
|
12
|
+
"sedentary": "0.0.52"
|
|
13
13
|
},
|
|
14
14
|
"description": "The ORM which never needs to migrate - PostgreSQL",
|
|
15
15
|
"engines": {
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"test": "jest --no-cache --runInBand"
|
|
48
48
|
},
|
|
49
49
|
"types": "./dist/types/index.d.ts",
|
|
50
|
-
"version": "0.0.
|
|
50
|
+
"version": "0.0.52"
|
|
51
51
|
}
|