Closed devth closed 11 years ago
Hey. Sorry for the delay. The first variant is not meant to be used from a repl and requires explicit handling of connection and db. It assumes it's a web app and that you would be wrapping your middleware with wrap-datomic. I'll update the docs to be more clear.
To answer your question about, why you don't want to do this by default requires looking into what happens when you use :dynamic-vars. On every query, it creates a new db object to be passed to datomic. While this is a nice convenience, you should be using wrap-datomic or something that explicitly handles updating db and connection as needed.
Got it, thanks.
I pasted the example from the README in my REPL but ran into this exception as soon as I try to use any of the fns created by
(dc/create-model-fns model-namespace)
:Using this variant to create the db:
If I instead use this variant, it works:
I'm running into the same exception in my actual code as well, trying to connect to a datomic-free transactor. Looks like
dc/start
with:dynamic-vars
properly returns adatomico.db/entity
while specifying a:uri
returns nil.Using the 0.1.0 release.
Edit: It looks like I'm missing something fundamental about how to set the dynamic
*db*
value. Apparently:dynamic-vars true
does this for you but is "Not recommended for application code. Default is false." What is the correct way to set*db*
and why wouldn't you always want it to be the most recent db version by default?