Fork me on GitHub
#datomic
<
2022-10-05
>
ivana12:10:50

Hello! I need an ability to have a setting, should I use Datomic or not. And if yes, then I make all the queries & transactions with my connection & db, but if not I want to have nils on any query & transaction without altering and even connecting to any db. Of course I may wrap all my code used Datomic api into (when ...) but there are so many places of it. Maybe there is a way of setting empty or blank connection parameters? Nil or {} fhrows an exceptions, maybe there is a way?

souenzzo12:10:32

Where the nils are created?

ivana12:10:01

For now - nowhere. It is just my wish & dream of it, and I asked if it possible

pyry14:10:23

Perhaps redefine the relevant functions from Datomic API with something like (alter-var-root! #'datomic.api/q ...)

pyry14:10:07

Of course, what's practical depends on the specifics of your problem. I imagine the above would work fairly well if there's one global setting to toggle, whereas it probably won't be as good if you have eg. a toggle per user.

ivana14:10:44

Thanks, looks like hack but if we have not other way, maybe it is the one

pyry14:10:06

Well, I suppose a hack is exactly what you need if you don't want to refactor your callsites. 😅

ivana14:10:08

Yep, you are right and thanks for it, but I hoped that Datomic may have that feature on its own side, i.e. (d/transact nil [.......]) => nil etc 🙂