Trait diesel::prelude::PreferredBoolSqlType
source · pub trait PreferredBoolSqlType {
type PreferredSqlType;
}
Expand description
Allow ~type inference on And and Or helper types
This is used to be statistically correct as last generic parameter of dsl::And
and dsl::Or
without having to specify an additional type parameter.
It works with types that are Expressions and have a SqlType
that is
either Bool
or Nullable<Bool>
, and with bool
(and Option<bool>
and references to those).
Cases where an additional type parameter would still have to be specified in the helper type generic parameters are:
- If this trait isn’t implemented for the
other
parameter of the expression (in that case the user (you?) probably wants to implement it) - If the user actually was using the not-preferred implementation of
AsExpression
(e.g. towardsNullable<Bool>
instead ofBool
)
Required Associated Types§
sourcetype PreferredSqlType
type PreferredSqlType
The preferred Bool
SQL type for this AsExpression implementation.
That should be either Bool
or Nullable<Bool>
.
Implementations on Foreign Types§
source§impl PreferredBoolSqlType for &&Option<bool>
impl PreferredBoolSqlType for &&Option<bool>
type PreferredSqlType = Nullable<Bool>
source§impl PreferredBoolSqlType for &&bool
impl PreferredBoolSqlType for &&bool
type PreferredSqlType = Bool
source§impl PreferredBoolSqlType for &Option<bool>
impl PreferredBoolSqlType for &Option<bool>
type PreferredSqlType = Nullable<Bool>
source§impl PreferredBoolSqlType for &bool
impl PreferredBoolSqlType for &bool
type PreferredSqlType = Bool
source§impl PreferredBoolSqlType for Option<bool>
impl PreferredBoolSqlType for Option<bool>
type PreferredSqlType = Nullable<Bool>
source§impl PreferredBoolSqlType for bool
impl PreferredBoolSqlType for bool
This impl has to live in Diesel because otherwise it would conflict with the blanket impl above because “diesel might add an implementation of Expression for bool”