You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// internal/dao/post.go// =================================================================================// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.// =================================================================================package dao
import (
"context""gdb-withall-bug/internal/dao/internal""gdb-withall-bug/internal/model/entity"
)
// internalPostDao is internal type for wrapping internal DAO implements.typeinternalPostDao=*internal.PostDao// postDao is the data access object for table post.// You can define custom methods on it to extend its functionality as you wish.typepostDaostruct {
internalPostDao
}
var (
// Post is globally public accessible object for table post operations.Post=postDao{
internal.NewPostDao(),
}
)
// Fill with you ideas below.func (dpostDao) Get(ctx context.Context, idint64) (entity.PostWithUser, error) {
vardata entity.PostWithUsererr:=d.Ctx(ctx).WithAll().Where(d.Columns().Id, id).Scan(&data)
returndata, err
}
I have read the instruction here: https://goframe.org/pages/viewpage.action?pageId=3672072. It does not mention the time zone used for querying and unmarshaling data, but after my testing, it should be consistent with the parameter passing. And it has little to do with this issue.
5. What did you expect to see?
The two unix timestamp should be the same. More specifically, it should print the following content.
2023/09/22 15:24:25 1695384000 is not equals to 1695384000
6. What did you see instead?
2023/09/22 15:24:25 1695355200 is not equals to 1695384000
The text was updated successfully, but these errors were encountered:
Try to change loc param in MySQL dsn continuously. It should print the two same unix seconds.
More specifically, the problem is that time fields of the embedded struct Post in PostWithUser are always using Local time zone, which are not consistent with User in PostWithUser or other common cases, no matter which loc you set. The time is received from the MySQL server and parsed in the wrong time zone.
If you set loc to Local, the problem may not be reproduced.
Here is a screenshot displaying the inconsistence in debug window:
1. What version of
Go
and system type/arch are you using?go1.21.0 darwin/arm64
2. What version of
GoFrame
are you using?v2.5.4
3. Can this issue be re-produced with the latest release?
yes
4. What did you do?
init MySQL data
reproduce logic
You can also clone this repository and run it locally. https://github.com/exqlnet/gdb-withall-bug
hack/init.sql
in local/test MySQL server.hack/config.yaml
.go run hack/withall.go
I have read the instruction here: https://goframe.org/pages/viewpage.action?pageId=3672072. It does not mention the time zone used for querying and unmarshaling data, but after my testing, it should be consistent with the parameter passing. And it has little to do with this issue.
5. What did you expect to see?
The two unix timestamp should be the same. More specifically, it should print the following content.
6. What did you see instead?
The text was updated successfully, but these errors were encountered: