[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/emacsql fc941d7c75 118/427: Capture a common identifier ve
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/emacsql fc941d7c75 118/427: Capture a common identifier vector pattern. |
Date: |
Tue, 13 Dec 2022 02:59:33 -0500 (EST) |
branch: elpa/emacsql
commit fc941d7c7502b9d064a931e9c53ec0073901c771
Author: Christopher Wellons <wellons@nullprogram.com>
Commit: Christopher Wellons <wellons@nullprogram.com>
Capture a common identifier vector pattern.
---
emacsql.el | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/emacsql.el b/emacsql.el
index b674bfbc9e..0211a07a10 100644
--- a/emacsql.el
+++ b/emacsql.el
@@ -476,6 +476,14 @@ definitions for return from a `emacsql-defexpander'."
(recur 0)
(combine (emacsql-expand subsql :sub)))))))))))))
+(defun emacsql--idents (idents)
+ "Read in a vector of IDENTS identifiers, or just an single identifier."
+ (emacsql-with-vars ""
+ (cl-etypecase idents
+ (symbol (var idents :identifier))
+ (vector (mapconcat (lambda (e) (combine (emacsql--expr e)))
+ idents ", ")))))
+
(defun emacsql-init-font-lock ()
"Add font-lock highlighting for `emacsql-defexpander'."
(font-lock-add-keywords
@@ -488,11 +496,9 @@ definitions for return from a `emacsql-defexpander'."
(emacsql-defexpander :select (arg)
"Expands to the SELECT keyword."
(emacsql-with-vars "SELECT "
- (cond
- ((eq '* arg) "*")
- ((vectorp arg)
- (mapconcat (lambda (s) (combine (emacsql--expr s))) arg ", "))
- ((var arg :identifier)))))
+ (if (eq '* arg)
+ "*"
+ (combine (emacsql--idents arg)))))
(emacsql-defexpander :from (table)
"Expands to the FROM keyword."
@@ -512,8 +518,7 @@ definitions for return from a `emacsql-defexpander'."
(symbol (var table :identifier))
(list (cl-destructuring-bind (name columns) table
(format "%s (%s)" (var name :identifier)
- (mapconcat (lambda (c) (var c :identifier))
- columns ", ")))))))
+ (combine (emacsql--idents columns))))))))
(emacsql-defexpander :where (expr)
(emacsql-with-vars "WHERE "
@@ -554,7 +559,7 @@ definitions for return from a `emacsql-defexpander'."
(emacsql-defexpander :set (set)
(emacsql-with-vars "SET "
(cl-etypecase set
- (vector (mapconcat (lambda (s) (combine (emacsql--expr s))) set ", "))
+ (vector (combine (emacsql--idents set)))
(list (combine (emacsql--expr set))))))
(emacsql-defexpander :union ()
- [nongnu] elpa/emacsql 5df2891557 349/427: Use cl-generic package, (continued)
- [nongnu] elpa/emacsql 5df2891557 349/427: Use cl-generic package, ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql e8c090e11f 353/427: Improve Makefile portability and dump Cask, ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 0ba12b89d5 084/427: Drop "work in progress.", ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 364bf466ea 086/427: Linkify the issue in the README., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql dd3f153406 089/427: Drop old with-errors macro., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 72c1954517 096/427: Block on connection until the output has flushed., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 1e9857ccc4 103/427: Allow variables inside vectors., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 8a66563af6 105/427: Combine :insert and :into., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql d04ef64ce0 109/427: Add IF NOT EXISTS and TEMPORARY to CREATE TABLE., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 58641b9827 115/427: Fill out keywords in README., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql fc941d7c75 118/427: Capture a common identifier vector pattern.,
ELPA Syncer <=
- [nongnu] elpa/emacsql a09911a205 125/427: Add LIMIT and OFFSET expanders., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 8945af0dd8 129/427: Add :check and allow schemas to have variables., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 4206b17f39 134/427: Add support for AS with CREATE TABLE., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 6c32f02139 137/427: Add emacsql-thread macro., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 54c180017e 138/427: Add :pragma and note in README., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 5e2ab842f7 139/427: Add foreign key test., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 42c2fd7569 145/427: Tweak limitation wording., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql fe0c7004fc 146/427: Add :begin, :commit, and :rollback., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 2550196816 162/427: Drop SQLite version requirements., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 9a1b4209ba 164/427: Add PostgreSQL front-end., ELPA Syncer, 2022/12/13