pub struct AccountRepository { /* private fields */ }Expand description
Repository for account persistence
Implementations§
Source§impl AccountRepository
impl AccountRepository
Sourcepub fn load(&self) -> Result<(), EnvelopeError>
pub fn load(&self) -> Result<(), EnvelopeError>
Load accounts from disk
Sourcepub fn save(&self) -> Result<(), EnvelopeError>
pub fn save(&self) -> Result<(), EnvelopeError>
Save accounts to disk
Sourcepub fn get(&self, id: AccountId) -> Result<Option<Account>, EnvelopeError>
pub fn get(&self, id: AccountId) -> Result<Option<Account>, EnvelopeError>
Get an account by ID
Sourcepub fn get_active(&self) -> Result<Vec<Account>, EnvelopeError>
pub fn get_active(&self) -> Result<Vec<Account>, EnvelopeError>
Get all active (non-archived) accounts
Sourcepub fn get_by_name(&self, name: &str) -> Result<Option<Account>, EnvelopeError>
pub fn get_by_name(&self, name: &str) -> Result<Option<Account>, EnvelopeError>
Get an account by name (case-insensitive)
Sourcepub fn upsert(&self, account: Account) -> Result<(), EnvelopeError>
pub fn upsert(&self, account: Account) -> Result<(), EnvelopeError>
Insert or update an account
Sourcepub fn name_exists(
&self,
name: &str,
exclude_id: Option<AccountId>,
) -> Result<bool, EnvelopeError>
pub fn name_exists( &self, name: &str, exclude_id: Option<AccountId>, ) -> Result<bool, EnvelopeError>
Check if an account name is already taken
Sourcepub fn count(&self) -> Result<usize, EnvelopeError>
pub fn count(&self) -> Result<usize, EnvelopeError>
Count accounts
Auto Trait Implementations§
impl !Freeze for AccountRepository
impl RefUnwindSafe for AccountRepository
impl Send for AccountRepository
impl Sync for AccountRepository
impl Unpin for AccountRepository
impl UnwindSafe for AccountRepository
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