mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-11-11 06:37:21 +01:00
Factor out the transaction executor construction so that we can have access to the raw BatchedSQLQueries type from within tests.
23 lines
449 B
Go
23 lines
449 B
Go
//go:build !test_db_postgres && test_db_sqlite
|
|
|
|
package graphdb
|
|
|
|
import (
|
|
"database/sql"
|
|
"testing"
|
|
|
|
"github.com/lightningnetwork/lnd/sqldb"
|
|
)
|
|
|
|
// newBatchQuerier creates a new BatchedSQLQueries instance for testing
|
|
// using a SQLite database.
|
|
func newBatchQuerier(t testing.TB) BatchedSQLQueries {
|
|
db := sqldb.NewTestSqliteDB(t).BaseDB
|
|
|
|
return sqldb.NewTransactionExecutor(
|
|
db, func(tx *sql.Tx) SQLQueries {
|
|
return db.WithTx(tx)
|
|
},
|
|
)
|
|
}
|