Skip to content

Commit

Permalink
comments and gofumpt
Browse files Browse the repository at this point in the history
  • Loading branch information
suprjinx committed Aug 17, 2023
1 parent 6887e10 commit 763f1cd
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions pkg/database/db_factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,10 @@ func ConnectDB(dsn string, slowThreshold time.Duration, poolMax int, reset bool,
return DB, nil
}

// MakeDbInstance will create a DbInstance from the parameters.
// MakeDbInstance will create a DbInstance from the parameters, without affecting the global var database.DB.
func MakeDBInstance(
dsn string, slowThreshold time.Duration, poolMax int, reset bool, migrate bool, artifactRoot string,
) (*DbInstance, error) {

dbFactory, err := NewFactory(dsn, slowThreshold, poolMax, reset)
if err != nil {
return nil, err
Expand All @@ -95,7 +94,6 @@ func MakeDBInstance(
func NewFactory(
dsn string, slowThreshold time.Duration, poolMax int, reset bool,
) (DbFactory, error) {

dsnURL, err := url.Parse(dsn)
if err != nil {
return nil, fmt.Errorf("invalid database URL: %w", err)
Expand Down Expand Up @@ -123,13 +121,13 @@ func NewFactory(
return nil, eris.New("unsupported database type")
}

// MakeDbInsance will construct a Postgres MakeDbInstance
// MakeDbInsance will construct a Postgres DbInstance.
func (f PostgresDbFactory) MakeDbInstance() (*DbInstance, error) {
var sourceConn gorm.Dialector
var replicaConn gorm.Dialector

db := DbInstance{dsn: f.dsnURL.String()}
sourceConn = postgres.Open(f.dsnURL.String())
sourceConn = postgres.Open(f.dsnURL.String())

logURL := f.dsnURL
q := logURL.Query()
Expand Down

0 comments on commit 763f1cd

Please sign in to comment.