aboutsummaryrefslogtreecommitdiff
path: root/src/macros.lisp
diff options
context:
space:
mode:
authorcolin <colin@cicadas.surf>2023-11-22 07:18:59 -0800
committercolin <colin@cicadas.surf>2023-11-22 07:18:59 -0800
commitf0aed2231f077a05f3bcb95cf332dd75866dc9aa (patch)
treed058917cbf522549e210ba49b5a4e20a405e26f5 /src/macros.lisp
parent10bb613d023468f1b00f02e8f3c9a61de22610ed (diff)
updated parenscript client gen; added body variables to endpoints
Diffstat (limited to 'src/macros.lisp')
-rw-r--r--src/macros.lisp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/macros.lisp b/src/macros.lisp
index 0d941b6..fe2c6cc 100644
--- a/src/macros.lisp
+++ b/src/macros.lisp
@@ -47,3 +47,15 @@ first mapped with the PARSER function."
collect `(,name (when ,name (funcall ',(second (assoc name params)) ,name))))
,@body))))
+(defmacro let-body ((&rest var-names) &body body)
+ (let ((key (gensym "key"))
+ (val (gensym "val"))
+ (var (gensym "var")))
+ `(derrida:with-plist
+ ,var-names
+ (loop :for (,key ,val) :on (request-body) :by #'cddr
+ :for ,var := (find ,key ',var-names :test #'string-equal)
+ :when ,var :collect ,var :and :collect ,val)
+ ,@body)))
+
+