Fork me on GitHub

Hi. Is it possible to build pipeline from datomic queries? I have a lots of filters in my app so I would like to create protocol Filter and implement that protocol for each of my filters (by using different datomic query in each of them) then build pipeline from them.


when using datomic.client.api/q is it possible to have optional inputs? and only apply some where clauses when those inputs are specified?


It’s possible but awkward. Use a special sentinel value (not nil) and make rules or or clauses that assert it matches or doesn’t match the sentinel


Usually it’s easier to dynamically build up the query clauses appropriate to your inputs using cons-> instead of pattern matching on the value of “empty” sentinel input values


makes sense, thank you!

Christian Johansen23:02:41

I don't think that's possible. But queries are data - just build the query dynamically before passing it to q