satellite/metainfo/metabase: fix segment listing with cursor.Part
Change-Id: I910888d435b11d2d4687ea0042998a1078cd6443
This commit is contained in:
parent
67c210a64c
commit
dad36179c6
@ -55,7 +55,7 @@ func (db *DB) ListSegments(ctx context.Context, opts ListSegments) (result ListS
|
||||
FROM segments
|
||||
WHERE
|
||||
stream_id = $1 AND
|
||||
($2 = 0 OR position > $2)
|
||||
($2 = 0::INT8 OR position > $2)
|
||||
ORDER BY position ASC
|
||||
LIMIT $3
|
||||
`, opts.StreamID, opts.Cursor, opts.Limit+1))(func(rows tagsql.Rows) error {
|
||||
|
@ -132,6 +132,20 @@ func TestListSegments(t *testing.T) {
|
||||
},
|
||||
}.Check(ctx, t, db)
|
||||
|
||||
ListSegments{
|
||||
Opts: metabase.ListSegments{
|
||||
StreamID: obj.StreamID,
|
||||
Limit: 2,
|
||||
Cursor: metabase.SegmentPosition{
|
||||
Part: 1,
|
||||
Index: 10,
|
||||
},
|
||||
},
|
||||
Result: metabase.ListSegmentsResult{
|
||||
More: false,
|
||||
},
|
||||
}.Check(ctx, t, db)
|
||||
|
||||
Verify{
|
||||
Objects: []metabase.RawObject{
|
||||
metabase.RawObject(expectedObject),
|
||||
|
Loading…
Reference in New Issue
Block a user