From 8313747f679b255721f3207114bc16bfb489a6f4 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Fri, 26 Jan 2024 09:51:48 +0200 Subject: gnosis-select: Add flatten optional argument --- gnosis.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'gnosis.el') 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." -- cgit v1.2.3