rename NowTime -> nowTime
This commit is contained in:
parent
4a9423b408
commit
75c8f66009
|
@ -1516,8 +1516,8 @@ func (engine *Engine) Import(r io.Reader) ([]sql.Result, error) {
|
||||||
return results, lastError
|
return results, lastError
|
||||||
}
|
}
|
||||||
|
|
||||||
// NowTime return current time
|
// nowTime return current time
|
||||||
func (engine *Engine) NowTime(col *core.Column) (interface{}, time.Time) {
|
func (engine *Engine) nowTime(col *core.Column) (interface{}, time.Time) {
|
||||||
t := time.Now()
|
t := time.Now()
|
||||||
var tz = engine.DatabaseTZ
|
var tz = engine.DatabaseTZ
|
||||||
if !col.DisableTimeZone && col.TimeZone != nil {
|
if !col.DisableTimeZone && col.TimeZone != nil {
|
||||||
|
|
|
@ -422,7 +422,7 @@ func genCols(table *core.Table, session *Session, bean interface{}, useCol bool,
|
||||||
|
|
||||||
if (col.IsCreated || col.IsUpdated) && session.statement.UseAutoTime /*&& isZero(fieldValue.Interface())*/ {
|
if (col.IsCreated || col.IsUpdated) && session.statement.UseAutoTime /*&& isZero(fieldValue.Interface())*/ {
|
||||||
// if time is non-empty, then set to auto time
|
// if time is non-empty, then set to auto time
|
||||||
val, t := session.engine.NowTime(col)
|
val, t := session.engine.nowTime(col)
|
||||||
args = append(args, val)
|
args = append(args, val)
|
||||||
|
|
||||||
var colName = col.Name
|
var colName = col.Name
|
||||||
|
|
|
@ -184,12 +184,12 @@ func (session *Session) Delete(bean interface{}) (int64, error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// !oinume! Insert NowTime to the head of session.statement.Params
|
// !oinume! Insert nowTime to the head of session.statement.Params
|
||||||
condArgs = append(condArgs, "")
|
condArgs = append(condArgs, "")
|
||||||
paramsLen := len(condArgs)
|
paramsLen := len(condArgs)
|
||||||
copy(condArgs[1:paramsLen], condArgs[0:paramsLen-1])
|
copy(condArgs[1:paramsLen], condArgs[0:paramsLen-1])
|
||||||
|
|
||||||
val, t := session.engine.NowTime(deletedColumn)
|
val, t := session.engine.nowTime(deletedColumn)
|
||||||
condArgs[0] = val
|
condArgs[0] = val
|
||||||
|
|
||||||
var colName = deletedColumn.Name
|
var colName = deletedColumn.Name
|
||||||
|
|
|
@ -126,7 +126,7 @@ func (session *Session) innerInsertMulti(rowsSlicePtr interface{}) (int64, error
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (col.IsCreated || col.IsUpdated) && session.statement.UseAutoTime {
|
if (col.IsCreated || col.IsUpdated) && session.statement.UseAutoTime {
|
||||||
val, t := session.engine.NowTime(col)
|
val, t := session.engine.nowTime(col)
|
||||||
args = append(args, val)
|
args = append(args, val)
|
||||||
|
|
||||||
var colName = col.Name
|
var colName = col.Name
|
||||||
|
@ -181,7 +181,7 @@ func (session *Session) innerInsertMulti(rowsSlicePtr interface{}) (int64, error
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (col.IsCreated || col.IsUpdated) && session.statement.UseAutoTime {
|
if (col.IsCreated || col.IsUpdated) && session.statement.UseAutoTime {
|
||||||
val, t := session.engine.NowTime(col)
|
val, t := session.engine.nowTime(col)
|
||||||
args = append(args, val)
|
args = append(args, val)
|
||||||
|
|
||||||
var colName = col.Name
|
var colName = col.Name
|
||||||
|
|
|
@ -205,7 +205,7 @@ func (session *Session) Update(bean interface{}, condiBean ...interface{}) (int6
|
||||||
if _, ok := session.statement.columnMap[strings.ToLower(table.Updated)]; !ok {
|
if _, ok := session.statement.columnMap[strings.ToLower(table.Updated)]; !ok {
|
||||||
colNames = append(colNames, session.engine.Quote(table.Updated)+" = ?")
|
colNames = append(colNames, session.engine.Quote(table.Updated)+" = ?")
|
||||||
col := table.UpdatedColumn()
|
col := table.UpdatedColumn()
|
||||||
val, t := session.engine.NowTime(col)
|
val, t := session.engine.nowTime(col)
|
||||||
args = append(args, val)
|
args = append(args, val)
|
||||||
|
|
||||||
var colName = col.Name
|
var colName = col.Name
|
||||||
|
|
Loading…
Reference in New Issue