From fb01362a9dd816fc0d0e50052ab4764dd30e46f3 Mon Sep 17 00:00:00 2001 From: LLLL Colonq Date: Thu, 1 May 2025 17:06:41 -0400 Subject: You know we love updating with a horrendous commit message --- src/wasp-db.el | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/wasp-db.el') diff --git a/src/wasp-db.el b/src/wasp-db.el index 506002a1..8900cdc1 100644 --- a/src/wasp-db.el +++ b/src/wasp-db.el @@ -40,7 +40,7 @@ (defun w/db-parse-value () "Parse a single RESP value from the current buffer." ;; (w/write-log (format "parsing: %S" (buffer-string))) - (when-let ((c (char-after))) + (when-let* ((c (char-after))) (delete-char 1) (cl-case c (?+ (w/db-parse-rest)) @@ -56,7 +56,7 @@ (?* (let ((len (string-to-number (w/db-parse-rest)))) (--map (w/db-parse-value) (-iota len)))) - (otherwise (error (format "Unknown Redis sigil: %s" c)))))) + (otherwise (error (format "Unknown Redis sigil: %s (contents: %S)" c (buffer-string))))))) (defun w/db-parse-response () "Try to parse a single RESP value from the current process buffer. @@ -144,9 +144,15 @@ If not, return nil." "Get KEYS from Redis and pass the corresponding values to K." (w/db-cmd `("MGET" ,@keys) k)) +(defun w/db-hset-then (key hkey val k &rest vals) + "Set HKEY in hash KEY to VAL in Redis. +Afterward call K." + (w/db-cmd `("HSET" ,key ,hkey ,val ,@vals) k)) + (defun w/db-hset (key hkey val &rest vals) "Set HKEY in hash KEY to VAL in Redis." (w/db-cmd `("HSET" ,key ,hkey ,val ,@vals) (lambda (_) nil))) + ;; (w/db-hset-then key hkey val (lambda (_) nil) vals)) (defun w/db-hget (key hkey k) "Get HKEY in hash KEY from Redis and pass the corresponding value to K." -- cgit v1.2.3