Parcourir la source

enable parseTime=true

CaIon il y a 2 ans
Parent
commit
c09f3b9282
1 fichiers modifiés avec 5 ajouts et 1 suppressions
  1. 5 1
      model/main.go

+ 5 - 1
model/main.go

@@ -54,7 +54,11 @@ func chooseDB() (*gorm.DB, error) {
 		common.SysLog("using MySQL as database")
 		// check parseTime
 		if !strings.Contains(dsn, "parseTime") {
-			dsn += "?parseTime=true"
+			if strings.Contains(dsn, "?") {
+				dsn += "&parseTime=true"
+			} else {
+				dsn += "?parseTime=true"
+			}
 		}
 		return gorm.Open(mysql.Open(dsn), &gorm.Config{
 			PrepareStmt: true, // precompile SQL