From 4997ba96bf27b05757e170dee7de1b0865b25d5d Mon Sep 17 00:00:00 2001 From: Aaron L Date: Mon, 9 Jan 2017 20:28:07 -0800 Subject: [PATCH] Add more clear documentation about boil.Begin() - Fix #88 --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index ac8159a..1479d6c 100644 --- a/README.md +++ b/README.md @@ -558,6 +558,9 @@ err := pilot.Delete(db) // Regular variant, takes a db handle (boil.Executor int pilot.DeleteP(db) // Panic variant, takes a db handle and panics on error. err := pilot.DeleteG() // Global variant, uses the globally set db handle (boil.SetDB()). pilot.DeleteGP() // Global&Panic variant, combines the global db handle and panic on error. + +db.Begin() // Normal sql package way of creating a transaction +boil.Begin() // Uses the global database handle set by boil.SetDB() ``` Note that it's slightly different for query building. @@ -857,6 +860,10 @@ tx.Commit() tx.Rollback() ``` +It's also worth noting that there's a way to take advantage of `boil.SetDB()` +by using the [boil.Begin()](https://godoc.org/github.com/vattle/sqlboiler/boil#Begin) function. +This opens a transaction using the globally stored database. + ### Debug Logging Debug logging will print your generated SQL statement and the arguments it is using.