pub enum StatementCacheKey<DB>where
DB: Backend,{
Type(TypeId),
Sql {
sql: String,
bind_types: Vec<<DB as TypeMetadata>::TypeMetadata, Global>,
},
}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
§
bind_types: Vec<<DB as TypeMetadata>::TypeMetadata, Global>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§
source§impl<DB> StatementCacheKey<DB>where
DB: Backend,
<DB as Backend>::QueryBuilder: Default,
<DB as TypeMetadata>::TypeMetadata: Clone,
impl<DB> StatementCacheKey<DB>where
DB: Backend,
<DB as Backend>::QueryBuilder: Default,
<DB as TypeMetadata>::TypeMetadata: Clone,
sourcepub fn for_source<T>(
source: &T,
bind_types: &[<DB as TypeMetadata>::TypeMetadata],
backend: &DB
) -> Result<StatementCacheKey<DB>, Error>where
T: QueryFragment<DB, NotSpecialized> + QueryId,
pub fn for_source<T>(
source: &T,
bind_types: &[<DB as TypeMetadata>::TypeMetadata],
backend: &DB
) -> Result<StatementCacheKey<DB>, Error>where
T: QueryFragment<DB, NotSpecialized> + QueryId,
Create a new statement cache key for the given query source
Trait Implementations§
source§impl<DB> Hash for StatementCacheKey<DB>where
DB: Hash + Backend,
<DB as TypeMetadata>::TypeMetadata: Hash,
impl<DB> Hash for StatementCacheKey<DB>where
DB: Hash + Backend,
<DB as TypeMetadata>::TypeMetadata: Hash,
source§impl<DB> PartialEq<StatementCacheKey<DB>> for StatementCacheKey<DB>where
DB: PartialEq<DB> + Backend,
<DB as TypeMetadata>::TypeMetadata: PartialEq<<DB as TypeMetadata>::TypeMetadata>,
impl<DB> PartialEq<StatementCacheKey<DB>> for StatementCacheKey<DB>where
DB: PartialEq<DB> + Backend,
<DB as TypeMetadata>::TypeMetadata: PartialEq<<DB as TypeMetadata>::TypeMetadata>,
source§fn eq(&self, other: &StatementCacheKey<DB>) -> bool
fn eq(&self, other: &StatementCacheKey<DB>) -> bool
This method tests for
self and other values to be equal, and is used
by ==.impl<DB> Eq for StatementCacheKey<DB>where
DB: Eq + Backend,
<DB as TypeMetadata>::TypeMetadata: Eq,
impl<DB> StructuralEq for StatementCacheKey<DB>where
DB: Backend,
impl<DB> StructuralPartialEq for StatementCacheKey<DB>where
DB: Backend,
Auto Trait Implementations§
impl<DB> RefUnwindSafe for StatementCacheKey<DB>where
<DB as TypeMetadata>::TypeMetadata: RefUnwindSafe,
impl<DB> Send for StatementCacheKey<DB>where
<DB as TypeMetadata>::TypeMetadata: Send,
impl<DB> Sync for StatementCacheKey<DB>where
<DB as TypeMetadata>::TypeMetadata: Sync,
impl<DB> Unpin for StatementCacheKey<DB>where
<DB as TypeMetadata>::TypeMetadata: Unpin,
impl<DB> UnwindSafe for StatementCacheKey<DB>where
<DB as TypeMetadata>::TypeMetadata: UnwindSafe,
Blanket Implementations§
source§impl<T> IntoSql for T
impl<T> IntoSql for T
source§fn into_sql<T>(self) -> Self::Expressionwhere
Self: AsExpression<T> + Sized,
T: SqlType + TypedExpressionType,
fn into_sql<T>(self) -> Self::Expressionwhere
Self: AsExpression<T> + Sized,
T: SqlType + TypedExpressionType,
Convert
self to an expression for Diesel’s query builder. Read moresource§fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expressionwhere
&'a Self: AsExpression<T>,
T: SqlType + TypedExpressionType,
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expressionwhere
&'a Self: AsExpression<T>,
T: SqlType + TypedExpressionType,
Convert
&self to an expression for Diesel’s query builder. Read more