Skip to content

Commit

Permalink
update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
korotkov-aerospike committed Jan 26, 2025
1 parent 34c2c03 commit 1802196
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/util/safe_map.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ func (s *SafeMap[K, V]) Apply(key K, callback func(value V)) {
}
}

// ApplyOrCreate applies a function to a specific key if it exists.
// Puts new key if it is absent
// ApplyOrCreate executes the callback function with the value associated with
// the given key if the key exists in the map. If the key does not exist, the
// defaultValue is assigned to the key.
func (s *SafeMap[K, V]) ApplyOrCreate(key K, callback func(value V), defaultValue V) {
s.mu.Lock()
defer s.mu.Unlock()
Expand Down

0 comments on commit 1802196

Please sign in to comment.