summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gnosis.el8
1 files changed, 7 insertions, 1 deletions
diff --git a/gnosis.el b/gnosis.el
index 16a8874..c38394e 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -84,6 +84,12 @@ Used to calcuate new interval for failed questions."
"Insert VALUES to TABLE."
(emacsql gnosis-db `[:insert :into ,table :values ,values]))
+(cl-defun gnosis-update (table value where)
+ "Update records in TABLE with to new VALUE based on the given WHERE condition.
+Example:
+ (gnosis-update 'notes '(= main \"NEW VALUE\") '(= id 12))"
+ (emacsql gnosis-db `[:update ,table :set ,value :where ,where]))
+
(defun gnosis-get (value table &optional restrictions)
"Get VALUE from TABLE, optionally with where RESTRICTIONS."
(caar (gnosis--select value table restrictions)))
@@ -230,7 +236,7 @@ TAGS are used to organize questions."
(error (message "No NOTES table to drop.")))
(condition-case nil
(gnosis--drop-table 'decks)
- (error (message "No NOTES table to drop.")))
+ (error (message "No DECKS table to drop.")))
(condition-case nil
(gnosis--drop-table 'review)
(error (message "No REVIEW table to drop.")))