pub trait ExecuteExt: Sized {
// Provided methods
fn traced(self) -> Traced<Self> { ... }
fn record(self, span: &Span) -> Traced<Self> { ... }
}Expand description
An extension trait that wraps a sqlx query so its SQL and timing get recorded when it is executed.
The span attached should have the db.query.text and
db.response.returned_rows attribute set.
Provided Methods§
Sourcefn traced(self) -> Traced<Self>
fn traced(self) -> Traced<Self>
Wrap the query so that, when executed, its SQL is recorded as
db.query.text on the current span and its count/timing are added to
the current [LogContext].
Sourcefn record(self, span: &Span) -> Traced<Self>
fn record(self, span: &Span) -> Traced<Self>
Like ExecuteExt::traced, but records onto the given span instead of
the current one. Use when the query runs under a span other than the
one current at the call site.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.