This repository has been archived on 2024-08-30. You can view files and clone it, but cannot push or open issues or pull requests.
RaceBot/database/sqlite.go
2023-04-15 16:23:34 +07:00

21 lines
525 B
Go

package database
import (
"fmt"
"git.rouggy.com/rouggy/RaceBot/config"
"github.com/jinzhu/gorm"
_ "github.com/mattn/go-sqlite3"
)
// SQLiteDBConnect : Create Connection to database
func SQLiteDBConnect() {
//Connect to database, exit when errored
db, err = gorm.Open("sqlite3", "./"+config.DBName+".db")
if err != nil {
panic("[Database] Failed to connect to database")
}
fmt.Println("[Database] Database successfully connected")
//If set true then print all executed queries to the console
db.LogMode(true)
}