etcd-io / bbolt

An embedded key/value database for Go.
https://go.etcd.io/bbolt
MIT License
8.31k stars 646 forks source link

add new func , return root #827

Closed icetech233 closed 3 months ago

icetech233 commented 3 months ago

file tx.go add code

func (tx *Tx) RootBucket() Bucket {
    return tx.root
}
ahrtr commented 3 months ago

Do you have real use case for this request?

We intentionally do not expose the root bucket. It (the root bucket) is invisible to users. It means users can't operate the root bucket directly, i.e. write data into the root bucket directly. It's similar to that you can't write a RDMS database directly, you must create a table firstly.