This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-09-08
Channels
- # admin-announcements (42)
- # clara (8)
- # cljs-dev (2)
- # clojure (132)
- # clojure-argentina (4)
- # clojure-berlin (3)
- # clojure-brasil (3)
- # clojure-dev (8)
- # clojure-france (2)
- # clojure-hamburg (2)
- # clojure-india (1)
- # clojure-italy (4)
- # clojure-nl (1)
- # clojure-russia (31)
- # clojure-spain (1)
- # clojurescript (154)
- # core-async (19)
- # datomic (16)
- # devcards (43)
- # funcool (3)
- # hoplon (4)
- # immutant (8)
- # jobs (4)
- # ldnclj (71)
- # off-topic (1)
- # om (4)
- # onyx (30)
- # re-frame (3)
- # reagent (6)
- # remote-jobs (2)
- # ring (2)
is there a simple way to flat a nested vector with transaction data?
[[[:db.fn/retractEntity 17592186045471]]
[[[:db.fn/retractEntity 17592186045470]
{:db/id {:part :db.part/user, :idx -1001126},
:field/ref 17592186045462,
:city/name “Fooo",
:fieldset/_values 17592186045469}]]]
clojure.core/flatten does not solve it@caskolkm: does it need to flatten to an arbitrary depth or can you just use concat
and vec
?
[
[:db.fn/retractEntity 17592186045471]
[:db.fn/retractEntity 17592186045470]
{:db/id {:part :db.part/user, :idx -1001126},
:field/ref 17592186045462,
:city/name “Fooo",
:fieldset/_values 17592186045469}
]
should be the result 😉not sure why you have those outer vectors, valid tx data is a sequence containing either vectors or maps (`[[:db/add ..] {:db/id ..}]`). If you can do without those then (apply concat tx-datas)
will combine them for you.
well if there is guaranteed to be just one child in each outer vec then you can just (mapcat first tx-datas)
@clojuregeek: I used to use lein-datomic
but after a while I decided it was not worth the overhead and started using shell scripts.
@bensu: thanks, yeah it doesn't seem to add alot of functionality that you couldn't add in other ways. Thanks for your input
just like to share a win I had today using datomic. I had dates across multiple entities that were saved incorrectly. Essentially the year was saved as 12 instead of 2012. So when writing a script to update all of those entities, I used the power of datomic to query the schema to find all date attributes, then filter those bad dates:
(d/q '[:find ?e (pull ?attr [:db/ident]) ?date
:where
[?attr :db/valueType :db.type/instant]
[?tx :db/ident :db/txInstant]
[(not= ?tx ?attr)]
[?e ?attr ?date]
[(.getYear ^java.util.Date ?date) ?year]
[(< ?year 100)]]
(d/db conn))
Super powerfulwould have not been nearly as easy if we were just using a traditional rdbms
@bostonaholic: noice! I liiiiike.