MCPcopy
hub / github.com/etcd-io/bbolt / ForEach

Method ForEach

tx.go:156–160  ·  tx.go::Tx.ForEach

ForEach executes a function for each bucket in the root. If the provided function returns an error then the iteration is stopped and the error is returned to the caller.

(fn func(name []byte, b *Bucket) error)

Source from the content-addressed store, hash-verified

154// If the provided function returns an error then the iteration is stopped and
155// the error is returned to the caller.
156func (tx *Tx) ForEach(fn func(name []byte, b *Bucket) error) error {
157 return tx.root.ForEach(func(k, v []byte) error {
158 return fn(k, tx.root.Bucket(k))
159 })
160}
161
162// OnCommit adds a handler function to be executed after the transaction successfully commits.
163func (tx *Tx) OnCommit(fn func()) {

Callers 15

cloneBucketFunction · 0.45
TestBucket_ForEachFunction · 0.45
TestBucket_Delete_QuickFunction · 0.45
ExampleBucket_ForEachFunction · 0.45
walkFunction · 0.45
walkBucketFunction · 0.45
TestTx_ForEach_NoErrorFunction · 0.45
TestTx_ForEach_WithErrorFunction · 0.45

Calls 1

BucketMethod · 0.45

Tested by 12

cloneBucketFunction · 0.36
TestBucket_ForEachFunction · 0.36
TestBucket_Delete_QuickFunction · 0.36
ExampleBucket_ForEachFunction · 0.36
TestTx_ForEach_NoErrorFunction · 0.36
TestTx_ForEach_WithErrorFunction · 0.36
chkdbFunction · 0.36
walkBucketFunction · 0.36