You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Set method is implemented as blind upsert and does not return any indication of what value, if any, previously existed for the key in question. Callers that wish to leave any existing value intact, or save or report it elsewhere after it is overwritten, must first perform a Get or Has in order to establish if one exists. Set could instead return an indication of whether the key previously existed.
anorth
changed the title
Set() to return a value indicating whether the key already existed
Add SetIfAbsent(), returning a value indicating whether the key already existed
Jan 4, 2021
The Set method is implemented as blind upsert and does not return any indication of what value, if any, previously existed for the key in question. Callers that wish to leave any existing value intact, or save or report it elsewhere after it is overwritten, must first perform a Get or Has in order to establish if one exists. Set could instead return an indication of whether the key previously existed.
See discussion about this for the HAMT in filecoin-project/go-hamt-ipld#75.
The text was updated successfully, but these errors were encountered: