GORM Playground Link
https://github.com/go-gorm/playground/pull/421/files
Description
Hello there! We started migration from gorm v1 and have the next problem.
We have a case when build a large complicated condition and before we scan paginated results we use a few counting queries with logic. But now logic from counting queries assigns to the whole condition, so we need to double large condition for all queries.
On the gorm v1 for update pre-build query we reassign it with the new condition like this
query = query.Where("1=1")
and then use different conditions which no-afffects to other one
query.Where("name = 'something'").Count(&c)
var users []User
query.Find(&users)
Comment From: a631807682
Similar to https://github.com/go-gorm/gorm/issues/5129
Use Session