mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-08-04 18:18:03 +00:00
Add assertion forbidding duplicate cursor keys
This commit is contained in:
parent
77ce4780d9
commit
592ba41137
1 changed files with 7 additions and 0 deletions
|
@ -249,6 +249,13 @@ impl ProgramBuilder {
|
|||
}
|
||||
|
||||
pub fn alloc_cursor_id_keyed(&mut self, key: CursorKey, cursor_type: CursorType) -> usize {
|
||||
assert!(
|
||||
!self
|
||||
.cursor_ref
|
||||
.iter()
|
||||
.any(|(k, _)| k.as_ref().map_or(false, |k| k.equals(&key))),
|
||||
"duplicate cursor key"
|
||||
);
|
||||
self._alloc_cursor_id(Some(key), cursor_type)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue