From f9fc73a2286e41a6ceb883ed05dac3499c2a73eb Mon Sep 17 00:00:00 2001 From: Artem Vorotnikov Date: Thu, 8 Feb 2024 00:13:10 +0300 Subject: [PATCH] Expose table_stat in ORM --- src/orm/transaction.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/orm/transaction.rs b/src/orm/transaction.rs index 02b6e03..9a7b645 100644 --- a/src/orm/transaction.rs +++ b/src/orm/transaction.rs @@ -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}; @@ -42,6 +42,14 @@ impl<'db, K> Transaction<'db, K> where K: TransactionKind, { + pub fn table_stat(&self) -> Result + where + T: Table, + { + self.inner + .table_stat(&self.inner.open_table(Some(T::NAME))?) + } + pub fn cursor<'tx, T>(&'tx self) -> anyhow::Result> where 'db: 'tx,