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.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'cmd/bolt/main.go') 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) -- cgit v1.2.3