This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-05-25
Channels
- # beginners (27)
- # boot (49)
- # cider (51)
- # cljs-dev (29)
- # cljsjs (1)
- # cljsrn (19)
- # clojure (59)
- # clojure-austin (2)
- # clojure-belgium (19)
- # clojure-china (1)
- # clojure-dev (14)
- # clojure-dusseldorf (7)
- # clojure-russia (8)
- # clojure-spec (115)
- # clojure-uk (45)
- # clojurescript (118)
- # css (6)
- # cursive (8)
- # datascript (20)
- # datomic (32)
- # emacs (5)
- # events (2)
- # flambo (21)
- # hoplon (58)
- # incanter (8)
- # jobs-rus (1)
- # jobs_rus (1)
- # off-topic (3)
- # om (22)
- # om-next (9)
- # onyx (5)
- # other-languages (79)
- # re-frame (126)
- # reagent (6)
- # ring (7)
- # specter (1)
- # untangled (119)
- # yada (38)
For instance, a clojure set gets quietly converted to a java.util.HashSet. Which was very confusing and broke my function. This is also not documented anywhere. I posted this on the mailing list a few days ago, but it hasn't been published.
@rauh: at present Java collections — java.util.HashSet, java.util.ArrayList, etc. — not documented at present because it falls out of an implementation details. We’re considering whether or not to change the behavior in a future release and will document the boundaries when we make that decision.
definitely understand why it’s surprising at present.
Hi. There may be an obvious question but how do I query only the datoms that were introduced/modified/removed in a specific transaction? I know I can run (let [db (d/db conn)] (d/q ... (d/history db) (d/t->tx (d/basis-t db))))
but then I can't use pull
in the query because that doesn't work against the history.
@jannis: you want to do a query against the log, as with the last few examples on this page: http://docs.datomic.com/log.html
is X in the db? - (d/db conn) was X ever in the db? - (d/history db) was X in the db at this time? (as-of filter) did X get added after this point? (since filter) what data was in X transaction (log)
@bkamphaus: Nice summary of scenarios, thanks 🙂
I guess since
would work if there is a simple way to obtain the penultimate transaction.
When testing queries that use the pull syntax I'm assuming I need to create a memory-backed Datomic connection and transact some test fixtures into it?
not sure I follow what is meant by “those datasets”, d/with
returns db-after
, db-before
etc. and these are database values.
For protecting tests that mutate state from each other's damage we also enjoy: https://github.com/vvvvalvalval/datomock (bonus: our tests run a zillion times faster because we only migrate the test database once at the start of the test runs)
and if you don't want to do that for each test you can always create-database and delete-database in the test ns fixtures
which is vastly slower but whatever at least you don't have to worry about cross-test state persistence
@bvulpes: Something like this:
(defn empty-db-with-schema []
(d/create-database uri)
(let [conn (d/connect uri)
db (d/db conn)]
(d/delete-database uri)
(d/release conn)
(-> db
(d/with schema)
:db-after)))
If all your tests need to do is query you could call that once and use the returned database value in all of your tests.