guard uninitialized time in func (engine *Engine) TZTime(t time.Time)
This commit is contained in:
parent
0e8dcc062b
commit
6958d6d3dc
|
@ -1396,8 +1396,16 @@ func (engine *Engine) Import(r io.Reader) ([]sql.Result, error) {
|
||||||
return results, lastError
|
return results, lastError
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
NULL_TIME time.Time
|
||||||
|
)
|
||||||
|
|
||||||
func (engine *Engine) TZTime(t time.Time) time.Time {
|
func (engine *Engine) TZTime(t time.Time) time.Time {
|
||||||
|
|
||||||
|
if NULL_TIME != t { // if time is not initialized it's not suitable for Time.In()
|
||||||
return t.In(engine.TZLocation)
|
return t.In(engine.TZLocation)
|
||||||
|
}
|
||||||
|
return t
|
||||||
}
|
}
|
||||||
|
|
||||||
func (engine *Engine) NowTime(sqlTypeName string) interface{} {
|
func (engine *Engine) NowTime(sqlTypeName string) interface{} {
|
||||||
|
|
Loading…
Reference in New Issue