sqldb: demonstrate the use of ExecutePagedQuery

Here, a new query (GetChannelsByOutpoints) is added which makes use of
the /*SLICE:outpoints*/ directive & added workaround. This is then used
in a test to demonstrate how the ExecutePagedQuery helper can be used to
wrap a query like this such that calls are done in pages.

The query that has been added will also be used by live code paths in an
upcoming commit.
This commit is contained in:
Elle Mouton
2025-07-16 08:29:40 +02:00
parent 006905d57f
commit f0d2d1fd0a
6 changed files with 175 additions and 0 deletions

View File

@@ -7,6 +7,14 @@ import (
"testing"
)
// isSQLite is true if the build tag is set to test_db_sqlite. It is used in
// tests that compile for both SQLite and Postgres databases to determine
// which database implementation is being used.
//
// TODO(elle): once we've updated to using sqldbv2, we can remove this since
// then we will have access to the DatabaseType on the BaseDB struct at runtime.
const isSQLite = true
// NewTestDB is a helper function that creates an SQLite database for testing.
func NewTestDB(t *testing.T) *SqliteStore {
return NewTestSqliteDB(t)