pub struct SqliteStore { /* private fields */ }Expand description
A SQLite-backed implementation of LedgerStore.
Uses connection pooling via sqlx::SqlitePool for efficient concurrent access.
Implementations§
Source§impl SqliteStore
impl SqliteStore
Sourcepub async fn new(db_url: &str) -> Result<Self, ZakatError>
pub async fn new(db_url: &str) -> Result<Self, ZakatError>
Sourcepub fn from_pool(pool: SqlitePool) -> Self
pub fn from_pool(pool: SqlitePool) -> Self
Creates a new SqliteStore from an existing pool.
Note: This does NOT run migrations. Use new() for automatic schema setup.
Sourcepub fn pool(&self) -> &SqlitePool
pub fn pool(&self) -> &SqlitePool
Returns a reference to the underlying connection pool.
Trait Implementations§
Source§impl LedgerStore for SqliteStore
impl LedgerStore for SqliteStore
Source§fn save_event<'life0, 'life1, 'async_trait>(
&'life0 self,
event: &'life1 LedgerEvent,
) -> Pin<Box<dyn Future<Output = Result<(), ZakatError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn save_event<'life0, 'life1, 'async_trait>(
&'life0 self,
event: &'life1 LedgerEvent,
) -> Pin<Box<dyn Future<Output = Result<(), ZakatError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Saves a single event to the store.
Source§fn load_events<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<LedgerEvent>, ZakatError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn load_events<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<LedgerEvent>, ZakatError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Loads all events from the store.
Auto Trait Implementations§
impl Freeze for SqliteStore
impl !RefUnwindSafe for SqliteStore
impl Send for SqliteStore
impl Sync for SqliteStore
impl Unpin for SqliteStore
impl !UnwindSafe for SqliteStore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more