pub enum StatementCacheKey<DB: Backend> {
    Type(TypeId),
    Sql {
        sql: String,
        bind_types: Vec<DB::TypeMetadata>,
    },
}
Available on crate feature i-implement-a-third-party-backend-and-opt-into-breaking-changes only.
Expand description

The lookup key used by StatementCache internally

This can contain either a at compile time known type id (representing a statically known query) or a at runtime calculated query string + parameter types (for queries that may change depending on their parameters)

Variants§

§

Type(TypeId)

Represents a at compile time known query

Calculated via QueryId::QueryId

§

Sql

Fields

§sql: String

contains the sql query string

§bind_types: Vec<DB::TypeMetadata>

contains the types of any bind parameter passed to the query

Represents a dynamically constructed query

This variant is used if QueryId::HAS_STATIC_QUERY_ID is false and AstPass::unsafe_to_cache_prepared is not called for a given query.

Implementations§

Create a new statement cache key for the given query source

Get the sql for a given query source based

This is an optimization that may skip constructing the query string twice if it’s already part of the current cache key

Trait Implementations§

Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

Convert self to an expression for Diesel’s query builder. Read more
Convert &self to an expression for Diesel’s query builder. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.