mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 10:50:54 +00:00
Nil check
This commit is contained in:
parent
2ae480556d
commit
f508f8d959
@ -523,8 +523,13 @@ func (o *orm) Driver() Driver {
|
||||
}
|
||||
|
||||
// return sql.DBStats for current database
|
||||
func (o *orm) DBStats() sql.DBStats {
|
||||
return o.alias.DB.Stats()
|
||||
func (o *orm) DBStats() *sql.DBStats {
|
||||
if o.alias != nil && o.alias.DB != nil {
|
||||
stats := o.alias.DB.Stats()
|
||||
return &stats
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewOrm create new orm
|
||||
|
@ -128,7 +128,7 @@ type Ormer interface {
|
||||
// // update user testing's name to slene
|
||||
Raw(query string, args ...interface{}) RawSeter
|
||||
Driver() Driver
|
||||
DBStats() sql.DBStats
|
||||
DBStats() *sql.DBStats
|
||||
}
|
||||
|
||||
// Inserter insert prepared statement
|
||||
|
Loading…
Reference in New Issue
Block a user