-
-
Save refset/65602bdbc4e75cb0d2047ff9ce0134a4 to your computer and use it in GitHub Desktop.
which-op-failed.clj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def n (xt/start-node {})) | |
(xt/submit-tx n [[::xt/put {:xt/id :a :foo :bar}]]) | |
(defn with-tx-failed? [db ops] | |
(nil? (xt/with-tx db ops))) | |
(xt/q (xt/db n (xt/latest-completed-tx n)) | |
'{:find [ops] | |
:in [[ops ...]] | |
:where [[(dev/with-tx-failed? $ ops)]]} | |
[[[::xt/put {:xt/id :a :foo :bar}]] | |
[[::xt/match :b {:xt/id :b}] [::xt/put {:xt/id :b :foo :bar}]] | |
[[::xt/match :c nil] [::xt/put {:xt/id :c :foo :bar}]]]) | |
;;=> #{[[[:xtdb.api/match :b #:xt{:id :b}] [:xtdb.api/put {:foo :bar, :xt/id :b}]]]} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment