Fork me on GitHub
#datomic
<
2019-02-01
>
m_m_m17:02:22

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.

currentoor23:02:27

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

favila05:02:46

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

favila05:02:40

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

currentoor20:02:38

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