branch: elpa/emacsql commit 84499878d0bc570d6fc3d2d9329041a41e2359ab Author: Christopher Wellons <well...@nullprogram.com> Commit: Christopher Wellons <well...@nullprogram.com>
Add :union, :union-all, :difference, and :except. --- README.md | 8 ++++++++ emacsql.el | 12 ++++++++++++ 2 files changed, 20 insertions(+) diff --git a/README.md b/README.md index 452faa7b90..7e232caa20 100644 --- a/README.md +++ b/README.md @@ -193,6 +193,14 @@ Provides `SET`. [:update people :set [(= name "Ricky") (= salary 300000)] :where ...] ``` +#### :union, :union-all, :difference, :except + +Provides `UNION`, `UNION ALL`, `DIFFERENCE`, and `EXCEPT`. + +```el +[:select * :from sales :union :select * :from accounting] +``` + ### Templates To make statement compilation faster, and to avoid making you build up diff --git a/emacsql.el b/emacsql.el index a3ea075d2d..4ba13c93c3 100644 --- a/emacsql.el +++ b/emacsql.el @@ -485,6 +485,18 @@ definitions for return from a `emacsql-defexpander'." (vector (mapconcat (lambda (s) (combine (emacsql--expr s))) set ", ")) (list (combine (emacsql--expr set)))))) +(emacsql-defexpander :union () + (list "UNION")) + +(emacsql-defexpander :union-all () + (list "UNION ALL")) + +(emacsql-defexpander :intersect () + (list "INTERSECT")) + +(emacsql-defexpander :except () + (list "EXCEPT")) + (provide 'emacsql) ;;; emacsql.el ends here