mirror of
https://github.com/onsonr/sonr.git
synced 2025-03-10 13:07:09 +00:00
refactor: rename database initialization function
This commit is contained in:
parent
c67a7823a6
commit
bb7724ece1
@ -30,7 +30,7 @@ func setupServer(env config.Env) (*echo.Echo, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
db, err := sessions.InitDB(env)
|
db, err := sessions.NewGormDB(env)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -9,8 +9,8 @@ import (
|
|||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
// InitDB initializes and returns a configured database connection
|
// NewGormDB initializes and returns a configured database connection
|
||||||
func InitDB(env config.Env) (*gorm.DB, error) {
|
func NewGormDB(env config.Env) (*gorm.DB, error) {
|
||||||
path := formatDBPath(env.GetSqliteFile())
|
path := formatDBPath(env.GetSqliteFile())
|
||||||
db, err := gorm.Open(sqlite.Open(path), &gorm.Config{})
|
db, err := gorm.Open(sqlite.Open(path), &gorm.Config{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user