diff --git a/orm/orm.go b/orm/orm.go index bcf6e4be..fc3cd400 100644 --- a/orm/orm.go +++ b/orm/orm.go @@ -522,6 +522,16 @@ func (o *orm) Driver() Driver { return driver(o.alias.Name) } +// return sql.DBStats for current database +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 func NewOrm() Ormer { BootStrap() // execute only once diff --git a/orm/types.go b/orm/types.go index ddf39a2b..6c6443c7 100644 --- a/orm/types.go +++ b/orm/types.go @@ -128,6 +128,7 @@ type Ormer interface { // // update user testing's name to slene Raw(query string, args ...interface{}) RawSeter Driver() Driver + DBStats() *sql.DBStats } // Inserter insert prepared statement