micro-wrapper-sql/tx.go
Vasiliy Tolstov 3f1068e708 update workflows
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-10-27 18:49:33 +03:00

31 lines
509 B
Go

package wrapper
import (
"database/sql/driver"
"go.unistack.org/micro/v3/tracer"
)
// wrapperTx defines a wrapper for driver.Tx
type wrapperTx struct {
tx driver.Tx
span tracer.Span
opts Options
}
// Commit implements driver.Tx Commit
func (w *wrapperTx) Commit() error {
if w.span != nil {
defer w.span.Finish()
}
return w.tx.Commit()
}
// Rollback implements driver.Tx Rollback
func (w *wrapperTx) Rollback() error {
if w.span != nil {
defer w.span.Finish()
}
return w.tx.Rollback()
}