lightning-terminal/accounts/test_sql.go
Viktor Torstensson b7ee351cb0
multi: use sqldb/v2 in accounts package
Update the accounts package to use the `sqldb/v2` package instead of the
older version.
2026-05-14 11:37:41 +02:00

27 lines
656 B
Go

//go:build test_db_postgres || test_db_sqlite
package accounts
import (
"testing"
"github.com/lightninglabs/lightning-terminal/db/sqlc"
"github.com/lightningnetwork/lnd/clock"
"github.com/lightningnetwork/lnd/sqldb/v2"
"github.com/stretchr/testify/require"
)
// createStore is a helper function that creates a new SQLStore and ensure that
// it is closed when during the test cleanup.
func createStore(t *testing.T, sqlDB *sqldb.BaseDB,
clock clock.Clock) *SQLStore {
queries := sqlc.NewForType(sqlDB, sqlDB.BackendType)
store := NewSQLStore(sqlDB, queries, clock)
t.Cleanup(func() {
require.NoError(t, store.Close())
})
return store
}