diff options
| author | Anhgelus Morhtuuzh <william@herges.fr> | 2026-03-05 12:21:04 +0100 |
|---|---|---|
| committer | Anhgelus Morhtuuzh <william@herges.fr> | 2026-03-07 13:31:35 +0100 |
| commit | 88e1b886e5471552c055374f71d848d3a3dcb4b6 (patch) | |
| tree | d3e64db1fa350339ac147c04d02ab7baea82e6d9 /common/config.go | |
| parent | 89b23632f5ceeebd82132210c1407dc9514a547b (diff) | |
feat(db): connect with sql instead of gorm
Diffstat (limited to 'common/config.go')
| -rw-r--r-- | common/config.go | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/common/config.go b/common/config.go index 8cb74ab..5519690 100644 --- a/common/config.go +++ b/common/config.go @@ -1,12 +1,12 @@ package common import ( + "database/sql" "fmt" "os" + _ "github.com/lib/pq" "github.com/pelletier/go-toml/v2" - "gorm.io/driver/postgres" - "gorm.io/gorm" ) type Config struct { @@ -31,12 +31,8 @@ func (p *PostgresConfig) SetDefaultValues() { p.Port = 5432 } -func (p *PostgresConfig) Connect() (*gorm.DB, error) { - db, err := gorm.Open(postgres.Open(p.generateDsn()), &gorm.Config{}) - if err != nil { - return nil, err - } - return db, nil +func (p *PostgresConfig) Connect() (*sql.DB, error) { + return sql.Open("postgres", p.generateDsn()) } // generateDsn for the connection to postgres using the given config.SQLCredentials |
