Skip to content

Commit 3aa0c7e

Browse files
committed
fixed an off by one error in the memory database impl
1 parent a5813c7 commit 3aa0c7e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

database/memory/base.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func (m *Memory) ListDocuments(auth model.Auth, dbName, col string, params model
6666
}
6767

6868
start := (params.Page - 1) * params.Size
69-
end := start + params.Size - 1
69+
end := start + params.Size
7070

7171
if l := int64(len(list)); end > l {
7272
end = l
@@ -94,7 +94,7 @@ func (m *Memory) QueryDocuments(auth model.Auth, dbName, col string, filter map[
9494
filtered := filterByClauses(list, filter)
9595

9696
start := (params.Page - 1) * params.Size
97-
end := start + params.Size - 1
97+
end := start + params.Size
9898

9999
if l := int64(len(filtered)); end > l {
100100
end = l

0 commit comments

Comments
 (0)