pub struct QueryContext { /* private fields */ }Expand description
Context passed through the middleware chain.
Implementations§
Source§impl QueryContext
impl QueryContext
Sourcepub fn new(sql: impl Into<String>, params: Vec<FilterValue>) -> Self
pub fn new(sql: impl Into<String>, params: Vec<FilterValue>) -> Self
Create a new query context.
Sourcepub fn params(&self) -> &[FilterValue]
pub fn params(&self) -> &[FilterValue]
Get the query parameters.
Sourcepub fn params_mut(&mut self) -> &mut Vec<FilterValue>
pub fn params_mut(&mut self) -> &mut Vec<FilterValue>
Get mutable parameters.
Sourcepub fn query_type(&self) -> QueryType
pub fn query_type(&self) -> QueryType
Get the query type.
Sourcepub fn metadata(&self) -> &QueryMetadata
pub fn metadata(&self) -> &QueryMetadata
Get the metadata.
Sourcepub fn metadata_mut(&mut self) -> &mut QueryMetadata
pub fn metadata_mut(&mut self) -> &mut QueryMetadata
Get mutable metadata.
Sourcepub fn with_metadata(self, metadata: QueryMetadata) -> Self
pub fn with_metadata(self, metadata: QueryMetadata) -> Self
Set metadata.
Sourcepub fn elapsed_us(&self) -> u64
pub fn elapsed_us(&self) -> u64
Get elapsed time in microseconds.
Sourcepub fn phase(&self) -> QueryPhase
pub fn phase(&self) -> QueryPhase
Get the current phase.
Sourcepub fn set_phase(&mut self, phase: QueryPhase)
pub fn set_phase(&mut self, phase: QueryPhase)
Set the current phase.
Sourcepub fn should_skip(&self) -> bool
pub fn should_skip(&self) -> bool
Check if execution should be skipped.
Sourcepub fn skip_with_response(&mut self, response: Value)
pub fn skip_with_response(&mut self, response: Value)
Mark query to skip execution (e.g., for cache hit).
Sourcepub fn cached_response(&self) -> Option<&Value>
pub fn cached_response(&self) -> Option<&Value>
Get the cached response if skipping.
Trait Implementations§
Source§impl Clone for QueryContext
impl Clone for QueryContext
Source§fn clone(&self) -> QueryContext
fn clone(&self) -> QueryContext
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for QueryContext
impl RefUnwindSafe for QueryContext
impl Send for QueryContext
impl Sync for QueryContext
impl Unpin for QueryContext
impl UnwindSafe for QueryContext
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