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{}) }