aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorBen Johnson <benbjohnson@yahoo.com>2014-03-24 11:46:58 -0600
committerBen Johnson <benbjohnson@yahoo.com>2014-03-24 11:46:58 -0600
commit2bc868c4663468c38aa5d5523138b8837993db8a (patch)
treef264bf174c0ca41218a9cd40025ab90aeaf56ad4 /cmd
parentMerge pull request #87 from benbjohnson/errors (diff)
parentMake DB/Tx API more consistent. (diff)
downloaddedo-2bc868c4663468c38aa5d5523138b8837993db8a.tar.gz
dedo-2bc868c4663468c38aa5d5523138b8837993db8a.tar.xz
Merge pull request #88 from benbjohnson/tx-rename
Make DB/Tx API more consistent.
Diffstat (limited to 'cmd')
-rw-r--r--cmd/bolt/main.go10
-rw-r--r--cmd/bolt/main_test.go10
2 files changed, 10 insertions, 10 deletions
diff --git a/cmd/bolt/main.go b/cmd/bolt/main.go
index 647c1c2..9a51ec5 100644
--- a/cmd/bolt/main.go
+++ b/cmd/bolt/main.go
@@ -66,7 +66,7 @@ func GetCommand(c *cli.Context) {
}
defer db.Close()
- err = db.With(func(tx *bolt.Tx) error {
+ err = db.View(func(tx *bolt.Tx) error {
// Find bucket.
b := tx.Bucket(name)
if b == nil {
@@ -105,7 +105,7 @@ func SetCommand(c *cli.Context) {
}
defer db.Close()
- err = db.Do(func(tx *bolt.Tx) error {
+ err = db.Update(func(tx *bolt.Tx) error {
// Find bucket.
b := tx.Bucket(name)
if b == nil {
@@ -137,7 +137,7 @@ func KeysCommand(c *cli.Context) {
}
defer db.Close()
- err = db.With(func(tx *bolt.Tx) error {
+ err = db.View(func(tx *bolt.Tx) error {
// Find bucket.
b := tx.Bucket(name)
if b == nil {
@@ -172,7 +172,7 @@ func BucketsCommand(c *cli.Context) {
}
defer db.Close()
- err = db.With(func(tx *bolt.Tx) error {
+ err = db.View(func(tx *bolt.Tx) error {
for _, b := range tx.Buckets() {
println(b.Name())
}
@@ -202,7 +202,7 @@ func PagesCommand(c *cli.Context) {
println("ID TYPE ITEMS OVRFLW")
println("======== ========== ====== ======")
- db.Do(func(tx *bolt.Tx) error {
+ db.Update(func(tx *bolt.Tx) error {
var id int
for {
p, err := tx.Page(id)
diff --git a/cmd/bolt/main_test.go b/cmd/bolt/main_test.go
index b755ccd..b203d2c 100644
--- a/cmd/bolt/main_test.go
+++ b/cmd/bolt/main_test.go
@@ -15,7 +15,7 @@ import (
func TestGet(t *testing.T) {
SetTestMode(true)
open(func(db *bolt.DB) {
- db.Do(func(tx *bolt.Tx) error {
+ db.Update(func(tx *bolt.Tx) error {
tx.CreateBucket("widgets")
tx.Bucket("widgets").Put([]byte("foo"), []byte("bar"))
return nil
@@ -45,7 +45,7 @@ func TestGetBucketNotFound(t *testing.T) {
func TestGetKeyNotFound(t *testing.T) {
SetTestMode(true)
open(func(db *bolt.DB) {
- db.Do(func(tx *bolt.Tx) error {
+ db.Update(func(tx *bolt.Tx) error {
return tx.CreateBucket("widgets")
})
output := run("get", db.Path(), "widgets", "foo")
@@ -57,7 +57,7 @@ func TestGetKeyNotFound(t *testing.T) {
func TestSet(t *testing.T) {
SetTestMode(true)
open(func(db *bolt.DB) {
- db.Do(func(tx *bolt.Tx) error {
+ db.Update(func(tx *bolt.Tx) error {
tx.CreateBucket("widgets")
return nil
})
@@ -86,7 +86,7 @@ func TestSetBucketNotFound(t *testing.T) {
func TestKeys(t *testing.T) {
SetTestMode(true)
open(func(db *bolt.DB) {
- db.Do(func(tx *bolt.Tx) error {
+ db.Update(func(tx *bolt.Tx) error {
tx.CreateBucket("widgets")
tx.Bucket("widgets").Put([]byte("0002"), []byte(""))
tx.Bucket("widgets").Put([]byte("0001"), []byte(""))
@@ -118,7 +118,7 @@ func TestKeysBucketNotFound(t *testing.T) {
func TestBuckets(t *testing.T) {
SetTestMode(true)
open(func(db *bolt.DB) {
- db.Do(func(tx *bolt.Tx) error {
+ db.Update(func(tx *bolt.Tx) error {
tx.CreateBucket("woojits")
tx.CreateBucket("widgets")
tx.CreateBucket("whatchits")