如何检查boltdb上是否存在密钥?如果要作为地图,则可以使用逗号,ok语法。我如何对boltdb做同样的事情?

分析解答

从螺栓doc

Get retrieves the value for a key in the bucket. Returns a nil value if the key does not exist or if the key is a nested bucket. The returned value is only valid for the life of the transaction.

value := b.Get([]byte("foo"))
if value == nil {
  fmt.Println("key does not exist")
}