Derive Macro diesel_derives::QueryId
source · [−]#[derive(QueryId)]
Expand description
Implements QueryId
For example, given this struct:
#[derive(diesel::query_builder::QueryId)]
pub struct And<Left, Right> {
left: Left,
right: Right,
}
the following implementation will be generated
impl<Left, Right> QueryId for And<Left, Right>
where
Left: QueryId,
Right: QueryId,
{
type QueryId = And<Left::QueryId, Right::QueryId>;
const HAS_STATIC_QUERY_ID: bool = Left::HAS_STATIC_QUERY_ID && Right::HAS_STATIC_QUERY_ID;
}
If the SQL generated by a struct is not uniquely identifiable by its type,
meaning that HAS_STATIC_QUERY_ID
should always be false,
you should not derive this trait.
In that case you should implement it manually instead.