更新 MysqlQuery.go

修改为配置文件连接
master
wangsiyuan 2023-06-05 17:19:39 +08:00
parent e374a8a3e1
commit bb36010ca0
1 changed files with 2 additions and 2 deletions

View File

@ -13,9 +13,9 @@ type IpInformation struct {
TimeZone string `json:"Time_Zone"`
}
func MysqlQuery(ip string) IpInformation {
func MysqlQuery(ip string, dsn string) IpInformation {
// 连接到MySQL数据库
db, err := sql.Open("mysql", "root:990821@tcp(192.168.2.20:3306)/checkip")
db, err := sql.Open("mysql", dsn)
if err != nil {
log.Fatal(err)
}