fix: time-zone issue, localhost issue
This commit is contained in:
@@ -68,7 +68,7 @@ func NewYamlConfig() YamlConfig {
|
||||
return YamlConfig{
|
||||
Database: DbConfig{
|
||||
Type: "mysql",
|
||||
ConnParam: "charset=utf8mb4&collation=utf8mb4_general_ci&loc=Local",
|
||||
ConnParam: "charset=utf8mb4&collation=utf8mb4_general_ci&parseTime=True&interpolateParams=True",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,12 +51,14 @@ func initDbClient() error {
|
||||
//}
|
||||
// defer dbClient.xEngine.Close() // 退出后关闭
|
||||
|
||||
if dbClient.IsShowSQL == true {
|
||||
if dbClient.IsShowSQL {
|
||||
dbClient.xEngine.ShowSQL(true)
|
||||
}
|
||||
dbClient.xEngine.SetConnMaxLifetime(dbClient.dbConnMaxLifetime)
|
||||
dbClient.xEngine.SetMaxIdleConns(dbClient.dbMaxIdleConns)
|
||||
dbClient.xEngine.SetMaxOpenConns(dbClient.dbMaxOpenConns)
|
||||
dbClient.xEngine.DatabaseTZ = time.Local // 必须
|
||||
dbClient.xEngine.TZLocation = time.Local // 必须
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -447,7 +449,7 @@ func XormInsertTalbeOne(tbInfo interface{}) (int64, error) {
|
||||
}
|
||||
|
||||
func XormGetDataBySQL(sql string) (*[]map[string]string, error) {
|
||||
log.Debug("XormGetDataBySQL processing... ")
|
||||
//log.Debug("XormGetDataBySQL processing... ")
|
||||
|
||||
rows := make([]map[string]string, 0)
|
||||
rows, err := dbClient.xEngine.QueryString(sql)
|
||||
|
||||
@@ -25,6 +25,7 @@ database:
|
||||
host: 127.0.0.1
|
||||
port: 33066
|
||||
name: omc_db
|
||||
connParam: charset=utf8mb4&collation=utf8mb4_general_ci&parseTime=True&interpolateParams=True
|
||||
backup: d:/local.git/be.ems/restagent/database
|
||||
|
||||
# northbound interface, cm/pm
|
||||
|
||||
Reference in New Issue
Block a user