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
(defn pmapcat [f batches] | |
(->> batches | |
(pmap f) | |
(apply concat) | |
doall)) |
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
(defn doeach [function coll] | |
(doseq [c coll] | |
(function c))) |
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
(defn domap [function coll] | |
(->> coll (map function) doall)) |
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
{:first-name "amit" | |
:last-name "rathore" | |
:db/id 123123123} |
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
{:user/first-name "amit" | |
:user/last-name "rathore" | |
:db/id 123123123} | |
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
(defn datomic-key->regular-key [datomic-key] | |
(-> datomic-key | |
name | |
any-other-transform | |
keyword)) |
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
(defn convert-to-regular-map [user-entity] | |
(-> user-entity | |
(select-keys some-interesting-keys) | |
(maps/update-all-map-keys datomic-key->regular-key))) |
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
(defn insert-and-transform-with [a-map transform] | |
(-> a-map | |
insert | |
transform)) |
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
(defn load-and-transform-with [eid transform] | |
(-> eid | |
load-entity | |
transform)) |
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
(deftest test-demonic-testing | |
(demonic-testing "check not present, insert, then check present" | |
(is (nil? (:db/id (find-by-id some-id)))) | |
(demonic/insert some-map) | |
(is (not (nil? (:db/id (find-by-id some-id))))))) |