datahike

https://datahike.io/, Join the conversation at https://discord.com/invite/kEBzMvb, history for this channel is available at https://clojurians.zulipchat.com/#narrow/stream/180378-slack-archive/topic/datahike
sova-soars-the-sora 2020-06-14T14:03:41.388700Z

Hi, where do I put :initial-tx ?

sova-soars-the-sora 2020-06-14T14:04:10.389200Z

(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-sora 2020-06-14T14:30:03.389600Z

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

whilo 2020-06-14T18:16:24.390300Z

@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-sora 2020-06-14T21:15:34.391400Z

@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.