pub struct TransactionRepository { /* private fields */ }Expand description
Repository for transaction persistence with indexing
Implementations§
Source§impl TransactionRepository
impl TransactionRepository
Sourcepub fn load(&self) -> Result<(), EnvelopeError>
pub fn load(&self) -> Result<(), EnvelopeError>
Load transactions from disk and build indexes
Sourcepub fn save(&self) -> Result<(), EnvelopeError>
pub fn save(&self) -> Result<(), EnvelopeError>
Save transactions to disk
Sourcepub fn get(
&self,
id: TransactionId,
) -> Result<Option<Transaction>, EnvelopeError>
pub fn get( &self, id: TransactionId, ) -> Result<Option<Transaction>, EnvelopeError>
Get a transaction by ID
Sourcepub fn get_all(&self) -> Result<Vec<Transaction>, EnvelopeError>
pub fn get_all(&self) -> Result<Vec<Transaction>, EnvelopeError>
Get all transactions
Sourcepub fn get_by_account(
&self,
account_id: AccountId,
) -> Result<Vec<Transaction>, EnvelopeError>
pub fn get_by_account( &self, account_id: AccountId, ) -> Result<Vec<Transaction>, EnvelopeError>
Get transactions for an account
Sourcepub fn get_by_category(
&self,
category_id: CategoryId,
) -> Result<Vec<Transaction>, EnvelopeError>
pub fn get_by_category( &self, category_id: CategoryId, ) -> Result<Vec<Transaction>, EnvelopeError>
Get transactions for a category
Sourcepub fn get_by_date_range(
&self,
start: NaiveDate,
end: NaiveDate,
) -> Result<Vec<Transaction>, EnvelopeError>
pub fn get_by_date_range( &self, start: NaiveDate, end: NaiveDate, ) -> Result<Vec<Transaction>, EnvelopeError>
Get transactions in a date range
Sourcepub fn upsert(&self, txn: Transaction) -> Result<(), EnvelopeError>
pub fn upsert(&self, txn: Transaction) -> Result<(), EnvelopeError>
Insert or update a transaction
Sourcepub fn delete(&self, id: TransactionId) -> Result<bool, EnvelopeError>
pub fn delete(&self, id: TransactionId) -> Result<bool, EnvelopeError>
Delete a transaction
Sourcepub fn find_by_import_id(
&self,
import_id: &str,
) -> Result<Option<Transaction>, EnvelopeError>
pub fn find_by_import_id( &self, import_id: &str, ) -> Result<Option<Transaction>, EnvelopeError>
Find transaction by import ID
Sourcepub fn count(&self) -> Result<usize, EnvelopeError>
pub fn count(&self) -> Result<usize, EnvelopeError>
Count transactions
Auto Trait Implementations§
impl !Freeze for TransactionRepository
impl RefUnwindSafe for TransactionRepository
impl Send for TransactionRepository
impl Sync for TransactionRepository
impl Unpin for TransactionRepository
impl UnwindSafe for TransactionRepository
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> 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