Skip to content

Commit 5490a87

Browse files
committed
Should use global NowFunc when trace SQL
1 parent 11e2819 commit 5490a87

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

callback_create.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func updateTimeStampForCreateCallback(scope *Scope) {
5050
// createCallback the callback used to insert data into database
5151
func createCallback(scope *Scope) {
5252
if !scope.HasError() {
53-
defer scope.trace(scope.db.nowFunc())
53+
defer scope.trace(NowFunc())
5454

5555
var (
5656
columns, placeholders []string

callback_query.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func queryCallback(scope *Scope) {
2424
return
2525
}
2626

27-
defer scope.trace(scope.db.nowFunc())
27+
defer scope.trace(NowFunc())
2828

2929
var (
3030
isSlice, isPtr bool

scope.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ func (scope *Scope) Raw(sql string) *Scope {
358358

359359
// Exec perform generated SQL
360360
func (scope *Scope) Exec() *Scope {
361-
defer scope.trace(scope.db.nowFunc())
361+
defer scope.trace(NowFunc())
362362

363363
if !scope.HasError() {
364364
if result, err := scope.SQLDB().Exec(scope.SQL, scope.SQLVars...); scope.Err(err) == nil {
@@ -934,7 +934,7 @@ func (scope *Scope) updatedAttrsWithValues(value interface{}) (results map[strin
934934
}
935935

936936
func (scope *Scope) row() *sql.Row {
937-
defer scope.trace(scope.db.nowFunc())
937+
defer scope.trace(NowFunc())
938938

939939
result := &RowQueryResult{}
940940
scope.InstanceSet("row_query_result", result)
@@ -944,7 +944,7 @@ func (scope *Scope) row() *sql.Row {
944944
}
945945

946946
func (scope *Scope) rows() (*sql.Rows, error) {
947-
defer scope.trace(scope.db.nowFunc())
947+
defer scope.trace(NowFunc())
948948

949949
result := &RowsQueryResult{}
950950
scope.InstanceSet("row_query_result", result)

0 commit comments

Comments
 (0)