some improvements

This commit is contained in:
Lunny Xiao 2023-07-13 13:27:55 +08:00
parent abc324c944
commit 230342d41b
No known key found for this signature in database
GPG Key ID: C3B7C91B632F738A
1 changed files with 3 additions and 3 deletions

View File

@ -299,13 +299,13 @@ func (statement *Statement) writeGroupBy(w builder.Writer) error {
if statement.GroupByStr == "" {
return nil
}
_, err := fmt.Fprintf(w, " GROUP BY %s", statement.GroupByStr)
_, err := fmt.Fprint(w, " GROUP BY ", statement.GroupByStr)
return err
}
// Having generate "Having conditions" statement
func (statement *Statement) Having(conditions string) *Statement {
statement.HavingStr = fmt.Sprintf("HAVING %v", statement.ReplaceQuote(conditions))
statement.HavingStr = conditions
return statement
}
@ -313,7 +313,7 @@ func (statement *Statement) writeHaving(w builder.Writer) error {
if statement.HavingStr == "" {
return nil
}
_, err := fmt.Fprint(w, " ", statement.HavingStr)
_, err := fmt.Fprint(w, " HAVING ", statement.ReplaceQuote(statement.HavingStr))
return err
}