midr @ 90d9d819b70f68e10482954cfc461737c0165f8a

 1package db
 2
 3import (
 4	"gorm.io/driver/sqlite"
 5	"gorm.io/gorm"
 6)
 7
 8var (
 9	DB  *gorm.DB
10	err error
11)
12
13func ConnectDb() {
14	DB, err = gorm.Open(sqlite.Open("main.db"), &gorm.Config{})
15
16	if err != nil {
17		panic("failed to connect to the database.")
18	}
19
20	DB.AutoMigrate(&Entry{})
21}