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, Error>where
P: Params,
pub fn execute_batch(&self, sql: &str) -> Result<(), Error>
pub fn query_row<T, P, F>( &self, sql: &str, params: P, map: F, ) -> Result<T, Error>
pub fn query<T, P, F>( &self, sql: &str, params: P, map: F, ) -> Result<Vec<T>, Error>
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moreCreates a shared type from an unshared type.