aboutsummaryrefslogtreecommitdiff
path: root/bucket.go
blob: 6cfe1ca5995057aa105476d3829722c2b0f233e8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package bolt

type Bucket struct {
	*bucket
	name        string
	transaction *Transaction
}

type bucket struct {
	root pgid
}

// Name returns the name of the bucket.
func (b *Bucket) Name() string {
	return b.name
}

// Get retrieves the value for a key in the bucket.
func (b *Bucket) Get(key []byte) []byte {
	return b.Cursor().Get(key)
}

// Cursor creates a new cursor for this bucket.
func (b *Bucket) Cursor() *Cursor {
	return &Cursor{
		transaction: b.transaction,
		root:        b.root,
		stack:       make([]elem, 0),
	}
}