aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorBen Johnson <benbjohnson@yahoo.com>2014-04-07 16:24:51 -0600
committerBen Johnson <benbjohnson@yahoo.com>2014-04-11 12:36:54 -0600
commit698b07b074dc554578ecddd138972702f46d0879 (patch)
treef171f10bd4f17986cb9120d71263995b28273a7a /cmd
parentUpdate cursor benchmark. (diff)
downloaddedo-698b07b074dc554578ecddd138972702f46d0879.tar.gz
dedo-698b07b074dc554578ecddd138972702f46d0879.tar.xz
Add nested buckets.
This commit adds the ability to create buckets inside of other buckets. It also replaces the buckets page with a root bucket. Fixes #56.
Diffstat (limited to 'cmd')
-rw-r--r--cmd/bolt/buckets.go8
-rw-r--r--cmd/bolt/get.go2
-rw-r--r--cmd/bolt/keys.go2
-rw-r--r--cmd/bolt/set.go2
4 files changed, 7 insertions, 7 deletions
diff --git a/cmd/bolt/buckets.go b/cmd/bolt/buckets.go
index 10766a6..48395d8 100644
--- a/cmd/bolt/buckets.go
+++ b/cmd/bolt/buckets.go
@@ -21,10 +21,10 @@ func Buckets(path string) {
defer db.Close()
err = db.View(func(tx *bolt.Tx) error {
- for _, b := range tx.Buckets() {
- println(b.Name())
- }
- return nil
+ return tx.ForEach(func(name []byte, _ *bolt.Bucket) error {
+ println(string(name))
+ return nil
+ })
})
if err != nil {
fatal(err)
diff --git a/cmd/bolt/get.go b/cmd/bolt/get.go
index 10216e3..6ea7f04 100644
--- a/cmd/bolt/get.go
+++ b/cmd/bolt/get.go
@@ -22,7 +22,7 @@ func Get(path, name, key string) {
err = db.View(func(tx *bolt.Tx) error {
// Find bucket.
- b := tx.Bucket(name)
+ b := tx.Bucket([]byte(name))
if b == nil {
fatalf("bucket not found: %s", name)
return nil
diff --git a/cmd/bolt/keys.go b/cmd/bolt/keys.go
index 56245b8..6affefe 100644
--- a/cmd/bolt/keys.go
+++ b/cmd/bolt/keys.go
@@ -22,7 +22,7 @@ func Keys(path, name string) {
err = db.View(func(tx *bolt.Tx) error {
// Find bucket.
- b := tx.Bucket(name)
+ b := tx.Bucket([]byte(name))
if b == nil {
fatalf("bucket not found: %s", name)
return nil
diff --git a/cmd/bolt/set.go b/cmd/bolt/set.go
index ff12024..9761f44 100644
--- a/cmd/bolt/set.go
+++ b/cmd/bolt/set.go
@@ -22,7 +22,7 @@ func Set(path, name, key, value string) {
err = db.Update(func(tx *bolt.Tx) error {
// Find bucket.
- b := tx.Bucket(name)
+ b := tx.Bucket([]byte(name))
if b == nil {
fatalf("bucket not found: %s", name)
return nil