[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/emacsql 03295cba37 119/427: Add ORDER BY expanders.
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/emacsql 03295cba37 119/427: Add ORDER BY expanders. |
Date: |
Tue, 13 Dec 2022 02:59:34 -0500 (EST) |
branch: elpa/emacsql
commit 03295cba37ff1053e81763191832a5cc91bd2289
Author: Christopher Wellons <wellons@nullprogram.com>
Commit: Christopher Wellons <wellons@nullprogram.com>
Add ORDER BY expanders.
---
README.md | 9 +++++++++
emacsql.el | 8 ++++++++
2 files changed, 17 insertions(+)
diff --git a/README.md b/README.md
index 55654a5b91..6e71467091 100644
--- a/README.md
+++ b/README.md
@@ -160,6 +160,15 @@ Provides `GROUP BY`.
[... :group-by name]
```
+#### :ascending-by <expr>, :descending-by <expr>
+
+Provides `ORDER BY`.
+
+```el
+[... :ascending-by date]
+[... :descending-by [width height]]
+```
+
#### :insert, :replace
Provides `INSERT`, `REPLACE`.
diff --git a/emacsql.el b/emacsql.el
index 0211a07a10..70cf4e673c 100644
--- a/emacsql.el
+++ b/emacsql.el
@@ -528,6 +528,14 @@ definitions for return from a `emacsql-defexpander'."
(emacsql-with-vars "GROUP BY "
(combine (emacsql--expr expr))))
+(emacsql-defexpander :ascending-by (columns)
+ (emacsql-with-vars "ORDER BY "
+ (concat (combine (emacsql--idents columns)) " ASC")))
+
+(emacsql-defexpander :descending-by (columns)
+ (emacsql-with-vars "ORDER BY "
+ (concat (combine (emacsql--idents columns)) " DESC")))
+
(emacsql-defexpander :create-table (table schema)
(emacsql-with-vars "CREATE "
(let (temporary if-not-exists name)
- [nongnu] elpa/emacsql b9599f1f41 066/427: Spelling error., (continued)
- [nongnu] elpa/emacsql b9599f1f41 066/427: Spelling error., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql f410b5d663 068/427: Fix spelling error., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql b3110c9fa9 018/427: Rename .sqlite to .db., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 031ec59f18 048/427: Add combine function to with-vars macro., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql f9820deed7 056/427: Add unary operators., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql f9c562b0a4 069/427: Add SQLite link., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 43ecb5a252 071/427: Tweak README names., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 58e31aa3a9 079/427: Add :update and :set expanders., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql c9aab20d47 082/427: Add in operator (special case operator)., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 25f9817064 094/427: Add work-in-progress note back., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 03295cba37 119/427: Add ORDER BY expanders.,
ELPA Syncer <=
- [nongnu] elpa/emacsql d1c0904564 120/427: Fix missing quotes., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 4718ff4e89 122/427: Simplify all the expanders with new local functions., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 54247e4b5e 127/427: Add another insertion unit test., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql aa9283ca0a 132/427: Allow sub-selects with :from., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql c236aa8437 144/427: Remove extra space., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 75ea77c9a0 149/427: Add an "as" operator, greatly simplifying :from., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 213bb71b7a 152/427: Add :having expander., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 8123020ca7 153/427: Make and and or operators variadic., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 76bf0c34dc 038/427: Add rudimentary :where expander., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql afe64ca63a 040/427: Fix emacsql-add-expander example., ELPA Syncer, 2022/12/13