mirror of
https://github.com/ent/ent.git
synced 2026-05-28 09:49:08 +03:00
adding NopTx helper to dialect
Reviewed By: a8m Differential Revision: D16757886 fbshipit-source-id: bd50ed4eefd30b5ed617220e6ba5b65b66cad2f3
This commit is contained in:
committed by
Facebook Github Bot
parent
f2411742ae
commit
ad53473dd7
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user