Source File
stmtcacher.go
Belonging Package
github.com/Masterminds/squirrel
package squirrel
import (
)
type DBProxy interface {
Execer
Queryer
QueryRower
Preparer
}
func ( *StmtCache) () ( error) {
.mu.Lock()
defer .mu.Unlock()
for , := range .cache {
delete(.cache, )
if == nil {
continue
}
if := .Close(); != nil {
=
}
}
if != nil {
return fmt.Errorf("one or more Stmt.Close failed; last error: %v", )
}
return
}
type DBProxyBeginner interface {
DBProxy
Begin() (*sql.Tx, error)
}
type stmtCacheProxy struct {
DBProxy
db *sql.DB
}
func ( *sql.DB) DBProxyBeginner {
return &stmtCacheProxy{DBProxy: NewStmtCache(), db: }
}
func ( *stmtCacheProxy) () (*sql.Tx, error) {
return .db.Begin()
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |