Debian Codegraph @

prepare_stmt.go

raw symbols SCIP
1 package gormscip-go gomod gorm.io/gorm . `gorm.io/gorm`/
2
3 import (
4 "contextscip-go gomod github.com/golang/go/src go1.18 context/"
5 "database/sqlscip-go gomod github.com/golang/go/src go1.18 `database/sql`/"
6 "database/sql/driverscip-go gomod github.com/golang/go/src go1.18 `database/sql/driver`/"
7 "errorsscip-go gomod github.com/golang/go/src go1.18 errors/"
8 "reflectscip-go gomod github.com/golang/go/src go1.18 reflect/"
9 "syncscip-go gomod github.com/golang/go/src go1.18 sync/"
10 "timescip-go gomod github.com/golang/go/src go1.18 time/"
11
12 "gorm.io/gorm/internal/stmt_storescip-go gomod gorm.io/gorm . `gorm.io/gorm/internal/stmt_store`/"
13 )
14
15 type PreparedStmtDBscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB# struct {
16 Stmtsscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#Stmts. stmt_storescip-go gomod gorm.io/gorm . `gorm.io/gorm/internal/stmt_store`/.Storescip-go gomod gorm.io/gorm . `gorm.io/gorm/internal/stmt_store`/Store#
17 Muxscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#Mux. *syncscip-go gomod github.com/golang/go/src go1.18 sync/.RWMutexscip-go gomod github.com/golang/go/src go1.18 sync/RWMutex#
18 ConnPoolscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#ConnPool.
19 }
20
21 // NewPreparedStmtDB creates and initializes a new instance of PreparedStmtDB.
22 //
23 // Parameters:
24 // - connPool: A connection pool that implements the ConnPool interface, used for managing database connections.
25 // - maxSize: The maximum number of prepared statements that can be stored in the statement store.
26 // - ttl: The time-to-live duration for each prepared statement in the store. Statements older than this duration will be automatically removed.
27 //
28 // Returns:
29 // - A pointer to a PreparedStmtDB instance, which manages prepared statements using the provided connection pool and configuration.
30 func NewPreparedStmtDBscip-go gomod gorm.io/gorm . `gorm.io/gorm`/NewPreparedStmtDB().(connPool ConnPoolscip-go gomod gorm.io/gorm . `gorm.io/gorm`/ConnPool#, maxSize int, ttl timescip-go gomod github.com/golang/go/src go1.18 time/.Durationscip-go gomod github.com/golang/go/src go1.18 time/Duration#) *PreparedStmtDBscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB# {
31 return &PreparedStmtDBscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#{
32 ConnPoolscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#ConnPool.: connPool, // Assigns the provided connection pool to manage database connections.
33 Stmtsscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#Stmts.: stmt_storescip-go gomod gorm.io/gorm . `gorm.io/gorm/internal/stmt_store`/.Newscip-go gomod gorm.io/gorm . `gorm.io/gorm/internal/stmt_store`/New().(maxSize, ttl), // Initializes a new statement store with the specified maximum size and TTL.
34 Muxscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#Mux.: &syncscip-go gomod github.com/golang/go/src go1.18 sync/.RWMutexscip-go gomod github.com/golang/go/src go1.18 sync/RWMutex#{}, // Sets up a read-write mutex for synchronizing access to the statement store.
35 }
36 }
37
38 // GetDBConn returns the underlying *sql.DB connection
39 func (db *PreparedStmtDBscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#) GetDBConnscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#GetDBConn().() (*sqlscip-go gomod github.com/golang/go/src go1.18 `database/sql`/.DBscip-go gomod github.com/golang/go/src go1.18 `database/sql`/DB#, error) {
40 if sqldb, ok := db.ConnPoolscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#ConnPool..(*sqlscip-go gomod github.com/golang/go/src go1.18 `database/sql`/.DBscip-go gomod github.com/golang/go/src go1.18 `database/sql`/DB#); ok {
41 return sqldb, nil
42 }
43
44 if dbConnector, ok := db.ConnPoolscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#ConnPool..(GetDBConnectorscip-go gomod gorm.io/gorm . `gorm.io/gorm`/GetDBConnector#); ok && dbConnector != nil {
45 return dbConnector.GetDBConnscip-go gomod gorm.io/gorm . `gorm.io/gorm`/GetDBConnector#GetDBConn.()
46 }
47
48 return nil, ErrInvalidDBscip-go gomod gorm.io/gorm . `gorm.io/gorm`/ErrInvalidDB.
49 }
50
51 // Close closes all prepared statements in the store
52 func (db *PreparedStmtDBscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#) Closescip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#Close().() {
53 db.Muxscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#Mux..Lockscip-go gomod github.com/golang/go/src go1.18 sync/RWMutex#Lock().()
54 defer db.Muxscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#Mux..Unlockscip-go gomod github.com/golang/go/src go1.18 sync/RWMutex#Unlock().()
55
56 for _, key := range db.Stmtsscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#Stmts..Keysscip-go gomod gorm.io/gorm . `gorm.io/gorm/internal/stmt_store`/Store#Keys.() {
57 db.Stmtsscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#Stmts..Deletescip-go gomod gorm.io/gorm . `gorm.io/gorm/internal/stmt_store`/Store#Delete.(key)
58 }
59 }
60
61 // Reset Deprecated use Close instead
62 func (db *PreparedStmtDBscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#) Resetscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#Reset().() {
63 db.Closescip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#Close().()
64 }
65
66 func (db *PreparedStmtDBscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#) preparescip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#prepare().(ctx contextscip-go gomod github.com/golang/go/src go1.18 context/.Contextscip-go gomod github.com/golang/go/src go1.18 context/Context#, conn ConnPoolscip-go gomod gorm.io/gorm . `gorm.io/gorm`/ConnPool#, isTransaction bool, query string) (_ *stmt_storescip-go gomod gorm.io/gorm . `gorm.io/gorm/internal/stmt_store`/.Stmtscip-go gomod gorm.io/gorm . `gorm.io/gorm/internal/stmt_store`/Stmt#, err error) {
67 db.Muxscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#Mux..RLockscip-go gomod github.com/golang/go/src go1.18 sync/RWMutex#RLock().()
68 if db.Stmtsscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#Stmts. != nil {
69 if stmt, ok := db.Stmtsscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#Stmts..Getscip-go gomod gorm.io/gorm . `gorm.io/gorm/internal/stmt_store`/Store#Get.(query); ok && (!stmt.Transactionscip-go gomod gorm.io/gorm . `gorm.io/gorm/internal/stmt_store`/Stmt#Transaction. || isTransaction) {
70 db.Muxscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#Mux..RUnlockscip-go gomod github.com/golang/go/src go1.18 sync/RWMutex#RUnlock().()
71 return stmt, stmt.Errorscip-go gomod gorm.io/gorm . `gorm.io/gorm/internal/stmt_store`/Stmt#Error().()
72 }
73 }
74 db.Muxscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#Mux..RUnlockscip-go gomod github.com/golang/go/src go1.18 sync/RWMutex#RUnlock().()
75
76 // retry
77 db.Muxscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#Mux..Lockscip-go gomod github.com/golang/go/src go1.18 sync/RWMutex#Lock().()
78 if db.Stmtsscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#Stmts. != nil {
79 if stmt, ok := db.Stmtsscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#Stmts..Getscip-go gomod gorm.io/gorm . `gorm.io/gorm/internal/stmt_store`/Store#Get.(query); ok && (!stmt.Transactionscip-go gomod gorm.io/gorm . `gorm.io/gorm/internal/stmt_store`/Stmt#Transaction. || isTransaction) {
80 db.Muxscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#Mux..Unlockscip-go gomod github.com/golang/go/src go1.18 sync/RWMutex#Unlock().()
81 return stmt, stmt.Errorscip-go gomod gorm.io/gorm . `gorm.io/gorm/internal/stmt_store`/Stmt#Error().()
82 }
83 }
84
85 return db.Stmtsscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#Stmts..Newscip-go gomod gorm.io/gorm . `gorm.io/gorm/internal/stmt_store`/Store#New.(ctx, query, isTransaction, conn, db.Muxscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#Mux.)
86 }
87
88 func (db *PreparedStmtDBscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#) BeginTxscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#BeginTx().(ctx contextscip-go gomod github.com/golang/go/src go1.18 context/.Contextscip-go gomod github.com/golang/go/src go1.18 context/Context#, opt *sqlscip-go gomod github.com/golang/go/src go1.18 `database/sql`/.TxOptionsscip-go gomod github.com/golang/go/src go1.18 `database/sql`/TxOptions#) (ConnPoolscip-go gomod gorm.io/gorm . `gorm.io/gorm`/ConnPool#, error) {
89 if beginner, ok := db.ConnPoolscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#ConnPool..(TxBeginnerscip-go gomod gorm.io/gorm . `gorm.io/gorm`/TxBeginner#); ok {
90 tx, err := beginner.BeginTxscip-go gomod gorm.io/gorm . `gorm.io/gorm`/TxBeginner#BeginTx.(ctx, opt)
91 return &PreparedStmtTXscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtTX#{PreparedStmtDBscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtTX#PreparedStmtDB.: db, Txscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtTX#Tx.: tx}, err
92 }
93
94 beginner, ok := db.ConnPoolscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#ConnPool..(ConnPoolBeginnerscip-go gomod gorm.io/gorm . `gorm.io/gorm`/ConnPoolBeginner#)
95 if !ok {
96 return nil, ErrInvalidTransactionscip-go gomod gorm.io/gorm . `gorm.io/gorm`/ErrInvalidTransaction.
97 }
98
99 connPool, err := beginner.BeginTxscip-go gomod gorm.io/gorm . `gorm.io/gorm`/ConnPoolBeginner#BeginTx.(ctx, opt)
100 if err != nil {
101 return nil, err
102 }
103 if tx, ok := connPool.(Txscip-go gomod gorm.io/gorm . `gorm.io/gorm`/Tx#); ok {
104 return &PreparedStmtTXscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtTX#{PreparedStmtDBscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtTX#PreparedStmtDB.: db, Txscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtTX#Tx.: tx}, nil
105 }
106 return nil, ErrInvalidTransactionscip-go gomod gorm.io/gorm . `gorm.io/gorm`/ErrInvalidTransaction.
107 }
108
109 func (db *PreparedStmtDBscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#) ExecContextscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#ExecContext().(ctx contextscip-go gomod github.com/golang/go/src go1.18 context/.Contextscip-go gomod github.com/golang/go/src go1.18 context/Context#, query string, args ...interface{}) (result sqlscip-go gomod github.com/golang/go/src go1.18 `database/sql`/.Resultscip-go gomod github.com/golang/go/src go1.18 `database/sql`/Result#, err error) {
110 stmt, err := db.preparescip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#prepare().(ctx, db.ConnPoolscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#ConnPool., false, query)
111 if err == nil {
112 result, err = stmt.ExecContextscip-go gomod github.com/golang/go/src go1.18 `database/sql`/Stmt#ExecContext().(ctx, args...)
113 if errorsscip-go gomod github.com/golang/go/src go1.18 errors/.Isscip-go gomod github.com/golang/go/src go1.18 errors/Is().(err, driverscip-go gomod github.com/golang/go/src go1.18 `database/sql/driver`/.ErrBadConnscip-go gomod github.com/golang/go/src go1.18 `database/sql/driver`/ErrBadConn.) {
114 db.Stmtsscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#Stmts..Deletescip-go gomod gorm.io/gorm . `gorm.io/gorm/internal/stmt_store`/Store#Delete.(query)
115 }
116 }
117 return result, err
118 }
119
120 func (db *PreparedStmtDBscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#) QueryContextscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#QueryContext().(ctx contextscip-go gomod github.com/golang/go/src go1.18 context/.Contextscip-go gomod github.com/golang/go/src go1.18 context/Context#, query string, args ...interface{}) (rows *sqlscip-go gomod github.com/golang/go/src go1.18 `database/sql`/.Rowsscip-go gomod github.com/golang/go/src go1.18 `database/sql`/Rows#, err error) {
121 stmt, err := db.preparescip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#prepare().(ctx, db.ConnPoolscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#ConnPool., false, query)
122 if err == nil {
123 rows, err = stmt.QueryContextscip-go gomod github.com/golang/go/src go1.18 `database/sql`/Stmt#QueryContext().(ctx, args...)
124 if errorsscip-go gomod github.com/golang/go/src go1.18 errors/.Isscip-go gomod github.com/golang/go/src go1.18 errors/Is().(err, driverscip-go gomod github.com/golang/go/src go1.18 `database/sql/driver`/.ErrBadConnscip-go gomod github.com/golang/go/src go1.18 `database/sql/driver`/ErrBadConn.) {
125 db.Stmtsscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#Stmts..Deletescip-go gomod gorm.io/gorm . `gorm.io/gorm/internal/stmt_store`/Store#Delete.(query)
126 }
127 }
128 return rows, err
129 }
130
131 func (db *PreparedStmtDBscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#) QueryRowContextscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#QueryRowContext().(ctx contextscip-go gomod github.com/golang/go/src go1.18 context/.Contextscip-go gomod github.com/golang/go/src go1.18 context/Context#, query string, args ...interface{}) *sqlscip-go gomod github.com/golang/go/src go1.18 `database/sql`/.Rowscip-go gomod github.com/golang/go/src go1.18 `database/sql`/Row# {
132 stmt, err := db.preparescip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#prepare().(ctx, db.ConnPoolscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#ConnPool., false, query)
133 if err == nil {
134 return stmt.QueryRowContextscip-go gomod github.com/golang/go/src go1.18 `database/sql`/Stmt#QueryRowContext().(ctx, args...)
135 }
136 return &sqlscip-go gomod github.com/golang/go/src go1.18 `database/sql`/.Rowscip-go gomod github.com/golang/go/src go1.18 `database/sql`/Row#{}
137 }
138
139 func (db *PreparedStmtDBscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#) Pingscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#Ping().() error {
140 conn, err := db.GetDBConnscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#GetDBConn().()
141 if err != nil {
142 return err
143 }
144 return conn.Pingscip-go gomod github.com/golang/go/src go1.18 `database/sql`/DB#Ping().()
145 }
146
147 type PreparedStmtTXscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtTX# struct {
148 Txscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtTX#Tx.
149 PreparedStmtDBscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtTX#PreparedStmtDB. *PreparedStmtDBscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#
150 }
151
152 func (db *PreparedStmtTXscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtTX#) GetDBConnscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtTX#GetDBConn().() (*sqlscip-go gomod github.com/golang/go/src go1.18 `database/sql`/.DBscip-go gomod github.com/golang/go/src go1.18 `database/sql`/DB#, error) {
153 return db.PreparedStmtDBscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtTX#PreparedStmtDB..GetDBConnscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#GetDBConn().()
154 }
155
156 func (tx *PreparedStmtTXscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtTX#) Commitscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtTX#Commit().() error {
157 if tx.Txscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtTX#Tx. != nil && !reflectscip-go gomod github.com/golang/go/src go1.18 reflect/.ValueOfscip-go gomod github.com/golang/go/src go1.18 reflect/ValueOf().(tx.Txscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtTX#Tx.).IsNilscip-go gomod github.com/golang/go/src go1.18 reflect/Value#IsNil().() {
158 return tx.Txscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtTX#Tx..Commitscip-go gomod gorm.io/gorm . `gorm.io/gorm`/TxCommitter#Commit.()
159 }
160 return ErrInvalidTransactionscip-go gomod gorm.io/gorm . `gorm.io/gorm`/ErrInvalidTransaction.
161 }
162
163 func (tx *PreparedStmtTXscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtTX#) Rollbackscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtTX#Rollback().() error {
164 if tx.Txscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtTX#Tx. != nil && !reflectscip-go gomod github.com/golang/go/src go1.18 reflect/.ValueOfscip-go gomod github.com/golang/go/src go1.18 reflect/ValueOf().(tx.Txscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtTX#Tx.).IsNilscip-go gomod github.com/golang/go/src go1.18 reflect/Value#IsNil().() {
165 return tx.Txscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtTX#Tx..Rollbackscip-go gomod gorm.io/gorm . `gorm.io/gorm`/TxCommitter#Rollback.()
166 }
167 return ErrInvalidTransactionscip-go gomod gorm.io/gorm . `gorm.io/gorm`/ErrInvalidTransaction.
168 }
169
170 func (tx *PreparedStmtTXscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtTX#) ExecContextscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtTX#ExecContext().(ctx contextscip-go gomod github.com/golang/go/src go1.18 context/.Contextscip-go gomod github.com/golang/go/src go1.18 context/Context#, query string, args ...interface{}) (result sqlscip-go gomod github.com/golang/go/src go1.18 `database/sql`/.Resultscip-go gomod github.com/golang/go/src go1.18 `database/sql`/Result#, err error) {
171 stmt, err := tx.PreparedStmtDBscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtTX#PreparedStmtDB..preparescip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#prepare().(ctx, tx.Txscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtTX#Tx., true, query)
172 if err == nil {
173 result, err = tx.Txscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtTX#Tx..StmtContextscip-go gomod gorm.io/gorm . `gorm.io/gorm`/Tx#StmtContext.(ctx, stmt.Stmtscip-go gomod gorm.io/gorm . `gorm.io/gorm/internal/stmt_store`/Stmt#Stmt.).ExecContextscip-go gomod github.com/golang/go/src go1.18 `database/sql`/Stmt#ExecContext().(ctx, args...)
174 if errorsscip-go gomod github.com/golang/go/src go1.18 errors/.Isscip-go gomod github.com/golang/go/src go1.18 errors/Is().(err, driverscip-go gomod github.com/golang/go/src go1.18 `database/sql/driver`/.ErrBadConnscip-go gomod github.com/golang/go/src go1.18 `database/sql/driver`/ErrBadConn.) {
175 tx.PreparedStmtDBscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtTX#PreparedStmtDB..Stmtsscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#Stmts..Deletescip-go gomod gorm.io/gorm . `gorm.io/gorm/internal/stmt_store`/Store#Delete.(query)
176 }
177 }
178 return result, err
179 }
180
181 func (tx *PreparedStmtTXscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtTX#) QueryContextscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtTX#QueryContext().(ctx contextscip-go gomod github.com/golang/go/src go1.18 context/.Contextscip-go gomod github.com/golang/go/src go1.18 context/Context#, query string, args ...interface{}) (rows *sqlscip-go gomod github.com/golang/go/src go1.18 `database/sql`/.Rowsscip-go gomod github.com/golang/go/src go1.18 `database/sql`/Rows#, err error) {
182 stmt, err := tx.PreparedStmtDBscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtTX#PreparedStmtDB..preparescip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#prepare().(ctx, tx.Txscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtTX#Tx., true, query)
183 if err == nil {
184 rows, err = tx.Txscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtTX#Tx..StmtContextscip-go gomod gorm.io/gorm . `gorm.io/gorm`/Tx#StmtContext.(ctx, stmt.Stmtscip-go gomod gorm.io/gorm . `gorm.io/gorm/internal/stmt_store`/Stmt#Stmt.).QueryContextscip-go gomod github.com/golang/go/src go1.18 `database/sql`/Stmt#QueryContext().(ctx, args...)
185 if errorsscip-go gomod github.com/golang/go/src go1.18 errors/.Isscip-go gomod github.com/golang/go/src go1.18 errors/Is().(err, driverscip-go gomod github.com/golang/go/src go1.18 `database/sql/driver`/.ErrBadConnscip-go gomod github.com/golang/go/src go1.18 `database/sql/driver`/ErrBadConn.) {
186 tx.PreparedStmtDBscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtTX#PreparedStmtDB..Stmtsscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#Stmts..Deletescip-go gomod gorm.io/gorm . `gorm.io/gorm/internal/stmt_store`/Store#Delete.(query)
187 }
188 }
189 return rows, err
190 }
191
192 func (tx *PreparedStmtTXscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtTX#) QueryRowContextscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtTX#QueryRowContext().(ctx contextscip-go gomod github.com/golang/go/src go1.18 context/.Contextscip-go gomod github.com/golang/go/src go1.18 context/Context#, query string, args ...interface{}) *sqlscip-go gomod github.com/golang/go/src go1.18 `database/sql`/.Rowscip-go gomod github.com/golang/go/src go1.18 `database/sql`/Row# {
193 stmt, err := tx.PreparedStmtDBscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtTX#PreparedStmtDB..preparescip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtDB#prepare().(ctx, tx.Txscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtTX#Tx., true, query)
194 if err == nil {
195 return tx.Txscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtTX#Tx..StmtContextscip-go gomod gorm.io/gorm . `gorm.io/gorm`/Tx#StmtContext.(ctx, stmt.Stmtscip-go gomod gorm.io/gorm . `gorm.io/gorm/internal/stmt_store`/Stmt#Stmt.).QueryRowContextscip-go gomod github.com/golang/go/src go1.18 `database/sql`/Stmt#QueryRowContext().(ctx, args...)
196 }
197 return &sqlscip-go gomod github.com/golang/go/src go1.18 `database/sql`/.Rowscip-go gomod github.com/golang/go/src go1.18 `database/sql`/Row#{}
198 }
199
200 func (tx *PreparedStmtTXscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtTX#) Pingscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtTX#Ping().() error {
201 conn, err := tx.GetDBConnscip-go gomod gorm.io/gorm . `gorm.io/gorm`/PreparedStmtTX#GetDBConn().()
202 if err != nil {
203 return err
204 }
205 return conn.Pingscip-go gomod github.com/golang/go/src go1.18 `database/sql`/DB#Ping().()
206 }