Vestmore_GO/model/var.go
2024-04-10 17:30:12 +08:00

19 lines
351 B
Go

package model
import (
"gorm.io/driver/mysql"
"gorm.io/gorm"
)
func init() {
ModelInit("zunxinfinance:brTziKHKhsCxTcJmA#2@tcp(192.168.3.99:3307)/zunxinfinance?charset=utf8mb4&timeout=10s&parseTime=true")
}
func ModelInit(mysqlDNS string) {
db, err := gorm.Open(mysql.Open(mysqlDNS))
if err != nil {
panic(err)
}
Models.SetGormDriver(db)
}