Skip to content

Instantly share code, notes, and snippets.

@teaforthecat
Created July 13, 2014 01:50
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 teaforthecat/d5921a1516f27877ddda to your computer and use it in GitHub Desktop.
Save teaforthecat/d5921a1516f27877ddda to your computer and use it in GitHub Desktop.
broken upsert transaction
;; implicit upsert due to unique constraint on message
;; temp id will get replaced with real id if message exists
(defn upsert-message-tx [greeting]
(let [tempid (d/tempid :db.part/user -1 )]
[{ :db/id tempid
:greeting/message greeting}
[:inc tempid :greeting/hit-count 1]]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment