Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8dc8c42

Browse files
committed
Handle nonzero limit
1 parent b46813f commit 8dc8c42

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

coderd/database/modelqueries.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,7 @@ type getWorkspaceBuildParams struct {
202202
WorkspaceID uuid.UUID `db:"workspace_id"`
203203
BuildNumber int32 `db:"build_number"`
204204
LimitOpt int32 `db:"limit_opt"`
205-
Latest bool `db:"-"`
206-
TestLimit int `db:"-"`
205+
Latest bool `db:"-"` statu
207206
}
208207

209208
func (q *sqlQuerier) getWorkspaceBuild(ctx context.Context, arg getWorkspaceBuildParams) (WorkspaceBuild, error) {

coderd/database/sqlxqueries/workspace.gosql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ WHERE
5353
ORDER BY
5454
build_number desc
5555
{{ end }}
56-
LIMIT @limit_opt;
56+
{{ if gt .LimitOpt 0 }} LIMIT @limit_opt {{ end }}
57+
;
5758
{{ end }}
5859

5960

0 commit comments

Comments
 (0)