Skip to main content

SqliteDatabase

Struct SqliteDatabase 

Source
pub struct SqliteDatabase { /* private fields */ }
Available on crate feature sqlite only.
Expand description

SQLite database connection pool

Implementations§

Source§

impl SqliteDatabase

Source

pub fn new(config: &DatabaseConfig) -> Result<Self, CommerceError>

Create a new SQLite database connection

Source

pub fn in_memory() -> Result<Self, CommerceError>

Create an in-memory database (useful for testing)

Source

pub fn conn( &self, ) -> Result<PooledConnection<SqliteConnectionManager>, CommerceError>

Get a connection from the pool

Source

pub fn health_check(&self) -> Result<DbHealthStatus, CommerceError>

Run a health check: verify DB connectivity, return pool and storage stats.

Source

pub fn shutdown(&self) -> Result<(), CommerceError>

Graceful shutdown: checkpoint WAL and optimize before closing.

Call this before dropping the database to ensure all WAL data is flushed to the main database file. Safe to call multiple times.

Source

pub fn orders(&self) -> SqliteOrderRepository

Get order repository

Source

pub fn inventory(&self) -> SqliteInventoryRepository

Get inventory repository

Source

pub fn customers(&self) -> SqliteCustomerRepository

Get customer repository

Source

pub fn products(&self) -> SqliteProductRepository

Get product repository

Source

pub fn custom_objects(&self) -> SqliteCustomObjectRepository

Get custom objects repository (custom states / metaobjects)

Source

pub fn returns(&self) -> SqliteReturnRepository

Get return repository

Source

pub fn bom(&self) -> SqliteBomRepository

Get BOM (Bill of Materials) repository

Source

pub fn work_orders(&self) -> SqliteWorkOrderRepository

Get work order repository

Source

pub fn shipments(&self) -> SqliteShipmentRepository

Get shipment repository

Source

pub fn payments(&self) -> SqlitePaymentRepository

Get payment repository

Source

pub fn warranties(&self) -> SqliteWarrantyRepository

Get warranty repository

Source

pub fn purchase_orders(&self) -> SqlitePurchaseOrderRepository

Get purchase order repository

Source

pub fn invoices(&self) -> SqliteInvoiceRepository

Get invoice repository

Source

pub fn carts(&self) -> SqliteCartRepository

Get cart repository

Source

pub fn analytics(&self) -> SqliteAnalyticsRepository

Get analytics repository

Source

pub fn currency(&self) -> SqliteCurrencyRepository

Get currency repository

Source

pub fn tax(&self) -> SqliteTaxRepository

Get tax repository

Source

pub fn promotions(&self) -> SqlitePromotionRepository

Get promotions repository

Source

pub fn subscriptions(&self) -> SqliteSubscriptionRepository

Get subscriptions repository

Source

pub fn quality(&self) -> SqliteQualityRepository

Get quality repository

Source

pub fn lots(&self) -> SqliteLotRepository

Get lots repository

Source

pub fn serials(&self) -> SqliteSerialRepository

Get serials repository

Source

pub fn warehouse(&self) -> SqliteWarehouseRepository

Get warehouse repository

Source

pub fn receiving(&self) -> SqliteReceivingRepository

Get receiving repository

Source

pub fn fulfillment(&self) -> SqliteFulfillmentRepository

Get fulfillment repository

Source

pub fn accounts_payable(&self) -> SqliteAccountsPayableRepository

Get accounts payable repository

Source

pub fn cost_accounting(&self) -> SqliteCostAccountingRepository

Get cost accounting repository

Source

pub fn credit(&self) -> SqliteCreditRepository

Get credit repository

Source

pub fn backorder(&self) -> SqliteBackorderRepository

Get backorder repository

Source

pub fn accounts_receivable(&self) -> SqliteAccountsReceivableRepository

Get accounts receivable repository

Source

pub fn general_ledger(&self) -> SqliteGeneralLedgerRepository

Get general ledger repository

Source

pub fn x402_payment_intents(&self) -> SqliteX402PaymentIntentRepository

Get x402 payment intent repository

Source

pub fn x402_credits(&self) -> SqliteX402CreditRepository

Get x402 credit ledger repository

Source

pub fn a2a_quotes(&self) -> SqliteA2ARepository

Get A2A quote/purchase repository

Source

pub fn a2a_purchases(&self) -> SqliteA2ARepository

Get A2A quote/purchase repository

Source

pub fn agent_cards(&self) -> SqliteAgentCardRepository

Get agent card repository

Source

pub fn agent_identities(&self) -> SqliteAgentIdentityRepository

Get agent identity repository (ERC-8004)

Source

pub fn agent_reputation(&self) -> SqliteAgentReputationRepository

Get agent reputation repository (ERC-8004)

Source

pub fn agent_validation(&self) -> SqliteAgentValidationRepository

Get agent validation repository (ERC-8004)

Source

pub fn gift_cards(&self) -> SqliteGiftCardRepository

Get gift card repository

Source

pub fn store_credits(&self) -> SqliteStoreCreditRepository

Get store credit repository

Source

pub fn segments(&self) -> SqliteSegmentRepository

Get customer segment repository

Source

pub fn shipping_zones(&self) -> SqliteShippingZoneRepository

Get shipping zone repository

Source

pub fn channels(&self) -> SqliteChannelRepository

Get channel repository

Source

pub fn companies(&self) -> SqliteCompanyRepository

Get company (B2B account) repository

Source

pub fn transfer_orders(&self) -> SqliteTransferOrderRepository

Get transfer order repository

Source

pub fn units_of_measure(&self) -> SqliteUnitOfMeasureRepository

Get units-of-measure repository

Source

pub fn production_batches(&self) -> SqliteProductionBatchRepository

Get production batch repository

Source

pub fn supplier_skus(&self) -> SqliteSupplierSkuRepository

Get supplier SKU repository

Source

pub fn fixed_assets(&self) -> SqliteFixedAssetRepository

Get fixed asset repository

Source

pub fn revenue_recognition(&self) -> SqliteRevenueRecognitionRepository

Get revenue recognition repository

Source

pub fn vendor_returns(&self) -> SqliteVendorReturnRepository

Get vendor return repository

Source

pub fn vendor_credits(&self) -> SqliteVendorCreditRepository

Get vendor credit repository

Source

pub fn payment_obligations(&self) -> SqlitePaymentObligationRepository

Get payment obligation repository

Source

pub fn price_levels(&self) -> SqlitePriceLevelRepository

Get price level repository

Source

pub fn prepayments(&self) -> SqlitePrepaymentRepository

Get prepayment repository

Source

pub fn price_schedules(&self) -> SqlitePriceScheduleRepository

Get price schedule repository

Source

pub fn http_idempotency(&self) -> SqliteHttpIdempotencyRepository

Get the durable HTTP idempotency repository

Source

pub fn activity_logs(&self) -> SqliteActivityLogRepository

Get activity log repository

Source

pub fn integration_mappings(&self) -> SqliteIntegrationMappingRepository

Get integration mapping repository

Source

pub fn inbound_shipments(&self) -> SqliteInboundShipmentRepository

Get inbound shipment repository

Source

pub fn purgatory(&self) -> SqlitePurgatoryRepository

Get purgatory (order ingestion staging) repository

Source

pub fn print_stations(&self) -> SqlitePrintStationRepository

Get print station repository

Source

pub fn edi_documents(&self) -> SqliteEdiDocumentRepository

Get EDI document repository

Source

pub fn integration_field_mappings( &self, ) -> SqliteIntegrationFieldMappingRepository

Get integration field-mapping repository

Source

pub fn topology_snapshots(&self) -> SqliteTopologySnapshotRepository

Get topology snapshot repository

Source

pub fn stock_snapshots(&self) -> SqliteStockSnapshotRepository

Get stock snapshot repository

Source

pub fn zone_shipping_methods(&self) -> SqliteZoneShippingMethodRepository

Get zone shipping method repository

Source

pub fn reviews(&self) -> SqliteReviewRepository

Get product review repository

Source

pub fn wishlists(&self) -> SqliteWishlistRepository

Get wishlist repository

Source

pub fn loyalty_programs(&self) -> SqliteLoyaltyProgramRepository

Get loyalty program repository

Source

pub fn rewards(&self) -> SqliteRewardRepository

Get reward catalog repository

Source

pub fn fraud(&self) -> SqliteFraudRepository

Get fraud detection repository

Source

pub fn search_configs(&self) -> SqliteSearchConfigRepository

Get search configuration repository

Source

pub const fn pool(&self) -> &Pool<SqliteConnectionManager>

Get underlying pool (for advanced use)

Trait Implementations§

Source§

impl Database for SqliteDatabase

Source§

fn backend_name(&self) -> &'static str

Human-readable backend name.
Source§

fn supports_capability(&self, capability: DatabaseCapability) -> bool

Whether the backend supports a given optional repository domain.
Source§

fn orders(&self) -> Box<dyn OrderRepository + '_>

Get the order repository
Source§

fn inventory(&self) -> Box<dyn InventoryRepository + '_>

Get the inventory repository
Source§

fn customers(&self) -> Box<dyn CustomerRepository + '_>

Get the customer repository
Source§

fn products(&self) -> Box<dyn ProductRepository + '_>

Get the product repository
Source§

fn custom_objects(&self) -> Box<dyn CustomObjectRepository + '_>

Get the custom objects repository (custom states / metaobjects)
Source§

fn returns(&self) -> Box<dyn ReturnRepository + '_>

Get the return repository
Source§

fn bom(&self) -> Box<dyn BomRepository + '_>

Get the BOM (Bill of Materials) repository
Source§

fn work_orders(&self) -> Box<dyn WorkOrderRepository + '_>

Get the work order repository
Source§

fn shipments(&self) -> Box<dyn ShipmentRepository + '_>

Get the shipment repository
Source§

fn payments(&self) -> Box<dyn PaymentRepository + '_>

Get the payment repository
Source§

fn warranties(&self) -> Box<dyn WarrantyRepository + '_>

Get the warranty repository
Source§

fn purchase_orders(&self) -> Box<dyn PurchaseOrderRepository + '_>

Get the purchase order repository
Source§

fn invoices(&self) -> Box<dyn InvoiceRepository + '_>

Get the invoice repository
Source§

fn carts(&self) -> Box<dyn CartRepository + '_>

Get the cart/checkout repository
Source§

fn analytics(&self) -> Box<dyn AnalyticsRepository + '_>

Get the analytics repository
Source§

fn currency(&self) -> Box<dyn CurrencyRepository + '_>

Get the currency repository
Source§

fn tax(&self) -> Box<dyn TaxRepository + '_>

Get the tax repository
Source§

fn promotions(&self) -> Box<dyn PromotionRepository + '_>

Get the promotions repository
Source§

fn subscriptions(&self) -> Box<dyn SubscriptionRepository + '_>

Get the subscriptions repository
Source§

fn quality(&self) -> Box<dyn QualityRepository + '_>

Get the quality repository
Source§

fn lots(&self) -> Box<dyn LotRepository + '_>

Get the lots repository
Source§

fn serials(&self) -> Box<dyn SerialRepository + '_>

Get the serials repository
Source§

fn warehouse(&self) -> Box<dyn WarehouseRepository + '_>

Get the warehouse repository
Source§

fn receiving(&self) -> Box<dyn ReceivingRepository + '_>

Get the receiving repository
Source§

fn fulfillment(&self) -> Box<dyn FulfillmentRepository + '_>

Get the fulfillment repository
Source§

fn accounts_payable(&self) -> Box<dyn AccountsPayableRepository + '_>

Get the accounts payable repository
Source§

fn cost_accounting(&self) -> Box<dyn CostAccountingRepository + '_>

Get the cost accounting repository
Source§

fn credit(&self) -> Box<dyn CreditRepository + '_>

Get the credit repository
Source§

fn backorder(&self) -> Box<dyn BackorderRepository + '_>

Get the backorder repository
Source§

fn accounts_receivable(&self) -> Box<dyn AccountsReceivableRepository + '_>

Get the accounts receivable repository
Source§

fn general_ledger(&self) -> Box<dyn GeneralLedgerRepository + '_>

Get the general ledger repository
Source§

fn x402_payment_intents(&self) -> Box<dyn X402PaymentIntentRepository + '_>

Get the x402 payment intent repository
Source§

fn x402_credits(&self) -> Box<dyn X402CreditRepository + '_>

Get the x402 credit ledger repository
Source§

fn a2a_quotes(&self) -> Box<dyn A2ACommerceRepository + '_>

Get the agent-to-agent commerce repository (quotes and purchases)
Source§

fn a2a_purchases(&self) -> Box<dyn A2ACommerceRepository + '_>

Get the agent-to-agent commerce repository (quotes and purchases)
Source§

fn agent_cards(&self) -> Box<dyn AgentCardRepository + '_>

Get the agent card repository
Source§

fn agent_identities(&self) -> Box<dyn AgentIdentityRepository + '_>

Get the agent identity registry repository (ERC-8004)
Source§

fn agent_reputation(&self) -> Box<dyn AgentReputationRepository + '_>

Get the agent reputation registry repository (ERC-8004)
Source§

fn agent_validation(&self) -> Box<dyn AgentValidationRepository + '_>

Get the agent validation registry repository (ERC-8004)
Source§

fn gift_cards(&self) -> Box<dyn GiftCardRepository + '_>

Get the gift card repository
Source§

fn store_credits(&self) -> Box<dyn StoreCreditRepository + '_>

Get the store credit repository
Source§

fn segments(&self) -> Box<dyn SegmentRepository + '_>

Get the customer segment repository
Source§

fn shipping_zones(&self) -> Box<dyn ShippingZoneRepository + '_>

Get the shipping zone repository
Source§

fn zone_shipping_methods(&self) -> Box<dyn ZoneShippingMethodRepository + '_>

Get the zone shipping method repository
Source§

fn reviews(&self) -> Box<dyn ReviewRepository + '_>

Get the product review repository
Source§

fn wishlists(&self) -> Box<dyn WishlistRepository + '_>

Get the wishlist repository
Source§

fn loyalty_programs(&self) -> Box<dyn LoyaltyProgramRepository + '_>

Get the loyalty program repository
Source§

fn rewards(&self) -> Box<dyn RewardRepository + '_>

Get the reward catalog repository
Source§

fn fraud(&self) -> Box<dyn FraudRepository + '_>

Get the fraud detection repository
Source§

fn search_configs(&self) -> Box<dyn SearchConfigRepository + '_>

Get the search configuration repository
Source§

fn channels(&self) -> Box<dyn ChannelRepository + '_>

Get the sales/fulfillment channel repository
Source§

fn companies(&self) -> Box<dyn CompanyRepository + '_>

Get the B2B company repository
Source§

fn transfer_orders(&self) -> Box<dyn TransferOrderRepository + '_>

Get the transfer order repository
Source§

fn units_of_measure(&self) -> Box<dyn UnitOfMeasureRepository + '_>

Get the units-of-measure repository
Source§

fn production_batches(&self) -> Box<dyn ProductionBatchRepository + '_>

Get the production batch repository
Source§

fn supplier_skus(&self) -> Box<dyn SupplierSkuRepository + '_>

Get the supplier SKU repository
Source§

fn vendor_returns(&self) -> Box<dyn VendorReturnRepository + '_>

Get the vendor return repository
Source§

fn vendor_credits(&self) -> Box<dyn VendorCreditRepository + '_>

Get the vendor credit repository
Source§

fn payment_obligations(&self) -> Box<dyn PaymentObligationRepository + '_>

Get the payment obligation repository
Source§

fn price_levels(&self) -> Box<dyn PriceLevelRepository + '_>

Get the price level repository
Source§

fn prepayments(&self) -> Box<dyn PrepaymentRepository + '_>

Get the prepayment repository
Source§

fn price_schedules(&self) -> Box<dyn PriceScheduleRepository + '_>

Get the price schedule repository
Source§

fn activity_logs(&self) -> Box<dyn ActivityLogRepository + '_>

Get the activity log repository
Source§

fn integration_mappings(&self) -> Box<dyn IntegrationMappingRepository + '_>

Get the integration mapping repository
Source§

fn inbound_shipments(&self) -> Box<dyn InboundShipmentRepository + '_>

Get the inbound shipment repository
Source§

fn purgatory(&self) -> Box<dyn PurgatoryRepository + '_>

Get the purgatory repository
Source§

fn print_stations(&self) -> Box<dyn PrintStationRepository + '_>

Get the print station repository
Source§

fn edi_documents(&self) -> Box<dyn EdiDocumentRepository + '_>

Get the EDI document repository
Source§

fn integration_field_mappings( &self, ) -> Box<dyn IntegrationFieldMappingRepository + '_>

Get the integration field-mapping repository
Source§

fn topology_snapshots(&self) -> Box<dyn TopologySnapshotRepository + '_>

Get the topology snapshot repository
Source§

fn stock_snapshots(&self) -> Box<dyn StockSnapshotRepository + '_>

Get the stock snapshot repository
Source§

fn fixed_assets(&self) -> Box<dyn FixedAssetRepository + '_>

Get the fixed asset repository
Source§

fn revenue_recognition(&self) -> Box<dyn RevenueRecognitionRepository + '_>

Get the revenue recognition repository
Source§

fn http_idempotency(&self) -> Option<Box<dyn HttpIdempotencyRepository + '_>>

Get the durable HTTP idempotency repository, if the backend provides one. Backends without durable idempotency support return None, in which case callers fall back to in-memory behavior.
Source§

fn ensure_capability(&self, capability: DatabaseCapability) -> Result<()>

Fail fast when a caller requests an unsupported optional repository domain.
Source§

impl DatabaseExt for SqliteDatabase

Source§

fn with_transaction<F, T>(&self, f: F) -> Result<T>
where F: FnMut(&Connection) -> Result<T, Error>,

Execute a closure within a database transaction. Read more
Source§

fn with_transaction_opts<F, T>( &self, opts: TransactionOptions, f: F, ) -> Result<T>
where F: FnMut(&Connection) -> Result<T, Error>,

Execute a closure within a database transaction with custom options. Read more
Source§

impl Debug for SqliteDatabase

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

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

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

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> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

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

fn with_current_subscriber(self) -> WithDispatch<Self>

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