pub struct RecorderDatabase { /* private fields */ }
Expand description
SQLite database for recorder
Implementations§
Source§impl RecorderDatabase
impl RecorderDatabase
Sourcepub async fn new_in_memory() -> Result<Self>
pub async fn new_in_memory() -> Result<Self>
Create an in-memory database (for testing)
Sourcepub async fn insert_request(&self, request: &RecordedRequest) -> Result<()>
pub async fn insert_request(&self, request: &RecordedRequest) -> Result<()>
Insert a new request
Sourcepub async fn insert_response(&self, response: &RecordedResponse) -> Result<()>
pub async fn insert_response(&self, response: &RecordedResponse) -> Result<()>
Insert a response
Sourcepub async fn get_request(&self, id: &str) -> Result<Option<RecordedRequest>>
pub async fn get_request(&self, id: &str) -> Result<Option<RecordedRequest>>
Get a request by ID
Sourcepub async fn get_response(
&self,
request_id: &str,
) -> Result<Option<RecordedResponse>>
pub async fn get_response( &self, request_id: &str, ) -> Result<Option<RecordedResponse>>
Get a response by request ID
Sourcepub async fn get_exchange(&self, id: &str) -> Result<Option<RecordedExchange>>
pub async fn get_exchange(&self, id: &str) -> Result<Option<RecordedExchange>>
Get an exchange (request + response) by request ID
Sourcepub async fn list_recent(&self, limit: i32) -> Result<Vec<RecordedRequest>>
pub async fn list_recent(&self, limit: i32) -> Result<Vec<RecordedRequest>>
List recent requests
Sourcepub async fn delete_older_than(&self, days: i64) -> Result<u64>
pub async fn delete_older_than(&self, days: i64) -> Result<u64>
Delete old requests
Sourcepub async fn get_stats(&self) -> Result<DatabaseStats>
pub async fn get_stats(&self) -> Result<DatabaseStats>
Get database statistics
Sourcepub async fn get_statistics(&self) -> Result<DetailedStats>
pub async fn get_statistics(&self) -> Result<DetailedStats>
Get detailed statistics for API
Trait Implementations§
Source§impl Clone for RecorderDatabase
impl Clone for RecorderDatabase
Source§fn clone(&self) -> RecorderDatabase
fn clone(&self) -> RecorderDatabase
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 RecorderDatabase
impl !RefUnwindSafe for RecorderDatabase
impl Send for RecorderDatabase
impl Sync for RecorderDatabase
impl Unpin for RecorderDatabase
impl !UnwindSafe for RecorderDatabase
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