diff options
author | Steve Manuel <nilslice@gmail.com> | 2016-11-01 23:58:24 -0700 |
---|---|---|
committer | Steve Manuel <nilslice@gmail.com> | 2016-11-01 23:58:24 -0700 |
commit | fe3e580e05cdbe1b7794f8c5f61634654377433b (patch) | |
tree | 5a4373917e60d65780d7fadbb08ce41926723a2b /system/db/content.go | |
parent | 0620fa5c061b83141e00daeabc5e7ee982e0de55 (diff) |
testing start / end positions on cursor - added back bounds check from prior version
Diffstat (limited to 'system/db/content.go')
-rw-r--r-- | system/db/content.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/system/db/content.go b/system/db/content.go index 8058cad..f1969b5 100644 --- a/system/db/content.go +++ b/system/db/content.go @@ -228,6 +228,14 @@ func Query(namespace string, opts QueryOptions) [][]byte { end = start + opts.Count } + // bounds check on posts given the start & end count + if start > n { + start = n - opts.Count + } + if end > n { + end = n + } + i := 0 // count of num posts added cur := 0 // count of where cursor is switch opts.Order { |