diff options
author | Thanos Apollo <[email protected]> | 2024-01-26 09:51:48 +0200 |
---|---|---|
committer | Thanos Apollo <[email protected]> | 2024-01-26 09:51:48 +0200 |
commit | 8313747f679b255721f3207114bc16bfb489a6f4 (patch) | |
tree | 7538b3480f9b5c4a84b2e80e69b321bd99aa2bc6 /gnosis.el | |
parent | c7a9d7343add099c1ea807fc6065855e8354a6e9 (diff) |
gnosis-select: Add flatten optional argument
Diffstat (limited to 'gnosis.el')
-rw-r--r-- | gnosis.el | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -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." |