Fork me on GitHub

Hi all, just getting started with Clara and hit a point of confusion. I'd like to query records that fall within a given date range. I'm trying define a query with ?start and ?end parameters, but from what I've tried, mk-session fails out saying that those variables are unbound. Any tips?

(defrecord Foo [date])

(defquery get-foos-in-date-range
  [?start ?end]
  [?foos <- (acc/all) :from [Foo (date-in-range? date ?start ?end)]])

(mk-session) ;; Exception: Unbound variables #{:?start :?end}


Queries in Clara only support equality matches on provided parameters.


Ah, so this isn't possible with a query? I'm guessing then I should just query all Foos and do a filter outside the query?


That, or insert a fact that would represent the values needed, join it to the foos and insert only the matched foos as another fact

💯 1

Hm, like a filter-foo rule that could have that predicate (and possibly others) that inserts a FilteredFoo fact?