pub trait IntoField<T> {
// Required method
fn into_field(self) -> T;
}Available on crate feature
db only.Expand description
A trait for database types that can be converted to the field type.
This trait is mostly a helper trait to make comparisons like $id == 5
where id is of type Auto or ForeignKey easier to write and more
readable.
§Example
use cot::db::query::{Expr, ExprEq, Query};
use cot::db::{Auto, model, query};
#[model]
struct MyModel {
#[model(primary_key)]
id: Auto<i32>,
};
// uses the `IntoField` trait to convert the `5` to `Auto<i32>`
let expr = <MyModel as cot::db::Model>::Fields::id.eq(5);Required Methods§
Sourcefn into_field(self) -> T
fn into_field(self) -> T
Converts the type to the field type.