use crate::expression::*; use crate::query_builder::*; use crate::query_source::joins::ToInnerJoin; use crate::result::QueryResult; use crate::sql_types::{DieselNumericOps, IntoNotNullable}; #[derive(Default, Debug, Copy, Clone, DieselNumericOps, ValidGrouping)] pub struct AssumeNotNull(T); impl AssumeNotNull { pub fn new(expr: T) -> Self { AssumeNotNull(expr) } } impl Expression for AssumeNotNull where T: Expression, T::SqlType: IntoNotNullable, ::NotNullable: TypedExpressionType, { type SqlType = ::NotNullable; } impl QueryFragment for AssumeNotNull where DB: Backend, T: QueryFragment, { fn walk_ast<'b>(&'b self, pass: AstPass<'_, 'b, DB>) -> QueryResult<()> { self.0.walk_ast(pass) } } impl AppearsOnTable for AssumeNotNull where T: AppearsOnTable, AssumeNotNull: Expression, { } impl QueryId for AssumeNotNull { type QueryId = T::QueryId; const HAS_STATIC_QUERY_ID: bool = T::HAS_STATIC_QUERY_ID; } impl SelectableExpression for AssumeNotNull where Self: AppearsOnTable, QS: ToInnerJoin, T: SelectableExpression, { } impl SelectableExpression for AssumeNotNull where Self: AppearsOnTable { }