Source File
order_by.go
Belonging Package
gorm.io/gorm/clause
package clausetype OrderByColumn struct {Column ColumnDesc boolReorder bool}type OrderBy struct {Columns []OrderByColumnExpression Expression}// Name where clause namefunc ( OrderBy) () string {return "ORDER BY"}// Build build where clausefunc ( OrderBy) ( Builder) {if .Expression != nil {.Expression.Build()} else {for , := range .Columns {if > 0 {.WriteByte(',')}.WriteQuoted(.Column)if .Desc {.WriteString(" DESC")}}}}// MergeClause merge order by clausesfunc ( OrderBy) ( *Clause) {if , := .Expression.(OrderBy); {for := len(.Columns) - 1; >= 0; -- {if .Columns[].Reorder {.Columns = .Columns[:].Expression =return}}:= make([]OrderByColumn, len(.Columns))copy(, .Columns).Columns = append(, .Columns...)}.Expression =}
![]() |
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. |