mirror of https://github.com/go-gorm/gorm.git
Should use global NowFunc when trace SQL
This commit is contained in:
parent
11e2819f44
commit
5490a87fe9
|
@ -50,7 +50,7 @@ func updateTimeStampForCreateCallback(scope *Scope) {
|
|||
// createCallback the callback used to insert data into database
|
||||
func createCallback(scope *Scope) {
|
||||
if !scope.HasError() {
|
||||
defer scope.trace(scope.db.nowFunc())
|
||||
defer scope.trace(NowFunc())
|
||||
|
||||
var (
|
||||
columns, placeholders []string
|
||||
|
|
|
@ -24,7 +24,7 @@ func queryCallback(scope *Scope) {
|
|||
return
|
||||
}
|
||||
|
||||
defer scope.trace(scope.db.nowFunc())
|
||||
defer scope.trace(NowFunc())
|
||||
|
||||
var (
|
||||
isSlice, isPtr bool
|
||||
|
|
6
scope.go
6
scope.go
|
@ -358,7 +358,7 @@ func (scope *Scope) Raw(sql string) *Scope {
|
|||
|
||||
// Exec perform generated SQL
|
||||
func (scope *Scope) Exec() *Scope {
|
||||
defer scope.trace(scope.db.nowFunc())
|
||||
defer scope.trace(NowFunc())
|
||||
|
||||
if !scope.HasError() {
|
||||
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
|
|||
}
|
||||
|
||||
func (scope *Scope) row() *sql.Row {
|
||||
defer scope.trace(scope.db.nowFunc())
|
||||
defer scope.trace(NowFunc())
|
||||
|
||||
result := &RowQueryResult{}
|
||||
scope.InstanceSet("row_query_result", result)
|
||||
|
@ -944,7 +944,7 @@ func (scope *Scope) row() *sql.Row {
|
|||
}
|
||||
|
||||
func (scope *Scope) rows() (*sql.Rows, error) {
|
||||
defer scope.trace(scope.db.nowFunc())
|
||||
defer scope.trace(NowFunc())
|
||||
|
||||
result := &RowsQueryResult{}
|
||||
scope.InstanceSet("row_query_result", result)
|
||||
|
|
Loading…
Reference in New Issue