Fork me on GitHub
#xtdb
<
2020-07-18
>
Eric Ihli14:07:54

Along those lines, and this may be more of a beginner Clojure question than a Crux question, how would I evaluate and run one of the functions stored as a transaction? A crux query for the function returns a chunked seq. How would I go about evaluating that as a fn so I can run it? My idea was if I can't get info about the failed transaction, I can do a (if-not (crux/tx-committed? conn tx)) (log/error (manually-run-validations ,,,)). The list I'm getting from querying for the function is below. I'm trying to figure out how to turn it into a callable.

(clojure.core/fn
 [com.owoga.template.dev/ctx com.owoga.template.dev/user]
 (clojure.spec.alpha/valid?
  :com.owoga.template.dev/user+db
  (clojure.core/merge
   com.owoga.template.dev/user
   {:db com.owoga.template.dev/ctx})))
edit: Ah yes. Same reason the second form below fails.
(eval `(+ 2 2))
  (eval `(defn foo [] (+ 2 2)))
Because qualifies with namespaces. And an fn` form can't take com.owoga.template.dev/ctx as a valid argument form. It needs just ctx I see.

👍 3