This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # aleph (12)
- # beginners (23)
- # boot (12)
- # cider (40)
- # cljs-dev (8)
- # cljsrn (20)
- # clojars (1)
- # clojure (122)
- # clojure-canada (2)
- # clojure-dev (21)
- # clojure-gamedev (2)
- # clojure-italy (3)
- # clojure-nl (12)
- # clojure-norway (1)
- # clojure-sanfrancisco (3)
- # clojure-spec (59)
- # clojure-uk (114)
- # clojurescript (50)
- # clojurex (1)
- # cursive (2)
- # datascript (2)
- # datomic (26)
- # emacs (5)
- # fulcro (19)
- # garden (1)
- # hoplon (54)
- # leiningen (42)
- # luminus (14)
- # off-topic (24)
- # om (5)
- # onyx (7)
- # re-frame (2)
- # reagent (31)
- # reitit (3)
- # ring-swagger (39)
- # shadow-cljs (8)
- # sql (3)
- # tools-deps (13)
Be careful that Datoms are also treated as lists sometimes - as @U0509NKGK said, the most foolproof way is probably to transact
@greywolve how would this Datom be used? afaik, the only way Datomic’s APIs encounter Datoms is by reading them from storage under the hood. therefore, the simplest way to mock them is to transact. can you explain why making your own would be useful to you?
I guess that's probably the simplest approach, maybe constructing is the wrong approach, even for mocking purposes.
hello here! How do you do your test with the client library? starting an in memory peer-server is a must right? how do you go about cleaning the db?
I tried to use the peer library for testing but ofc the connection doesn't like
I'm not sure there is a great way. What I've done is wrapped the datomic api fns I use and call the client or peer as appropriate for the type of connection I have. Not ideal, but easy enough to do to allow me to use the peer for testing (or perhaps even switch between peer and client later on as needed).
Hi all I am trying to start datomic console but got this:
Datomic installed via homebrew formula https://github.com/Homebrew/homebrew-core/blob/master/Formula/datomic.rb Console install with
/usr/local/Cellar/datomic/0.9.5656 % bin/console -p 8080 alias transactor-uri-no-db bin/console: line 3: bin/classpath: No such file or directory Error: Could not find or load main class clojure.main
Please advice what can be wrong thanks
ok, seems I should have used
Now everything works
Noting a small documentation inconsistency I hit when trying the tuorial... The datomic retract tutorial documents
d/transact as accepting a hash-map with a
:tx-data key as its second argument (https://docs.datomic.com/cloud/tutorial/retract.html); however, the datomic.api package accepts only a list of lists as the second argument (https://docs.datomic.com/on-prem/clojure/index.html#datomic.api/transact).
@bj the tutorial you mentioned uses the client API (https://docs.datomic.com/client-api/datomic.client.api.html#var-transact), while the api link you provided is the peer API
:thumbsup: Thanks. And of course after I sent this I noticed the
cloud url paths 😅
Curious @marshall is there a need to make these API's differentiate? As per the question above regarding testing and my own use where I've internally wrapped these calls and dispatched to the correct api based on my connection type....it seems the differences in the api are minor so why not provide consistency so they are interchangeable (at least some core set of api usage)?
Suppose it's not hard to do on our own but I can imagine that many apps are going to end up with very similar layer of wrapping at least the transact and query calls for testing purposes.
Just getting started with datomic queries. I see that we can use predicates.
predicates can compare a
property with the provided value
But I have a predicate, which takes an entity. How can I pass entity to the predicate?
(defn event-matches-1 [event start-time end-time categories levels] ... ) [:find ?e :in $ ?start ?end ?categories ?levels :where [(user/event-matches-1 ?e ?start ?end ?categories ?levels)]]
based on what you have there I'd guess that
?e needs to be bound to something before calling the predicate
example of what I mean: https://docs.datomic.com/on-prem/query.html#predicate-expressions
@adammiller I did try binding ?e also, but that doesn’t work too
[:find ?e :in $ ?start ?end ?categories ?levels :where [?e ?entity] [(user/event-matches-1 ?entity ?start ?end ?categories ?levels)]]
well, it would have to be bound to some attribute specifically. Not sure what your model looks like but if you have an attribute of say
:event/title or something it would be like:
[:find ?e :in $ ?start ?end ?categories ?levels :where [?e :event/title] [(user/event-matches-1 ?entity ?start ?end ?categories ?levels)]]