fix Count Debug
This commit is contained in:
parent
45ccb13437
commit
2bd6928400
5
scope.go
5
scope.go
@ -940,8 +940,13 @@ func (scope *Scope) pluck(column string, value interface{}) *Scope {
|
|||||||
|
|
||||||
func (scope *Scope) count(value interface{}) *Scope {
|
func (scope *Scope) count(value interface{}) *Scope {
|
||||||
if query, ok := scope.Search.selects["query"]; !ok || !countingQueryRegexp.MatchString(fmt.Sprint(query)) {
|
if query, ok := scope.Search.selects["query"]; !ok || !countingQueryRegexp.MatchString(fmt.Sprint(query)) {
|
||||||
|
if len(scope.Search.group) != 0 {
|
||||||
|
scope.Search.Select("count(*) FROM ( SELECT count(*) ")
|
||||||
|
scope.Search.group += " ) AS count"
|
||||||
|
} else {
|
||||||
scope.Search.Select("count(*)")
|
scope.Search.Select("count(*)")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
scope.Search.ignoreOrderQuery = true
|
scope.Search.ignoreOrderQuery = true
|
||||||
scope.Err(scope.row().Scan(value))
|
scope.Err(scope.row().Scan(value))
|
||||||
return scope
|
return scope
|
||||||
|
Loading…
x
Reference in New Issue
Block a user