diff --git a/pkg/dbmanager/connection.go b/pkg/dbmanager/connection.go index 23f1ea0..2f73ed5 100644 --- a/pkg/dbmanager/connection.go +++ b/pkg/dbmanager/connection.go @@ -26,6 +26,7 @@ type Connection interface { Bun() (*bun.DB, error) GORM() (*gorm.DB, error) Native() (*sql.DB, error) + DB() (*sql.DB, error) // Common Database interface (for SQL databases) Database() (common.Database, error) @@ -224,6 +225,11 @@ func (c *sqlConnection) Native() (*sql.DB, error) { return c.nativeDB, nil } +// DB returns the underlying *sql.DB connection +func (c *sqlConnection) DB() (*sql.DB, error) { + return c.Native() +} + // Bun returns a Bun ORM instance wrapping the native connection func (c *sqlConnection) Bun() (*bun.DB, error) { if c == nil { @@ -645,6 +651,11 @@ func (c *mongoConnection) Native() (*sql.DB, error) { return nil, ErrNotSQLDatabase } +// DB returns an error for MongoDB connections +func (c *mongoConnection) DB() (*sql.DB, error) { + return nil, ErrNotSQLDatabase +} + // Database returns an error for MongoDB connections func (c *mongoConnection) Database() (common.Database, error) { return nil, ErrNotSQLDatabase