This commit is contained in:
Andrew Martin 2015-02-17 10:19:42 +11:00
parent 52775992ec
commit f9638f3633
1 changed files with 10 additions and 9 deletions

View File

@ -215,26 +215,26 @@ func (scope *Scope) whereSql() (sql string) {
return return
} }
func (s *Scope) selectSql() string { func (scope *Scope) selectSql() string {
if len(s.Search.Selects) == 0 { if len(scope.Search.Selects) == 0 {
return "*" return "*"
} }
var selectQueries []string var selectQueries []string
for _, clause := range s.Search.Selects { for _, clause := range scope.Search.Selects {
selectQueries = append(selectQueries, s.buildSelectQuery(clause)) selectQueries = append(selectQueries, scope.buildSelectQuery(clause))
} }
return strings.Join(selectQueries, ", ") return strings.Join(selectQueries, ", ")
} }
func (s *Scope) orderSql() string { func (scope *Scope) orderSql() string {
if len(s.Search.Orders) == 0 { if len(scope.Search.Orders) == 0 {
return "" return ""
} else { } else {
return " ORDER BY " + strings.Join(s.Search.Orders, ",") return " ORDER BY " + strings.Join(scope.Search.Orders, ",")
} }
} }
@ -245,9 +245,10 @@ func (s *Scope) limitSql() string {
} else { } else {
return " LIMIT " + s.Search.Limit return " LIMIT " + s.Search.Limit
} }
} else {
return ""
} }
return ""
} }
func (s *Scope) topSql() string { func (s *Scope) topSql() string {