aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Johnson <benbjohnson@yahoo.com>2014-01-21 15:22:49 -0700
committerBen Johnson <benbjohnson@yahoo.com>2014-01-21 15:22:49 -0700
commita5d6fd8d5093a960029f65d3a25f404608c6a8d2 (patch)
treeedb3be22a141bf5c1147b63aed415d02a90c3131
parentUpdate README.md (diff)
downloaddedo-a5d6fd8d5093a960029f65d3a25f404608c6a8d2.tar.gz
dedo-a5d6fd8d5093a960029f65d3a25f404608c6a8d2.tar.xz
Update README.md
-rw-r--r--README.md36
1 files changed, 34 insertions, 2 deletions
diff --git a/README.md b/README.md
index f52ab61..d2b9fd4 100644
--- a/README.md
+++ b/README.md
@@ -55,7 +55,7 @@ err := db.DeleteBucket("widgets")
### Transactions
-All access to the bucket data happens through a Transaction.
+Versioning of data in the bucket data happens through a Transaction.
These transactions can be either be read-only or read/write transactions.
Transactions are what keeps Bolt consistent and allows data to be rolled back if needed.
@@ -69,12 +69,44 @@ Please double check that you are appropriately closing all transactions after yo
```go
t, err := db.Transaction()
+t.Close()
+```
+
+#### Creating and committing a read/write transaction
+
+```
+t, err := db.RWTransaction()
+err := t.Commit()
+```
+
+#### Creating and aborting a read/write transaction
-// Read/write txn:
+```
t, err := db.RWTransaction()
+err := t.Abort()
+```
+
+
+### Cursors
+
+Cursors provide access to a specific bucket within a transaction.
+
+
+#### Creating a read-only cursor
+
+```go
+t, err := db.Transaction()
+b, err := t.Bucket("widgets")
+c, err := b.Cursor()
```
+#### Creating a read/write cursor
+```go
+t, err := db.RWTransaction()
+b, err := t.Bucket("widgets")
+c, err := b.RWCursor()
+```