I want to have a dbtest macro that can be used as follows:
(dbtest (prn test-object1) (prn test-object2))
test-object1 and test-object2 should be the variables that dbtest defines (because I need them every time I use dbtest macro). "prn" is just an example; I want to use arbitrary code inside a macro.
I tried this:
(defmacro dbtest [& body] `(sql/with-connection db (delete-all-tables) (let [~'test-object1 (insert-object "foo")] ~@body )))
where insert-object is a function that inserts something into the database and returns the corresponding data structure.
But this does not work: I get the error "no such var"
source share