mirror of
https://github.com/lightninglabs/lightning-terminal.git
synced 2026-08-13 12:33:36 +02:00
sqlc: introduce NewForType helper method
The upcoming implementation of `sqldb/v2` will extensively create a `Queries` object on the fly. To make more intuitive how to create the queries object for specific database types, we introduce a `NewForType` helper method. This also mimics how `tapd` creates the `Queries` object, and in order not let `litd` have it's own definition of how `Queries` object are created on the fly, the upcoming `sqldb/v2` usage will utilize this helper method.
This commit is contained in:
parent
91ed65954d
commit
2483339da9
1 changed files with 5 additions and 0 deletions
|
|
@ -36,6 +36,11 @@ func NewPostgres(db DBTX) *Queries {
|
|||
return &Queries{db: &wrappedTX{db, sqldb.BackendTypePostgres}}
|
||||
}
|
||||
|
||||
// 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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue