mirror of https://github.com/go-gorm/gorm.git
Fix overwrite Statement in scopes
This commit is contained in:
parent
a855fe6402
commit
82cb4ebfe2
16
callbacks.go
16
callbacks.go
|
@ -72,20 +72,20 @@ func (cs *callbacks) Raw() *processor {
|
|||
}
|
||||
|
||||
func (p *processor) Execute(db *DB) {
|
||||
var (
|
||||
curTime = time.Now()
|
||||
stmt = db.Statement
|
||||
)
|
||||
|
||||
// call scopes
|
||||
for len(stmt.scopes) > 0 {
|
||||
scopes := stmt.scopes
|
||||
stmt.scopes = nil
|
||||
for len(db.Statement.scopes) > 0 {
|
||||
scopes := db.Statement.scopes
|
||||
db.Statement.scopes = nil
|
||||
for _, scope := range scopes {
|
||||
db = scope(db)
|
||||
}
|
||||
}
|
||||
|
||||
var (
|
||||
curTime = time.Now()
|
||||
stmt = db.Statement
|
||||
)
|
||||
|
||||
// assign model values
|
||||
if stmt.Model == nil {
|
||||
stmt.Model = stmt.Dest
|
||||
|
|
Loading…
Reference in New Issue