From 675de6fc165aaabdfee959d1d09be58fe41c67aa Mon Sep 17 00:00:00 2001 From: Jinzhu Date: Mon, 8 Mar 2021 19:21:09 +0800 Subject: [PATCH] Clear scopes before invoke scopes methods --- callbacks.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/callbacks.go b/callbacks.go index 5b878af0..ba7dae04 100644 --- a/callbacks.go +++ b/callbacks.go @@ -109,10 +109,11 @@ func (p *processor) Execute(db *DB) { } // call scopes - for _, scope := range stmt.scopes { + scopes := stmt.scopes + stmt.scopes = nil + for _, scope := range scopes { db = scope(db) } - stmt.scopes = nil for _, f := range p.fns { f(db)