Map names to db ident names for columns passed for ordering in paginated queries.
This commit is contained in:
parent
fbd20de71f
commit
fb74d84cb7
@ -1,6 +1,6 @@
|
||||
# Package
|
||||
|
||||
version = "2.1.1"
|
||||
version = "2.2.0"
|
||||
author = "Jonathan Bernard"
|
||||
description = "Lightweight Postgres ORM for Nim."
|
||||
license = "GPL-3.0"
|
||||
|
@ -438,7 +438,7 @@ template findRecordsWhere*[D: DbConnType](
|
||||
if page.isSome:
|
||||
let p = page.get
|
||||
if p.orderBy.isSome:
|
||||
fetchStmt &= " ORDER BY " & p.orderBy.get
|
||||
fetchStmt &= " ORDER BY " & identNameToDb(p.orderBy.get)
|
||||
else:
|
||||
fetchStmt &= " ORDER BY id"
|
||||
|
||||
@ -469,7 +469,7 @@ template getAllRecords*[D: DbConnType](
|
||||
if page.isSome:
|
||||
let p = page.get
|
||||
if p.orderBy.isSome:
|
||||
fetchStmt &= " ORDER BY " & p.orderBy.get
|
||||
fetchStmt &= " ORDER BY " & identNameToDb(p.orderBy.get)
|
||||
else:
|
||||
fetchStmt &= " ORDER BY id"
|
||||
|
||||
@ -508,7 +508,7 @@ template findRecordsBy*[D: DbConnType](
|
||||
if page.isSome:
|
||||
let p = page.get
|
||||
if p.orderBy.isSome:
|
||||
fetchStmt &= " ORDER BY " & p.orderBy.get
|
||||
fetchStmt &= " ORDER BY " & identNameToDb(p.orderBy.get)
|
||||
else:
|
||||
fetchStmt &= " ORDER BY id"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user