Source File
limit.go
Belonging Package
gorm.io/gorm/clause
package clauseimport// Limit limit clausetype Limit struct {Limit *intOffset int}// Name where clause namefunc ( Limit) () string {return "LIMIT"}// Build build where clausefunc ( Limit) ( Builder) {if .Limit != nil && *.Limit >= 0 {.WriteString("LIMIT ").WriteString(strconv.Itoa(*.Limit))}if .Offset > 0 {if .Limit != nil && *.Limit >= 0 {.WriteByte(' ')}.WriteString("OFFSET ").WriteString(strconv.Itoa(.Offset))}}// MergeClause merge order by clausesfunc ( Limit) ( *Clause) {.Name = ""if , := .Expression.(Limit); {if (.Limit == nil || *.Limit == 0) && .Limit != nil {.Limit = .Limit}if .Offset == 0 && .Offset > 0 {.Offset = .Offset} else if .Offset < 0 {.Offset = 0}}.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. |