Fork me on GitHub
#datahike
<
2020-06-14
sova14:06:41

Hi, where do I put :initial-tx ?

sova14: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

sova14: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

sova21: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.