Skip to content

Commit 3e755c0

Browse files
committed
fix: limit=0 results (#5735)
1 parent 3670b0c commit 3e755c0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sqlserver.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,12 @@ func (dialector Dialector) ClauseBuilders() map[string]clause.ClauseBuilder {
8787
builder.WriteString(" ROWS")
8888
}
8989

90-
if limit.Limit > 0 {
90+
if limit.Limit != nil && *limit.Limit >= 0 {
9191
if limit.Offset == 0 {
9292
builder.WriteString("OFFSET 0 ROW")
9393
}
9494
builder.WriteString(" FETCH NEXT ")
95-
builder.WriteString(strconv.Itoa(limit.Limit))
95+
builder.WriteString(strconv.Itoa(*limit.Limit))
9696
builder.WriteString(" ROWS ONLY")
9797
}
9898
}

0 commit comments

Comments
 (0)