mirror of
https://github.com/mgerb/go-discord-bot
synced 2026-01-09 08:32:48 +00:00
24 lines
371 B
Go
24 lines
371 B
Go
package db
|
|
|
|
import (
|
|
"github.com/jinzhu/gorm"
|
|
|
|
// database driver for sqlite
|
|
_ "github.com/jinzhu/gorm/dialects/sqlite"
|
|
)
|
|
|
|
// Conn - database connection
|
|
var Conn *gorm.DB
|
|
|
|
// Init - initialize database
|
|
func Init() {
|
|
var err error
|
|
Conn, err = gorm.Open("sqlite3", "data.db")
|
|
|
|
if err != nil {
|
|
panic("failed to connect database")
|
|
}
|
|
|
|
Conn.DB().SetMaxIdleConns(1)
|
|
}
|