adding NopTx helper to dialect

Reviewed By: a8m

Differential Revision: D16757886

fbshipit-source-id: bd50ed4eefd30b5ed617220e6ba5b65b66cad2f3
This commit is contained in:
Alex Snast
2019-08-11 10:33:40 -07:00
committed by Facebook Github Bot
parent f2411742ae
commit ad53473dd7
2 changed files with 15 additions and 8 deletions

View File

@@ -44,6 +44,19 @@ type Tx interface {
driver.Tx
}
type nopTx struct {
Driver
}
func (nopTx) Commit() error { return nil }
func (nopTx) Rollback() error { return nil }
// NopTx returns a Tx with a no-op Commit / Rollback methods wrapping
// the provided Driver d.
func NopTx(d Driver) Tx {
return nopTx{d}
}
// DebugDriver is a driver that logs all driver operations.
type DebugDriver struct {
Driver // underlying driver.