pub struct ReaderGuard<'pool> { /* private fields */ }Expand description
A reader connection checked out from the pool. Returns the connection to the pool on drop.
Implementations§
Source§impl<'pool> ReaderGuard<'pool>
impl<'pool> ReaderGuard<'pool>
Sourcepub fn query_row<T, P, F>(
&self,
sql: &str,
params: P,
f: F,
) -> Result<T, SqliteError>
pub fn query_row<T, P, F>( &self, sql: &str, params: P, f: F, ) -> Result<T, SqliteError>
Run one read-only statement against this reader lease and map the
first resulting row, for callers outside khive-db.
Unlike a raw Connection, this never hands out a capability that can
change connection-local or database state: sql is checked against
the same allow-listed read-shape classifier
(SELECT/WITH ... SELECT/VALUES/EXPLAIN/a fixed read-only
PRAGMA set) the pooled SqlReader surface admits raw SQL through,
and anything else — BEGIN, DML, DDL, a setting PRAGMA, ATTACH
— is refused before it ever reaches SQLite. An admitted statement
still marks the checkout dirty unconditionally, so Drop always pays
the pristine-state scan (or, in degraded shared-lease mode, the
settings/rollback verification) on return.
SQL stepping cooperatively observes the current request’s cancellation and original absolute deadline. Synchronous mapper/native callback code cannot be forcibly preempted; a post-check refuses a successful result if the request stopped while that code ran.
Trait Implementations§
Source§impl<'pool> Drop for ReaderGuard<'pool>
impl<'pool> Drop for ReaderGuard<'pool>
Auto Trait Implementations§
impl<'pool> !Freeze for ReaderGuard<'pool>
impl<'pool> !RefUnwindSafe for ReaderGuard<'pool>
impl<'pool> !Sync for ReaderGuard<'pool>
impl<'pool> !UnwindSafe for ReaderGuard<'pool>
impl<'pool> Send for ReaderGuard<'pool>
impl<'pool> Unpin for ReaderGuard<'pool>
impl<'pool> UnsafeUnpin for ReaderGuard<'pool>
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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> ⓘ
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> ⓘ
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