From 2ae480556dc660ac3e9b9a5078568e7af7a5847a Mon Sep 17 00:00:00 2001 From: Bharat Patel Date: Thu, 17 Jan 2019 09:56:42 -0800 Subject: [PATCH] Add DBStats method wrapper to provide sql.DBStats when using ormer --- orm/orm.go | 5 +++++ orm/types.go | 1 + 2 files changed, 6 insertions(+) diff --git a/orm/orm.go b/orm/orm.go index bcf6e4be..b7296ab9 100644 --- a/orm/orm.go +++ b/orm/orm.go @@ -522,6 +522,11 @@ func (o *orm) Driver() Driver { return driver(o.alias.Name) } +// return sql.DBStats for current database +func (o *orm) DBStats() sql.DBStats { + return o.alias.DB.Stats() +} + // NewOrm create new orm func NewOrm() Ormer { BootStrap() // execute only once diff --git a/orm/types.go b/orm/types.go index ddf39a2b..4c67c7a6 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