diff --git a/lib/db/types/map.go b/lib/db/types/map.go index aa311a6..ebfdd88 100644 --- a/lib/db/types/map.go +++ b/lib/db/types/map.go @@ -116,6 +116,15 @@ func (m Map[K, V]) Get(key K) (V, bool) { return val, ok } +// Exists checks if a key exists in the map +func (m Map[K, V]) Exists(key K) bool { + shard := m.GetShard(key) + shard.RLock() + _, ok := shard.items[key] + shard.RUnlock() + return ok +} + // Remove deletes a key-value pair from the map. func (m Map[K, V]) Remove(key K) { shard := m.GetShard(key)