完成基本的创建使用功能

This commit is contained in:
2024-09-11 20:19:47 +08:00
parent 28a84ad4d7
commit 951572a1f5
22 changed files with 783 additions and 31 deletions
+30
View File
@@ -0,0 +1,30 @@
package global
import (
"gorm.io/gorm"
"work_cation/cfg"
"work_cation/models"
"work_cation/models/repo"
"work_cation/pkg/gormx"
)
var DB *gorm.DB
func InitDB() {
var err error
DB, err = gormx.New(gormx.Config{DSN: cfg.T.DbPath, Type: "sqlite3"})
if err != nil {
panic(err)
}
err = DB.AutoMigrate(
&models.ErlangCards{},
&models.ErlangCardCollections{},
&models.History{},
&models.Users{},
&models.UserFollows{},
)
if err != nil {
panic(err)
}
repo.UserRepo.GetUserInfo(DB)
}