diff options
| author | LLLL Colonq <llll@colonq> | 2025-05-01 17:06:41 -0400 |
|---|---|---|
| committer | LLLL Colonq <llll@colonq> | 2025-05-01 17:06:41 -0400 |
| commit | fb01362a9dd816fc0d0e50052ab4764dd30e46f3 (patch) | |
| tree | d581df21e161a0483d8b02ea4519debb4501a4a7 /src/wasp-db.el | |
| parent | b21ecce6645fc17c520b722de3d96e550c77c490 (diff) | |
You know we love updating with a horrendous commit message
Diffstat (limited to 'src/wasp-db.el')
| -rw-r--r-- | src/wasp-db.el | 10 |
1 files changed, 8 insertions, 2 deletions
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." |
