pub struct QueryMetadata {
pub operation: String,
pub table: String,
pub rows_affected: Option<u64>,
pub duration_ms: u64,
pub success: bool,
pub error: Option<String>,
}Expand description
Query metadata for tracing
Fields§
§operation: StringOperation type (SELECT, INSERT, UPDATE, DELETE)
table: StringTable name
rows_affected: Option<u64>Number of rows affected
duration_ms: u64Query duration in milliseconds
success: boolWhether the query was successful
error: Option<String>Error message (if any)
Implementations§
Source§impl QueryMetadata
impl QueryMetadata
Sourcepub fn success(operation: String, table: String, duration_ms: u64) -> Self
pub fn success(operation: String, table: String, duration_ms: u64) -> Self
Create metadata for a successful query
Sourcepub fn failure(
operation: String,
table: String,
duration_ms: u64,
error: String,
) -> Self
pub fn failure( operation: String, table: String, duration_ms: u64, error: String, ) -> Self
Create metadata for a failed query
Sourcepub fn with_rows_affected(self, rows: u64) -> Self
pub fn with_rows_affected(self, rows: u64) -> Self
Set the number of rows affected
Trait Implementations§
Source§impl Clone for QueryMetadata
impl Clone for QueryMetadata
Source§fn clone(&self) -> QueryMetadata
fn clone(&self) -> QueryMetadata
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 QueryMetadata
impl RefUnwindSafe for QueryMetadata
impl Send for QueryMetadata
impl Sync for QueryMetadata
impl Unpin for QueryMetadata
impl UnwindSafe for QueryMetadata
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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 more