pub trait ModelRuntime: Send + Sync {
// Required methods
fn role(&self, table: &str) -> Option<ModelRole>;
fn write<'a>(
&'a self,
tx: &'a Transaction,
ast: QueryAst,
) -> TransactionFuture<'a, ModelWriteResult>;
// Provided methods
fn transaction_lock(&self) -> Option<Arc<Mutex<()>>> { ... }
fn prepare_read(&self, ast: QueryAst) -> QueryAst { ... }
fn authorize_read(&self, _ast: &QueryAst) -> Result<(), OrmError> { ... }
}Expand description
Transactional extension point for registered model writes. Implementations use raw transaction methods internally to avoid recursively capturing writes.
Required Methods§
fn role(&self, table: &str) -> Option<ModelRole>
fn write<'a>( &'a self, tx: &'a Transaction, ast: QueryAst, ) -> TransactionFuture<'a, ModelWriteResult>
Provided Methods§
fn transaction_lock(&self) -> Option<Arc<Mutex<()>>>
fn prepare_read(&self, ast: QueryAst) -> QueryAst
Recheck access for every SELECT, including nested subqueries, counts, relation loading, and SELECTs embedded in ordinary mutation predicates.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".