expose sql.DB to let orm operate on it (#1015)
* expose sql.DB to let orm operate on it * add missing RawDB methods * add NewSqlConnFromDB for cooperate with dtm
This commit is contained in:
@@ -13,6 +13,7 @@ type (
|
||||
MockConn struct {
|
||||
db *sql.DB
|
||||
}
|
||||
|
||||
statement struct {
|
||||
stmt *sql.Stmt
|
||||
}
|
||||
@@ -62,6 +63,11 @@ func (conn *MockConn) QueryRowsPartial(v interface{}, q string, args ...interfac
|
||||
}, q, args...)
|
||||
}
|
||||
|
||||
// RawDB returns the underlying sql.DB.
|
||||
func (conn *MockConn) RawDB() (*sql.DB, error) {
|
||||
return conn.db, nil
|
||||
}
|
||||
|
||||
// Transact is the implemention of sqlx.SqlConn, nothing to do
|
||||
func (conn *MockConn) Transact(func(session sqlx.Session) error) error {
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user