mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-08-04 18:18:03 +00:00
call cursor methods instead of duplicating logic
This commit is contained in:
parent
93c3689070
commit
cb9d929eab
1 changed files with 2 additions and 15 deletions
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue