mirror of https://github.com/go-gorm/gorm.git
Cleanup Model after Count
This commit is contained in:
parent
3313c11888
commit
528e5ba5c4
|
@ -289,6 +289,9 @@ func (db *DB) Count(count *int64) (tx *DB) {
|
||||||
tx = db.getInstance()
|
tx = db.getInstance()
|
||||||
if tx.Statement.Model == nil {
|
if tx.Statement.Model == nil {
|
||||||
tx.Statement.Model = tx.Statement.Dest
|
tx.Statement.Model = tx.Statement.Dest
|
||||||
|
defer func() {
|
||||||
|
tx.Statement.Model = nil
|
||||||
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(tx.Statement.Selects) == 0 {
|
if len(tx.Statement.Selects) == 0 {
|
||||||
|
|
Loading…
Reference in New Issue