1Panel/backend/init/db/sqlite.go

18 lines
284 B
Go
Raw Normal View History

2022-08-16 23:30:23 +08:00
package db
import (
"github.com/1Panel-dev/1Panel/backend/global"
2022-08-16 23:30:23 +08:00
"gorm.io/driver/sqlite"
"gorm.io/gorm"
)
func SqliteGorm() *gorm.DB {
s := global.CONF.Sqlite
if db, err := gorm.Open(sqlite.Open(s.Dsn()), &gorm.Config{}); err != nil {
panic(err)
} else {
return db
}
}