Macro diesel::impl_query_id[][src]

macro_rules! impl_query_id {
    ($name : ident) => { ... };
    ($name : ident < $($ty_param : ident), + >) => { ... };
    (noop : $name : ident) => { ... };
    (noop : $name : ident < $($ty_param : ident), + >) => { ... };
}
👎 Deprecated since 1.1.0:

Use #[derive(QueryId)] instead

Expand description

Provides a standard implementation of QueryId. Apps should not need to concern themselves with this macro.

This macro should be called with the name of your type, along with all of it’s type parameters. If the SQL generated by your type not uniquely identifiable by the type itself, you should put noop: in front.

For example, given the type And<Left, Right>, invoking impl_query_id!(And<Left, Right>) will generate:

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;
}

Invoking impl_query_id!(noop: And<Left, Right>) will generate:

impl<Left, Right> QueryId for And<Left, Right> {
    type QueryId = ();

    const HAS_STATIC_QUERY_ID: bool = false;
}