Skip to main content

TierWriter

Trait TierWriter 

Source
pub trait TierWriter: TierReader {
    // Required methods
    fn save_user_tier_sync(&self, update: &UserTierUpdate) -> Result<()>;
    fn set_margin_mode_sync(
        &self,
        wallet: &WalletAddress,
        margin_mode: MarginMode,
    ) -> Result<i64>;
    fn insert_margin_mode_if_missing_sync(
        &self,
        wallet: &WalletAddress,
        margin_mode: MarginMode,
    ) -> Result<Option<i64>>;
    fn delete_user_tier_sync(&self, wallet: &WalletAddress) -> Result<()>;
}
Expand description

Tier mutations.

Required Methods§

Source

fn save_user_tier_sync(&self, update: &UserTierUpdate) -> Result<()>

Upsert a tier. None fields in UserTierUpdate are left unchanged in the DB.

Source

fn set_margin_mode_sync( &self, wallet: &WalletAddress, margin_mode: MarginMode, ) -> Result<i64>

Set margin mode for a wallet. Returns the new version counter.

Source

fn insert_margin_mode_if_missing_sync( &self, wallet: &WalletAddress, margin_mode: MarginMode, ) -> Result<Option<i64>>

Insert a tier row with margin mode only if one doesn’t exist. Returns the new version counter, or None if the row already existed.

Source

fn delete_user_tier_sync(&self, wallet: &WalletAddress) -> Result<()>

Delete the tier row for a wallet.

Implementors§