diff options
Diffstat (limited to 'database/src/table.rs')
| -rw-r--r-- | database/src/table.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/database/src/table.rs b/database/src/table.rs index a96f96c..ad3775a 100644 --- a/database/src/table.rs +++ b/database/src/table.rs @@ -8,13 +8,14 @@ use crate::{query::Query, sort::Index}; use anyhow::{Result, anyhow}; use jellykv::{ReadTransaction, WriteTransaction}; use jellyobject::ObjectBuffer; +use std::collections::HashMap; pub type TableNum = u64; pub type RowNum = u64; pub struct Table { id: u32, - pub(crate) indices: Vec<Box<dyn Index>>, + pub(crate) indices: HashMap<IndexKey, Box<dyn Index>>, } impl Table { pub fn new(id: u32) -> Self { @@ -80,10 +81,10 @@ impl Table { txn.set(&self.key(row), bytemuck::cast_slice(entry.0.as_slice()))?; - for idx in &self.indices { - if !idx.compare(before, after) { - idx.remove(txn, row, before)?; - idx.add(txn, row, after)?; + for index in &self.indices { + if !index.compare(before, after) { + index.remove(txn, row, before)?; + index.add(txn, row, after)?; } } |