Skip to main content

DatabaseHandler

Struct DatabaseHandler 

Source
pub struct DatabaseHandler {
    pool: Arc<DbPool>,
}
Expand description

Synchronous persistence handler. Owns an r2d2 connection pool and implements all engine-path traits from hypercall_db (orders, instruments, tiers, settlements, journal replay, archiver, RFQ).

Constructors run Diesel migrations and ensure_enum_values by default. Use Self::new_readonly or Self::with_pool_no_migrations to skip.

Fields§

§pool: Arc<DbPool>

Implementations§

Source§

impl DatabaseHandler

Source

pub fn new(database_url: &str) -> Result<Self>

Create a new handler: build pool + run migrations.

Source

pub fn new_with_pool_size(database_url: &str, pool_max: u32) -> Result<Self>

Create a new handler with explicit pool size: build pool + run migrations.

Source

pub fn new_with_auth(auth: DbAuthConfig, pool_max: u32) -> Result<Self>

Create a new handler with DbAuthConfig: build pool + run migrations.

Source

pub fn new_with_timeouts( database_url: &str, pool_max: u32, statement_timeout_ms: u32, lock_timeout_ms: u32, ) -> Result<Self>

Create a handler with custom statement/lock timeouts, no migrations. Used by db-archiver which needs longer timeouts for batch operations.

Source

pub fn new_with_timeouts_auth( auth: DbAuthConfig, pool_max: u32, statement_timeout_ms: u32, lock_timeout_ms: u32, ) -> Result<Self>

Create a handler with custom timeouts and DbAuthConfig, no migrations.

Source

pub fn new_readonly(database_url: &str, pool_max: u32) -> Result<Self>

Create a handler with pool only, no migrations (for read-only replicas).

Source

pub fn new_readonly_auth(auth: DbAuthConfig, pool_max: u32) -> Result<Self>

Create a readonly handler with DbAuthConfig, no migrations.

Source

pub fn with_pool(pool: Arc<DbPool>) -> Result<Self>

Wrap an existing pool + run migrations.

Source

pub fn with_pool_no_migrations(pool: Arc<DbPool>) -> Self

Wrap an existing pool, skip migrations.

Source

pub fn pool(&self) -> Arc<DbPool>

Expose the pool (Arc-cloned).

Source

pub fn get_pool(&self) -> DbPool

Clone the inner pool (not the Arc).

Source

pub fn run_migrations(&self) -> Result<()>

Run pending Diesel migrations + ensure enum values.

Source

fn ensure_real_liquidation_schema(conn: &mut PgConnection) -> Result<()>

Source

fn build_pool( auth: &DbAuthConfig, pool_max: u32, statement_timeout_ms: u32, lock_timeout_ms: u32, ) -> Result<Self>

Source

fn ensure_enum_values(conn: &mut PgConnection) -> Result<()>

Ensure all required Postgres enum values exist.

Source

fn ensure_directive_action_key_enum(conn: &mut PgConnection) -> Result<()>

Ensure the directive outbox action-key enum exists even if an older duplicate-version migration was recorded before this enum migration ran.

Source

fn ensure_directive_outbox_wallet_address(conn: &mut PgConnection) -> Result<()>

Source

pub(crate) fn order_update_status_to_db( status: OrderUpdateStatus, ) -> &'static str

Map an OrderUpdateStatus enum to its DB string representation.

Source

pub(crate) fn observe_diesel_option_token_violation(err: &Error)

Log and count option_token_address unique constraint violations.

Source

pub fn update_snapshot_boundary_sync(&self, last_command_id: i64) -> Result<()>

Persist the engine state snapshot’s last_command_id to Postgres so the db-archiver can compute a safe deletion boundary. Must be called after every successful snapshot write to disk.

Source

pub fn directive_outbox_exists_sync(&self, directive_id: &str) -> Result<bool>

Check whether a directive outbox row exists for the given directive_id.

Source

pub async fn get_max_rsm_deposit_credit_observed_block( &self, ) -> Result<Option<u64>>

Get the maximum observed block from rsm_deposit_credits.

Source

pub async fn ensure_observed_deposit_account( &self, account: &WalletAddress, ) -> Result<()>

Ensure a user_tiers row exists for the wallet that will receive deposit credit.

Source

pub async fn claim_rsm_deposit_credit( &self, input: &RsmDepositCreditClaimInput, ) -> Result<RsmDepositCreditClaimRecord>

Claim an RSM deposit credit (idempotent upsert).

Source

pub async fn mark_rsm_deposit_credit_submitted( &self, request_id: &str, ) -> Result<()>

Mark an RSM deposit credit as submitted.

Source

pub async fn mark_rsm_deposit_credit_failed( &self, request_id: &str, error: &str, ) -> Result<()>

Mark an RSM deposit credit as failed.

Source

pub async fn pending_rsm_usdc_deposit_for_amount( &self, amount_wei: &str, ) -> Result<Option<RsmUsdcDepositMatch>>

Return the oldest pending Exchange.UsdcDeposit event for a HyperCore cash amount.

Source

pub async fn pending_rsm_usdc_deposit_for_evm_tx_hash( &self, evm_tx_hash: &str, amount_wei: &str, ) -> Result<Option<RsmUsdcDepositMatch>>

Return the pending Exchange.UsdcDeposit event for a CoreWriter writer-action EVM tx hash.

Source

pub async fn pm_liquidity_deposit_for_evm_tx_hash( &self, evm_tx_hash: &str, amount_wei: &str, ) -> Result<Option<RsmUsdcDepositMatch>>

Return a PM liquidity Exchange deposit by CoreWriter writer-action EVM tx hash.

Source

pub async fn pm_liquidity_deposit_for_amount( &self, amount_wei: &str, ) -> Result<Option<RsmUsdcDepositMatch>>

Return the oldest PM liquidity Exchange deposit for a HyperCore cash amount.

Source

pub async fn mark_pm_liquidity_deposit_hypercore_matched( &self, request_id: &str, event_hash: &str, ) -> Result<()>

Mark a PM liquidity Exchange deposit as consumed by a HyperCore cash event.

Source

pub async fn pending_rsm_usdc_deposit_for_credited_hypercore_event( &self, event_hash: &str, amount_wei: &str, ) -> Result<Option<RsmUsdcDepositMatch>>

Return a pending Exchange.UsdcDeposit request for an already credited HyperCore event.

Source

pub async fn credited_wallet_for_hypercore_cash_event( &self, event_hash: &str, ) -> Result<Option<WalletAddress>>

Return the credited wallet for an already-applied HyperCore cash event.

Source

pub async fn non_crediting_hypercore_cash_event( &self, event_hash: &str, amount_usdc: Decimal, ) -> Result<bool>

Return true when this HyperCore cash event is already recorded as non-crediting.

Source

pub async fn list_recent_cash_deposit_monitoring_rows( &self, limit: i64, offset: i64, ) -> Result<Vec<DepositMonitoringRow>>

Return recent cash deposit attribution rows for the admin panel.

Source

pub async fn apply_hypercore_cash_deposit( &self, input: &HypercoreCashLedgerApply, ) -> Result<HypercoreCashLedgerApplyResult>

Apply a HyperCore cash deposit (idempotent).

Source

pub async fn record_hypercore_cash_deposit_non_crediting( &self, input: &HypercoreCashLedgerApply, ) -> Result<()>

Record an observed Exchange HyperCore deposit that must not credit engine cash.

Source

pub async fn record_hypercore_cash_deposit_pending_margin_mode( &self, input: &HypercoreCashLedgerApply, ) -> Result<()>

Record a HyperCore cash deposit that cannot yet be credited because margin mode is unknown. The row pins the replay watermark until a later replay can apply the credit with a durable ledger sequence.

Source

pub fn get_exchange_cash_ledger_watermark_sync(&self) -> Result<Option<i64>>

Get the exchange-wide cash ledger watermark (max event_time_ms).

Source

pub async fn get_rsm_signer_nonce( &self, signer: &WalletAddress, ) -> Result<Option<RsmSignerNonceRecord>>

Load the current nonce state for a signer address (sync, used by startup code).

Source

pub async fn get_option_instrument_for_credit( &self, token: &WalletAddress, ) -> Result<Option<OptionInstrumentForCredit>>

Look up an option instrument by its on-chain token address.

Source§

impl DatabaseHandler

Source

pub(crate) fn upsert_order_info( conn: &mut PgConnection, info: &NewOrderInfo, ) -> Result<()>

Upsert static order info into order_infos. Used by handle_event_with_conn and the OrderWriter trait impl.

Source

pub(crate) fn insert_order_action( conn: &mut PgConnection, action: &NewOrderAction, ) -> Result<()>

Insert an order action audit trail entry. Used by handle_event_with_conn and the OrderWriter trait impl.

Source

pub fn handle_event_sync(&self, event: &EngineMessage) -> Result<()>

Persist a single engine event, acquiring a connection from the pool.

Source

pub fn handle_event_batch_sync(&self, events: &[EngineMessage]) -> Result<()>

Persist a batch of engine events in a single transaction.

Source

pub fn handle_event_with_conn( &self, conn: &mut PgConnection, event: &EngineMessage, ) -> Result<()>

Persist a single engine event using the provided connection.

Source

pub fn batch_cancel_expired_orders_sync( &self, cancels: &[ExpiredOrderCancel], reason: &str, ) -> Result<usize>

Batch-insert CANCELED rows into order_updates for orders on expired instruments. Skips orders that already have a terminal status (CANCELED, FILLED, REJECTED) in order_infos for idempotency.

Runs as a single serializable transaction with retry.

Source

fn save_liquidation_state_with_conn( &self, conn: &mut PgConnection, state: &NewLiquidationState, ) -> Result<()>

Source

fn insert_liquidation_history_with_conn( &self, conn: &mut PgConnection, entry: &NewLiquidationHistory, ) -> Result<i64>

Source

fn upsert_liquidation_auction_with_conn( &self, conn: &mut PgConnection, auction: &NewLiquidationAuction, ) -> Result<()>

Source

fn update_liquidation_auction_with_conn( &self, conn: &mut PgConnection, auction_id: &str, update: &UpdateLiquidationAuction, ) -> Result<()>

Source

fn get_liquidation_auction_with_conn( &self, conn: &mut PgConnection, auction_id: &str, ) -> Result<Option<LiquidationAuctionRecord>>

Source

fn persist_transaction_update( conn: &mut PgConnection, tx_update: &TransactionUpdate, ) -> Result<()>

Update directive outbox status from a transaction lifecycle event. Withdrawal failures are not auto-refunded here. Until withdrawal proofs are user-driven, terminal withdrawal states require manual reconciliation.

Source§

impl DatabaseHandler

Source

pub(crate) fn apply_fill_ledger_side_effects( conn: &mut PgConnection, wallet: &WalletAddress, fill: &Fill, realized_delta: Decimal, premium_delta: Decimal, ) -> Result<()>

Trait Implementations§

Source§

impl ArchiverReader for DatabaseHandler

Source§

fn find_safe_boundary(&self, min_age_hours: i64) -> Result<ArchivalBoundary>

Find the safe archival boundary based on the engine snapshot’s last_command_id and the configured minimum age.
Source§

fn fetch_events_batch( &self, max_command_id: i64, age_cutoff: &DateTime<Utc>, batch_size: i64, after_event_id: Option<i64>, ) -> Result<Vec<ArchivedEvent>>

Fetch a batch of engine events eligible for archival.
Source§

fn fetch_orphan_commands_batch( &self, max_command_id: i64, age_cutoff: &DateTime<Utc>, batch_size: i64, after_command_id: Option<i64>, ) -> Result<Vec<ArchivedCommand>>

Fetch engine commands that have no remaining engine events (orphans).
Source§

fn fetch_order_actions_batch( &self, age_cutoff: &DateTime<Utc>, batch_size: i64, after_id: Option<i32>, ) -> Result<Vec<ArchivedOrderAction>>

Fetch a batch of order actions eligible for archival.
Source§

fn fetch_order_updates_batch( &self, age_cutoff: &DateTime<Utc>, batch_size: i64, after_id: Option<i32>, ) -> Result<Vec<ArchivedOrderUpdate>>

Fetch a batch of order updates eligible for archival.
Source§

impl ArchiverWriter for DatabaseHandler

Source§

fn delete_events(&self, event_ids: &[i64]) -> Result<usize>

Delete engine events by their IDs.
Source§

fn delete_commands(&self, command_ids: &[i64]) -> Result<usize>

Delete engine commands (and their digests) by their IDs.
Source§

fn delete_order_actions(&self, ids: &[i32]) -> Result<usize>

Delete order actions by their IDs.
Source§

fn delete_order_updates(&self, ids: &[i32]) -> Result<usize>

Delete order updates by their IDs.
Source§

fn delete_notifications_before( &self, cutoff: &DateTime<Utc>, batch_size: i64, ) -> Result<usize>

Delete a batch of notifications older than cutoff.
Source§

fn delete_notifications_over_per_user_cap( &self, max_per_user: i64, batch_size: i64, ) -> Result<usize>

Delete notifications that exceed the per-user cap.
Source§

impl DirectiveOutboxReader for DatabaseHandler

Source§

fn claim_next_directive_outbox_item_sync( &self, ) -> Result<Option<DirectiveOutboxRow>>

Source§

fn get_directive_status_sync( &self, directive_id: &str, ) -> Result<Option<DirectiveStatusRow>>

Look up the delivery status of a single directive by its ID.
Source§

fn get_withdrawal_history_sync( &self, wallet: &WalletAddress, limit: i64, ) -> Result<Vec<DirectiveStatusRow>>

Return withdrawal directive history for a wallet, most recent first.
Source§

fn list_directive_outbox_delivery_metrics_sync( &self, ) -> Result<Vec<DirectiveOutboxDeliveryMetricsRow>>

Return retryable directive delivery backlog grouped by stable low-cardinality labels.
Source§

fn list_recent_directive_outbox_rows_sync( &self, limit: i64, offset: i64, ) -> Result<Vec<DirectiveOutboxRecentRow>>

Return recent directive outbox rows for operator debugging.
Source§

impl DirectiveOutboxWriter for DatabaseHandler

Source§

fn mark_directive_outbox_delivery_failed_sync( &self, outbox_seq: i64, error: &str, ) -> Result<()>

Source§

fn mark_directive_outbox_dead_lettered_sync( &self, outbox_seq: i64, error: &str, ) -> Result<()>

Source§

fn mark_directive_outbox_manual_reconciliation_sync( &self, outbox_seq: i64, error: &str, ) -> Result<()>

Stop retrying a directive whose on-chain outcome is unknown. Read more
Source§

fn record_directive_submitter_submission_sync( &self, request_id: &str, submitter_address: &Address, submitter_nonce: u64, ) -> Result<()>

Store the submitter-owned submission pointer for a directive. Read more
Source§

fn persist_directive_transaction_update_sync( &self, request_id: &str, status: TransactionStatus, tx_hash: Option<&str>, error: Option<&str>, ) -> Result<()>

Persist transaction-submitter status updates for a directive. Read more
Source§

impl EngineJournalBatchWriter for DatabaseHandler

Source§

fn insert_engine_journal_batch_sync( &self, entries: &[EngineJournalEntryInsert], persist_digests: bool, rsm_blocks: Option<&EngineJournalRsmBlockBatch>, ) -> Result<EngineJournalBatchInsertResult>

Source§

fn lookup_engine_journal_command_ids_sync( &self, request_ids: &[Uuid], ) -> Result<Vec<(Uuid, i64)>>

Source§

impl InstrumentReader for DatabaseHandler

Source§

fn get_all_instruments_sync(&self) -> Result<Vec<InstrumentRecord>>

Load all instruments regardless of status.
Source§

fn get_instruments_by_status_sync( &self, status: &str, ) -> Result<Vec<InstrumentRecord>>

Load instruments filtered by status (e.g. “ACTIVE”, “PENDING_SETTLEMENT”).
Source§

fn get_instrument_status_counts_sync(&self) -> Result<Vec<(String, i64)>>

Count instruments grouped by status.
Source§

fn get_markets_expiring_within_sync(&self, seconds: i64) -> Result<i64>

Count markets (underlying+expiry) expiring within seconds from now.
§

fn get_active_instruments_expired_by_sync( &self, now_ts_secs: u64, ) -> Result<Vec<InstrumentRecord>, Error>

Load active instruments whose expiry timestamp is at or before now_ts_secs.
Source§

impl InstrumentWriter for DatabaseHandler

Source§

fn save_market_and_instrument_sync( &self, underlying: &str, expiry: i64, instrument: &InstrumentRecord, ) -> Result<()>

Persist a new instrument and its parent market. Only used for new ACTIVE instruments – status transitions on existing instruments go through update_instrument_status_sync.
Source§

fn delete_market_and_instrument_sync(&self, symbol: &str) -> Result<()>

Delete an instrument and its parent market row.
Source§

fn update_instrument_status_sync( &self, symbols: &[String], status: &str, ) -> Result<usize>

Batch-update instrument status. Returns number of rows updated.
Source§

fn transition_active_instruments_to_expired_pending_sync( &self, symbols: &[String], ) -> Result<usize>

Transition only instruments that are still ACTIVE to EXPIRED_PENDING_PRICE. Returns number of rows updated.
Source§

impl InstrumentsSnapshotReader for DatabaseHandler

Source§

fn get_latest_instruments_snapshot_id_sync(&self) -> Result<Option<i64>>

Load the latest instruments snapshot ID.
Source§

fn load_instruments_snapshot_sync( &self, snapshot_id: i64, ) -> Result<InstrumentsSnapshotData>

Load instruments snapshot data for a given snapshot ID.
Source§

impl InstrumentsSnapshotWriter for DatabaseHandler

Source§

fn write_instruments_snapshot_sync( &self, input: &InstrumentsSnapshotInput, ) -> Result<i64>

Write a complete instruments snapshot in a single transaction. Returns the new snapshot ID.
Source§

impl JournalReplayReader for DatabaseHandler

Source§

fn get_next_engine_command_id_sync(&self) -> Result<i64>

Next command_id for sequence initialization (MAX + 1, or 1 if empty).
Source§

fn get_journal_command_id_bounds_sync( &self, ) -> Result<Option<JournalCommandIdBounds>>

Inclusive command-id bounds for replayable rows in engine_commands.
Source§

fn count_non_replayable_commands_in_range_sync( &self, start_command_id: i64, end_command_id: i64, ) -> Result<i64>

Count durable non-replayable journal rows in a command-id range (exclusive start, inclusive end).
Source§

fn get_commands_with_l2_after_seq_sync( &self, l2_seq: i64, ) -> Result<Vec<ReplayCommand>>

Fetch commands that produced L2 events after the snapshot’s L2 sequence. Used for the primary replay path (Pass 1).
Source§

fn get_replay_commands_after_command_id_sync( &self, after_command_id: i64, up_to_command_id: Option<i64>, limit: i64, ) -> Result<Vec<ReplayCommand>>

Paginated replay cursor: fetch up to limit commands after after_command_id, optionally bounded by up_to_command_id.
Source§

fn get_fill_events_for_command_range_sync( &self, start_command_id: i64, end_command_id: i64, ) -> Result<Vec<Vec<u8>>>

Raw OrderFilled event payloads in a command_id range (exclusive start, inclusive end).
Source§

fn get_portfolio_events_for_command_range_sync( &self, start_command_id: i64, end_command_id: i64, ) -> Result<Vec<PortfolioReplayEvent>>

Portfolio-relevant events (OrderFilled + PositionExpired) in a command_id range. Used during portfolio cache replay.
Source§

fn get_order_update_events_for_command_range_sync( &self, start_command_id: i64, end_command_id: i64, ) -> Result<Vec<Vec<u8>>>

Raw OrderUpdate event payloads in a command_id range (exclusive start, inclusive end).
Source§

fn get_max_l2_seq_from_events_sync(&self) -> Result<i64>

Maximum L2 sequence from engine_events. Returns 0 if no L2 events exist.
Source§

fn get_fill_events_after_seq_sync(&self, l2_seq: i64) -> Result<Vec<Vec<u8>>>

Raw OrderFilled event payloads after the snapshot boundary (by L2 sequence). Used during replay Pass 2 (fill reconciliation).
Source§

fn get_order_update_events_after_seq_sync( &self, l2_seq: i64, ) -> Result<Vec<Vec<u8>>>

Raw OrderUpdate event payloads after the snapshot boundary (by L2 sequence). Used during replay Pass 3 (side-effect cancel detection).
Source§

impl MmpConfigReader for DatabaseHandler

Source§

fn get_mmp_config_sync( &self, wallet: &WalletAddress, currency: &str, ) -> Result<Option<MmpConfigRecord>>

Load MMP config for a specific wallet+currency pair.
Source§

fn get_all_mmp_configs_for_wallet_sync( &self, wallet: &WalletAddress, ) -> Result<Vec<MmpConfigRecord>>

Load all MMP configs for a wallet (all currencies).
Source§

fn get_all_mmp_configs_sync(&self) -> Result<Vec<MmpConfigRecord>>

Load all MMP configs across all wallets.
Source§

impl MmpConfigWriter for DatabaseHandler

Source§

fn save_mmp_config_sync(&self, config: &MmpConfigRecord) -> Result<()>

Upsert an MMP config (insert or update on wallet+currency conflict).
Source§

fn delete_mmp_config_sync( &self, wallet: &WalletAddress, currency: &str, ) -> Result<()>

Delete an MMP config for a specific wallet+currency pair.
Source§

impl OracleWriter for DatabaseHandler

Source§

fn save_oracle_price_samples_sync( &self, samples: &[NewOraclePriceSampleInput], ) -> Result<()>

Persist a batch of price samples for a given symbol/expiry. Duplicate samples (by symbol, expiry, timestamp, source) are silently ignored.
Source§

fn save_oracle_settlement_price_sync( &self, settlement: &NewOracleSettlementPriceInput, ) -> Result<()>

Persist a finalized settlement price. If a settlement already exists for this (symbol, expiry), it is silently ignored.
Source§

fn get_oracle_settlement_price_sync( &self, symbol: &str, expiry_timestamp: i64, ) -> Result<Option<f64>>

Load a settlement price from the database. Returns None if no settlement exists for this symbol/expiry.
Source§

impl OrderReader for DatabaseHandler

Source§

fn get_order_infos_sync( &self, wallet: Option<&WalletAddress>, ) -> Result<Vec<OrderInfoRecord>>

Load materialized order infos, optionally filtered by wallet.
Source§

fn get_client_ids_by_order_ids_sync( &self, order_ids: &[i64], ) -> Result<HashMap<i64, Option<String>>>

Batch lookup of client_ids by order_ids (sync path).
Source§

fn get_terminal_order_ids_sync(&self, order_ids: &[i64]) -> Result<Vec<i64>>

Return which of the given order IDs are in a terminal state.
Source§

fn get_max_order_id_sync(&self) -> Result<u64>

MAX(order_id) + 1 for sequence initialization.
Source§

fn get_max_trade_id_sync(&self) -> Result<u64>

MAX(trade_id) + 1 for sequence initialization.
Source§

impl OrderWriter for DatabaseHandler

Source§

fn persist_order_info_sync(&self, info: &PersistOrderInfo) -> Result<()>

Persist static order info (upsert on order_id).
Source§

fn persist_order_action_sync(&self, action: &PersistOrderAction) -> Result<()>

Persist an order action audit trail entry.
Source§

fn persist_order_update_sync(&self, update: &OrderUpdateMessage) -> Result<()>

Persist an order status update + materialize into order_infos.
Source§

fn persist_fill_with_side_effects_sync( &self, fill: &Fill, side_effects: &FillSideEffects, ) -> Result<(bool, bool)>

Persist a fill atomically with trades + ledger side effects.
Source§

fn batch_cancel_orders_for_settlement_sync( &self, order_ids: &[i64], timestamp_ms: i64, ) -> Result<usize>

Batch cancel orders for settlement.
Source§

fn cancel_orphaned_orders_by_symbols_sync( &self, symbols: &[String], ) -> Result<usize>

Cancel orphaned orders by symbol.
Source§

impl PmSettlementProjectionSyncReader for DatabaseHandler

Source§

fn list_pm_settlement_pools_sync( &self, ) -> Result<Vec<PmSettlementPoolProjection>>

Source§

fn list_pm_settlement_accounts_sync( &self, ) -> Result<Vec<PmSettlementAccountProjection>>

Source§

fn list_pm_settlement_events_sync( &self, ) -> Result<Vec<PmSettlementEventProjection>>

Source§

fn list_pm_settlement_interest_events_sync( &self, ) -> Result<Vec<PmSettlementInterestEventProjection>>

Source§

fn list_pm_settlement_repayment_events_sync( &self, ) -> Result<Vec<PmSettlementRepaymentEventProjection>>

Source§

fn list_pm_recovery_plans_sync(&self) -> Result<Vec<PmRecoveryPlanProjection>>

Source§

fn list_pm_recovery_actions_sync( &self, ) -> Result<Vec<PmRecoveryActionProjection>>

Source§

impl PmSettlementProjectionSyncWriter for DatabaseHandler

Source§

fn apply_pm_settlement_projection_writes_sync( &self, writes: &[PmSettlementProjectionWrite], ) -> Result<()>

Source§

impl PortfolioSnapshotReader for DatabaseHandler

Source§

fn get_latest_portfolio_snapshot_id_sync(&self) -> Result<Option<i64>>

Load the latest portfolio snapshot ID.
Source§

fn portfolio_snapshot_exists_sync(&self, snapshot_id: i64) -> Result<bool>

Check if a portfolio snapshot exists.
Source§

fn load_portfolio_snapshot_sync( &self, snapshot_id: i64, ) -> Result<PortfolioSnapshotData>

Load portfolio snapshot data for a given snapshot ID.
Source§

impl PortfolioSnapshotWriter for DatabaseHandler

Source§

fn write_portfolio_snapshot_sync( &self, input: &PortfolioSnapshotInput, ) -> Result<i64>

Write a complete portfolio snapshot in a single transaction. Returns the new snapshot ID.
Source§

impl RfqReader for DatabaseHandler

Source§

fn get_all_quote_providers_sync(&self) -> Result<Vec<QuoteProviderRecord>>

Load all registered quote providers.
Source§

impl RfqWriter for DatabaseHandler

Source§

fn upsert_quote_provider_sync(&self, qp: &QuoteProviderRecord) -> Result<()>

Upsert a quote provider registration.
Source§

fn update_quote_provider_status_sync( &self, wallet: &WalletAddress, status: &str, ) -> Result<()>

Update a quote provider’s status (“active” / “suspended”).
Source§

fn persist_rfq_record_sync( &self, rfq_id: &Uuid, taker_wallet: &WalletAddress, underlying: &str, status: &str, taker_signature: &str, taker_nonce: u64, legs_hash: &[u8; 32], legs: &[(String, String, Decimal)], expires_at_ms: u64, ) -> Result<()>

Persist an RFQ record and its legs atomically.
Source§

fn persist_rfq_quote_sync( &self, quote_id: &Uuid, rfq_id: &Uuid, qp_wallet: &WalletAddress, net_premium: Decimal, valid_for_ms: u64, qp_signature: &str, qp_nonce: u64, legs: &[(String, String, Decimal, Decimal)], expires_at_ms: u64, ) -> Result<()>

Persist a quote provider’s firm quote and its legs atomically.
Source§

fn update_rfq_status_sync(&self, rfq_id: &Uuid, status: &str) -> Result<()>

Update RFQ record status.
Source§

impl RsmCreditReader for DatabaseHandler

Source§

fn directive_outbox_exists_sync(&self, directive_id: &str) -> Result<bool>

Check whether a directive outbox row exists for the given directive_id.
Source§

fn get_max_rsm_deposit_credit_observed_block<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Option<u64>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Return the replay watermark for RSM deposit credits.
Source§

fn get_exchange_cash_ledger_watermark_sync(&self) -> Result<Option<i64>>

Return the replay watermark for exchange cash ledger events.
Source§

fn get_option_instrument_for_credit<'life0, 'life1, 'async_trait>( &'life0 self, token: &'life1 WalletAddress, ) -> Pin<Box<dyn Future<Output = Result<Option<OptionInstrumentForCredit>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Look up an option instrument by its on-chain token address.
Source§

fn list_recent_cash_deposit_monitoring_rows<'life0, 'async_trait>( &'life0 self, limit: i64, offset: i64, ) -> Pin<Box<dyn Future<Output = Result<Vec<DepositMonitoringRow>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Return recent cash deposit attribution rows for admin monitoring.
Source§

impl RsmCreditWriter for DatabaseHandler

Source§

fn ensure_observed_deposit_account<'life0, 'life1, 'async_trait>( &'life0 self, account: &'life1 WalletAddress, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Ensure an observed deposit account has a tier row before crediting.
Source§

fn claim_rsm_deposit_credit<'life0, 'life1, 'async_trait>( &'life0 self, input: &'life1 RsmDepositCreditClaimInput, ) -> Pin<Box<dyn Future<Output = Result<RsmDepositCreditClaimRecord>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Claim an observed RSM deposit credit idempotently.
Source§

fn mark_rsm_deposit_credit_submitted<'life0, 'life1, 'async_trait>( &'life0 self, request_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Mark an RSM deposit credit as submitted to the engine/journal path.
Source§

fn mark_rsm_deposit_credit_failed<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, request_id: &'life1 str, error: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Mark an RSM deposit credit as failed so observers can quarantine invalid public events.
Source§

fn pending_rsm_usdc_deposit_for_amount<'life0, 'life1, 'async_trait>( &'life0 self, amount_wei: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<RsmUsdcDepositMatch>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Match a pending Exchange.UsdcDeposit event to one observed HyperCore cash deposit.
Source§

fn pending_rsm_usdc_deposit_for_evm_tx_hash<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, evm_tx_hash: &'life1 str, amount_wei: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Option<RsmUsdcDepositMatch>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Match a pending Exchange.UsdcDeposit event to a CoreWriter writer-action EVM tx hash.
Source§

fn pending_rsm_usdc_deposit_for_credited_hypercore_event<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, event_hash: &'life1 str, amount_wei: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Option<RsmUsdcDepositMatch>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Recover a still-pending Exchange.UsdcDeposit request for an already credited HyperCore event.
Source§

fn credited_wallet_for_hypercore_cash_event<'life0, 'life1, 'async_trait>( &'life0 self, event_hash: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<WalletAddress>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Return the wallet already credited for a HyperCore cash deposit event, if any.
Source§

fn non_crediting_hypercore_cash_event<'life0, 'life1, 'async_trait>( &'life0 self, event_hash: &'life1 str, amount_usdc: Decimal, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Return true when a HyperCore cash deposit event is already recorded as non-crediting.
Source§

fn apply_hypercore_cash_deposit<'life0, 'life1, 'async_trait>( &'life0 self, input: &'life1 HypercoreCashLedgerApply, ) -> Pin<Box<dyn Future<Output = Result<HypercoreCashLedgerApplyResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Apply a HyperCore cash deposit idempotently.
Source§

fn record_hypercore_cash_deposit_pending_margin_mode<'life0, 'life1, 'async_trait>( &'life0 self, input: &'life1 HypercoreCashLedgerApply, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Persist a replayable cash deposit row when margin mode is temporarily unavailable.
Source§

impl SettlementReader for DatabaseHandler

Source§

fn is_settlement_ledger_applied_sync( &self, wallet: &WalletAddress, symbol: &str, ) -> Result<bool>

Check if a specific settlement has been applied to the ledger.
Source§

fn get_applied_settlement_symbols_sync( &self, wallet: &WalletAddress, symbols: &[String], ) -> Result<HashSet<String>>

Return the subset of symbols that have applied settlement payouts for a wallet.
Source§

fn get_total_fill_volume_sync(&self) -> Result<(i64, Decimal)>

Get total fill volume: (fill_count, total_notional).
Source§

impl SettlementWriter for DatabaseHandler

Source§

fn try_apply_settlement_sync( &self, wallet: &WalletAddress, symbol: &str, position_size: Decimal, settlement_price: Decimal, settlement_value: Decimal, margin_mode: MarginMode, event_ts_ms: i64, settlement_entry_price: Option<Decimal>, cost_basis: Option<Decimal>, net_pnl: Option<Decimal>, ) -> Result<SettlementResult>

Idempotent settlement audit: expiration row, payout row, and ledger event. Returns whether this was a new settlement or a duplicate replay.
Source§

fn observe_applied_settlement_sync( &self, wallet: &WalletAddress, symbol: &str, position_size: Decimal, settlement_price: Decimal, settlement_value: Decimal, margin_mode: MarginMode, settlement_entry_price: Option<Decimal>, cost_basis: Option<Decimal>, net_pnl: Option<Decimal>, ) -> Result<SettlementResult>

Read and validate an already-applied settlement without writing. Read more
Source§

impl TierReader for DatabaseHandler

Source§

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

Get margin mode for a wallet, defaulting to Standard if no row exists.
Source§

fn get_existing_margin_mode_sync( &self, wallet: &WalletAddress, ) -> Result<Option<MarginMode>>

Get margin mode only if a tier row exists (returns None otherwise).
Source§

fn get_tier_defaults_sync( &self, tier_name: &str, ) -> Result<Option<TierDefaultsRecord>>

Load default rate limits for a tier name (e.g. “default”, “mm”).
Source§

fn get_user_tier_sync( &self, wallet: &WalletAddress, ) -> Result<Option<UserTierRecord>>

Load the full tier record for a wallet.
Source§

fn get_all_user_tiers_sync(&self) -> Result<Vec<UserTierRecord>>

Load all user tiers across all wallets.
Source§

impl TierWriter for DatabaseHandler

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.
Source§

impl TransactionSubmitterStore for DatabaseHandler

Source§

fn max_nonce_for_submitter_sync( &self, submitter: &SubmitterId, ) -> Result<Option<u64>>

Source§

fn record_submission_sync( &self, record: &SubmissionRecord, attempts: &[SubmissionAttemptRecord], ) -> Result<()>

Source§

fn update_submission_status_sync( &self, submitter: &SubmitterId, nonce: SubmittedNonce, status: SubmissionStatus, primary_tx_hash: Option<&str>, terminal_error: Option<&str>, ) -> Result<()>

Source§

fn list_pending_submissions_sync( &self, after_submission_id: i64, limit: i64, ) -> Result<Vec<PendingSubmissionRow>>

Source§

impl Transactional for DatabaseHandler

Source§

impl ValidatorRsmStateReader for DatabaseHandler

Source§

fn get_validator_rsm_root_summary_sync( &self, environment: ValidatorRsmEnvironment, version: u64, ) -> Result<Option<ValidatorRsmRootSummary>>

Source§

fn get_validator_rsm_current_state_sync( &self, environment: ValidatorRsmEnvironment, ) -> Result<Option<ValidatorRsmCurrentState>>

Source§

fn get_validator_rsm_current_root_summary_sync( &self, environment: ValidatorRsmEnvironment, ) -> Result<Option<ValidatorRsmRootSummary>>

Source§

fn get_rsm_block_by_height_sync( &self, environment: ValidatorRsmEnvironment, height: u64, ) -> Result<Option<RsmBlockView>>

Source§

fn get_rsm_block_by_hash_sync( &self, environment: ValidatorRsmEnvironment, hash: [u8; 32], ) -> Result<Option<RsmBlockView>>

Source§

fn get_latest_rsm_block_sync( &self, environment: ValidatorRsmEnvironment, ) -> Result<Option<RsmBlockView>>

Source§

fn list_rsm_blocks_sync( &self, environment: ValidatorRsmEnvironment, from_height: Option<u64>, limit: u32, ) -> Result<Vec<RsmBlockView>>

Source§

fn get_rsm_block_commands_sync( &self, environment: ValidatorRsmEnvironment, height: u64, ) -> Result<Vec<RsmBlockCommand>>

§

fn get_rsm_block_data_sync( &self, environment: ValidatorRsmEnvironment, height: u64, ) -> Result<Option<RsmBlockData>, Error>

Source§

impl ValidatorRsmStateWriter for DatabaseHandler

Source§

fn save_validator_rsm_root_summary_sync( &self, summary: &NewValidatorRsmRootSummary, advance_current: bool, ) -> Result<()>

Source§

fn save_rsm_block_header_sync(&self, block: &NewRsmBlockHeader) -> Result<()>

Source§

fn save_rsm_block_commands_sync( &self, commands: &[NewRsmBlockCommand], ) -> Result<()>

Auto Trait Implementations§

Blanket Implementations§

§

impl<T> AggregateExpressionMethods for T

§

fn aggregate_distinct(self) -> Self::Output
where Self: DistinctDsl,

DISTINCT modifier for aggregate functions Read more
§

fn aggregate_all(self) -> Self::Output
where Self: AllDsl,

ALL modifier for aggregate functions Read more
§

fn aggregate_filter<P>(self, f: P) -> Self::Output
where P: AsExpression<Bool>, Self: FilterDsl<<P as AsExpression<Bool>>::Expression>,

Add an aggregate function filter Read more
§

fn aggregate_order<O>(self, o: O) -> Self::Output
where Self: OrderAggregateDsl<O>,

Add an aggregate function order Read more
Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Conv for T

§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into T using Into<T>. Read more
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Converts &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSend for T
where T: Any + Send,

§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Sync + Send>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
§

impl<T> FmtForward for T

§

fn fmt_binary(self) -> FmtBinary<Self>
where Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
§

fn fmt_display(self) -> FmtDisplay<Self>
where Self: Display,

Causes self to use its Display implementation when Debug-formatted.
§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where Self: LowerExp,

Causes self to use its LowerExp implementation when Debug-formatted.
§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where Self: LowerHex,

Causes self to use its LowerHex implementation when Debug-formatted.
§

fn fmt_octal(self) -> FmtOctal<Self>
where Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
§

fn fmt_pointer(self) -> FmtPointer<Self>
where Self: Pointer,

Causes self to use its Pointer implementation when Debug-formatted.
§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where Self: UpperExp,

Causes self to use its UpperExp implementation when Debug-formatted.
§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where Self: UpperHex,

Causes self to use its UpperHex implementation when Debug-formatted.
§

fn fmt_list(self) -> FmtList<Self>
where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
§

impl<T> IntoSql for T

§

fn into_sql<T>(self) -> Self::Expression
where Self: Sized + AsExpression<T>, T: SqlType + TypedExpressionType,

Convert self to an expression for Diesel’s query builder. Read more
§

fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
where &'a Self: AsExpression<T>, T: SqlType + TypedExpressionType,

Convert &self to an expression for Diesel’s query builder. Read more
§

impl<T> Pipe for T
where T: ?Sized,

§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe function.
§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R, ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
§

impl<T, Conn> RunQueryDsl<Conn> for T

§

fn execute<'conn, 'query>( self, conn: &'conn mut Conn, ) -> <Conn as AsyncConnectionCore>::ExecuteFuture<'conn, 'query>
where Conn: AsyncConnectionCore + Send, Self: ExecuteDsl<Conn> + 'query,

Executes the given command, returning the number of rows affected. Read more
§

fn load<'query, 'conn, U>( self, conn: &'conn mut Conn, ) -> AndThen<Self::LoadFuture<'conn>, TryCollect<Self::Stream<'conn>, Vec<U>>>
where U: Send, Conn: AsyncConnectionCore, Self: LoadQuery<'query, Conn, U> + 'query,

Executes the given query, returning a Vec with the returned rows. Read more
§

fn load_stream<'conn, 'query, U>( self, conn: &'conn mut Conn, ) -> Self::LoadFuture<'conn>
where Conn: AsyncConnectionCore, U: 'conn, Self: LoadQuery<'query, Conn, U> + 'query,

Executes the given query, returning a [Stream] with the returned rows. Read more
§

fn get_result<'query, 'conn, U>( self, conn: &'conn mut Conn, ) -> AndThen<Self::LoadFuture<'conn>, LoadNext<Pin<Box<Self::Stream<'conn>>>>>
where U: Send + 'conn, Conn: AsyncConnectionCore, Self: LoadQuery<'query, Conn, U> + 'query,

Runs the command, and returns the affected row. Read more
§

fn get_results<'query, 'conn, U>( self, conn: &'conn mut Conn, ) -> AndThen<Self::LoadFuture<'conn>, TryCollect<Self::Stream<'conn>, Vec<U>>>
where U: Send, Conn: AsyncConnectionCore, Self: LoadQuery<'query, Conn, U> + 'query,

Runs the command, returning an Vec with the affected rows. Read more
§

fn first<'query, 'conn, U>( self, conn: &'conn mut Conn, ) -> AndThen<<Self::Output as LoadQuery<'query, Conn, U>>::LoadFuture<'conn>, LoadNext<Pin<Box<<Self::Output as LoadQuery<'query, Conn, U>>::Stream<'conn>>>>>
where U: Send + 'conn, Conn: AsyncConnectionCore, Self: LimitDsl, Self::Output: LoadQuery<'query, Conn, U> + Send + 'query,

Attempts to load a single record. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T> Tap for T

§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release builds.
§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds.
§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release builds.
§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release builds.
§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
§

impl<T> TryConv for T

§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WindowExpressionMethods for T

§

fn over(self) -> Self::Output
where Self: OverDsl,

Turn a function call into a window function call Read more
§

fn window_filter<P>(self, f: P) -> Self::Output
where P: AsExpression<Bool>, Self: FilterDsl<<P as AsExpression<Bool>>::Expression>,

Add a filter to the current window function Read more
§

fn partition_by<E>(self, expr: E) -> Self::Output
where Self: PartitionByDsl<E>,

Add a partition clause to the current window function Read more
§

fn window_order<E>(self, expr: E) -> Self::Output
where Self: OrderWindowDsl<E>,

Add a order clause to the current window function Read more
§

fn frame_by<E>(self, expr: E) -> Self::Output
where Self: FrameDsl<E>,

Add a frame clause to the current window function Read more
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,