mirror of
https://github.com/bitechdev/ResolveSpec.git
synced 2026-04-05 07:32:26 +00:00
feat(db): add DB method to sqlConnection and mongoConnection
Some checks failed
Build , Vet Test, and Lint / Run Vet Tests (1.24.x) (push) Successful in -30m22s
Build , Vet Test, and Lint / Run Vet Tests (1.23.x) (push) Successful in -29m59s
Build , Vet Test, and Lint / Lint Code (push) Failing after -30m11s
Build , Vet Test, and Lint / Build (push) Successful in -30m12s
Tests / Unit Tests (push) Successful in -30m49s
Tests / Integration Tests (push) Failing after -30m59s
Some checks failed
Build , Vet Test, and Lint / Run Vet Tests (1.24.x) (push) Successful in -30m22s
Build , Vet Test, and Lint / Run Vet Tests (1.23.x) (push) Successful in -29m59s
Build , Vet Test, and Lint / Lint Code (push) Failing after -30m11s
Build , Vet Test, and Lint / Build (push) Successful in -30m12s
Tests / Unit Tests (push) Successful in -30m49s
Tests / Integration Tests (push) Failing after -30m59s
This commit is contained in:
@@ -26,6 +26,7 @@ type Connection interface {
|
|||||||
Bun() (*bun.DB, error)
|
Bun() (*bun.DB, error)
|
||||||
GORM() (*gorm.DB, error)
|
GORM() (*gorm.DB, error)
|
||||||
Native() (*sql.DB, error)
|
Native() (*sql.DB, error)
|
||||||
|
DB() (*sql.DB, error)
|
||||||
|
|
||||||
// Common Database interface (for SQL databases)
|
// Common Database interface (for SQL databases)
|
||||||
Database() (common.Database, error)
|
Database() (common.Database, error)
|
||||||
@@ -224,6 +225,11 @@ func (c *sqlConnection) Native() (*sql.DB, error) {
|
|||||||
return c.nativeDB, nil
|
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
|
// Bun returns a Bun ORM instance wrapping the native connection
|
||||||
func (c *sqlConnection) Bun() (*bun.DB, error) {
|
func (c *sqlConnection) Bun() (*bun.DB, error) {
|
||||||
if c == nil {
|
if c == nil {
|
||||||
@@ -645,6 +651,11 @@ func (c *mongoConnection) Native() (*sql.DB, error) {
|
|||||||
return nil, ErrNotSQLDatabase
|
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
|
// Database returns an error for MongoDB connections
|
||||||
func (c *mongoConnection) Database() (common.Database, error) {
|
func (c *mongoConnection) Database() (common.Database, error) {
|
||||||
return nil, ErrNotSQLDatabase
|
return nil, ErrNotSQLDatabase
|
||||||
|
|||||||
Reference in New Issue
Block a user