Fork me on GitHub
#datahike
<
2020-06-14
>
sova-soars-the-sora14:06:41

Hi, where do I put :initial-tx ?

sova-soars-the-sora14:06:10

(def cfg {:store {:backend :file :path "data/sovabes"}
										:initial-tx [;message schema
																		{:db/ident :message/messageid
                   :db/valueType :db.type/string
                   :db/cardinality :db.cardinality/one }
                  {:db/ident :message/title
                   :db/valueType :db.type/string
                   :db/cardinality :db.cardinality/one }})
not doing the trick

sova-soars-the-sora14:06:03

anyway, is there a straightforward way to turn the results set #{} into a map?

whilo18:06:24

@sova You can use the :keys syntax to declare what keyword in the return maps should map to which term in the clause head like here: https://github.com/replikativ/datahike/issues/149

sova-soars-the-sora21:06:34

@whilo thank you whilo. I ended up simply running the output through a function that looks like

(->>
  (d/q ...)
  (map (fn [[ aid c t mid ]]
         { :authorid aid :content c :timestamp t :messageid mid}))
      (sort-by :timestamp)
      (into []))
which is fine, I need some granularity on destructuring and not all fields are useful at all times.