Skip to content

Commit

Permalink
Add more clear documentation about boil.Begin()
Browse files Browse the repository at this point in the history
- Fix #88
  • Loading branch information
aarondl committed Jan 10, 2017
1 parent 711ecbb commit 4997ba9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 4997ba9

Please sign in to comment.