A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/etcd-io/bbolt/issues/726 below:

Can not distinguish between "does not exist" and "has no value" · Issue #726 · etcd-io/bbolt · GitHub

I wrote the pwned passwords into a bucket. Because I only need to know if the hash exists, I wrote an empty value into the bucket.

err := hashes.Put(hash, []byte{})

Now I tried to find a hash, but I had to realize that Go does not distinguish between an empty array and nil. The problem is: Bolt returns nil to indicate that a key does not exist. This is a problem because of Go's limitation.

How to store keys without values in order to check just for existence?

I think Bucket.Get needs to return an additional boolean or Bucket needs an additional function to check just for existence.

Go itself also indicates the existence of a key in a map by an additional boolean:


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4