Fix condition for limit (#5735) (#118)

The limit clause should be included when the limit value is greater than or equal to zero.
This commit is contained in:
robhafner
2022-10-10 23:01:15 -04:00
committed by GitHub
parent 1007940dc9
commit 22036f5c52

View File

@@ -101,7 +101,7 @@ func (dialector Dialector) ClauseBuilders() map[string]clause.ClauseBuilder {
if limit.Limit != nil && *limit.Limit >= 0 {
lmt = *limit.Limit
}
if lmt > 0 || limit.Offset > 0 {
if lmt >= 0 || limit.Offset > 0 {
builder.WriteString("LIMIT ")
builder.WriteString(strconv.Itoa(lmt))
}