Fork me on GitHub
#datomic
<
2015-10-13
>
robert-stuttaford11:10:09

@peterbak: we’re doing exactly that. web-based SaaS, Clojure/ClojureScript/Datomic/AWS/DDB. happy to answer your questions. custom dashboards for sure.

robert-stuttaford11:10:35

admin data access is just as business focused as end-user data access. console is not sufficient at all.

misha13:10:10

Can anyone help me understand why quoted tx-vector '[[:db.fn/retractEntity 17592186047366]] works here: @(datomic.api/transact (datomic.api/connect db-url) '[[:db.fn/retractEntity 17592186047366]]) but does not work here: ((defn delete-entity [conn id] @(d/transact conn '[[:db.fn/retractEntity id]]))) ?

;; quoted tx-vector inside function:
(defn delete-entity [conn id]
  @(d/transact conn '[[:db.fn/retractEntity id]]))

(delete-entity (d/connect db-url) 17592186047368)
=> {:db-before datomic.db.Db@b0c105bd, :db-after datomic.db.Db@6c30bdd6,
 :tx-data [#datom[13194139536294 50 #inst "2015-10-13T13:22:44.104-00:00" 13194139536294 true]], :tempids {}}

;; unquoted tx-vector inside function:
(defn delete-entity [conn id]
  @(d/transact conn [[:db.fn/retractEntity id]]))

(delete-entity (d/connect db-url) 17592186047368)
=> {:db-before datomic.db.Db@6c30bdd6, :db-after datomic.db.Db@e6202e4c,
 :tx-data [#datom[13194139536295 50 #inst "2015-10-13T13:26:42.812-00:00" 13194139536295 true]
           #datom[17592186047368 121 "b" 13194139536295 false]], :tempids {}}

;; quoted tx-vector w/o function
@(datomic.api/transact (d/connect db-url) '[[:db.fn/retractEntity 17592186047366]])
 => {:db-before datomic.db.Db@7e5e4260, :db-after datomic.db.Db@c732de53,
 :tx-data [#datom[13194139536296 50 #inst "2015-10-13T13:30:25.865-00:00" 13194139536296 true]
           #datom[17592186047366 121 "a" 13194139536296 false]], :tempids {}}

Ben Kamphaus13:10:48

@misha not sure why you’re using the quoted form?

misha13:10:05

@bkamphaus: I'm not sure either simple_smile

Ben Kamphaus13:10:14

but in the second case you’re not passing the evaluated var, you’re passing the symbol (b/c it’s in a quoted coll)

misha13:10:00

so it evaluates to :db.fn/retractEntity 'id?

misha13:10:13

"retract symbol id"

Ben Kamphaus13:10:43

I’m probably not being as precise as I mean to.

Ben Kamphaus13:10:40

But you’re not binding a value to the id symbol in the scope of the fn, without delving into how it gets treated or eval’d on the other side

misha13:10:57

ok, then what makes it work, when I am passing the same quoted vector to d/transact directly? what happens/does not happen if the same "text" gets wrapped up in a function. does it have something to do with the clojure's reader? what should I read about this?

Ben Kamphaus13:10:10

the main thing is, transact is intended to take vecs, not quoted vecs

misha13:10:21

thank you

Ben Kamphaus13:10:28

@misha you don’t pass the same quoted vec

Ben Kamphaus13:10:41

in your example, you pass one with the value in it, not the symbol

misha13:10:26

makes sense. this does not work either:

(let [id 17592186047360]
  @(datomic.api/transact (datomic.api/connect w.db/db-url) '[[:db.fn/retractEntity id]]))

misha13:10:11

*for the same reason.

Ben Kamphaus15:10:22

@robert-stuttaford: ^ addresses your issue from a few days ago, with: > * Bugfix: Fixed bug that prevented connecting from a peer that deletes and recreates a database name.

Ben Kamphaus15:10:43

I’m sure there are other interested parties in that one lurking here as well… simple_smile

robert-stuttaford15:10:09

@bkamphaus: -applause- -celebration- thank you!