aboutsummaryrefslogtreecommitdiff
path: root/cmd/bolt/set.go
diff options
context:
space:
mode:
authorBen Johnson <benbjohnson@yahoo.com>2014-05-05 07:48:45 -0600
committerBen Johnson <benbjohnson@yahoo.com>2014-05-05 07:48:45 -0600
commitc22d2e03bc5af06ce0f7d877b1efaf9b08e91d68 (patch)
tree0ca4b592b7772e7066022f220c67072d372b802f /cmd/bolt/set.go
parentMerge pull request #151 from benbjohnson/remove-c (diff)
downloaddedo-c22d2e03bc5af06ce0f7d877b1efaf9b08e91d68.tar.gz
dedo-c22d2e03bc5af06ce0f7d877b1efaf9b08e91d68.tar.xz
Remove 'bolt set'.
This commit removes the 'set' command in the Bolt CLI. It proved to not be very useful so there's no point in keeping the extra code around.
Diffstat (limited to 'cmd/bolt/set.go')
-rw-r--r--cmd/bolt/set.go39
1 files changed, 0 insertions, 39 deletions
diff --git a/cmd/bolt/set.go b/cmd/bolt/set.go
deleted file mode 100644
index f4a4696..0000000
--- a/cmd/bolt/set.go
+++ /dev/null
@@ -1,39 +0,0 @@
-package main
-
-import (
- "os"
-
- "github.com/boltdb/bolt"
-)
-
-// Set sets the value for a given key in a bucket.
-func Set(path, name, key, value string) {
- if _, err := os.Stat(path); os.IsNotExist(err) {
- fatal(err)
- return
- }
-
- db, err := bolt.Open(path, 0600)
- if err != nil {
- fatal(err)
- return
- }
- defer db.Close()
-
- err = db.Update(func(tx *bolt.Tx) error {
-
- // Find bucket.
- b := tx.Bucket([]byte(name))
- if b == nil {
- fatalf("bucket not found: %s", name)
- return nil
- }
-
- // Set value for a given key.
- return b.Put([]byte(key), []byte(value))
- })
- if err != nil {
- fatal(err)
- return
- }
-}