From c22d2e03bc5af06ce0f7d877b1efaf9b08e91d68 Mon Sep 17 00:00:00 2001 From: Ben Johnson Date: Mon, 5 May 2014 07:48:45 -0600 Subject: 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. --- cmd/bolt/set.go | 39 --------------------------------------- 1 file changed, 39 deletions(-) delete mode 100644 cmd/bolt/set.go (limited to 'cmd/bolt/set.go') 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 - } -} -- cgit v1.2.3