Skip to content

Commit

Permalink
fix: secondary for rw transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
vincent-herlemont committed Sep 1, 2024
1 parent 7810f2f commit 7e0d719
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
9 changes: 4 additions & 5 deletions src/transaction/query/len.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,9 @@ impl RwLen<'_, '_> {
/// Get the number of values by secondary key.
///
/// Same as [`RLen::secondary()`](struct.RLen.html#method.secondary).
pub fn secondary<T: ToInput>(
&self,
_key_def: impl ToKeyDefinition<KeyOptions>,
) -> Result<Option<T>> {
todo!()
pub fn secondary<T: ToInput>(&self, key_def: impl ToKeyDefinition<KeyOptions>) -> Result<u64> {
let model = T::native_db_model();
let result = self.internal.secondary_len(model, key_def)?;
Ok(result)
}
}
4 changes: 2 additions & 2 deletions tests/upgrade/from_0_7_x_to_0_8_x.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use itertools::Itertools;
use native_db::*;
use native_model::{native_model, Model};
use redb::ReadableTable;
use serde::{Deserialize, Serialize};
use itertools::Itertools;
use std::path::PathBuf;
use redb::ReadableTable;

const OLD_TABLE: redb::TableDefinition<Key, Key> = redb::TableDefinition::new("2_1_name");
const NEW_TABLE: redb::MultimapTableDefinition<Key, Key> =
Expand Down

0 comments on commit 7e0d719

Please sign in to comment.