diff --git a/scope_private.go b/scope_private.go index 1151f481..7004ed93 100644 --- a/scope_private.go +++ b/scope_private.go @@ -251,52 +251,53 @@ func (s *Scope) limitSql() string { } -func (s *Scope) topSql() string { - if s.Dialect().HasTop() && len(s.Search.Offset) == 0 { - if len(s.Search.Limit) == 0 { +func (scope *Scope) topSql() string { + if scope.Dialect().HasTop() && len(scope.Search.Offset) == 0 { + if len(scope.Search.Limit) == 0 { return "" } else { - return " TOP(" + s.Search.Limit + ")" + return " TOP(" + scope.Search.Limit + ")" } - } else { - return "" } + + return "" + } -func (s *Scope) offsetSql() string { - if len(s.Search.Offset) == 0 { +func (scope *Scope) offsetSql() string { + if len(scope.Search.Offset) == 0 { return "" } else { - if s.Dialect().HasTop() { - sql := " OFFSET " + s.Search.Offset + " ROW " - if len(s.Search.Limit) > 0 { - sql += "FETCH NEXT " + s.Search.Limit + " ROWS ONLY" + if scope.Dialect().HasTop() { + sql := " OFFSET " + scope.Search.Offset + " ROW " + if len(scope.Search.Limit) > 0 { + sql += "FETCH NEXT " + scope.Search.Limit + " ROWS ONLY" } return sql } else { - return " OFFSET " + s.Search.Offset + return " OFFSET " + scope.Search.Offset } } } -func (s *Scope) groupSql() string { - if len(s.Search.Group) == 0 { +func (scope *Scope) groupSql() string { + if len(scope.Search.Group) == 0 { return "" } else { - return " GROUP BY " + s.Search.Group + return " GROUP BY " + scope.Search.Group } } -func (s *Scope) havingSql() string { - if s.Search.HavingCondition == nil { +func (scope *Scope) havingSql() string { + if scope.Search.HavingCondition == nil { return "" } else { - return " HAVING " + s.buildWhereCondition(s.Search.HavingCondition) + return " HAVING " + scope.buildWhereCondition(scope.Search.HavingCondition) } } -func (s *Scope) joinsSql() string { - return s.Search.Joins + " " +func (scope *Scope) joinsSql() string { + return scope.Search.Joins + " " } func (scope *Scope) prepareQuerySql() {