datascript

Immutable database and Datalog query engine for Clojure, ClojureScript and JS
misha 2018-04-25T09:18:16.000220Z

Probably to match clojure.core/comp, which composes fns right to left, @rnagpal

rnagpal 2018-04-25T13:49:32.000807Z

what is the best way of having unique ids for IDs (:db/id) I tried using string(UUID -> str) and it doesn’t seem to work. t/now -> to-long works

rnagpal 2018-04-25T14:06:31.000085Z

or use nano-time ?

rnagpal 2018-04-25T14:06:42.000013Z

(defn nano-time []
  #?(:clj (System/nanoTime)
     :cljs (js/performance.now)))

rnagpal 2018-04-25T14:35:41.000365Z

Another question 🙂 This query is not working

(defn find-before-time [end]
  (let [query '[:find [(pull ?e [*]) ...]
                :where
                [?e :timestamp ?time]
                [(< ?time)]]]
    (d/q query @conn end)))

souenzzo 2018-04-25T14:47:39.000013Z

try with (new js/Date)

souenzzo 2018-04-25T14:48:25.000394Z

(defn find-before-time 
  [end]
  (let [query '[:find [(pull ?e [*]) ...]
                :in $ ?end
                :where
                [?e :timestamp ?time]
                [(< ?end ?time)]]]
    (d/q query @conn end)))

✔️ 1
rnagpal 2018-04-25T14:57:28.000586Z

Thanks @souenzzo