19 lines
355 B
Go
19 lines
355 B
Go
package db
|
|
|
|
import (
|
|
"log"
|
|
|
|
"github.com/spf13/viper"
|
|
"gorm.io/driver/sqlite" // Sqlite driver based on CGO
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
func connectSQLite() *gorm.DB {
|
|
sqlDB := sqlite.Open(viper.GetString("db.path"))
|
|
connection, err := gorm.Open(sqlDB, &gorm.Config{})
|
|
if err != nil {
|
|
log.Fatal("Could not connect to Database", err)
|
|
}
|
|
return connection
|
|
}
|