mirror of
https://github.com/glebarez/sqlite.git
synced 2025-10-04 15:22:42 +08:00
Fix change limit.Limit type
This commit is contained in:
12
sqlite.go
12
sqlite.go
@@ -97,13 +97,13 @@ func (dialector Dialector) ClauseBuilders() map[string]clause.ClauseBuilder {
|
||||
},
|
||||
"LIMIT": func(c clause.Clause, builder clause.Builder) {
|
||||
if limit, ok := c.Expression.(clause.Limit); ok {
|
||||
if (limit.Limit != nil && *limit.Limit >= 0) || limit.Offset > 0 {
|
||||
if *limit.Limit <= 0 {
|
||||
i := -1
|
||||
limit.Limit = &i
|
||||
}
|
||||
var lmt = -1
|
||||
if limit.Limit != nil && *limit.Limit >= 0 {
|
||||
lmt = *limit.Limit
|
||||
}
|
||||
if lmt > 0 || limit.Offset > 0 {
|
||||
builder.WriteString("LIMIT ")
|
||||
builder.WriteString(strconv.Itoa(*limit.Limit))
|
||||
builder.WriteString(strconv.Itoa(lmt))
|
||||
}
|
||||
if limit.Offset > 0 {
|
||||
builder.WriteString(" OFFSET ")
|
||||
|
Reference in New Issue
Block a user