call cursor methods instead of duplicating logic

This commit is contained in:
Jussi Saurio 2025-02-07 10:09:42 +02:00
parent 93c3689070
commit cb9d929eab

View file

@ -83,24 +83,11 @@ impl VTabModule for GenerateSeriesVTab {
}
fn next(cursor: &mut Self::VCursor) -> ResultCode {
// Check for invalid ranges (empty series) first
if cursor.eof() {
return ResultCode::EOF;
}
// Handle overflow
cursor.current = match cursor.current.checked_add(cursor.step) {
Some(val) => val,
None => {
return ResultCode::EOF;
}
};
ResultCode::OK
cursor.next()
}
fn eof(cursor: &Self::VCursor) -> bool {
cursor.is_invalid_range() || cursor.would_exceed()
cursor.eof()
}
}