Source File
limit.go
Belonging Package
gorm.io/gorm/clause
package clause// 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 ").AddVar(, *.Limit)}if .Offset > 0 {if .Limit != nil && *.Limit >= 0 {.WriteByte(' ')}.WriteString("OFFSET ").AddVar(, .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.8.2. (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 @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |