etcd-io / bbolt

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

add new func , return root #827

Closed icetech233 closed 1 month ago

icetech233 commented 1 month ago

file tx.go add code

func (tx *Tx) RootBucket() Bucket {
    return tx.root
}
ahrtr commented 1 month 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.