Fork me on GitHub

Does anyone know if there’s a way that I can wrap a Datomic connection and log all the calls that get made to it? I’m working with some inherited spaghetti code and it’s not unusual for me to have no idea when certain kinds of entities are created or updated. My hope is that I can log the events I care about so I can work out what code is responsible. Ideally I’d get a stack trace at those times.


could you make a core async channel which you use to talk to datomic? so rather then calling something directly you put it into the channel which will then do the actual call. then the channel could do arbitrary things, like maybe log something to a file


The way this thing is built there are a whole bunch of auto-magic macros that wire up functions and local mutable state into a graph. I have control of the place where the connection comes from, but the other functions are littered across the code base, so it is currently impractical to refactor. As such I don’t think a channel will help. Thanks though.


It looks like I can probably use the [transaction report queue]( for my needs.


@adamkowalski: I found a promising lead that uses core.async here: Thanks for the suggestion.


Is there a simple way to run a query that matches a given string against one of a few attributes? For example, something like this pseudocode: :where [?user :user/email ?string] :or [?user :user/name ?string]


Is this possible?


Query syntax supports or — check the docs for the correct syntax


Oh wait, I remember why this was more complicated...


It was because I'm using clojure.string/includes? to check for a substring of any of these. Which exploded the query into a bunch of temporary variables which I then check with or, and needed to bind with or-join.


That explosion of a query is what I'm trying to avoid. Is that possible?


Hmm. I'll experiment with it a bit more. I think I can get it simpler.


I had to use rules to get that working.


Or lets you test different values of the same attribute, but if you want to (say) search for a string among a few attributes, the rule stuff was what worked for me.


@zentrope: Thanks, that sounds promising, will look further into rules.


@zentrope: Ahh, I see why that works. Per the docs: "Rules with multiple definitions will evaluate them as different logical paths to the same conclusion (i.e. logical OR)."


Beautiful, sounds like exactly what I need.


Anyone have any experience with Adi?


@zane: @zcaudate hangs out mostly on his gitter simple_smile answers loads of questions there


@dominicm: Thanks for the heads up! I don't have a specific question. I was just wondering what others' experiences with it have been like.


@zane: Positive. I really like it.


He has a lot of great ideas about clojure in general, and his libs reflect that


Seems like I have a lot of reading to do.


Check out hara.event, it's a personal favourite