1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00

Fix MySQL connection timezone.

This commit is contained in:
Ferdinand Mütsch 2019-10-10 18:09:50 +02:00
parent 43f6f33966
commit 5a5586b40d

View File

@ -27,6 +27,7 @@ func ParseUserAgent(ua string) (string, string, error) {
} }
func MakeConnectionString(config *models.Config) string { func MakeConnectionString(config *models.Config) string {
location, _ := time.LoadLocation("Local")
str := strings.Builder{} str := strings.Builder{}
str.WriteString(config.DbUser) str.WriteString(config.DbUser)
str.WriteString(":") str.WriteString(":")
@ -35,6 +36,7 @@ func MakeConnectionString(config *models.Config) string {
str.WriteString(config.DbHost) str.WriteString(config.DbHost)
str.WriteString(")/") str.WriteString(")/")
str.WriteString(config.DbName) str.WriteString(config.DbName)
str.WriteString("?charset=utf8&parseTime=true") str.WriteString("?charset=utf8&parseTime=true&loc=")
str.WriteString(location.String())
return str.String() return str.String()
} }