Fork me on GitHub
#datomic
<
2017-03-29
>
dm308:03:20

is there an easy way to do the following - if the param is present, bind it as in [:find ?x :in $ ?param :where [?x :x/param ?param] ...]; if it’s nil - effectively skip the clause: [:find ?x :in $ ?param :where …]?

dm310:03:43

also - what’s the best way to get the time of the transaction from the tx report queue? I understand the relevant attribute is :db/txInstant, but getting to the tx entity seems too onerous, e.g. (:db/txInstant (d/entity (:db-after tx) (d/t->tx (d/basis-t (:db-after tx)))) - is there a simpler way?

dm310:03:46

This also works:

(let [a (:id (d/attribute (:db-after tx) :db/txInstant))]
                          (:v (m/find-first #(= a (:a %)) (:tx-data tx))))
I guess I could cache the attribute id...

favila15:03:12

@dm3 when I have "optional" params in a query I add/remove query clauses and params using cond->

favila15:03:24

You can't really use the same query

dm320:03:40

favila: thx, that’s what I thought