Skip to content

Commit

Permalink
Removed unused function
Browse files Browse the repository at this point in the history
  • Loading branch information
Wil Simpson committed Mar 17, 2024
1 parent 217de62 commit 25f941f
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions pkg/repository/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@ package repository

import (
"fmt"
"time"

"github.com/ShatteredRealms/go-backend/pkg/config"
"github.com/jackc/pgx/v5"
"github.com/jackc/pgx/v5/stdlib"
_ "github.com/lib/pq"
"github.com/uptrace/opentelemetry-go-extra/otelgorm"
"gopkg.in/yaml.v3"
"gorm.io/driver/postgres"
"gorm.io/gorm"
"gorm.io/plugin/dbresolver"
"io/ioutil"
"time"
)

// ConnectDB Initializes the connection to a Postgres database
Expand Down Expand Up @@ -53,17 +52,17 @@ func ConnectDB(pool config.DBPoolConfig) (*gorm.DB, error) {
return db, err
}

func ConnectFromFile(filePath string) (*gorm.DB, error) {
file, err := ioutil.ReadFile(filePath)
if err != nil {
return nil, err
}

c := &config.DBPoolConfig{}
err = yaml.Unmarshal(file, c)
if err != nil {
return nil, err
}

return ConnectDB(*c)
}
// func ConnectFromFile(filePath string) (*gorm.DB, error) {
// file, err := ioutil.ReadFile(filePath)
// if err != nil {
// return nil, err
// }
//
// c := &config.DBPoolConfig{}
// err = yaml.Unmarshal(file, c)
// if err != nil {
// return nil, err
// }
//
// return ConnectDB(*c)
// }

0 comments on commit 25f941f

Please sign in to comment.