pub struct SqlContext<'context, 'connection> { /* private fields */ }Expand description
Host SQL inside one journaled write transaction.
The underlying transaction remains private so host SQL cannot remove Coven’s authorizer or address Coven-owned attached schemas.
Implementations§
Source§impl<'context, 'connection> SqlContext<'context, 'connection>
impl<'context, 'connection> SqlContext<'context, 'connection>
pub fn execute<P>(&self, sql: &str, params: P) -> Result<usize>where
P: Params,
pub fn execute_batch(&self, sql: &str) -> Result<()>
pub fn query_row<T, P, F>(&self, sql: &str, params: P, map: F) -> Result<T>where
P: Params,
F: FnOnce(&Row<'_>) -> Result<T>,
pub fn query<T, P, F>(&self, sql: &str, params: P, map: F) -> Result<Vec<T>>where
P: Params,
F: FnMut(&Row<'_>) -> Result<T>,
pub fn stamp(&self) -> String
Sourcepub fn insert_external_blob(
&self,
table: &str,
row_id: &str,
prepared: PreparedExternalBlob,
insert_sql: &str,
params: &[(&str, &dyn ToSql)],
) -> Result<(), DbError>
pub fn insert_external_blob( &self, table: &str, row_id: &str, prepared: PreparedExternalBlob, insert_sql: &str, params: &[(&str, &dyn ToSql)], ) -> Result<(), DbError>
Insert a user-provided blob row without exposing its content hash to the
host. insert_sql names :coven_external_blob_hash where the declared
hash column belongs; params supplies every other named parameter. Coven
binds its private digest, verifies the inserted row and prepared file,
and registers the exact source path in this transaction.
pub fn register_external_blob( &self, table: &str, row_id: &str, prepared: PreparedExternalBlob, ) -> Result<(), DbError>
Sourcepub fn validate_row_blob_ref(
&self,
reference: &RowBlobRef,
) -> Result<(), DbError>
pub fn validate_row_blob_ref( &self, reference: &RowBlobRef, ) -> Result<(), DbError>
Require an earlier blob reference to still describe this transaction’s current row and stored object. Call before changing or deleting the row; a stale reference aborts the write when the error is propagated.
pub fn enqueue_blob_delete(&self, blob: &RowBlobRef) -> Result<(), DbError>
pub fn clear_external_blob( &self, table: &str, row_id: &str, ) -> Result<(), DbError>
pub fn materialized_sequence( &self, stream_id: &str, ) -> Result<Option<u64>, DbError>
Auto Trait Implementations§
impl<'context, 'connection> Freeze for SqlContext<'context, 'connection>
impl<'context, 'connection> !RefUnwindSafe for SqlContext<'context, 'connection>
impl<'context, 'connection> !Send for SqlContext<'context, 'connection>
impl<'context, 'connection> !Sync for SqlContext<'context, 'connection>
impl<'context, 'connection> Unpin for SqlContext<'context, 'connection>
impl<'context, 'connection> UnsafeUnpin for SqlContext<'context, 'connection>
impl<'context, 'connection> !UnwindSafe for SqlContext<'context, 'connection>
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