pusher/biz/dal/postgres/init.go
timerzz 4ec0cd1564
Some checks failed
Build image / build (push) Failing after 4m48s
feat 测试
2024-05-20 17:57:25 +08:00

28 lines
456 B
Go

package postgres
import (
"gitea.timerzz.com/kedaya_haitao/pusher/conf"
"gitea.timerzz.com/kedaya_haitao/pusher/kitex_gen/config"
"gorm.io/driver/postgres"
"gorm.io/gorm"
)
var (
DB *gorm.DB
err error
)
func Init() {
DB, err = gorm.Open(postgres.Open(conf.GetConf().DB.DSN),
&gorm.Config{
PrepareStmt: true,
SkipDefaultTransaction: true,
},
)
if err != nil {
panic(err)
}
_ = DB.AutoMigrate(&config.PusherConfig{})
}