Files
lnd/graph/db/test_sqlite.go
Elle Mouton 5d7abcdf03 graph/db: refactor SQL DB creation files
Factor out the transaction executor construction so that we can have
access to the raw BatchedSQLQueries type from within tests.
2025-07-07 08:36:12 +02:00

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)
},
)
}