diesel::connection

Enum InstrumentationEvent

Source
#[non_exhaustive]
pub enum InstrumentationEvent<'a> { StartEstablishConnection { url: &'a str, }, FinishEstablishConnection { url: &'a str, error: Option<&'a ConnectionError>, }, StartQuery { query: &'a dyn DebugQuery, }, CacheQuery { sql: &'a str, }, FinishQuery { query: &'a dyn DebugQuery, error: Option<&'a Error>, }, BeginTransaction { depth: NonZeroU32, }, CommitTransaction { depth: NonZeroU32, }, RollbackTransaction { depth: NonZeroU32, }, }
Expand description

This enum describes possible connection events that can be handled by an Instrumentation implementation

Some fields might contain sensitive information, like login details for the database.

Diesel does not guarantee that future versions will emit the same events in the same order or timing. In addition the output of the Debug and Display implementation of the enum itself and any of its fields is not guarantee to be stable.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

StartEstablishConnection

An event emitted by before starting establishing a new connection

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§url: &'a str

The database url the connection tries to connect to

This might contain sensitive information like the database password

§

FinishEstablishConnection

An event emitted after establishing a new connection

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§url: &'a str

The database url the connection tries is connected to

This might contain sensitive information like the database password

§error: Option<&'a ConnectionError>

An optional error if the connection failed

§

StartQuery

An event that is emitted before executing a query

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§query: &'a dyn DebugQuery

A opaque representation of the query

This type implements Debug and Display, but should be considered otherwise as opaque.

The exact output of the Debug and Display implementation is not considered as part of the stable API.

§

CacheQuery

An event that is emitted when a query is cached in the connection internal prepared statement cache

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§sql: &'a str

SQL string of the cached query

§

FinishQuery

An event that is emitted after executing a query

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§query: &'a dyn DebugQuery

A opaque representation of the query

This type implements Debug and Display, but should be considered otherwise as opaque.

The exact output of the Debug and Display implementation is not considered as part of the stable API.

§error: Option<&'a Error>

An optional error if the connection failed

§

BeginTransaction

An event that is emitted while starting a new transaction

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§depth: NonZeroU32

Transaction level of the newly started transaction

§

CommitTransaction

An event that is emitted while committing a transaction

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§depth: NonZeroU32

Transaction level of the to be committed transaction

§

RollbackTransaction

An event that is emitted while rolling back a transaction

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§depth: NonZeroU32

Transaction level of the to be rolled back transaction

Implementations§

Source§

impl<'a> InstrumentationEvent<'a>

Source

pub fn start_establish_connection(url: &'a str) -> Self

Available on crate feature i-implement-a-third-party-backend-and-opt-into-breaking-changes only.

Create a new InstrumentationEvent::StartEstablishConnection event

Source

pub fn finish_establish_connection( url: &'a str, error: Option<&'a ConnectionError>, ) -> Self

Available on crate feature i-implement-a-third-party-backend-and-opt-into-breaking-changes only.

Create a new InstrumentationEvent::FinishEstablishConnection event

Source

pub fn start_query(query: &'a dyn DebugQuery) -> Self

Available on crate feature i-implement-a-third-party-backend-and-opt-into-breaking-changes only.

Create a new InstrumentationEvent::StartQuery event

Source

pub fn cache_query(sql: &'a str) -> Self

Available on crate feature i-implement-a-third-party-backend-and-opt-into-breaking-changes only.

Create a new InstrumentationEvent::CacheQuery event

Source

pub fn finish_query(query: &'a dyn DebugQuery, error: Option<&'a Error>) -> Self

Available on crate feature i-implement-a-third-party-backend-and-opt-into-breaking-changes only.

Create a new InstrumentationEvent::FinishQuery event

Source

pub fn begin_transaction(depth: NonZeroU32) -> Self

Available on crate feature i-implement-a-third-party-backend-and-opt-into-breaking-changes only.

Create a new InstrumentationEvent::BeginTransaction event

Source

pub fn rollback_transaction(depth: NonZeroU32) -> Self

Available on crate feature i-implement-a-third-party-backend-and-opt-into-breaking-changes only.

Create a new InstrumentationEvent::RollbackTransaction event

Source

pub fn commit_transaction(depth: NonZeroU32) -> Self

Available on crate feature i-implement-a-third-party-backend-and-opt-into-breaking-changes only.

Create a new InstrumentationEvent::CommitTransaction event

Trait Implementations§

Source§

impl<'a> Debug for InstrumentationEvent<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoSql for T

Source§

fn into_sql<T>(self) -> AsExprOf<Self, T>

Convert self to an expression for Diesel’s query builder. Read more
Source§

fn as_sql<'a, T>(&'a self) -> AsExprOf<&'a Self, T>
where &'a Self: AsExpression<T>, T: SqlType + TypedExpressionType,

Convert &self to an expression for Diesel’s query builder. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T