-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
bugIt is confirmed a bug, but don't worry, we'll handle it.It is confirmed a bug, but don't worry, we'll handle it.
Description
Go version
go version go1.25.1 darwin/arm64
GoFrame version
v2.9.3
Can this bug be reproduced with the latest release?
Option Yes
What did you do?
result, err := db.Query(ctx, "SELECT NOW()")
if err != nil {
return nil, err
}
gtimeVal := result[0].Map()["now"].(*gtime.Time)
name1, offaet1 := gtimeVal.Zone()
fmt.Println("时区:", name1, offaet1/3600)
fmt.Println("数据库时间:", gtimeVal)
// 查询当前时间
var nowResult []time.Time
err = result.Structs(&nowResult)
if err != nil {
return nil, err
}
now := nowResult[0]
name2, offaet2 := now.Zone()
fmt.Println("Structs后 时区:", name2, offaet2/3600)
fmt.Println("Structs后 数据库时间:", now)
What did you see happen?
SELECT NOW()
时区: GMT 0
数据库时间: 2025-09-15 07:45:40
Structs后 时区: CST 8
Structs后 数据库时间: 2025-09-15 07:45:40 +0800 CST
What did you expect to see?
orm 的 result 在 Structs 会丢时区,然后以当前系统的时区处理了
Structs后 数据库时间: 2025-09-15 15:45:40 +0800 CST
Copilot
Metadata
Metadata
Labels
bugIt is confirmed a bug, but don't worry, we'll handle it.It is confirmed a bug, but don't worry, we'll handle it.