mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 22:30: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
|
// return sql.DBStats for current database
|
||||||
func (o *orm) DBStats() sql.DBStats {
|
func (o *orm) DBStats() *sql.DBStats {
|
||||||
return o.alias.DB.Stats()
|
if o.alias != nil && o.alias.DB != nil {
|
||||||
|
stats := o.alias.DB.Stats()
|
||||||
|
return &stats
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewOrm create new orm
|
// NewOrm create new orm
|
||||||
|
@ -128,7 +128,7 @@ type Ormer interface {
|
|||||||
// // update user testing's name to slene
|
// // update user testing's name to slene
|
||||||
Raw(query string, args ...interface{}) RawSeter
|
Raw(query string, args ...interface{}) RawSeter
|
||||||
Driver() Driver
|
Driver() Driver
|
||||||
DBStats() sql.DBStats
|
DBStats() *sql.DBStats
|
||||||
}
|
}
|
||||||
|
|
||||||
// Inserter insert prepared statement
|
// Inserter insert prepared statement
|
||||||
|
Loading…
Reference in New Issue
Block a user