更新 MysqlQuery.go
修改为配置文件连接
This commit is contained in:
@@ -13,9 +13,9 @@ type IpInformation struct {
|
|||||||
TimeZone string `json:"Time_Zone"`
|
TimeZone string `json:"Time_Zone"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func MysqlQuery(ip string) IpInformation {
|
func MysqlQuery(ip string, dsn string) IpInformation {
|
||||||
// 连接到MySQL数据库
|
// 连接到MySQL数据库
|
||||||
db, err := sql.Open("mysql", "root:990821@tcp(192.168.2.20:3306)/checkip")
|
db, err := sql.Open("mysql", dsn)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user