Skip to content

Instantly share code, notes, and snippets.

@jdkealy
Created August 16, 2016 17:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jdkealy/42bf630ceba6385914a43d5645d31d55 to your computer and use it in GitHub Desktop.
Save jdkealy/42bf630ceba6385914a43d5645d31d55 to your computer and use it in GitHub Desktop.
[{:db/id #db/id [:db.part/user]
:db/ident :person/namer
:db/doc "ensures unique name"
:db/fn #db/fn {:lang "clojure"
:params [db oid name]
:code "(let [ e (datomic.api/q
'[:find ?e
:in $ ?oid ?name
:where
[?e :person/name ?name]
[?e :person/organization ?oid]]
db oid name )]
e
)
)" }}]
; returns {:db-before datomic.db.Db@65b31281, :db-after datomic.db.Db@b0f2cef1, :tx-data #object[java.util.ArrayList 0x66857a32 [datomic.db.Datum@195f0712]], :tempids {}}
; would like it to return the entity id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment