MCPcopy
hub / github.com/go-gorm/gorm / GetDBConn

Method GetDBConn

prepare_stmt.go:39–49  ·  view source on GitHub ↗

GetDBConn returns the underlying *sql.DB connection

()

Source from the content-addressed store, hash-verified

37
38// GetDBConn returns the underlying *sql.DB connection
39func (db *PreparedStmtDB) GetDBConn() (*sql.DB, error) {
40 if sqldb, ok := db.ConnPool.(*sql.DB); ok {
41 return sqldb, nil
42 }
43
44 if dbConnector, ok := db.ConnPool.(GetDBConnector); ok && dbConnector != nil {
45 return dbConnector.GetDBConn()
46 }
47
48 return nil, ErrInvalidDB
49}
50
51// Close closes all prepared statements in the store
52func (db *PreparedStmtDB) Close() {

Callers 1

PingMethod · 0.95

Calls 1

GetDBConnMethod · 0.65

Tested by

no test coverage detected