Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add replace! (a means to update ALL of the fields in a vertex) #31

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

shirlenator
Copy link

No description provided.

@ZackGC
Copy link
Contributor

ZackGC commented Jan 23, 2013

  1. Why use this instead of hermes.vertex/upsert!? (This is a really good function to include, but I'd like to see the rationale written out.)
  2. The name doesn't feel right. Perhaps update-by-kv instead.
  3. Please write tests for this.
  4. The code seems a bit complicated. This should work the same:
(defn update-by-kv!
  "Given a key, a value, and a property map, update-all! finds all nodes with 
  the given key value pair and updates all fields with the new properties 
  by the map (not excluding the given k-v). Returns the set of vertices just replaced, if any."
  [k v m]
  (ensure-graph-is-transaction-safe)
  (doall (set (map #(set-properties! % m) (find-by-kv (name k) v))))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants