summaryrefslogtreecommitdiff
path: root/gnosis.el
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-01-26 09:51:48 +0200
committerThanos Apollo <[email protected]>2024-01-26 09:51:48 +0200
commit8313747f679b255721f3207114bc16bfb489a6f4 (patch)
tree7538b3480f9b5c4a84b2e80e69b321bd99aa2bc6 /gnosis.el
parentc7a9d7343add099c1ea807fc6065855e8354a6e9 (diff)
gnosis-select: Add flatten optional argument
Diffstat (limited to 'gnosis.el')
-rw-r--r--gnosis.el8
1 files changed, 5 insertions, 3 deletions
diff --git a/gnosis.el b/gnosis.el
index 951e61b..0098665 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -45,7 +45,6 @@
;;; Code:
-(require 'emacsql)
(require 'emacsql-sqlite)
(require 'cl-lib)
@@ -146,9 +145,12 @@
"Face for next review."
:group 'gnosis-face)
-(cl-defun gnosis-select (value table &optional (restrictions '1=1))
+(cl-defun gnosis-select (value table &optional (restrictions '1=1) (flatten nil))
"Select VALUE from TABLE, optionally with RESTRICTIONS."
- (emacsql gnosis-db `[:select ,value :from ,table :where ,restrictions]))
+ (let ((output (emacsql gnosis-db `[:select ,value :from ,table :where ,restrictions])))
+ (if flatten
+ (apply #'append output)
+ output)))
(cl-defun gnosis--create-table (table &optional values)
"Create TABLE for VALUES."