We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d98bf99 commit 0ebad4bCopy full SHA for 0ebad4b
dml_select.go
@@ -137,6 +137,16 @@ func CountDistinct(field string) string {
137
return strings.Join([]string{"COUNT(DISTINCT ", ")"}, field)
138
}
139
140
+// Sum returns a SUM(field).
141
+func Sum(field string) string {
142
+ return strings.Join([]string{"SUM(", ")"}, field)
143
+}
144
+
145
+// SelectSum appends the selected SUM(field) column in SELECT.
146
+func (b *SelectBuilder) Sum(field string) *SelectBuilder {
147
+ return b.Select(Sum(b.db.GetDialect().Quote(field)))
148
149
150
// SelectCount appends the selected COUNT(field) column in SELECT.
151
func (b *SelectBuilder) SelectCount(field string) *SelectBuilder {
152
return b.Select(Count(b.db.GetDialect().Quote(field)))
0 commit comments