Source File
group_by.go
Belonging Package
gorm.io/gorm/clause
package clause// GroupBy group by clausetype GroupBy struct {Columns []ColumnHaving []Expression}// Name from clause namefunc ( GroupBy) () string {return "GROUP BY"}// Build build group by clausefunc ( GroupBy) ( Builder) {for , := range .Columns {if > 0 {.WriteByte(',')}.WriteQuoted()}if len(.Having) > 0 {.WriteString(" HAVING ")Where{Exprs: .Having}.Build()}}// MergeClause merge group by clausefunc ( GroupBy) ( *Clause) {if , := .Expression.(GroupBy); {:= make([]Column, len(.Columns))copy(, .Columns).Columns = append(, .Columns...):= make([]Expression, len(.Having))copy(, .Having).Having = append(, .Having...)}.Expression =if len(.Columns) == 0 {.Name = ""} else {.Name = .Name()}}
![]() |
The pages are generated with Golds v0.6.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |