Workiva / eva

A distributed database-system implementing an entity-attribute-value data-model that is time-aware, accumulative, and atomically consistent
Other
565 stars 25 forks source link

It is possible to call a function inside a query and pass lvar in, but there is no way to do the same for the database #79

Open tylerwilding-wk opened 5 years ago

tylerwilding-wk commented 5 years ago
(defn find-in-db [db]
  (let [filing (-> (e/q '[:find ?u :where [?u :user/first-name "Alex"]
                          [?f :example.schema/user ?u]], db)
                   ffirst)]
    filing))
(e/q '[:find ?f :in $ :where [(eva-taxes.rules/find-in-db $) ?f]]
     (e/db conn))

The query fails:

EvaException Invalid data source: input for '$' does not satisfy the EDB protocol  eva.error/eva-exception (error.clj:121)

Similar code sample works in Datomic.

The use case: One wants to write a function accessing database and do some calculation based on found information, like special kind of aggregation for example. However it is not possible now.