pub struct VirtualCurrencyRepo { /* private fields */ }Expand description
Per-scope multi-currency balances. Keyed by (user_scope, code); a scope may hold balances in several currencies at once.
Implementations§
Source§impl VirtualCurrencyRepo
impl VirtualCurrencyRepo
pub fn new(store: Arc<CacheStore>) -> Self
Sourcepub fn get_all(&self, user_scope: &str) -> RovenueResult<BTreeMap<String, i64>>
pub fn get_all(&self, user_scope: &str) -> RovenueResult<BTreeMap<String, i64>>
All balances for a scope, ordered by code for stable snapshotting.
Sourcepub fn get(&self, user_scope: &str, code: &str) -> RovenueResult<Option<i64>>
pub fn get(&self, user_scope: &str, code: &str) -> RovenueResult<Option<i64>>
Single-currency convenience.
Sourcepub fn upsert_all(
&self,
user_scope: &str,
balances: &BTreeMap<String, i64>,
updated_at_ms: u64,
) -> RovenueResult<()>
pub fn upsert_all( &self, user_scope: &str, balances: &BTreeMap<String, i64>, updated_at_ms: u64, ) -> RovenueResult<()>
Replace the full balance set for a scope (the server response is
authoritative — currencies absent from balances are removed).
Auto Trait Implementations§
impl Freeze for VirtualCurrencyRepo
impl RefUnwindSafe for VirtualCurrencyRepo
impl Send for VirtualCurrencyRepo
impl Sync for VirtualCurrencyRepo
impl Unpin for VirtualCurrencyRepo
impl UnwindSafe for VirtualCurrencyRepo
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