midr @ 04a10f2acd73d88f90433755bfbe667c5174acb5

 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("test.db"), &gorm.Config{})
15
16	if err != nil {
17		panic("failed to connect to the database.")
18	}
19
20	DB.AutoMigrate(&YdlEntry{})
21}