aboutsummaryrefslogtreecommitdiff
path: root/cmd/bolt/set.go
diff options
context:
space:
mode:
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
- }
-}