Comparing version
@@ -5,2 +5,9 @@ # Changelog | ||
## [0.3.1](https://gitlab.com/monstrous/monstrous/compare/v0.3.0...v0.3.1) (2023-07-26) | ||
### Bug Fixes | ||
* compile order() exprs ([0d1be96](https://gitlab.com/monstrous/monstrous/commit/0d1be9605bb50947434544a1a296c664fc2ea423)) | ||
## [0.3.0](https://gitlab.com/monstrous/monstrous/compare/v0.2.0...v0.3.0) (2023-07-16) | ||
@@ -7,0 +14,0 @@ |
@@ -14,4 +14,4 @@ import pgp from 'pg-promise'; | ||
export const $order = { | ||
asc: val => `${val instanceof Expr ? val.sql : val} asc`, | ||
desc: val => `${val instanceof Expr ? val.sql : val} desc` | ||
asc: val => `${val instanceof Expr ? val.compile() : val} asc`, | ||
desc: val => `${val instanceof Expr ? val.compile() : val} desc` | ||
}; | ||
@@ -262,3 +262,9 @@ | ||
text.push(this.#order.join(', ')); | ||
text.push(this.#order.map(o => { | ||
if (o instanceof Expr) { | ||
return o.compile(); | ||
} | ||
return o; | ||
}).join(', ')); | ||
} | ||
@@ -265,0 +271,0 @@ |
{ | ||
"name": "monstrous", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "a lightweight SQL composer for Node.js and PostgreSQL", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -125,3 +125,3 @@ # monstrous | ||
`db.query` runs raw SQL statements. Ordinal arguments may be passed inline, or a map of [named parameters](https://github.com/vitaly-t/pg-promise#named-parameters). A [query target](#query-targets) may be passed as the final argument to specify results handling. | ||
`db.query` runs raw SQL statements. Pass ordinal arguments inline, or use a map of [named parameters](https://github.com/vitaly-t/pg-promise#named-parameters). A [query target](#query-targets) may be passed as the final argument to specify results handling. | ||
@@ -128,0 +128,0 @@ ```javascript |
90862
0.39%1825
0.27%