From f8ad21bad37735eb7e47330383f204d7a49c0ff9 Mon Sep 17 00:00:00 2001 From: Ben Johnson Date: Mon, 24 Mar 2014 11:43:06 -0600 Subject: Make DB/Tx API more consistent. I consolidated the DB.Tx() and DB.RWTx() calls into a single DB.Begin(writable bool) call. This is more consistent with the database/sql library. I also changed the DB.Do() and DB.With() call to DB.Update() and DB.View(), respectively. This is more intuitive and more inline with other database verbiage. --- cmd/bolt/main_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'cmd/bolt/main_test.go') 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") -- cgit v1.2.3