diff --git a/scope.go b/scope.go index 7fa64b19..4af5edde 100644 --- a/scope.go +++ b/scope.go @@ -777,7 +777,7 @@ func (scope *Scope) selectSQL() string { } func (scope *Scope) orderSQL() string { - if len(scope.Search.orders) == 0 || scope.Search.ignoreOrderQuery { + if len(scope.Search.orders) == 0 || scope.Search.ignoreProcessingResult { return "" } @@ -797,6 +797,9 @@ func (scope *Scope) orderSQL() string { } func (scope *Scope) limitAndOffsetSQL() string { + if scope.Search.ignoreProcessingResult { + return "" + } return scope.Dialect().LimitAndOffsetSQL(scope.Search.limit, scope.Search.offset) } @@ -1020,7 +1023,7 @@ func (scope *Scope) count(value interface{}) *Scope { scope.Search.Select("count(*)") } } - scope.Search.ignoreOrderQuery = true + scope.Search.ignoreProcessingResult = true scope.Err(scope.row().Scan(value)) return scope } diff --git a/search.go b/search.go index 90138595..1693e3b8 100644 --- a/search.go +++ b/search.go @@ -5,25 +5,25 @@ import ( ) type search struct { - db *DB - whereConditions []map[string]interface{} - orConditions []map[string]interface{} - notConditions []map[string]interface{} - havingConditions []map[string]interface{} - joinConditions []map[string]interface{} - initAttrs []interface{} - assignAttrs []interface{} - selects map[string]interface{} - omits []string - orders []interface{} - preload []searchPreload - offset interface{} - limit interface{} - group string - tableName string - raw bool - Unscoped bool - ignoreOrderQuery bool + db *DB + whereConditions []map[string]interface{} + orConditions []map[string]interface{} + notConditions []map[string]interface{} + havingConditions []map[string]interface{} + joinConditions []map[string]interface{} + initAttrs []interface{} + assignAttrs []interface{} + selects map[string]interface{} + omits []string + orders []interface{} + preload []searchPreload + offset interface{} + limit interface{} + group string + tableName string + raw bool + Unscoped bool + ignoreProcessingResult bool } type searchPreload struct {