Tx wraps sql.Tx to provide prepared statement caching for transaction queries
| 253 | |
| 254 | // Tx wraps sql.Tx to provide prepared statement caching for transaction queries |
| 255 | type Tx struct { |
| 256 | tx *sql.Tx |
| 257 | db *DB |
| 258 | ctx context.Context // context from BeginTx, used for commit/rollback |
| 259 | isWriteTx bool // true if this is a write transaction that needs serialized commit |
| 260 | unlockFn func() // function to unlock writerMu when transaction completes (write tx only) |
| 261 | unlockOnce sync.Once // ensures unlock happens only once |
| 262 | |
| 263 | // Track statements prepared during this transaction for promotion to DB cache after commit |
| 264 | txStmts map[string]struct{} // query -> struct{} (used as set to track which queries to cache) |
| 265 | tempTables map[string]struct{} // temp table names created/used in this transaction |
| 266 | txMu sync.Mutex // protects transaction-local cache metadata |
| 267 | } |
| 268 | |
| 269 | // markQueryForCaching records a successfully executed query for post-commit |
| 270 | // statement promotion and tracks temp-table lifecycle within the transaction. |
nothing calls this directly
no outgoing calls
no test coverage detected