func (conn *Connection) getDBTimeZone() {
var current time.Time
err := conn.QueryRowContext(context.Background(), "SELECT SYSTIMESTAMP FROM DUAL", nil).Scan(¤t)
if err != nil {
conn.dbTimeLoc = time.UTC
}
conn.dbTimeLoc = current.Location()
}
it always current.Location(), but error is not null ,so current is alway a nil time
change:
func (conn *Connection) getDBTimeZone() {
var current time.Time
err := conn.QueryRowContext(context.Background(), "SELECT SYSTIMESTAMP FROM DUAL").Scan(¤t)
if err != nil {
conn.dbTimeLoc = time.UTC
return
}
conn.dbTimeLoc = current.Location()
}
func (conn *Connection) getDBTimeZone() { var current time.Time err := conn.QueryRowContext(context.Background(), "SELECT SYSTIMESTAMP FROM DUAL", nil).Scan(¤t) if err != nil { conn.dbTimeLoc = time.UTC
} it always current.Location(), but error is not null ,so current is alway a nil time
change: func (conn *Connection) getDBTimeZone() { var current time.Time err := conn.QueryRowContext(context.Background(), "SELECT SYSTIMESTAMP FROM DUAL").Scan(¤t) if err != nil { conn.dbTimeLoc = time.UTC return } conn.dbTimeLoc = current.Location() }