From e2e54d57c921fce19f9f402387f7418c0db7fa93 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Tue, 27 Sep 2016 11:17:35 +0800 Subject: [PATCH] resolved #292 #91 --- VERSION | 2 +- helpers.go | 3 ++- xorm.go | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/VERSION b/VERSION index eefd2a22..22d10ea8 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -xorm v0.6.0.0923 \ No newline at end of file +xorm v0.6.0.0927 \ No newline at end of file diff --git a/helpers.go b/helpers.go index 9a461c0e..e82a85f4 100644 --- a/helpers.go +++ b/helpers.go @@ -550,7 +550,8 @@ func genCols(table *core.Table, session *Session, bean interface{}, useCol bool, } } - if (col.IsCreated || col.IsUpdated) && session.Statement.UseAutoTime { + if (col.IsCreated || col.IsUpdated) && session.Statement.UseAutoTime && !isZero(fieldValue.Interface()) { + // if time is non-empty, then set to auto time val, t := session.Engine.NowTime2(col.SQLType.Name) args = append(args, val) diff --git a/xorm.go b/xorm.go index 07405e2d..048d5b4f 100644 --- a/xorm.go +++ b/xorm.go @@ -17,7 +17,7 @@ import ( const ( // Version show the xorm's version - Version string = "0.6.0.0923" + Version string = "0.6.0.0927" ) func regDrvsNDialects() bool {