pub trait ExprDiv<T> {
// Required method
fn div<V: Into<T>>(self, other: V) -> Expr;
}Available on crate feature
db only.Expand description
A trait for database types that can be divided by each other.
Required Methods§
Sourcefn div<V: Into<T>>(self, other: V) -> Expr
fn div<V: Into<T>>(self, other: V) -> Expr
Creates an expression that divides the field by the given value.
§Examples
use cot::db::query::{Expr, ExprDiv, Query};
use cot::db::{model, query};
#[model]
struct MyModel {
#[model(primary_key)]
id: i32,
};
let expr = <MyModel as cot::db::Model>::Fields::id.div(2);
assert_eq!(
<Query<MyModel>>::new().filter(Expr::eq(Expr::field("id"), expr)),
query!(MyModel, $id == $id / 2)
);Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.