Matrix/utils/databaseController.go
2020-09-28 22:37:02 +02:00

20 lines
271 B
Go

package utils
import (
"database/sql"
"log"
_ "github.com/mattn/go-sqlite3"
)
func InitDB(filepath string) *sql.DB {
log.Printf("Init DB")
db, err := sql.Open("sqlite3", filepath)
if err != nil {
panic(err)
}
if db == nil {
panic("db nil")
}
return db
}