Skip to content

Commit 439089c

Browse files
committed
tapcfg+tapdb: move and export DatabaseBackend
1 parent 50e38df commit 439089c

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

tapcfg/server.go

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,6 @@ import (
2727
"github.com/lightningnetwork/lnd/signal"
2828
)
2929

30-
// databaseBackend is an interface that contains all methods our different
31-
// database backends implement.
32-
type databaseBackend interface {
33-
tapdb.BatchedQuerier
34-
WithTx(tx *sql.Tx) *sqlc.Queries
35-
}
36-
3730
// genServerConfig generates a server config from the given tapd config.
3831
//
3932
// NOTE: The RPCConfig and SignalInterceptor fields must be set by the caller
@@ -44,7 +37,7 @@ func genServerConfig(cfg *Config, cfgLogger btclog.Logger,
4437

4538
var (
4639
err error
47-
db databaseBackend
40+
db tapdb.DatabaseBackend
4841
dbType sqlc.BackendType
4942
)
5043

tapdb/migrations.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package tapdb
22

33
import (
44
"bytes"
5+
"database/sql"
56
"errors"
67
"fmt"
78
"io"
@@ -14,6 +15,7 @@ import (
1415
"github.com/golang-migrate/migrate/v4/database"
1516
"github.com/golang-migrate/migrate/v4/source/httpfs"
1617
"github.com/lightninglabs/taproot-assets/fn"
18+
"github.com/lightninglabs/taproot-assets/tapdb/sqlc"
1719
)
1820

1921
const (
@@ -25,6 +27,13 @@ const (
2527
LatestMigrationVersion = 31
2628
)
2729

30+
// DatabaseBackend is an interface that contains all methods our different
31+
// Database backends implement.
32+
type DatabaseBackend interface {
33+
BatchedQuerier
34+
WithTx(tx *sql.Tx) *sqlc.Queries
35+
}
36+
2837
// MigrationTarget is a functional option that can be passed to applyMigrations
2938
// to specify a target version to migrate to. `currentDbVersion` is the current
3039
// (migration) version of the database, or None if unknown.

0 commit comments

Comments
 (0)