Skip to content

Commit

Permalink
Expose table_stat in ORM
Browse files Browse the repository at this point in the history
  • Loading branch information
vorot93 committed Feb 7, 2024
1 parent 10c9d72 commit f9fc73a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/orm/transaction.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::{cursor::*, traits::*};
use crate::{TransactionKind, WriteFlags, WriteMap, RO, RW};
use crate::{Stat, TransactionKind, WriteFlags, WriteMap, RO, RW};
use anyhow::Context;
use std::{collections::HashMap, marker::PhantomData};

Expand Down Expand Up @@ -42,6 +42,14 @@ impl<'db, K> Transaction<'db, K>
where
K: TransactionKind,
{
pub fn table_stat<T>(&self) -> Result<Stat, crate::Error>
where
T: Table,
{
self.inner
.table_stat(&self.inner.open_table(Some(T::NAME))?)
}

pub fn cursor<'tx, T>(&'tx self) -> anyhow::Result<Cursor<'tx, K, T>>
where
'db: 'tx,
Expand Down

0 comments on commit f9fc73a

Please sign in to comment.