19 lines
351 B
Go
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)
|
|
}
|