Matrix/utils/databaseController.go

21 lines
271 B
Go
Raw Normal View History

2020-09-28 20:37:02 +00:00
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
}