mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-12-04 01:42:33 +01:00
graph/db: freeze sql migration queries
This commit is contained in:
@@ -37,6 +37,7 @@ import (
|
|||||||
"github.com/lightningnetwork/lnd/funding"
|
"github.com/lightningnetwork/lnd/funding"
|
||||||
graphdb "github.com/lightningnetwork/lnd/graph/db"
|
graphdb "github.com/lightningnetwork/lnd/graph/db"
|
||||||
graphdbmig1 "github.com/lightningnetwork/lnd/graph/db/migration1"
|
graphdbmig1 "github.com/lightningnetwork/lnd/graph/db/migration1"
|
||||||
|
graphmig1sqlc "github.com/lightningnetwork/lnd/graph/db/migration1/sqlc"
|
||||||
"github.com/lightningnetwork/lnd/htlcswitch"
|
"github.com/lightningnetwork/lnd/htlcswitch"
|
||||||
"github.com/lightningnetwork/lnd/invoices"
|
"github.com/lightningnetwork/lnd/invoices"
|
||||||
"github.com/lightningnetwork/lnd/keychain"
|
"github.com/lightningnetwork/lnd/keychain"
|
||||||
@@ -1141,7 +1142,8 @@ func (d *DefaultDatabaseBuilder) BuildDatabase(
|
|||||||
QueryCfg: queryCfg,
|
QueryCfg: queryCfg,
|
||||||
}
|
}
|
||||||
err := graphdbmig1.MigrateGraphToSQL(
|
err := graphdbmig1.MigrateGraphToSQL(
|
||||||
ctx, cfg, dbs.ChanStateDB.Backend, tx,
|
ctx, cfg, dbs.ChanStateDB.Backend,
|
||||||
|
graphmig1sqlc.New(tx.GetTx()),
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to migrate "+
|
return fmt.Errorf("failed to migrate "+
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ import (
|
|||||||
|
|
||||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||||
"github.com/lightningnetwork/lnd/graph/db/migration1/models"
|
"github.com/lightningnetwork/lnd/graph/db/migration1/models"
|
||||||
|
"github.com/lightningnetwork/lnd/graph/db/migration1/sqlc"
|
||||||
"github.com/lightningnetwork/lnd/kvdb"
|
"github.com/lightningnetwork/lnd/kvdb"
|
||||||
"github.com/lightningnetwork/lnd/lnwire"
|
"github.com/lightningnetwork/lnd/lnwire"
|
||||||
"github.com/lightningnetwork/lnd/routing/route"
|
"github.com/lightningnetwork/lnd/routing/route"
|
||||||
"github.com/lightningnetwork/lnd/sqldb"
|
"github.com/lightningnetwork/lnd/sqldb"
|
||||||
"github.com/lightningnetwork/lnd/sqldb/sqlc"
|
|
||||||
"golang.org/x/time/rate"
|
"golang.org/x/time/rate"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -17,10 +17,10 @@ import (
|
|||||||
"github.com/btcsuite/btcd/wire"
|
"github.com/btcsuite/btcd/wire"
|
||||||
"github.com/lightningnetwork/lnd/fn/v2"
|
"github.com/lightningnetwork/lnd/fn/v2"
|
||||||
"github.com/lightningnetwork/lnd/graph/db/migration1/models"
|
"github.com/lightningnetwork/lnd/graph/db/migration1/models"
|
||||||
|
"github.com/lightningnetwork/lnd/graph/db/migration1/sqlc"
|
||||||
"github.com/lightningnetwork/lnd/lnwire"
|
"github.com/lightningnetwork/lnd/lnwire"
|
||||||
"github.com/lightningnetwork/lnd/routing/route"
|
"github.com/lightningnetwork/lnd/routing/route"
|
||||||
"github.com/lightningnetwork/lnd/sqldb"
|
"github.com/lightningnetwork/lnd/sqldb"
|
||||||
"github.com/lightningnetwork/lnd/sqldb/sqlc"
|
|
||||||
"github.com/lightningnetwork/lnd/tlv"
|
"github.com/lightningnetwork/lnd/tlv"
|
||||||
"github.com/lightningnetwork/lnd/tor"
|
"github.com/lightningnetwork/lnd/tor"
|
||||||
)
|
)
|
||||||
|
|||||||
31
graph/db/migration1/sqlc/db.go
Normal file
31
graph/db/migration1/sqlc/db.go
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
// Code generated by sqlc. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// sqlc v1.29.0
|
||||||
|
|
||||||
|
package sqlc
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"database/sql"
|
||||||
|
)
|
||||||
|
|
||||||
|
type DBTX interface {
|
||||||
|
ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
|
||||||
|
PrepareContext(context.Context, string) (*sql.Stmt, error)
|
||||||
|
QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
|
||||||
|
QueryRowContext(context.Context, string, ...interface{}) *sql.Row
|
||||||
|
}
|
||||||
|
|
||||||
|
func New(db DBTX) *Queries {
|
||||||
|
return &Queries{db: db}
|
||||||
|
}
|
||||||
|
|
||||||
|
type Queries struct {
|
||||||
|
db DBTX
|
||||||
|
}
|
||||||
|
|
||||||
|
func (q *Queries) WithTx(tx *sql.Tx) *Queries {
|
||||||
|
return &Queries{
|
||||||
|
db: tx,
|
||||||
|
}
|
||||||
|
}
|
||||||
163
graph/db/migration1/sqlc/db_custom.go
Normal file
163
graph/db/migration1/sqlc/db_custom.go
Normal file
@@ -0,0 +1,163 @@
|
|||||||
|
package sqlc
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
// makeQueryParams generates a string of query parameters for a SQL query. It is
|
||||||
|
// meant to replace the `?` placeholders in a SQL query with numbered parameters
|
||||||
|
// like `$1`, `$2`, etc. This is required for the sqlc /*SLICE:<field_name>*/
|
||||||
|
// workaround. See scripts/gen_sqlc_docker.sh for more details.
|
||||||
|
func makeQueryParams(numTotalArgs, numListArgs int) string {
|
||||||
|
if numListArgs == 0 {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
var b strings.Builder
|
||||||
|
|
||||||
|
// Pre-allocate a rough estimation of the buffer size to avoid
|
||||||
|
// re-allocations. A parameter like $1000, takes 6 bytes.
|
||||||
|
b.Grow(numListArgs * 6)
|
||||||
|
|
||||||
|
diff := numTotalArgs - numListArgs
|
||||||
|
for i := 0; i < numListArgs; i++ {
|
||||||
|
if i > 0 {
|
||||||
|
// We don't need to check the error here because the
|
||||||
|
// WriteString method of strings.Builder always returns
|
||||||
|
// nil.
|
||||||
|
_, _ = b.WriteString(",")
|
||||||
|
}
|
||||||
|
|
||||||
|
// We don't need to check the error here because the
|
||||||
|
// Write method (called by fmt.Fprintf) of strings.Builder
|
||||||
|
// always returns nil.
|
||||||
|
_, _ = fmt.Fprintf(&b, "$%d", i+diff+1)
|
||||||
|
}
|
||||||
|
|
||||||
|
return b.String()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ChannelAndNodes is an interface that provides access to a channel and its
|
||||||
|
// two nodes.
|
||||||
|
type ChannelAndNodes interface {
|
||||||
|
// Channel returns the GraphChannel associated with this interface.
|
||||||
|
Channel() GraphChannel
|
||||||
|
|
||||||
|
// Node1 returns the first GraphNode associated with this channel.
|
||||||
|
Node1() GraphNode
|
||||||
|
|
||||||
|
// Node2 returns the second GraphNode associated with this channel.
|
||||||
|
Node2() GraphNode
|
||||||
|
}
|
||||||
|
|
||||||
|
// Channel returns the GraphChannel associated with this interface.
|
||||||
|
//
|
||||||
|
// NOTE: This method is part of the ChannelAndNodes interface.
|
||||||
|
func (r GetChannelsByPolicyLastUpdateRangeRow) Channel() GraphChannel {
|
||||||
|
return r.GraphChannel
|
||||||
|
}
|
||||||
|
|
||||||
|
// Node1 returns the first GraphNode associated with this channel.
|
||||||
|
//
|
||||||
|
// NOTE: This method is part of the ChannelAndNodes interface.
|
||||||
|
func (r GetChannelsByPolicyLastUpdateRangeRow) Node1() GraphNode {
|
||||||
|
return r.GraphNode
|
||||||
|
}
|
||||||
|
|
||||||
|
// Node2 returns the second GraphNode associated with this channel.
|
||||||
|
//
|
||||||
|
// NOTE: This method is part of the ChannelAndNodes interface.
|
||||||
|
func (r GetChannelsByPolicyLastUpdateRangeRow) Node2() GraphNode {
|
||||||
|
return r.GraphNode_2
|
||||||
|
}
|
||||||
|
|
||||||
|
// ChannelAndNodeIDs is an interface that provides access to a channel and its
|
||||||
|
// two node public keys.
|
||||||
|
type ChannelAndNodeIDs interface {
|
||||||
|
// Channel returns the GraphChannel associated with this interface.
|
||||||
|
Channel() GraphChannel
|
||||||
|
|
||||||
|
// Node1Pub returns the public key of the first node as a byte slice.
|
||||||
|
Node1Pub() []byte
|
||||||
|
|
||||||
|
// Node2Pub returns the public key of the second node as a byte slice.
|
||||||
|
Node2Pub() []byte
|
||||||
|
}
|
||||||
|
|
||||||
|
// Channel returns the GraphChannel associated with this interface.
|
||||||
|
//
|
||||||
|
// NOTE: This method is part of the ChannelAndNodeIDs interface.
|
||||||
|
func (r GetChannelsBySCIDWithPoliciesRow) Channel() GraphChannel {
|
||||||
|
return r.GraphChannel
|
||||||
|
}
|
||||||
|
|
||||||
|
// Node1Pub returns the public key of the first node as a byte slice.
|
||||||
|
//
|
||||||
|
// NOTE: This method is part of the ChannelAndNodeIDs interface.
|
||||||
|
func (r GetChannelsBySCIDWithPoliciesRow) Node1Pub() []byte {
|
||||||
|
return r.GraphNode.PubKey
|
||||||
|
}
|
||||||
|
|
||||||
|
// Node2Pub returns the public key of the second node as a byte slice.
|
||||||
|
//
|
||||||
|
// NOTE: This method is part of the ChannelAndNodeIDs interface.
|
||||||
|
func (r GetChannelsBySCIDWithPoliciesRow) Node2Pub() []byte {
|
||||||
|
return r.GraphNode_2.PubKey
|
||||||
|
}
|
||||||
|
|
||||||
|
// Node1 returns the first GraphNode associated with this channel.
|
||||||
|
//
|
||||||
|
// NOTE: This method is part of the ChannelAndNodes interface.
|
||||||
|
func (r GetChannelsBySCIDWithPoliciesRow) Node1() GraphNode {
|
||||||
|
return r.GraphNode
|
||||||
|
}
|
||||||
|
|
||||||
|
// Node2 returns the second GraphNode associated with this channel.
|
||||||
|
//
|
||||||
|
// NOTE: This method is part of the ChannelAndNodes interface.
|
||||||
|
func (r GetChannelsBySCIDWithPoliciesRow) Node2() GraphNode {
|
||||||
|
return r.GraphNode_2
|
||||||
|
}
|
||||||
|
|
||||||
|
// Channel returns the GraphChannel associated with this interface.
|
||||||
|
//
|
||||||
|
// NOTE: This method is part of the ChannelAndNodeIDs interface.
|
||||||
|
func (r GetChannelsByOutpointsRow) Channel() GraphChannel {
|
||||||
|
return r.GraphChannel
|
||||||
|
}
|
||||||
|
|
||||||
|
// Node1Pub returns the public key of the first node as a byte slice.
|
||||||
|
//
|
||||||
|
// NOTE: This method is part of the ChannelAndNodeIDs interface.
|
||||||
|
func (r GetChannelsByOutpointsRow) Node1Pub() []byte {
|
||||||
|
return r.Node1Pubkey
|
||||||
|
}
|
||||||
|
|
||||||
|
// Node2Pub returns the public key of the second node as a byte slice.
|
||||||
|
//
|
||||||
|
// NOTE: This method is part of the ChannelAndNodeIDs interface.
|
||||||
|
func (r GetChannelsByOutpointsRow) Node2Pub() []byte {
|
||||||
|
return r.Node2Pubkey
|
||||||
|
}
|
||||||
|
|
||||||
|
// Channel returns the GraphChannel associated with this interface.
|
||||||
|
//
|
||||||
|
// NOTE: This method is part of the ChannelAndNodeIDs interface.
|
||||||
|
func (r GetChannelsBySCIDRangeRow) Channel() GraphChannel {
|
||||||
|
return r.GraphChannel
|
||||||
|
}
|
||||||
|
|
||||||
|
// Node1Pub returns the public key of the first node as a byte slice.
|
||||||
|
//
|
||||||
|
// NOTE: This method is part of the ChannelAndNodeIDs interface.
|
||||||
|
func (r GetChannelsBySCIDRangeRow) Node1Pub() []byte {
|
||||||
|
return r.Node1PubKey
|
||||||
|
}
|
||||||
|
|
||||||
|
// Node2Pub returns the public key of the second node as a byte slice.
|
||||||
|
//
|
||||||
|
// NOTE: This method is part of the ChannelAndNodeIDs interface.
|
||||||
|
func (r GetChannelsBySCIDRangeRow) Node2Pub() []byte {
|
||||||
|
return r.Node2PubKey
|
||||||
|
}
|
||||||
3769
graph/db/migration1/sqlc/graph.sql.go
Normal file
3769
graph/db/migration1/sqlc/graph.sql.go
Normal file
File diff suppressed because it is too large
Load Diff
109
graph/db/migration1/sqlc/models.go
Normal file
109
graph/db/migration1/sqlc/models.go
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
// Code generated by sqlc. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// sqlc v1.29.0
|
||||||
|
|
||||||
|
package sqlc
|
||||||
|
|
||||||
|
import (
|
||||||
|
"database/sql"
|
||||||
|
)
|
||||||
|
|
||||||
|
type GraphChannel struct {
|
||||||
|
ID int64
|
||||||
|
Version int16
|
||||||
|
Scid []byte
|
||||||
|
NodeID1 int64
|
||||||
|
NodeID2 int64
|
||||||
|
Outpoint string
|
||||||
|
Capacity sql.NullInt64
|
||||||
|
BitcoinKey1 []byte
|
||||||
|
BitcoinKey2 []byte
|
||||||
|
Node1Signature []byte
|
||||||
|
Node2Signature []byte
|
||||||
|
Bitcoin1Signature []byte
|
||||||
|
Bitcoin2Signature []byte
|
||||||
|
}
|
||||||
|
|
||||||
|
type GraphChannelExtraType struct {
|
||||||
|
ChannelID int64
|
||||||
|
Type int64
|
||||||
|
Value []byte
|
||||||
|
}
|
||||||
|
|
||||||
|
type GraphChannelFeature struct {
|
||||||
|
ChannelID int64
|
||||||
|
FeatureBit int32
|
||||||
|
}
|
||||||
|
|
||||||
|
type GraphChannelPolicy struct {
|
||||||
|
ID int64
|
||||||
|
Version int16
|
||||||
|
ChannelID int64
|
||||||
|
NodeID int64
|
||||||
|
Timelock int32
|
||||||
|
FeePpm int64
|
||||||
|
BaseFeeMsat int64
|
||||||
|
MinHtlcMsat int64
|
||||||
|
MaxHtlcMsat sql.NullInt64
|
||||||
|
LastUpdate sql.NullInt64
|
||||||
|
Disabled sql.NullBool
|
||||||
|
InboundBaseFeeMsat sql.NullInt64
|
||||||
|
InboundFeeRateMilliMsat sql.NullInt64
|
||||||
|
MessageFlags sql.NullInt16
|
||||||
|
ChannelFlags sql.NullInt16
|
||||||
|
Signature []byte
|
||||||
|
}
|
||||||
|
|
||||||
|
type GraphChannelPolicyExtraType struct {
|
||||||
|
ChannelPolicyID int64
|
||||||
|
Type int64
|
||||||
|
Value []byte
|
||||||
|
}
|
||||||
|
|
||||||
|
type GraphClosedScid struct {
|
||||||
|
Scid []byte
|
||||||
|
}
|
||||||
|
|
||||||
|
type GraphNode struct {
|
||||||
|
ID int64
|
||||||
|
Version int16
|
||||||
|
PubKey []byte
|
||||||
|
Alias sql.NullString
|
||||||
|
LastUpdate sql.NullInt64
|
||||||
|
Color sql.NullString
|
||||||
|
Signature []byte
|
||||||
|
}
|
||||||
|
|
||||||
|
type GraphNodeAddress struct {
|
||||||
|
NodeID int64
|
||||||
|
Type int16
|
||||||
|
Position int32
|
||||||
|
Address string
|
||||||
|
}
|
||||||
|
|
||||||
|
type GraphNodeExtraType struct {
|
||||||
|
NodeID int64
|
||||||
|
Type int64
|
||||||
|
Value []byte
|
||||||
|
}
|
||||||
|
|
||||||
|
type GraphNodeFeature struct {
|
||||||
|
NodeID int64
|
||||||
|
FeatureBit int32
|
||||||
|
}
|
||||||
|
|
||||||
|
type GraphPruneLog struct {
|
||||||
|
BlockHeight int64
|
||||||
|
BlockHash []byte
|
||||||
|
}
|
||||||
|
|
||||||
|
type GraphSourceNode struct {
|
||||||
|
NodeID int64
|
||||||
|
}
|
||||||
|
|
||||||
|
type GraphZombieChannel struct {
|
||||||
|
Scid []byte
|
||||||
|
Version int16
|
||||||
|
NodeKey1 []byte
|
||||||
|
NodeKey2 []byte
|
||||||
|
}
|
||||||
@@ -3,10 +3,10 @@
|
|||||||
package migration1
|
package migration1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"database/sql"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/btcsuite/btcd/chaincfg"
|
"github.com/btcsuite/btcd/chaincfg"
|
||||||
|
"github.com/lightningnetwork/lnd/graph/db/migration1/sqlc"
|
||||||
"github.com/lightningnetwork/lnd/sqldb"
|
"github.com/lightningnetwork/lnd/sqldb"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
@@ -69,11 +69,10 @@ func newBatchQuerier(t testing.TB) BatchedSQLQueries {
|
|||||||
func newBatchQuerierWithFixture(t testing.TB,
|
func newBatchQuerierWithFixture(t testing.TB,
|
||||||
pgFixture *sqldb.TestPgFixture) BatchedSQLQueries {
|
pgFixture *sqldb.TestPgFixture) BatchedSQLQueries {
|
||||||
|
|
||||||
db := sqldb.NewTestPostgresDB(t, pgFixture).BaseDB
|
rawDB := sqldb.NewTestPostgresDB(t, pgFixture).BaseDB.DB
|
||||||
|
|
||||||
return sqldb.NewTransactionExecutor(
|
return &testBatchedSQLQueries{
|
||||||
db, func(tx *sql.Tx) SQLQueries {
|
db: rawDB,
|
||||||
return db.WithTx(tx)
|
Queries: sqlc.New(rawDB),
|
||||||
},
|
}
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|||||||
46
graph/db/migration1/test_sql.go
Normal file
46
graph/db/migration1/test_sql.go
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
//go:build test_db_postgres || test_db_sqlite
|
||||||
|
|
||||||
|
package migration1
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"database/sql"
|
||||||
|
|
||||||
|
"github.com/lightningnetwork/lnd/graph/db/migration1/sqlc"
|
||||||
|
"github.com/lightningnetwork/lnd/sqldb"
|
||||||
|
)
|
||||||
|
|
||||||
|
// testBatchedSQLQueries is a simple implementation of BatchedSQLQueries for
|
||||||
|
// testing.
|
||||||
|
type testBatchedSQLQueries struct {
|
||||||
|
db *sql.DB
|
||||||
|
*sqlc.Queries
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExecTx implements the transaction execution logic.
|
||||||
|
func (t *testBatchedSQLQueries) ExecTx(ctx context.Context,
|
||||||
|
txOpts sqldb.TxOptions, txBody func(SQLQueries) error,
|
||||||
|
reset func()) error {
|
||||||
|
|
||||||
|
sqlOptions := sql.TxOptions{
|
||||||
|
Isolation: sql.LevelSerializable,
|
||||||
|
ReadOnly: txOpts.ReadOnly(),
|
||||||
|
}
|
||||||
|
|
||||||
|
tx, err := t.db.BeginTx(ctx, &sqlOptions)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer func() {
|
||||||
|
if err != nil {
|
||||||
|
_ = tx.Rollback()
|
||||||
|
} else {
|
||||||
|
err = tx.Commit()
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
reset()
|
||||||
|
queries := sqlc.New(tx)
|
||||||
|
|
||||||
|
return txBody(queries)
|
||||||
|
}
|
||||||
@@ -3,10 +3,10 @@
|
|||||||
package migration1
|
package migration1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"database/sql"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/btcsuite/btcd/chaincfg"
|
"github.com/btcsuite/btcd/chaincfg"
|
||||||
|
"github.com/lightningnetwork/lnd/graph/db/migration1/sqlc"
|
||||||
"github.com/lightningnetwork/lnd/sqldb"
|
"github.com/lightningnetwork/lnd/sqldb"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
@@ -46,11 +46,10 @@ func newBatchQuerier(t testing.TB) BatchedSQLQueries {
|
|||||||
func newBatchQuerierWithFixture(t testing.TB,
|
func newBatchQuerierWithFixture(t testing.TB,
|
||||||
_ *sqldb.TestPgFixture) BatchedSQLQueries {
|
_ *sqldb.TestPgFixture) BatchedSQLQueries {
|
||||||
|
|
||||||
db := sqldb.NewTestSqliteDB(t).BaseDB
|
rawDB := sqldb.NewTestSqliteDB(t).BaseDB.DB
|
||||||
|
|
||||||
return sqldb.NewTransactionExecutor(
|
return &testBatchedSQLQueries{
|
||||||
db, func(tx *sql.Tx) SQLQueries {
|
db: rawDB,
|
||||||
return db.WithTx(tx)
|
Queries: sqlc.New(rawDB),
|
||||||
},
|
}
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,12 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// GetTx returns the underlying DBTX (either *sql.DB or *sql.Tx) used by the
|
||||||
|
// Queries struct.
|
||||||
|
func (q *Queries) GetTx() DBTX {
|
||||||
|
return q.db
|
||||||
|
}
|
||||||
|
|
||||||
// makeQueryParams generates a string of query parameters for a SQL query. It is
|
// makeQueryParams generates a string of query parameters for a SQL query. It is
|
||||||
// meant to replace the `?` placeholders in a SQL query with numbered parameters
|
// meant to replace the `?` placeholders in a SQL query with numbered parameters
|
||||||
// like `$1`, `$2`, etc. This is required for the sqlc /*SLICE:<field_name>*/
|
// like `$1`, `$2`, etc. This is required for the sqlc /*SLICE:<field_name>*/
|
||||||
|
|||||||
Reference in New Issue
Block a user