aboutsummaryrefslogtreecommitdiff
path: root/database/src/table.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2026-01-26 23:54:20 +0100
committermetamuffin <metamuffin@disroot.org>2026-01-26 23:54:20 +0100
commit088b6b323130b0a9509c76f395c7ed4bf5609234 (patch)
tree5f0e6480e68d61dd3b58d4ce986ef7f57adf589e /database/src/table.rs
parentf59c6f472d25084aa5f8a116f8cf92f81df09c50 (diff)
downloadjellything-088b6b323130b0a9509c76f395c7ed4bf5609234.tar
jellything-088b6b323130b0a9509c76f395c7ed4bf5609234.tar.bz2
jellything-088b6b323130b0a9509c76f395c7ed4bf5609234.tar.zst
small renamed
Diffstat (limited to 'database/src/table.rs')
-rw-r--r--database/src/table.rs11
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)?;
}
}