mirror of
https://github.com/lightninglabs/lightning-terminal.git
synced 2026-08-13 12:33:36 +02:00
As we've now switched over to using sqldb v2 for most of the db objects, we can remove a lot of deprecated code that's no longer used in the litd project. This commit removes that code.
48 lines
1.3 KiB
Go
48 lines
1.3 KiB
Go
package sqlc
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/lightningnetwork/lnd/sqldb/v2"
|
|
)
|
|
|
|
// wrappedTX is a wrapper around a DBTX that also stores the database backend
|
|
// type.
|
|
type wrappedTX struct {
|
|
DBTX
|
|
|
|
backendType sqldb.BackendType
|
|
}
|
|
|
|
// Backend returns the type of database backend we're using.
|
|
func (q *Queries) Backend() sqldb.BackendType {
|
|
wtx, ok := q.db.(*wrappedTX)
|
|
if !ok {
|
|
// Shouldn't happen unless a new database backend type is added
|
|
// but not initialized correctly.
|
|
return sqldb.BackendTypeUnknown
|
|
}
|
|
|
|
return wtx.backendType
|
|
}
|
|
|
|
// NewForType creates a new Queries instance for the given database type.
|
|
func NewForType(db DBTX, typ sqldb.BackendType) *Queries {
|
|
return &Queries{db: &wrappedTX{db, typ}}
|
|
}
|
|
|
|
// CustomQueries defines a set of custom queries that we define in addition
|
|
// to the ones generated by sqlc.
|
|
type CustomQueries interface {
|
|
// CountActions returns the number of actions that match the provided
|
|
// ActionQueryParams.
|
|
CountActions(ctx context.Context, arg ActionQueryParams) (int64, error)
|
|
|
|
// ListActions retrieves a list of actions based on the provided
|
|
// ListActionsParams.
|
|
ListActions(ctx context.Context,
|
|
arg ListActionsParams) ([]Action, error)
|
|
|
|
// Backend returns the type of the database backend used.
|
|
Backend() sqldb.BackendType
|
|
}
|