dendrite/internal/sqlutil/writer_dummy.go
Neil Alexander b24747b305
Transaction writer changes, move roomserver writers (#1285)
* Updated TransactionWriters, moved locks in roomserver, various other tweaks

* Fix redaction deadlocks

* Fix lint issue

* Rename SQLiteTransactionWriter to ExclusiveTransactionWriter

* Fix us not sending transactions through in latest events updater
2020-08-19 15:38:27 +01:00

22 lines
396 B
Go

package sqlutil
import (
"database/sql"
)
type DummyTransactionWriter struct {
}
func NewDummyTransactionWriter() TransactionWriter {
return &DummyTransactionWriter{}
}
func (w *DummyTransactionWriter) Do(db *sql.DB, txn *sql.Tx, f func(txn *sql.Tx) error) error {
if txn == nil {
return WithTransaction(db, func(txn *sql.Tx) error {
return f(txn)
})
} else {
return f(txn)
}
}