backup-notify/database/conn.go
2024-04-21 18:46:40 -07:00

18 lines
334 B
Go

package database
import (
"database/sql"
_ "github.com/mattn/go-sqlite3"
"log"
)
func MakeConn(databasePath *string) *sql.DB {
log.Println("opening database at", *databasePath, "with foreign keys enabled")
dbConn, err := sql.Open("sqlite3", *databasePath+"?_foreign_keys=on")
if err != nil {
panic(err)
}
return dbConn
}