Skip to content

Commit

Permalink
move connection to internal (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
crgimenes authored and felipeweb committed Jan 10, 2018
1 parent 28849c4 commit 3b80ee4
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 3 deletions.
41 changes: 41 additions & 0 deletions postgres/connection.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package postgres

import (
"github.com/jmoiron/sqlx"
"github.com/prest/adapters/postgres/internal/connection"
)

// GetURI postgres connection URI
func GetURI(DBName string) string {
return connection.GetURI(DBName)
}

// Get get postgres connection
func Get() (*sqlx.DB, error) {
return connection.Get()
}

// GetPool of connection
func GetPool() *connection.ConnectionPool {
return GetPool()
}

// AddDatabaseToPool add connection to pool
func AddDatabaseToPool(name string, DB *sqlx.DB) {
connection.AddDatabaseToPool(name, DB)
}

// MustGet get postgres connection
func MustGet() *sqlx.DB {
return connection.MustGet()
}

// SetDatabase set current database in use
func SetDatabase(name string) {
connection.SetDatabase(name)
}

// GetDatabase get current database in use
func GetDatabase() string {
return connection.GetDatabase()
}
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion postgres/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import (
"github.com/nuveo/log"
"github.com/prest/adapters"
"github.com/prest/adapters/internal/scanner"
"github.com/prest/adapters/postgres/connection"
"github.com/prest/adapters/postgres/formatters"
"github.com/prest/adapters/postgres/internal/connection"
"github.com/prest/config"
"github.com/prest/statements"
)
Expand Down
2 changes: 1 addition & 1 deletion postgres/postgres_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"testing"

"github.com/prest/adapters"
"github.com/prest/adapters/postgres/connection"
"github.com/prest/adapters/postgres/internal/connection"

"bytes"

Expand Down
2 changes: 1 addition & 1 deletion postgres/queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/nuveo/log"
"github.com/prest/adapters"
"github.com/prest/adapters/internal/scanner"
"github.com/prest/adapters/postgres/connection"
"github.com/prest/adapters/postgres/internal/connection"
"github.com/prest/config"
"github.com/prest/template"
)
Expand Down

0 comments on commit 3b80ee4

Please sign in to comment.