Skip to content

Commit 515edf1

Browse files
committed
count 0 vs -1
1 parent e0af28e commit 515edf1

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

coderd/users.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ func (api *API) GetUsers(rw http.ResponseWriter, r *http.Request) ([]database.Us
253253
// GetUsers does not return ErrNoRows because it uses a window function to get the count.
254254
// So we need to check if the userRows is empty and return an empty array if so.
255255
if len(userRows) == 0 {
256-
return []database.User{}, -1, true
256+
return []database.User{}, 0, true
257257
}
258258

259259
users := database.ConvertUserRows(userRows)

coderd/users_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1439,7 +1439,7 @@ func TestGetUsersPagination(t *testing.T) {
14391439
})
14401440
require.NoError(t, err)
14411441
require.Len(t, res.Users, 0)
1442-
require.Equal(t, res.Count, -1)
1442+
require.Equal(t, res.Count, 0)
14431443
}
14441444

14451445
func TestPostTokens(t *testing.T) {

0 commit comments

Comments
 (0)